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
Merge serverless functionality from @elastic/elasticsearch-serverless (#2695)
* Expose a serverMode option to enable serverless-friendly defaults
* Update basic config docs to note how the serverMode flag works
* Docs cleanup
* Add another note to docs about connecting to serverless
Or it can be an object (or an array of objects) that represents the node:
30
34
31
35
```js
@@ -52,7 +56,6 @@ Default: `null`
52
56
53
57
Your authentication data. You can use both basic authentication and [ApiKey](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-create-api-key).
54
58
See [Authentication](/reference/connecting.md#authentication) for more details.
55
-
56
59
57
60
Basic authentication:
58
61
@@ -113,7 +116,7 @@ Max ping request timeout in milliseconds for each request.
113
116
Type: `number, boolean`<br>
114
117
Default: `false`
115
118
116
-
Perform a sniff operation every `n` milliseconds.
119
+
Perform a sniff operation every `n` milliseconds.
117
120
118
121
:::{tip}
119
122
Sniffing might not be the best solution. Before using the various `sniff` options, review this [blog post](https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how).
@@ -182,7 +185,7 @@ Options: `'gzip'`, `false`
182
185
Type: `http.SecureContextOptions`<br>
183
186
Default: `null`
184
187
185
-
The [tls configuraton](https://nodejs.org/api/tls.md).
188
+
The [tls configuraton](https://nodejs.org/api/tls.html).
186
189
187
190
---
188
191
@@ -192,7 +195,6 @@ Type: `string, URL`<br>
192
195
Default: `null`
193
196
194
197
If you are using an http(s) proxy, you can put its url here. The client will automatically handle the connection to it.
195
-
196
198
197
199
```js
198
200
constclient=newClient({
@@ -213,7 +215,7 @@ const client = new Client({
213
215
Type: `http.AgentOptions, function`<br>
214
216
Default: `null`
215
217
216
-
http agent [options](https://nodejs.org/api/http.md#http_new_agent_options), or a function that returns an actual http agent instance. If you want to disable the http agent use entirely (and disable the `keep-alive` feature), set the agent to `false`.
218
+
http agent [options](https://nodejs.org/api/http.html#http_new_agent_options), or a function that returns an actual http agent instance. If you want to disable the http agent use entirely (and disable the `keep-alive` feature), set the agent to `false`.
217
219
218
220
```js
219
221
constclient=newClient({
@@ -394,4 +396,26 @@ When configured, `maxResponseSize` verifies that the uncompressed response size
394
396
Type: `number`<br>
395
397
Default: `null`
396
398
397
-
When configured, `maxCompressedResponseSize` verifies that the compressed response size is lower than the configured number. If it’s higher, the request will be canceled. The `maxCompressedResponseSize` cannot be higher than the value of `buffer.constants.MAX_STRING_LENGTH`.
399
+
When configured, `maxCompressedResponseSize` verifies that the compressed response size is lower than the configured number. If it’s higher, the request will be canceled. The `maxCompressedResponseSize` cannot be higher than the value of `buffer.constants.MAX_STRING_LENGTH`.
400
+
401
+
---
402
+
403
+
### `redaction`
404
+
405
+
Type: `object`<br>
406
+
Default: A configuration that will replace known sources of sensitive data in `Error` metadata
407
+
408
+
Options for how to redact potentially sensitive data from metadata attached to `Error` objects
409
+
410
+
::::{note}
411
+
[Read about redaction](/reference/advanced-config.md#redaction) for more details
412
+
::::
413
+
414
+
---
415
+
416
+
### `serverMode`
417
+
418
+
Type: `string`<br>
419
+
Default: `"stack"`
420
+
421
+
Setting to `"stack"` sets defaults assuming a traditional (non-serverless) {{es}} instance. Setting to `"serverless"` sets defaults to work more seamlessly with [Elastic Cloud Serverless](https://www.elastic.co/guide/en/serverless/current/intro.html), like enabling compression and disabling features that assume the possibility of multiple {{es}} nodes.
Copy file name to clipboardExpand all lines: docs/reference/client-helpers.md
-27Lines changed: 0 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -11,15 +11,12 @@ The client comes with an handy collection of helpers to give you a more comforta
11
11
The client helpers are experimental, and the API may change in the next minor releases. The helpers will not work in any Node.js version lower than 10.
12
12
::::
13
13
14
-
15
-
16
14
## Bulk helper [bulk-helper]
17
15
18
16
Added in `v7.7.0`
19
17
20
18
Running bulk requests can be complex due to the shape of the API, this helper aims to provide a nicer developer experience around the Bulk API.
21
19
22
-
23
20
### Usage [_usage_3]
24
21
25
22
```js
@@ -67,10 +64,8 @@ To create a new instance of the Bulk helper, access it as shown in the example a
67
64
|`wait`| How much time to wait before retries in milliseconds.<br> *Default:* 5000.<br><br>```js<br>const b = client.helpers.bulk({<br> wait: 3000<br>})<br>```<br> |
68
65
|`refreshOnCompletion`| If `true`, at the end of the bulk operation it runs a refresh on all indices or on the specified indices.<br> *Default:* false.<br><br>```js<br>const b = client.helpers.bulk({<br> refreshOnCompletion: true<br> // or<br> refreshOnCompletion: 'index-name'<br>})<br>```<br> |
69
66
70
-
71
67
### Supported operations [_supported_operations]
72
68
73
-
74
69
#### Index [_index_2]
75
70
76
71
```js
@@ -84,7 +79,6 @@ client.helpers.bulk({
84
79
})
85
80
```
86
81
87
-
88
82
#### Create [_create_4]
89
83
90
84
```js
@@ -98,7 +92,6 @@ client.helpers.bulk({
98
92
})
99
93
```
100
94
101
-
102
95
#### Update [_update_3]
103
96
104
97
```js
@@ -116,7 +109,6 @@ client.helpers.bulk({
116
109
})
117
110
```
118
111
119
-
120
112
#### Delete [_delete_10]
121
113
122
114
```js
@@ -130,7 +122,6 @@ client.helpers.bulk({
130
122
})
131
123
```
132
124
133
-
134
125
### Abort a bulk operation [_abort_a_bulk_operation]
135
126
136
127
If needed, you can abort a bulk operation at any time. The bulk helper returns a [thenable](https://promisesaplus.com/), which has an `abort` method.
@@ -139,7 +130,6 @@ If needed, you can abort a bulk operation at any time. The bulk helper returns a
139
130
The abort method stops the execution of the bulk operation, but if you are using a concurrency higher than one, the operations that are already running will not be stopped.
140
131
::::
141
132
142
-
143
133
```js
144
134
const { createReadStream } =require('fs')
145
135
constsplit=require('split2')
@@ -164,7 +154,6 @@ const b = client.helpers.bulk({
164
154
console.log(await b)
165
155
```
166
156
167
-
168
157
### Passing custom options to the Bulk API [_passing_custom_options_to_the_bulk_api]
169
158
170
159
You can pass any option supported by the link: [Bulk API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk) to the helper, and the helper uses those options in conjunction with the Bulk API call.
@@ -181,7 +170,6 @@ const result = await client.helpers.bulk({
181
170
})
182
171
```
183
172
184
-
185
173
### Usage with an async generator [_usage_with_an_async_generator]
186
174
187
175
```js
@@ -214,7 +202,6 @@ const result = await client.helpers.bulk({
214
202
console.log(result)
215
203
```
216
204
217
-
218
205
### Modifying a document before operation [_modifying_a_document_before_operation]
219
206
220
207
Added in `v8.8.2`
@@ -241,14 +228,12 @@ const result = await client.helpers.bulk({
241
228
console.log(result)
242
229
```
243
230
244
-
245
231
## Multi search helper [multi-search-helper]
246
232
247
233
Added in `v7.8.0`
248
234
249
235
If you send search request at a high rate, this helper might be useful for you. It uses the multi search API under the hood to batch the requests and improve the overall performances of your application. The `result` exposes a `documents` property as well, which allows you to access directly the hits sources.
250
236
251
-
252
237
### Usage [_usage_4]
253
238
254
239
```js
@@ -278,7 +263,6 @@ To create a new instance of the multi search (msearch) helper, you should access
278
263
|`retries`| How many times an operation is retried before to resolve the request. An operation is retried only in case of a 429 error.<br> *Default:* Client max retries.<br><br>```js<br>const m = client.helpers.msearch({<br> retries: 3<br>})<br>```<br> |
279
264
|`wait`| How much time to wait before retries in milliseconds.<br> *Default:* 5000.<br><br>```js<br>const m = client.helpers.msearch({<br> wait: 3000<br>})<br>```<br> |
280
265
281
-
282
266
### Stopping the msearch helper [_stopping_the_msearch_helper]
283
267
284
268
If needed, you can stop an msearch processor at any time. The msearch helper returns a [thenable](https://promisesaplus.com/), which has an `stop` method.
@@ -291,7 +275,6 @@ The `stop` method accepts an optional error, that will be dispatched every subse
291
275
The stop method stops the execution of the msearch processor, but if you are using a concurrency higher than one, the operations that are already running will not be stopped.
@@ -408,15 +386,12 @@ for await (const doc of scrollSearch) {
408
386
}
409
387
```
410
388
411
-
412
389
## ES|QL helper [esql-helper]
413
390
414
391
ES|QL queries can return their results in [several formats](docs-content://explore-analyze/query-filter/languages/esql-rest.md#esql-rest-format). The default JSON format returned by ES|QL queries contains arrays of values for each row, with column names and types returned separately:
415
392
416
-
417
393
### Usage [_usage_5]
418
394
419
-
420
395
#### `toRecords`[_torecords]
421
396
422
397
Added in `v8.14.0`
@@ -494,7 +469,6 @@ const result = await client.helpers
494
469
.toRecords<EventLog>()
495
470
```
496
471
497
-
498
472
#### `toArrowReader`[_toarrowreader]
499
473
500
474
Added in `v8.16.0`
@@ -516,7 +490,6 @@ for (const recordBatch of reader) {
Copy file name to clipboardExpand all lines: docs/reference/configuration.md
+5-10Lines changed: 5 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,8 @@ mapped_pages:
7
7
8
8
The client is designed to be easily configured for your needs. In the following section, you can see the possible options that you can use to configure it.
0 commit comments