Skip to content
Snippets Groups Projects
Commit ac5f8d85cf00 authored by Samuel Trégouët's avatar Samuel Trégouët
Browse files

easy customization of index-name

parent 418cc00ec3e8
No related branches found
No related tags found
No related merge requests found
......@@ -60,8 +60,12 @@
}
}
@property
def index_name(self):
return self._cw.vreg.config['index-name']
def get_connection(self):
self.create_index()
return es.get_connection(self._cw.vreg.config)
def create_index(self, index_name=None, custom_settings=None):
......@@ -63,9 +67,9 @@
def get_connection(self):
self.create_index()
return es.get_connection(self._cw.vreg.config)
def create_index(self, index_name=None, custom_settings=None):
index_name = index_name or self._cw.vreg.config['index-name']
index_name = index_name or self.index_name
if custom_settings is None:
settings = self.settings
else:
......
......@@ -66,7 +66,7 @@
json = serializer.serialize()
try:
# TODO option pour coté async ? thread
kwargs = dict(index=self.cnx.vreg.config['index-name'],
kwargs = dict(index=indexer.index_name,
id=entity.eid,
doc_type=entity.cw_etype,
body=json)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment