# Elasticsearch delete\_by\_query 409 version conflict

**URL:** <https://discuss.elastic.co/t/elasticsearch-delete-by-query-409-version-conflict/174150>\
**Category:** Elasticsearch\
**Created:** [March 27, 2019, 2:46pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-409-version-conflict/174150 "2019-03-27T14:46:38Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Rahul\_Kumar3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_kumar3/32/42574_2.png) [@Rahul\_Kumar3](https://discuss.elastic.co/u/Rahul_Kumar3)\
**Post date:** [March 29, 2019, 5:19am UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-409-version-conflict/174150/3 "2019-03-29T05:19:07Z")

</div>

Hi @HenningAndersen,

So \_delete\_by\_query basically searches for the documents to delete and then deletes them one by one. And a version conflict occurs if one or more of the documents gets update in between the time when the search was completed and the delete operation was started.

But as I said, I had received a successful created/updated response for all the documents that have to deleted, before sending the \_delete\_by\_query request. And I am pretty sure that that none of the documents are getting updated during the time duration when \_delete\_by\_query is running.

So I am guessing that a successful creation/updation does not imply that that the data is successfully persisted across the primary and replica shards (and is available immediately for search) but instead is written to some kind of translog and then persisted on required nodes once a refresh is done.

Assuming my above assumption to be correct, \_delete\_by\_query will throw a version conflict when a refresh occurs just after the search operation (of \_delete\_by\_query) completes and delete operation starts.

Please correct me if I am wrong.

---

_[View the full topic](https://discuss.elastic.co/t/elasticsearch-delete-by-query-409-version-conflict/174150)._
