Skip to content
Snippets Groups Projects
Commit a0e41f6bd19b authored by Arthur Lutz's avatar Arthur Lutz
Browse files

[ccplugin/hooks] use eid as id to avoid duplicates

parent 4674c8a25531
No related branches found
No related tags found
No related merge requests found
......@@ -68,7 +68,10 @@
json = serializer.serialize()
# TODO remove non indexable data or (better) serialize only
if not self.config.dry_run:
es.index(index=index_name, doc_type=etype, body=json)
es.index(index=index_name,
id=entity.eid,
doc_type=etype,
body=json)
# TODO optimize with elasticsearch.helpers.bulk
# or elasticsearch.helpers.parallel_bulk
# or elasticsearch.helpers.streaming_bulk
......
......@@ -53,6 +53,7 @@
try:
# TODO option pour coté async ?
es.index(index=index_name,
id=self.entity.eid,
doc_type=self.entity.cw_etype,
body=json)
except (ConnectionError, ProtocolError):
......
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