Please clarify search timeout relation to socket_timeout in Java client

I searched the whole forum, but didn’t found a good answer.

I use the Java-client and have a problem with the search timeout.

I can set a timeout for each search request individually. This makes sense, as I can define how long I want to wait for the answer.

But what happens when I set the timeout value higher than the default socket_timeout of (30000 ms)? In this case the client will timeout after 30 s anyway. It seems that Elasticsearch server isn’t sending heartbeat packets to keep the connection running.

Therefore I need a way to set the socket_timeout to a value higher than the search timeout. I don’t want to generally increase the socket_timeout on the underlying HTTP client, because the default timeout is normally ok.

I need a way to specify the socket_timeout on a per search call base.

How can I do that?