Retry for java High level rest client. ES version 6.1

we are using 6.1 ES, and Java High level Rest client. Intermittently we see "Connection reset by Peer" and "Listener timedout after 30000ms". In python there is way to set the max retries for such failures. Is there similar for Java client.

See https://github.com/elastic/elasticsearch/pull/38085 , we have removed support for maxRetryTimeout in 7.0, which is what was causing listener timeouts. You can read more in the issue about it. I would suggest that you set a high maxRetryTimeout, so the listener timeouts go away and you rely on the low-level timeouts provided by the underlying http async client (socket and connect and pool timeout).

How about failures retry, is there any such thing with high level rest client. Or we have to handle them manually

Yes there is, it's built-in in the low-level REST client, but it will retry a failed request (depending on the returned status code) on another node, up to all known nodes. Note that it will never retry the same request on the same node automatically.

One thing to add is that when you hit maxRetryTimeout, if it was the first attempt to timeout, there will not be retries on another node. I would suggest to set a very high maxRetryTimeout, and reasonably low socket and connect timeout. Note that maxRetryTimeout has been removed in 7.0.

1 Like

so if i undertand correctly there is built in retry to low level rest client. I just need to increase the maxRetryTimeout -- right ?

yes, from the info I have, it sounds like that should help.

thankyou for the response. Do you know how many retries it does by default and what is the best way to test this.

Here is what i did, i added maxRetryTimeInMilllis, and then stopped ES, when i rerun the query, somehow i dont see the client retry the same failed query again. this is in single node setup. Basically i am trying out in my ownsetup. How can i test this part if there is built in retry.

I would suggest to set a very high maxRetryTimeout, and reasonably low socket and connect timeout. Note that maxRetryTimeout has been removed in 7.0.diebestetest

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