Elasticsearch conflict during reindex with opType Create

157 views Asked by At

I've used reindex API with opType=create and I've expected for conflicts to be impossible because only new records will be inserted. But I get conflict message. Whats wrong? Does elasticsearch has timegap between checking if document exists and inserting it during reindex (not using some kind of CAS)? Does it mean if I set conflicts to proceed I'll get expected behavior to insert only absent documents? Or do I need to implement client side locking\mutex stuff?

The error I get in tasks:

{
  "completed": true,
  "task": {
    "node": "xxx",
    "id": 63525604,
    "type": "transport",
    "action": "indices:data/write/reindex",
    "status": {
      "total": 1101727,
      "updated": 0,
      "created": 240999,
      "deleted": 0,
      "batches": 241,
      "version_conflicts": 1,
      "noops": 0,
      "retries": {
        "bulk": 0,
        "search": 0
      },
      "throttled_millis": 479999,
      "requests_per_second": 500,
      "throttled_until_millis": 0
    },
    "description": "reindex from [xxx] to [xxx][_doc]",
    "start_time_in_millis": 1696388661522,
    "running_time_in_nanos": 554683695369,
    "cancellable": true,
    "cancelled": false,
    "headers": {}
  },
  "response": {
    "took": 554678,
    "timed_out": false,
    "total": 1101727,
    "updated": 0,
    "created": 240999,
    "deleted": 0,
    "batches": 241,
    "version_conflicts": 1,
    "noops": 0,
    "retries": {
      "bulk": 0,
      "search": 0
    },
    "throttled": "7.9m",
    "throttled_millis": 479999,
    "requests_per_second": 500,
    "throttled_until": "0s",
    "throttled_until_millis": 0,
    "failures": [
      {
        "index": "xxx",
        "type": "_doc",
        "id": "xxx",
        "cause": {
          "type": "version_conflict_engine_exception",
          "reason": "[xxx]: version conflict, document already exists (current version [3])",
          "index_uuid": "xxx",
          "shard": "0",
          "index": "xxx"
        },
        "status": 409
      }
    ]
  }
}
0

There are 0 answers