I would like to build in some retry logic on our Elasticsearch requests but I cannot find documentation to explain WHEN a request should be submitted again after a short delay. Also knowing if you are supposed to retry IOExceptions or only certain ones..
This is the only documentation that I found describing the errors (src: Bulk API | Java REST Client [6.8] | Elastic)
Synchronous calls may throw an
IOException
in case of either failing to parse the REST response in the high-level REST client, the request times out or similar cases where there is no response coming back from the server. In cases where the server returns a4xx
or5xx
error code, the high-level client tries to parse the response body error details instead and then throws a genericElasticsearchException
and adds the originalResponseException
as a suppressed exception to it.
But there are no documents that explain what error codes are deemed okay to retry and which ones are errors that cannot be retried?
Any help would be greatly appreciated. Thanks!