How to solve version_conflict_engine_exception in Elasticsearch Exception?

Viewed 3995

I am using Elasticsearch 7.9.0

I was updating the document very frequently. So I was getting the below exception

Elasticsearch exception [type=version_conflict_engine_exception, reason=[111]: version conflict, required seqNo [4348], primary term [2]. current document has seqNo [4427] and primary term [2]]

Then I have given a delay of 1 second between each update.(I can't give more then that)

But still the problem exists. How can we solve this. Please help me. Thanks.

1 Answers

This issue happens because of the versioning of document in elasticsearch. This feature exists in order to prevent concurrent changes to the same documents by tasks that runs simultaneously. When you try to update a document that is already being updated by another task you might run into this issue.

If you want to track the update process of documents by your updates you may want to use the Task management API by elastic: https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html

Also you might want to check this documentation on Index API as it explains further: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html

Related