# ElasticSearch reports non-200 response on successful update

**URL:** <https://discuss.elastic.co/t/elasticsearch-reports-non-200-response-on-successful-update/130131>\
**Category:** Elasticsearch\
**Created:** [May 1, 2018, 3:36pm UTC](https://discuss.elastic.co/t/elasticsearch-reports-non-200-response-on-successful-update/130131 "2018-05-01T15:36:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![devj1988](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/devj1988/32/30628_2.png) [@devj1988](https://discuss.elastic.co/u/devj1988)\
**Post date:** [May 1, 2018, 3:36pm UTC](https://discuss.elastic.co/t/elasticsearch-reports-non-200-response-on-successful-update/130131/1 "2018-05-01T15:36:24Z")

</div>

What is the response code when a document is updated?

AFAIK, the response code should be 200 for document update and 201 for creation.  
So, for something like :

PUT index/type/doc?version=1  
// body

if update is successful, then 200 should be returned, else 409 for version conflict.  
(This assumes that the document already exists before the PUT is sent)

in my code i have

```
while(true)
    response = try_update()
    if (response.code == 200):
        break

```

this should result in only one update (otherwise it will get 409 response code). But, the update happened twice and response code was 200 only once.  
How is this possible?

---

<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:** [May 29, 2018, 3:36pm UTC](https://discuss.elastic.co/t/elasticsearch-reports-non-200-response-on-successful-update/130131/2 "2018-05-29T15:36:34Z")

</div>

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