# Elastic Search Version Conflict

**URL:** https://discuss.elastic.co/t/elastic-search-version-conflict/249699
**Category:** Elasticsearch
**Created:** [September 23, 2020, 7:34pm UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699 "2020-09-23T19:34:11Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [September 23, 2020, 7:34pm UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699/1 "2020-09-23T19:34:11Z")

</div>

I am using an elastic search for search purpose. But recently I observer that some random error while adding data into elastic search. The error looks like:

```auto
version conflict, required seqNo [113789], primary term [19]. current document has seqNo [113797] and primary term [19]

```

The above type error comes randomly and I am not able to add/update data in elastic search. Can you please help to Understand :

1. What is the root cause of this issue?
2. How I can reproduce this issue? as this coming randomly need to know the basic step to reproduce this issue
3. What is the solution for this? How I can solve this issue?

Kindly help me here

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 23, 2020, 9:35pm UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699/2 "2020-09-23T21:35:45Z")

</div>

How are you indexing data into Elasticsearch? What is the source of the data?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [September 24, 2020, 3:32am UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699/3 "2020-09-24T03:32:41Z")

</div>

Can you tell us about the cluster? Which version are you using? How large is it? Where is it deployed? What type of hardware?

---

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [September 24, 2020, 5:47am UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699/4 "2020-09-24T05:47:08Z")

</div>

Yes, we have indexing data into elastic search. we have cms in which user adding/updating/deleting documents and we are listening this events and adding data into elastic search.  
We are using Mongo DB to fetch data in json format and then foramt it as per our elastic search mapping and add it into elastic search.

---

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [September 24, 2020, 5:49am UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699/5 "2020-09-24T05:49:02Z")

</div>

I am using Elastic search 6.8 version.

---

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [September 24, 2020, 5:50am UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699/6 "2020-09-24T05:50:03Z")

</div>

We are suing elastic search update\_by\_query and delete\_by \_query is because of that this issue is coming?

---

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [September 25, 2020, 3:44am UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699/7 "2020-09-25T03:44:26Z")

</div>

@Christian_Dahlqvist @warkolm Can you please help me here?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [September 25, 2020, 5:49am UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699/8 "2020-09-25T05:49:00Z")

</div>

I suspect concurrently updating and deleting the same document by query might cause this. As far as I know both operations work based on a snapshot of the data as it was when the operation started, so if the operations take a long time and affect a large number of documents it is likely that version conflicts may be detected if multiple operations affect the same documents.

There seem to be [a parameter determining how conflicts are handled](https://www.elastic.co/guide/en/elasticsearch/reference/7.9/docs-update-by-query.html#docs-update-by-query-api-query-params), have you used this? If that does not help, have you considered altering the size of the update and delete requests?

---

<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: [October 23, 2020, 5:49am UTC](https://discuss.elastic.co/t/elastic-search-version-conflict/249699/9 "2020-10-23T05:49:00Z")

</div>

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