diff --git a/cubicweb_elasticsearch/entities.py b/cubicweb_elasticsearch/entities.py index 54ec9e5c6291d5062cde78cc86c55e9e00f6ea39_Y3ViaWN3ZWJfZWxhc3RpY3NlYXJjaC9lbnRpdGllcy5weQ==..4060fb567a19d20f5a3cd259cc8c726fd4893c72_Y3ViaWN3ZWJfZWxhc3RpY3NlYXJjaC9lbnRpdGllcy5weQ== 100644 --- a/cubicweb_elasticsearch/entities.py +++ b/cubicweb_elasticsearch/entities.py @@ -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] diff --git a/cubicweb_elasticsearch/hooks.py b/cubicweb_elasticsearch/hooks.py index 54ec9e5c6291d5062cde78cc86c55e9e00f6ea39_Y3ViaWN3ZWJfZWxhc3RpY3NlYXJjaC9ob29rcy5weQ==..4060fb567a19d20f5a3cd259cc8c726fd4893c72_Y3ViaWN3ZWJfZWxhc3RpY3NlYXJjaC9ob29rcy5weQ== 100644 --- a/cubicweb_elasticsearch/hooks.py +++ b/cubicweb_elasticsearch/hooks.py @@ -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)