# Elasticsearch version conflict Issue

**URL:** <https://discuss.elastic.co/t/elasticsearch-version-conflict-issue/142069>\
**Category:** Elasticsearch\
**Created:** [July 29, 2018, 1:45pm UTC](https://discuss.elastic.co/t/elasticsearch-version-conflict-issue/142069 "2018-07-29T13:45:47Z")\
**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:** [July 29, 2018, 1:45pm UTC](https://discuss.elastic.co/t/elasticsearch-version-conflict-issue/142069/1 "2018-07-29T13:45:47Z")

</div>

I have updated document in the elastic search. after update using, I am fetching the same document by using their ID. It is giving me the 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?  
What is meaning of this error?

---

<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:** [August 26, 2018, 1:45pm UTC](https://discuss.elastic.co/t/elasticsearch-version-conflict-issue/142069/2 "2018-08-26T13:45:53Z")

</div>

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