Skip to content

Commit bb5fb24

Browse files
authored
[Backport 8.16] Add streaming support to Arrow helper (#2430)
1 parent 38358e2 commit bb5fb24

File tree

8 files changed

+402
-95
lines changed

8 files changed

+402
-95
lines changed

docs/changelog.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
You can find all the API changes
1414
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/release-notes-8.16.0.html[here].
1515

16+
[discrete]
17+
===== Support Apache Arrow in ES|QL helper
18+
19+
The ES|QL helper can now return results as an Apache Arrow `Table` or `RecordBatchReader`, which enables high-performance calculations on ES|QL results, even if the response data is larger than the system's available memory. See <<esql-helper>> for more information.
20+
1621
[discrete]
1722
==== Fixes
1823

docs/connecting.asciidoc

Lines changed: 70 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[client-connecting]]
2-
== Connecting
2+
== Connecting
33

4-
This page contains the information you need to connect and use the Client with
4+
This page contains the information you need to connect and use the Client with
55
{es}.
66

77
**On this page**
@@ -19,26 +19,26 @@ This page contains the information you need to connect and use the Client with
1919
[discrete]
2020
=== Authentication
2121

22-
This document contains code snippets to show you how to connect to various {es}
22+
This document contains code snippets to show you how to connect to various {es}
2323
providers.
2424

2525

2626
[discrete]
2727
[[auth-ec]]
2828
==== Elastic Cloud
2929

30-
If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers
31-
an easy way to connect to it via the `cloud` option. You must pass the Cloud ID
32-
that you can find in the cloud console, then your username and password inside
30+
If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers
31+
an easy way to connect to it via the `cloud` option. You must pass the Cloud ID
32+
that you can find in the cloud console, then your username and password inside
3333
the `auth` option.
3434

35-
NOTE: When connecting to Elastic Cloud, the client will automatically enable
36-
both request and response compression by default, since it yields significant
37-
throughput improvements. Moreover, the client will also set the tls option
38-
`secureProtocol` to `TLSv1_2_method` unless specified otherwise. You can still
35+
NOTE: When connecting to Elastic Cloud, the client will automatically enable
36+
both request and response compression by default, since it yields significant
37+
throughput improvements. Moreover, the client will also set the tls option
38+
`secureProtocol` to `TLSv1_2_method` unless specified otherwise. You can still
3939
override this option by configuring them.
4040

