aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkkraune <kristian@ymail.com>2020-04-16 09:49:28 +0200
committerkkraune <kristian@ymail.com>2020-04-16 09:49:28 +0200
commit73cd8b1e4b53d97872c7916783136e16ead93cea (patch)
treece1f0812e48a747b5b7dfe6cc91be104b8aebae3
parent8623bb270146aacc628912a71b4cbdd7fc814951 (diff)
use schema
-rw-r--r--config-model/src/main/python/ES_Vespa_parser.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/config-model/src/main/python/ES_Vespa_parser.py b/config-model/src/main/python/ES_Vespa_parser.py
index deebb1d6973..14feffefa3e 100644
--- a/config-model/src/main/python/ES_Vespa_parser.py
+++ b/config-model/src/main/python/ES_Vespa_parser.py
@@ -13,7 +13,7 @@ class ElasticSearchParser:
document_file = None
mapping_file = None
application_name = None
- search_definitions = {}
+ schemas = {}
path = ""
_all = True
all_mappings = {}
@@ -40,10 +40,10 @@ class ElasticSearchParser:
print(" > Folder '" + self.path + "' already existed")
try:
- os.makedirs(self.path + "searchdefinitions/", 0o777)
- print(" > Created folder '" + self.path + "searchdefinitions/" + "'")
+ os.makedirs(self.path + "schemas/", 0o777)
+ print(" > Created folder '" + self.path + "schemas/" + "'")
except OSError:
- print(" > Folder '" + self.path + "searchdefinitions/" + "' already existed")
+ print(" > Folder '" + self.path + "schemas/" + "' already existed")
self.parse()
self.createServices_xml()
@@ -62,17 +62,17 @@ class ElasticSearchParser:
_all_enabled = data[index]["mappings"][type]["_all"]["enabled"]
if not _all_enabled:
self._all = False
- print(" > Not all fields in the document type '" + type + "' are searchable. Edit " + self.path + "searchdefinitions/" + type + ".sd to control which fields are searchable")
+ print(" > Not all fields in the document type '" + type + "' are searchable. Edit " + self.path + "schemas/" + type + ".sd to control which fields are searchable")
except KeyError:
print(" > All fields in the document type '" + type + "' is searchable")
self.walk(mappings, type_mapping, "properties")
unparsed_mapping_file.close()
- if type not in self.search_definitions:
- self.search_definitions[type] = True
+ if type not in self.schemas:
+ self.schemas[type] = True
self.types.append(type)
- self.createSearchDefinition(type, type_mapping)
+ self.createSchema(type, type_mapping)
# Adding mapping to global map with mappings
self.all_mappings[type] = type_mapping
@@ -111,8 +111,8 @@ class ElasticSearchParser:
unparsed_document_file.close()
print(" > Parsed all documents '" + ", ".join(self.types) + "' at '" + file_path + "'")
- def createSearchDefinition(self, type, type_mapping):
- file_path = self.path + "searchdefinitions/" + type + ".sd"
+ def createSchema(self, type, type_mapping):
+ file_path = self.path + "schemas/" + type + ".sd"
new_sd = open(file_path, "w")
new_sd.write("search " + type + " {\n")
new_sd.write(" document " + type + " {\n")
@@ -129,7 +129,7 @@ class ElasticSearchParser:
new_sd.write(" }\n")
new_sd.write("}\n")
new_sd.close()
- print(" > Created search definition for '" + type + "' at '" + file_path + "'")
+ print(" > Created schema for '" + type + "' at '" + file_path + "'")
def createServices_xml(self):
file_path = self.path + "services.xml"