ElasticSearch reports non-200 response on successful update

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?

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