HTTP response codes when creating a document


Is there somewhere a list of all possible HTTP response codes when creating a new document in ElasticSearch? I only managed to find that in case of a successful creation 201 is responded while in case of a conflict the code is 409.
Are there any other possible cases? For example which code is responded in case the document is created successfully to a primary shard but it failed in a replica?
Moreover which of those error codes is retriable?

Thanks in advance

There is no Elasticsearch-specific list AFAIK. As well as 201 and 409 off the top of my head I can think of 404 (index not found), 429 (Elasticsearch is overloaded), 400 (bad request, e.g. the index is closed), 403 (forbidden, e.g. the index is readonly). Of these only 429 seems likely to resolve itself without intervention.

There is no special code for a case where the document is written to the primary but not a replica because this is handled internally by Elasticsearch.

So in case of failure in a replica, Elasticsearch will respond 201 and it will be responsible by itself to sync all replicas ?

That's correct.

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