Timeout best practices
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Timeout best practices
editThis client defaults to a 10-minute (600000 ms) request timeout. This is intentionally generous: Elasticsearch will always eventually respond to any request, even when indexing large payloads, running ML inference pipelines, or operating in Serverless environments with auto-scaling latency. The official Elasticsearch recommendation is to disable response timeouts entirely by default.
Since removing the timeout completely would be a breaking change, it has only been removed in the 9.x client. In the 8.x client, it defaults to 30 seconds in all client versions prior to 8.19.2, where the timeout default was increased. In the meantime, here is our recommendation for properly configuring your client:
-
Ensure keep-alive is enabled; this is the default, so no settings need to be changed, unless you have set
agenttofalseor provided an alternateagentthat disables keep-alive -
If using the default
UndiciConnection, disable request timeouts by settingtimeoutto0 -
If using the legacy
HttpConnection, settimeoutto a very large number (e.g.86400000, or one day)