Skip to content
Snippets Groups Projects
Commit 4060fb567a19 authored by Adrien Di Mascio's avatar Adrien Di Mascio
Browse files

make ES doc_type customizable

As for ES "id" parameters, "doc_type" should be customizable,
there is no reason why es document type should match cw_etype
parent 54ec9e5c6291
No related branches found
No related tags found
No related merge requests found
......@@ -97,6 +97,10 @@
def es_id(self):
return self.entity.eid
@property
def es_doc_type(self):
return self.entity.cw_etype
@cachedproperty
def fulltext_indexable_attributes(self):
eschema = self._cw.vreg.schema[self.entity.cw_etype]
......
......@@ -99,7 +99,7 @@
# IFullTextIndex serializer, therefore the "id" and "doc_type" in
# kwargs below must be container data.
kwargs['id'] = serializer.es_id
kwargs['doc_type'] = getattr(serializer, 'doc_type', json['cw_etype'])
kwargs['doc_type'] = serializer.es_doc_type
try:
# TODO option for async ?
es.index(**kwargs)
......
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