From 44ebc489eabc9d8f570da06dc06ff1122ea7ef70 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Sat, 4 Jan 2020 01:47:52 +0100 Subject: [PATCH] Update ES index creation and population scripts --- misc/elasticsearch/create_es_indexes.php | 38 ++++++++++++++++++++++ misc/elasticsearch/populate_es_indexes.php | 2 -- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/misc/elasticsearch/create_es_indexes.php b/misc/elasticsearch/create_es_indexes.php index 61d83e6fc..0cf9fcc0f 100644 --- a/misc/elasticsearch/create_es_indexes.php +++ b/misc/elasticsearch/create_es_indexes.php @@ -12,6 +12,25 @@ $releases_index = [ 'number_of_shards' => 2, 'number_of_replicas' => 0, ], + 'mappings' => [ + 'properties' => [ + 'id' => [ + 'type' => 'long', + 'index' => false + ], + 'name' => ['type' => 'text'], + 'searchname' => [ + 'type' => 'text', + 'fields' => [ + 'sort' => [ + 'type' => 'keyword' + ] + ] + ], + 'fromname' => ['type' => 'text'], + 'filename' => ['type' => 'text'], + ] + ] ], ]; @@ -28,7 +47,26 @@ $predb_index = [ 'number_of_shards' => 2, 'number_of_replicas' => 0, ], + 'mappings' => [ + 'properties' => [ + 'id' => [ + 'type' => 'long', + 'index' => false + ], + 'title' => [ + 'type' => 'text', + 'fields' => [ + 'sort' => [ + 'type' => 'keyword' + ] + ] + ], + 'filename' => ['type' => 'text'], + 'source' => ['type' => 'text'], + ] + ] ], + ]; $response = \Elasticsearch::indices()->create($predb_index); diff --git a/misc/elasticsearch/populate_es_indexes.php b/misc/elasticsearch/populate_es_indexes.php index 8dacbcec3..1077a30c5 100644 --- a/misc/elasticsearch/populate_es_indexes.php +++ b/misc/elasticsearch/populate_es_indexes.php @@ -73,7 +73,6 @@ function populate_indexes($table, $max) $data['body'][] = [ 'index' => [ '_index' => 'releases', - '_type' => 'releases', '_id' => $row->id, ], ]; @@ -91,7 +90,6 @@ function populate_indexes($table, $max) $data['body'][] = [ 'index' => [ '_index' => 'predb', - '_type' => 'predb', '_id' => $row->id, ], ];