79799364

Date: 2025-10-25 07:14:46
Score: 0.5
Natty:
Report link

Its giving version conflict error

...
"version_conflicts" : 1,
...

because some update happened at the same time you were trying to delete the documents. Try sending refresh=true in delete_by_query, that will make sure index is refreshed just before it tries to delete docs and reduce your chances of getting version conflicts.

If it still happens and you want some more robust solution, you can write some code to retry delete_by_query 3 (or more) times by catching ConflictError. That will work similar to how retry_on_conflict works in case of _update calls.

You can check out this doc: https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-delete-by-query

PS: From personal experience, you can't completely get rid of the version conflict issues (its just something you gotta make peace with, when working with elastic) but you can reduce them by using things like refresh or retry_on_conflict, etc.

Reasons:
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Sam