aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo Kristian Bergum <bergum@yahoo-inc.com>2018-09-10 16:03:26 +0200
committerGitHub <noreply@github.com>2018-09-10 16:03:26 +0200
commit3af44a21fb5f058e1d6e32528f39f83eba4f8f95 (patch)
tree1e4d2b1cbe273383dafdc59a914e20c440d17a57
parent278b2cb304fc1c98691e0b36de42a31c9128172d (diff)
parentb607f38212c619a3a8fc182fabc8d5f39d10db3a (diff)
Merge pull request #6879 from vespa-engine/andreer/tiny-es-import-improvements
tiny es import improvements
-rw-r--r--config-model/src/main/python/ES_Vespa_parser.py11
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]