# Version Conflict Engine Exception - seqNo question

**URL:** <https://discuss.elastic.co/t/version-conflict-engine-exception-seqno-question/272930>\
**Category:** Elasticsearch\
**Created:** [May 13, 2021, 3:40pm UTC](https://discuss.elastic.co/t/version-conflict-engine-exception-seqno-question/272930 "2021-05-13T15:40:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anabella\_Cristaldi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anabella_cristaldi/32/23612_2.png) [@Anabella\_Cristaldi](https://discuss.elastic.co/u/Anabella_Cristaldi)\
**Post date:** [May 13, 2021, 3:40pm UTC](https://discuss.elastic.co/t/version-conflict-engine-exception-seqno-question/272930/1 "2021-05-13T15:40:39Z")

</div>

Hi All,  
I'm getting version\_conflict\_engine\_exception when doing an update by query in an index with one shard and no replicas.  
I do not understand well why is this situation happening.  
Is there any place in the doc where it is explained the conditions under this exception is raised?

The update by query I'm doing is:

```
POST audit-trail-2021.05.07-000001/_update_by_query
{
 "query": {
  "range": {
    "@timestamp": {
      "lte": "now-1h"
    }
  }
}, 
  "script": {
    "source": """ctx._source.source = ["ip": ctx._source.ip]""",
    "lang": "painless"
  }
}

```

and the error

```
  {
          "index" : "audit-trail-2021.05.07-000001",
          "type" : "_doc",
          "id" : "agzwWHkBtct8ebcgWHR6",
          "cause" : {
            "type" : "version_conflict_engine_exception",
            "reason" : "[agzwWHkBtct8ebcgWHR6]: version conflict, required seqNo [13740177], primary term [1]. current document has seqNo [19475784] and primary term [1]",
            "index_uuid" : "1wZ7iI_CS760nKU2sKgVEA",
            "shard" : "0",
            "index" : "audit-trail-2021.05.07-000001"
          },
          "status" : 409
        }

```

If I run the update by query with `?conflicts=proceed` it executes well, but I want to understand the nature of the error  
Thank you very much in advance  
Regards  
Ana

---

<div class="post-metadata">

**Author:** ![Anabella\_Cristaldi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anabella_cristaldi/32/23612_2.png) [@Anabella\_Cristaldi](https://discuss.elastic.co/u/Anabella_Cristaldi)\
**Post date:** [May 13, 2021, 5:11pm UTC](https://discuss.elastic.co/t/version-conflict-engine-exception-seqno-question/272930/2 "2021-05-13T17:11:49Z")

</div>

I suppose that it is related to [this]  
([Optimistic concurrency control | Elasticsearch Guide [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.12/optimistic-concurrency-control.html))

So I run the following experiment

1. In the scope of the documents I want to update I wanted to know the max seq\_no, so I've executed this

and the document with highest seqNo is 37250895

1. After that I perform the update by query

I got the version\_conflict\_engine\_exception

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/8/f82f187c0246b2c8e1ba257cc609224d90307807.png)

How the required seqNo for this new update operation is lower than the max seqNo of the existing documents? (documents once indexed are not modified)  
How the required seqNo for the update by query operation is determined?

Probably I'm missing something...

Thank you!  
Regards  
Ana

---

<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:** [June 10, 2021, 5:11pm UTC](https://discuss.elastic.co/t/version-conflict-engine-exception-seqno-question/272930/3 "2021-06-10T17:11:57Z")

</div>

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