Elasticsearch Version Conflicts When Deleting Data


(Yan Wang) #1

Hi,

We are now using DeleteByQueryRequestBuilder to do the batch deletion of data. But in the process I see the VersionConflictEngineException [type][id]: version conflict, current version [-1] is different than the one provided [1]. When I query that id I can see it is existing in the index.

The version we are using is 5.1.1. Could it be a bug? Version -1 means the doc does not exist, right?


(David Pilato) #2

May be the document has been removed by another process while the DeleteByQuery was running?

See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

_delete_by_query gets a snapshot of the index when it starts and deletes what it finds using internal versioning. That means that you’ll get a version conflict if the document changes between the time when the snapshot was taken and when the delete request is processed. When the versions match the document is deleted.

The version we are using is 5.1.1

You should upgrade to latest 5.x version or better think about 6.3... :slight_smile:


(Yan Wang) #3

Thanks for you reply David. I doubt another process deleted it because I tried to flush the index and re-delete it again but I still got the conflicts and if I search it is still there..But yes we are upgrading our es version to es6 to see if that can be gone. I just want to find the root cause of it..


(David Pilato) #4

I don't remember exactly but I think that Delete By Query API has got some fixes. That's why I recommend using 5.6.10 at least.


(system) #5

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