You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/changelog.asciidoc
+5
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,11 @@
12
12
13
13
In 8.0, the top-level `body` parameter that was available on all API functions <<remove-body-key,was deprecated>>. In 9.0 this property is completely removed.
14
14
15
+
[discrete]
16
+
===== Remove the default 30-second timeout on all requests sent to Elasticsearch
17
+
18
+
Setting HTTP timeouts on Elasticsearch requests goes against Elastic's recommendations. See <<timeout-best-practices>> for more information.
Copy file name to clipboardExpand all lines: docs/connecting.asciidoc
+2-2
Original file line number
Diff line number
Diff line change
@@ -414,8 +414,8 @@ The supported request specific options are:
414
414
_Default:_ `null`
415
415
416
416
|`requestTimeout`
417
-
|`number | string` - Max request timeout for the request in milliseconds, it overrides the client default. +
418
-
_Default:_ `30000`
417
+
|`number | string | null` - Max request timeout for the request in milliseconds. This overrides the client default, which is to not time out at all. See https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#_http_client_configuration[Elasticsearch best practices for HTML clients] for more info. +
This client is configured by default to operate like many HTTP client libraries do, by using a relatively short (30 second) timeout on all requests sent to {es}, raising a `TimeoutError` when that time period has elapsed without receiving a response. However, {es} will always eventually respond to any request, even if it takes several minutes. The {ref}/modules-network.html#_http_client_configuration[official {es} recommendation] is to disable response timeouts entirely by default.
4
+
Starting in 9.0.0, this client is configured to not time out any HTTP request by default. {es} will always eventually respond to any request, even if it takes several minutes. Reissuing a request that it has not responded to yet can cause performance side effects. See the {ref}/modules-network.html#_http_client_configuration[official {es} recommendations for HTTP clients] for more information.
5
5
6
-
Since changing this default would be a breaking change, we won't do that until the next major release. In the meantime, here is our recommendation for properly configuring your client:
6
+
Prior to 9.0, this client was configured by default to operate like many HTTP client libraries do, by using a relatively short (30 second) timeout on all requests sent to {es}, raising a `TimeoutError` when that time period elapsed without receiving a response.
7
7
8
-
* Ensure keep-alive is enabled; this is the default, so no settings need to be changed, unless you have set `agent` to `false` or provided an alternate `agent` that disables keep-alive
9
-
* If using the default `UndiciConnection`, disable request timeouts by setting `timeout` to `0`
10
-
* If using the legacy `HttpConnection`, set `timeout` to a very large number (e.g. `86400000`, or one day)
8
+
If your circumstances require you to set timeouts on Elasticsearch requests, setting the `requestTimeout` value to a millisecond value will cause this client to operate as it did prior to 9.0.
/** @property requestTimeout Max request timeout in milliseconds for each request
111
-
* @defaultValue 30000 */
111
+
* @defaultValue No timeout
112
+
* @remarks Read [the Elasticsearch docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#_http_client_configuration) about HTTP client configuration for details. */
112
113
requestTimeout?: number
113
114
/** @property pingTimeout Max number of milliseconds a `ClusterConnectionPool` will wait when pinging nodes before marking them dead
114
115
* @defaultValue 3000 */
115
116
pingTimeout?: number
116
117
/** @property sniffInterval Perform a sniff operation every `n` milliseconds
117
118
* @remarks Sniffing might not be the best solution for you. Read https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how to learn more.
118
-
* @defaultValue */
119
+
* @defaultValuefalse */
119
120
sniffInterval?: number|boolean
120
121
/** @property sniffOnStart Perform a sniff once the client is started
121
122
* @remarks Sniffing might not be the best solution for you. Read https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how to learn more.
@@ -244,7 +245,6 @@ export default class Client extends API {
0 commit comments