41-
IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are
41+
IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are
4242
behind a load balancer, Elastic Cloud will take care of everything for you.
4343
Take a look https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how[here]
4444
to know more.
@@ -61,18 +61,18 @@ const client = new Client({
6161
[[connect-self-managed-new]]
6262
=== Connecting to a self-managed cluster
6363

64-
By default {es} will start with security features like authentication and TLS
65-
enabled. To connect to the {es} cluster you'll need to configure the Node.js {es}
66-
client to use HTTPS with the generated CA certificate in order to make requests
64+
By default {es} will start with security features like authentication and TLS
65+
enabled. To connect to the {es} cluster you'll need to configure the Node.js {es}
66+
client to use HTTPS with the generated CA certificate in order to make requests
6767
successfully.
6868

69-
If you're just getting started with {es} we recommend reading the documentation
70-
on https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html[configuring]
71-
and
72-
https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html[starting {es}]
69+
If you're just getting started with {es} we recommend reading the documentation
70+
on https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html[configuring]
71+
and
72+
https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html[starting {es}]
7373
to ensure your cluster is running as expected.
7474

75-
When you start {es} for the first time you'll see a distinct block like the one
75+
When you start {es} for the first time you'll see a distinct block like the one
7676
below in the output from {es} (you may have to scroll up if it's been a while):
7777

7878
[source,sh]
@@ -90,24 +90,24 @@ below in the output from {es} (you may have to scroll up if it's been a while):
9090
9191
----
9292

93-
Depending on the circumstances there are two options for verifying the HTTPS
94-
connection, either verifying with the CA certificate itself or via the HTTP CA
93+
Depending on the circumstances there are two options for verifying the HTTPS
94+
connection, either verifying with the CA certificate itself or via the HTTP CA
9595
certificate fingerprint.
9696

9797
[discrete]
9898
[[auth-tls]]
9999
==== TLS configuration
100100

101-
The generated root CA certificate can be found in the `certs` directory in your
102-
{es} config location (`$ES_CONF_PATH/certs/http_ca.crt`). If you're running {es}
103-
in Docker there is
101+
The generated root CA certificate can be found in the `certs` directory in your
102+
{es} config location (`$ES_CONF_PATH/certs/http_ca.crt`). If you're running {es}
103+
in Docker there is
104104
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html[additional documentation for retrieving the CA certificate].
105105

106-
Without any additional configuration you can specify `https://` node urls, and
107-
the certificates used to sign these requests will be verified. To turn off
108-
certificate verification, you must specify an `tls` object in the top level
109-
config and set `rejectUnauthorized: false`. The default `tls` values are the
110-
same that Node.js's https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[`tls.connect()`]
106+
Without any additional configuration you can specify `https://` node urls, and
107+
the certificates used to sign these requests will be verified. To turn off
108+
certificate verification, you must specify an `tls` object in the top level
109+
config and set `rejectUnauthorized: false`. The default `tls` values are the
110+
same that Node.js's https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[`tls.connect()`]
111111
uses.
112112

113113
[source,js]
@@ -152,16 +152,16 @@ const client = new Client({
152152
})
153153
----
154154

155-
The certificate fingerprint can be calculated using `openssl x509` with the
155+
The certificate fingerprint can be calculated using `openssl x509` with the
156156
certificate file:
157157

158158
[source,sh]
159159
----
160160
openssl x509 -fingerprint -sha256 -noout -in /path/to/http_ca.crt
161161
----
162162

163-
If you don't have access to the generated CA file from {es} you can use the
164-
following script to output the root CA fingerprint of the {es} instance with
163+
If you don't have access to the generated CA file from {es} you can use the
164+
following script to output the root CA fingerprint of the {es} instance with
165165
`openssl s_client`:
166166

167167
[source,sh]
@@ -186,8 +186,8 @@ SHA256 Fingerprint=A5:2D:D9:35:11:E8:C6:04:5E:21:F1:66:54:B7:7C:9E:E0:F3:4A:EA:2
186186

187187
WARNING: Running {es} without security enabled is not recommended.
188188

189-
If your cluster is configured with
190-
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html[security explicitly disabled]
189+
If your cluster is configured with
190+
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html[security explicitly disabled]
191191
then you can connect via HTTP:
192192

193193
[source,js]
@@ -208,14 +208,14 @@ Following you can find all the supported authentication strategies.
208208
[[auth-apikey]]
209209
==== ApiKey authentication
210210

211-
You can use the
212-
{ref-7x}/security-api-create-api-key.html[ApiKey]
213-
authentication by passing the `apiKey` parameter via the `auth` option. The
214-
`apiKey` parameter can be either a base64 encoded string or an object with the
215-
values that you can obtain from the
211+
You can use the
212+
{ref-7x}/security-api-create-api-key.html[ApiKey]
213+
authentication by passing the `apiKey` parameter via the `auth` option. The
214+
`apiKey` parameter can be either a base64 encoded string or an object with the
215+
values that you can obtain from the
216216
{ref-7x}/security-api-create-api-key.html[create api key endpoint].
217217

218-
NOTE: If you provide both basic authentication credentials and the ApiKey
218+
NOTE: If you provide both basic authentication credentials and the ApiKey
219219
configuration, the ApiKey takes precedence.
220220

221221
[source,js]
@@ -268,10 +268,10 @@ const client = new Client({
268268
[[auth-basic]]
269269
==== Basic authentication
270270

271-
You can provide your credentials by passing the `username` and `password`
271+
You can provide your credentials by passing the `username` and `password`
272272
parameters via the `auth` option.
273273

274-
NOTE: If you provide both basic authentication credentials and the Api Key
274+
NOTE: If you provide both basic authentication credentials and the Api Key
275275
configuration, the Api Key will take precedence.
276276

277277
[source,js]
@@ -342,14 +342,14 @@ const result = await client.search({
342342
}, { meta: true })
343343
----
344344

345-
In this case, the result will be:
345+
In this case, the result will be:
346346
[source,ts]
347347
----
348348
{
349349
body: object | boolean
350350
statusCode: number
351351
headers: object
352-
warnings: [string],
352+
warnings: string[],
353353
meta: object
354354
}
355355
----
@@ -361,7 +361,7 @@ NOTE: The body is a boolean value when you use `HEAD` APIs.
361361

362362
If needed, you can abort a running request by using the `AbortController` standard.
363363

364-
CAUTION: If you abort a request, the request will fail with a
364+
CAUTION: If you abort a request, the request will fail with a
365365
`RequestAbortedError`.
366366

367367

@@ -410,19 +410,23 @@ The supported request specific options are:
410410
[cols=2*]
411411
|===
412412
|`ignore`
413-
|`[number]` -  HTTP status codes which should not be considered errors for this request. +
413+
|`number[]` -  HTTP status codes which should not be considered errors for this request. +
414414
_Default:_ `null`
415415

416416
|`requestTimeout`
417-
|`number` - Max request timeout for the request in milliseconds, it overrides the client default. +
417+
|`number | string` - Max request timeout for the request in milliseconds, it overrides the client default. +
418418
_Default:_ `30000`
419419

420+
|`retryOnTimeout`
421+
|`boolean` - Retry requests that have timed out.
422+
_Default:_ `false`
423+
420424
|`maxRetries`
421425
|`number` - Max number of retries for the request, it overrides the client default. +
422426
_Default:_ `3`
423427

424428
|`compression`
425-
|`string, boolean` - Enables body compression for the request. +
429+
|`string | boolean` - Enables body compression for the request. +
426430
_Options:_ `false`, `'gzip'` +
427431
_Default:_ `false`
428432

@@ -446,6 +450,10 @@ _Default:_ `null`
446450
|`any` - Custom object per request. _(you can use it to pass data to the clients events)_ +
447451
_Default:_ `null`
448452

453+
|`opaqueId`
454+
|`string` - Set the `X-Opaque-Id` HTTP header. See {ref}/api-conventions.html#x-opaque-id
455+
_Default:_ `null`
456+
449457
|`maxResponseSize`
450458
|`number` - When configured, it verifies that the uncompressed response size is lower than the configured number, if it's higher it will abort the request. It cannot be higher than buffer.constants.MAX_STRING_LENTGH +
451459
_Default:_ `null`
@@ -458,6 +466,17 @@ _Default:_ `null`
458466
|`AbortSignal` - The AbortSignal instance to allow request abortion. +
459467
_Default:_ `null`
460468

469+
|`meta`
470+
|`boolean` - Rather than returning the body, return an object containing `body`, `statusCode`, `headers` and `meta` keys +
471+
_Default_: `false`
472+
473+
|`redaction`
474+
|`object` - Options for redacting potentially sensitive data from error metadata. See <<redaction>>.
475+
476+
|`retryBackoff`
477+
|`(min: number, max: number, attempt: number) => number;` - A function that calculates how long to sleep, in seconds, before the next request retry +
478+
_Default:_ A built-in function that uses exponential backoff with jitter.
479+
461480
|===
462481

463482
[discrete]
@@ -537,8 +556,8 @@ Resources used to assess these recommendations:
537556

538557
~Added~ ~in~ ~`v7.10.0`~
539558

540-
If you need to pass through an http(s) proxy for connecting to {es}, the client
541-
out of the box offers a handy configuration for helping you with it. Under the
559+
If you need to pass through an http(s) proxy for connecting to {es}, the client
560+
out of the box offers a handy configuration for helping you with it. Under the
542561
hood, it uses the https://github.com/delvedor/hpagent[`hpagent`] module.
543562

544563
IMPORTANT: In versions 8.0+ of the client, the default `Connection` type is set to `UndiciConnection`, which does not support proxy configurations.
@@ -715,5 +734,5 @@ This pre-flight product check allows the client to establish the version of Elas
715734
that it is communicating with. The product check requires one additional HTTP request to
716735
be sent to the server as part of the request pipeline before the main API call is sent.
717736
In most cases, this will succeed during the very first API call that the client sends.
718-
Once the product check completes, no further product check HTTP requests are sent for
737+
Once the product check completes, no further product check HTTP requests are sent for
719738
subsequent API calls.

0 commit comments

Comments
 (0)