Version conflict issue while updating data continously

Describe the bug/error/problem
I am getting this error sometimes while updating the index of user.
"error": "[409] {"error":{"root_cause":[{"type":"version_conflict_engine_exception","reason":"[2568]: version conflict, required seqNo [105769], primary term [1]. current document has seqNo [105774] and primary term [1]","index_uuid":"ZrDtgX8oQ4CP8hiIN8gIjQ","shard":"0","index":"users"}],"type":"version_conflict_engine_exception","reason":"[2568]: version conflict, required seqNo [105769], primary term [1]. current document has seqNo [105774] and primary term [1]","index_uuid":"ZrDtgX8oQ4CP8hiIN8gIjQ","shard":"0","index":"users"},"status":409}"

To Reproduce
Steps to reproduce the behavior:

  • Step 1:- update a document simultaneously 15-20 times, I am getting this bug and in my project I need to make this functional as we have so many things going on.

Your Environment (please complete the following information):

  • Operating System Ubuntu 20.04
  • Ruby Version (2.6.5)
  • Elasticsearch client version 7.5.0
  • Elasticsearch version 7.5.0

I don't think this is a bug, this is how Elasticsearch works.

How are you updating the document? For example, if you try to update the same document with two different threads, one of them may fail.

Check this answer on a similar question.

it's like updating a same field value simultaneously in different threads.

Yeah, this could lead to version conflicts, it is expected since one thread may try to update a document while another update on the same document wasn't finished yet.

1 Like

This is as Leandro explained expected behaviour. Elasticsearch is not optimised for handling frequent updates to the same documents. In addition to version conflicts it can also lead to performance issues.

okay so it means we can't achieve this kind of functionality from elasticsearch.

If you must support very frequent updates Elasticsearch may indeed not be the ideal choice.

Hi @Christian_Dahlqvist can you please let us know if you have any workaround?

As far as I am aware there is no workaround, at least within Elasticsearch. I have seen users gather updates outside of Elasticsearch using some other data store and only periodically update Elasticsearch, but that off course is more complicated and adds a lag.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.