# Version\_conflict when trying to delete documents using \_delete\_by\_query API

**URL:** <https://discuss.elastic.co/t/version-conflict-when-trying-to-delete-documents-using-delete-by-query-api/327954>\
**Category:** Elasticsearch\
**Created:** [March 17, 2023, 3:58pm UTC](https://discuss.elastic.co/t/version-conflict-when-trying-to-delete-documents-using-delete-by-query-api/327954 "2023-03-17T15:58:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmslara.a](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tmslara.a/32/116339_2.png) [@tmslara.a](https://discuss.elastic.co/u/tmslara.a)\
**Post date:** [March 17, 2023, 3:58pm UTC](https://discuss.elastic.co/t/version-conflict-when-trying-to-delete-documents-using-delete-by-query-api/327954/1 "2023-03-17T15:58:41Z")

</div>

Hello,

I'm using Elasticsearch 8.6. I loaded many documents to an index day by day. I made a mistake when uploading the data for one day, so I want to delete all data from that specific day and load the correct information.

To delete the information I'm using (trying to) the \_delete\_by\_query API. However, I'm getting an error "version\_conflict\_engine\_exception". I run these commands on Kibana's Dev Tools.

I used the following query.

```auto
POST /index/_delete_by_query?timeout=2h
{
  "query":{
    "range":{
      "@timestamp":
      {
        "gte":"2023-02-23T06:00:00Z",
        "lt":"2023-02-24T06:00:00Z"
      }
    }
  }
}

```

I include an example of the error I'm getting.

```auto
  "failures": [
    {
      "index": "udp_index",
      "id": "5yAw7IYBA_-qkaEK9-u_",
      "cause": {
        "type": "version_conflict_engine_exception",
        "reason": "[5yAw7IYBA_-qkaEK9-u_]: version conflict, required seqNo [210075013], primary term [1]. but no document was found",
        "index_uuid": "2_zyM_OYSYa4B0Gi9zE_Fw",
        "shard": "0",
        "index": "udp_index"
      },
      "status": 409
    }

```

I checked [this old post](https://discuss.elastic.co/t/version-conflict-while-using-delete-by-query/104831/5) but I'm not sure about the given solution.

EDIT: My elasticsearch process shut down after executing the previously mentioned instruction. I restarted it and now the index is failing. The status in Kibana is blank and the health column is just a black dot.

Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 14, 2023, 3:59pm UTC](https://discuss.elastic.co/t/version-conflict-when-trying-to-delete-documents-using-delete-by-query-api/327954/2 "2023-04-14T15:59:24Z")

</div>

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