# Please clarify search timeout relation to socket\_timeout in Java client

**URL:** <https://discuss.elastic.co/t/please-clarify-search-timeout-relation-to-socket-timeout-in-java-client/381941>\
**Category:** Elastic Search\
**Created:** [September 15, 2025, 7:26am UTC](https://discuss.elastic.co/t/please-clarify-search-timeout-relation-to-socket-timeout-in-java-client/381941 "2025-09-15T07:26:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeSER](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@MikeSER](https://discuss.elastic.co/u/MikeSER)\
**Post date:** [September 15, 2025, 7:26am UTC](https://discuss.elastic.co/t/please-clarify-search-timeout-relation-to-socket-timeout-in-java-client/381941/1 "2025-09-15T07:26:18Z")

</div>

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?
