Delete by query returns version_conflict_engine_exception

Hello,
I am trying to delete some old documents which are no longer needed using the https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

POST /aws-elb-2019.01/_delete_by_query?requests_per_second=50&wait_for_completion=false
{
  "query": {
    "terms": {
      "user_agent": [ "node", "axios" ],
      "boost": 1.0
    }
  }
}

but then in the output, i get:

{
  "completed" : true,
  "task" : {
    "node" : "clqjAxlMSwCIzENfCZKFRA",
    "id" : 653241034,
    "type" : "transport",
    "action" : "indices:data/write/delete/byquery",
    "status" : {
      "total" : 202028,
      "updated" : 0,
      "created" : 0,
      "deleted" : 23000,
      "batches" : 24,
      "version_conflicts" : 1000,
      "noops" : 0,
      "retries" : {
        "bulk" : 0,
        "search" : 0
      },
      "throttled_millis" : 2299999,
      "requests_per_second" : 10.0,
      "throttled_until_millis" : 0
    },
    "description" : "delete-by-query [aws-elb-2019.01]",
    "start_time_in_millis" : 1606845764653,
    "running_time_in_nanos" : 2305359063559,
    "cancellable" : true,
    "headers" : { }
  },
  "response" : {
    "took" : 2305298,
    "timed_out" : false,
    "total" : 202028,
    "updated" : 0,
    "created" : 0,
    "deleted" : 23000,
    "batches" : 24,
    "version_conflicts" : 1000,
    "noops" : 0,
    "retries" : {
      "bulk" : 0,
      "search" : 0
    },
    "throttled" : "38.3m",
    "throttled_millis" : 2299999,
    "requests_per_second" : 10.0,
    "throttled_until" : "0s",
    "throttled_until_millis" : 0,
    "failures" : [ {
      "index" : "aws-elb-2019.01",
      "type" : "_doc",
      "id" : "8pZao2gBmpWJuEQDr_mg",
      "cause" : {
        "type" : "version_conflict_engine_exception",
        "reason" : "[8pZao2gBmpWJuEQDr_mg]: version conflict, required seqNo [252831], primary term [4]. but no document was found",
        "index_uuid" : "MFTNjbp2QDCALrklwWe96Q",
        "shard" : "4",
        "index" : "aws-elb-2019.01"
      },
      "status" : 409

we had migrated from ES 6.4 to 7.1 and are now on 7.7.

how can i correct this and delete these documents?

any advice is much appreciated

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