diff options
author | andreer <andreer@oath.com> | 2018-09-10 15:53:18 +0200 |
---|---|---|
committer | andreer <andreer@oath.com> | 2018-09-10 15:53:18 +0200 |
commit | b607f38212c619a3a8fc182fabc8d5f39d10db3a (patch) | |
tree | 46aa15d98aa9d6ff5bc34fb1bf8ff4812ddcffaf /config-model/src/main/python/ES_Vespa_parser.py | |
parent | 7ee8a275f147330bb5540eeffc60d7005f71581a (diff) |
tiny es import improvements
Diffstat (limited to 'config-model/src/main/python/ES_Vespa_parser.py')
-rw-r--r-- | config-model/src/main/python/ES_Vespa_parser.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/config-model/src/main/python/ES_Vespa_parser.py b/config-model/src/main/python/ES_Vespa_parser.py index 477b0db4744..4721dbe8128 100644 --- a/config-model/src/main/python/ES_Vespa_parser.py +++ b/config-model/src/main/python/ES_Vespa_parser.py @@ -61,7 +61,7 @@ class ElasticSearchParser: _all_enabled = data[index]["mappings"][type]["_all"]["enabled"] if not _all_enabled: self._all = False - print(" > All fields in the document type '" + type + "' is not searchable. Go inside " + self.path + type + ".sd to add which fields that should be searchable") + print(" > Not all fields in the document type '" + type + "' are searchable. Edit " + self.path + "searchdefinitions/" + type + ".sd to control which fields are searchable") except KeyError: print(" > All fields in the document type '" + type + "' is searchable") @@ -108,7 +108,7 @@ class ElasticSearchParser: vespa_docs.close() unparsed_document_file.close() - print(" > Parsed all documents '" + ", ".join(self.types) + "'" + "' at '" + file_path + "'") + print(" > Parsed all documents '" + ", ".join(self.types) + "' at '" + file_path + "'") def createSearchDefinition(self, type, type_mapping): file_path = self.path + "searchdefinitions/" + type + ".sd" @@ -117,6 +117,10 @@ class ElasticSearchParser: new_sd.write(" document " + type + " {\n") for key, item in type_mapping.items(): + type = self.get_type(item) + if(type == "nested"): + print(" > SKIPPING FIELD " + key + ", this tool is not yet able to convert nested fields") + continue new_sd.write(" field " + key + " type " + self.get_type(item) + " {\n") new_sd.write(" indexing: " + self.get_indexing(key, self.get_type(item)) + "\n") new_sd.write(" }\n") @@ -180,6 +184,8 @@ class ElasticSearchParser: def get_type(self, type): return { + "integer": "int", + "string": "string", # for compatability with older ES versions "text": "string", "keyword": "string", "date": "string", @@ -189,6 +195,7 @@ class ElasticSearchParser: "ip": "text", "byte": "byte", "float": "float", + "nested": "nested" }[type] |