# Elasticsearch version conflict

**URL:** <https://discuss.elastic.co/t/elasticsearch-version-conflict/136787>\
**Category:** Elasticsearch\
**Created:** [June 21, 2018, 5:41am UTC](https://discuss.elastic.co/t/elasticsearch-version-conflict/136787 "2018-06-21T05:41:25Z")\
**Posts on this page:** 2\
**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:** [June 21, 2018, 5:41am UTC](https://discuss.elastic.co/t/elasticsearch-version-conflict/136787/1 "2018-06-21T05:41:26Z")

</div>

I have updated document in the Elasticsearch. after update using, I am fetching the same document by using their ID. It is giving me following response:  
{

> "\_index": "b123456",  
> "\_type": "documents",  
> "\_id": "bltde56dd11ba998bab",  
> "\_version": 3,  
> "found": true,  
> "\_source": {  
> "title": "index.json",  
> "url": "/index1",  
> "tags": ,  
> "created\_at": "2018-06-19T05:02:38.174Z",  
> "updated\_at": "2018-06-19T05:07:57.155Z",  
> "version": 1,  
> "fields": [{  
> "uid": "fname",  
> "value": "john"  
> },  
> {  
> "uid": "lname",  
> "value": "test"  
> }  
> ],  
> "class": "first"  
> }  
> }

After I am using update\_by\_query to update document I am sending following request to update\_by\_query:

> {  
> "script": {  
> "source": "ctx.\_source.title = params.title;ctx.\_source.url = params.url;ctx.\_source.created\_at = params.created\_at;ctx.\_source.updated\_at = params.updated\_at;ctx.\_source.version = params.version;ctx.\_source.fields = params.fields",  
> "params": {  
> "title": "Demo title",  
> "url": "/demo",  
> "created\_at": "2018-06-19T05:02:38.174Z",  
> "updated\_at": "2018-06-19T05:07:57.155Z",  
> "version": 2,  
> "fields": [{  
> "uid": "fname",  
> "value": "vicky"  
> },  
> {  
> "uid": "lname",  
> "value": "test"  
> }  
> ]  
> }  
> },  
> "query": {  
> "bool": {  
> "must": [{  
> "term": {  
> "\_id": "bltde56dd11ba998bab"  
> }  
> },  
> {  
> "range": {  
> "version": {  
> "lt": 2  
> }  
> }  
> }  
> ]  
> }  
> }  
> }

But it is giving me status code:409 and following error:

> [documents][bltde56dd11ba998bab]: version conflict, current version [3] is different than the one provided [2]

My document also contains custom version key. Can anyone help me into this. How I solved this issue?

---

<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:** [July 19, 2018, 5:41am UTC](https://discuss.elastic.co/t/elasticsearch-version-conflict/136787/2 "2018-07-19T05:41:36Z")

</div>

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