ES5: Correct RestClient.FailureListener behaviour & retry logic



I have been using the ES5 RestClient which I am building as follows:


The failureListener that I have created simply logs a message that there has been a failure as follows:

Host [http://localhost:9200] failure

When the above failure occurs (for a bulk indexing test I have been running) it will later be followed by a timeout: listener timeout after waiting for [10000] ms
at org.elasticsearch.client.RestClient$SyncResponseListener.get(
at org.elasticsearch.client.RestClient.performRequest(
at org.elasticsearch.client.RestClient.performRequest(

After a failure will the RestClient be in a usable state? Should I rebuild a new RestClient after a failure or perhaps do something in the onFailure method to recover?

If I want to add retry logic what is the best way to do this? Should I add retry logic around RestClient or can the RestClient provide it? Sounds a bit hacky, but if I provided a list of two identical hosts (&port) would the RestClient retry on the 'other' host if the first one failed?



(Nik Everett) #2

It'll be fine. If you have multiple nodes or are using the sniffer then for certain failures it'll remove the node from the list and try another node, iirc.

If you want to retry on the same node then I'd implement the retry logic outside of the REST client.


Great, thanks for the clarification.

(system) #4

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