Compare commits

..

64 Commits

Author SHA1 Message Date
1a3504f1bb Add changelog for 8.18 (#2746) (#2748)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-15 14:31:10 -05:00
4a059fdc0c Bug #2694 (#2731) (#2744)
Co-authored-by: Siddhu545 <Siddharthkhengare@gmail.com>
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
Co-authored-by: Siddharth Khengare <67581382+Siddhu545@users.noreply.github.com>
2025-04-15 13:26:29 -05:00
c5dd4e96d4 Auto-generated API code (#2735) 2025-04-14 11:49:52 -05:00
c9666e1778 Make example generation quiet by default (#2722) (#2724)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-08 11:39:19 -05:00
1ee6a34e73 Auto-generated API code (#2716) 2025-04-07 14:43:20 -05:00
34bb7f5916 [DOCS]Removes link pointing to EIS reference docs. (#2708) (#2709)
(cherry picked from commit 6042bcd20c)

Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
2025-04-07 11:12:04 -05:00
124753aea7 Auto-generated API code (#2691)f 2025-04-04 19:22:52 +00:00
e36b0e5374 Bump to 8.18.0 (#2702) (#2703)
(cherry picked from commit 3d59389b9d)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-04 14:01:11 -05:00
e5c88add07 Auto-generated API code (#2680) 2025-03-24 12:19:29 -05:00
75f31d974d Drop broken support for roles (#2674) (#2675)
(cherry picked from commit e502d2f17a)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-03-21 14:26:24 -05:00
177a420521 Auto-generated API code (#2658) 2025-03-20 01:01:14 +00:00
c0f7fa503a Report correct transport connection type in telemetry (#2599) (#2604)
Fixes #2324

(cherry picked from commit 172180cb21)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-02-03 13:29:54 -06:00
93e2b8b695 Auto-generated API code (#2581) 2025-01-28 11:52:55 -06:00
9c092a0b30 Update dependency @types/node to v22.10.7 (#2576) (#2582)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
(cherry picked from commit 5f9561d566)

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-21 13:11:24 -06:00
d161c0a428 [Backport 8.x] Update dependency typescript to v5.7.3 (#2571)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
(cherry picked from commit 2bcbd36d75)

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-13 10:19:45 -06:00
8c7d4c42e6 Auto-generated code for 8.x (#2568) 2025-01-13 10:06:57 -06:00
fbc4fa0685 [Backport 8.x] Update dependency @types/node to v22.10.5 (#2563)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
(cherry picked from commit 2b2a9947c7)

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-08 13:25:53 -06:00
cb6084b7c3 Auto-generated code for 8.x (#2548) 2025-01-07 12:52:35 -06:00
35ce1bfef1 [Backport 8.x] Drop @types/tap for built-in types (#2562)
(cherry picked from commit 0ee486bc9c)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-01-07 11:07:00 -06:00
151aef2707 [Backport 8.x] Update @sinonjs/fake-timers digest to 48f089f (#2560)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
(cherry picked from commit f835fa3b12)

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-06 12:51:31 -06:00
8579a85fde [Backport 8.x] Update dependency @elastic/request-converter to v8.17.0 (#2558)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
(cherry picked from commit e688f36396)

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-06 12:40:52 -06:00
be0400789a Prep 8.17.0 (#2543) 2024-12-12 10:50:16 -06:00
e2905c5708 Prep 8.16.3 for release (#2540) 2024-12-12 09:35:28 -06:00
f02c66cdcc Auto-generated code for 8.x (#2529) 2024-12-11 10:12:08 -06:00
8d868df86a [Backport 8.x] Parse branch name during code gen including 'x' (#2535)
(cherry picked from commit e992c329c3)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-12-10 11:13:03 -06:00
5ebd549ad1 [Backport 8.x] Checkout correct branch of generator (#2533)
(cherry picked from commit ed3cace127)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-12-10 10:19:55 -06:00
7f364b75b7 [Backport 8.x] Codegen for 8.x clients should use the 8.x generator branch (#2519)
(cherry picked from commit 15b9ee2f06)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-12-05 10:39:22 -06:00
fe0ddb31a1 [Backport 8.x] Update dependency into-stream to v8 (#2513)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
(cherry picked from commit 101f34bd5e)

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-12-02 12:18:18 -06:00
955eb121fb [Backport 8.x] Update dependency @types/node to v22.10.1 (#2510)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
(cherry picked from commit 86f488f68f)

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-12-02 12:13:54 -06:00
da1a798310 [Backport 8.x] Update dependency @elastic/request-converter to v8.16.2 (#2512)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
(cherry picked from commit c1e90b12f0)

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-12-02 12:13:07 -06:00
82c9e5df37 [Backport 8.x] Update dependency typescript to v5.7.2 (#2511)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
(cherry picked from commit 5cb670256e)

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-12-02 12:09:36 -06:00
4e1273ef33 Auto-generated code for 8.x (#2500) 2024-12-02 12:06:57 -06:00
dbd0ec2457 [Backport 8.x] Update changelog to include 8.16.2 and 8.15.3 (#2495)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-21 10:42:34 -06:00
fc7109aa66 [Backport 8.x] Ignore tap artifacts (#2491)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-21 10:21:56 -06:00
758b745254 Add docstrings for Client class and related properties (#2484) (#2485)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-21 10:20:37 -06:00
3f3e9bac1e [Backport 8.x] Add changelog for 8.16.1 (#2480)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-18 13:33:47 -06:00
b3b9d40293 [Backport 8.x] Fix ECMAScript import (#2476)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-18 12:34:14 -06:00
14cdd64f7d Update dependency @elastic/request-converter to v8.16.1 (#2469) (#2474)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-18 11:23:45 -06:00
5d41135190 Auto-generated code for 8.x (#2471) 2024-11-18 11:21:08 -06:00
e4c4f1acb7 [Backport 8.x] Update integration test automation branches (#2465)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-18 11:19:20 -06:00
ad3caf9e94 [Backport 8.x] Upgrade ts-standard (#2461)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-13 10:45:23 -06:00
fcb421a54e [Backport 8.x] Update dependency typescript to v5 (#2458)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-12 13:38:46 -06:00
71e6e7007a [Backport 8.x] Update dependency chai to v5 (#2457)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-12 11:29:02 -06:00
dabe34dae8 [Backport 8.x] Address feedback and add clarity (#2451)
Co-authored-by: Marci W <333176+marciw@users.noreply.github.com>
2024-11-12 11:07:14 -06:00
346663f704 [Backport 8.x] Update dependency @types/split2 to v4 (#2448)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-11 11:52:38 -06:00
32345dac41 [Backport 8.x] Update dependency @types/node to v22 (#2447)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-11 11:52:06 -06:00
6efbed6be1 Auto-generated code for 8.x (#2441) 2024-11-11 10:41:35 -06:00
8be306b82d [Backport 8.x] Add changelog for 8.15.2 (#2445)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-11 09:49:50 -06:00
979475b542 Update dependency @types/node to v18.19.64 (#2421) (#2431)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-06 13:10:34 -06:00
a829634f83 [Backport 8.x] Add _id to the result of helpers.search (#2434)
(cherry picked from commit 2455dac4e5)

Co-authored-by: Rami <72725910+ramikg@users.noreply.github.com>
2024-11-06 12:27:50 -06:00
dd9b38b051 [Backport 8.x] Add streaming support to Arrow helper (#2429)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-04 15:48:30 -06:00
0e98719d60 Auto-generated code for 8.x (#2426) 2024-11-04 09:58:15 -06:00
7da9976777 Auto-generated code for 8.x (#2412)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-28 15:12:33 -05:00
4ca358cad6 [Backport 8.x] Skip flaky test (#2418)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-28 11:57:48 -05:00
cf2eda1ab3 [Backport 8.x] Don't use hash-based Docker image version (#2415)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-28 11:27:40 -05:00
5d747eec0c [Backport 8.x] Pin dependencies (#2413)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-10-28 11:26:29 -05:00
f38cbde243 [Backport 8.x] Don't generate coverage during standard unit test run (#2405)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-24 12:07:39 -05:00
61c18a6ba5 [Backport 8.x] Upgrade tap to latest (#2402)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-24 11:38:47 -05:00
432cd36879 [Backport 8.x] Basic helper for ES|QL's Apache Arrow output format (#2394)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-23 08:46:40 -05:00
e7de86a1f2 [Backport 8.x] Upgrade transport to 8.8.1 (#2390)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-21 11:57:53 -05:00
f23f77cc41 Manually backport #2375 to 8.x (#2389) 2024-10-21 11:40:05 -05:00
09b5c84d24 [Backport 8.x] Respect disablePrototypePoisoningProtection option (#2388)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-21 11:34:12 -05:00
604d4aefa7 [Backport 8.x] Update changelog for 8.15.1 (#2387)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-21 11:05:24 -05:00
e279b3ebfa [Backport 8.x] Add doc about timeout best practices (#2386)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-21 11:04:55 -05:00
259 changed files with 15505 additions and 3430 deletions

View File

@ -5,3 +5,4 @@ elasticsearch
.git .git
lib lib
junit-output junit-output
.tap

14
.github/make.sh vendored
View File

@ -65,7 +65,7 @@ codegen)
if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then
# fall back to branch name or `main` if no VERSION is set # fall back to branch name or `main` if no VERSION is set
branch_name=$(git rev-parse --abbrev-ref HEAD) branch_name=$(git rev-parse --abbrev-ref HEAD)
if [[ "$branch_name" =~ ^[0-9]+\.[0-9]+ ]]; then if [[ "$branch_name" =~ ^[0-9]+\.([0-9]+|x) ]]; then
echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m" echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m"
VERSION="$branch_name" VERSION="$branch_name"
else else
@ -150,7 +150,7 @@ if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x}
-u "$(id -u):$(id -g)" \ -u "$(id -u):$(id -g)" \
--volume "$repo:/usr/src/elasticsearch-js" \ --volume "$repo:/usr/src/elasticsearch-js" \
--volume /usr/src/elasticsearch-js/node_modules \ --volume /usr/src/elasticsearch-js/node_modules \
--volume "$(realpath $repo/../elastic-client-generator-js):/usr/src/elastic-client-generator-js" \ --volume "$(realpath "$repo/../elastic-client-generator-js"):/usr/src/elastic-client-generator-js" \
--env "WORKFLOW=$WORKFLOW" \ --env "WORKFLOW=$WORKFLOW" \
--name make-elasticsearch-js \ --name make-elasticsearch-js \
--rm \ --rm \
@ -159,6 +159,14 @@ if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x}
node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}" node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}"
else else
echo -e "\033[34;1mINFO: Running in CI mode" echo -e "\033[34;1mINFO: Running in CI mode"
# determine branch to clone
GENERATOR_BRANCH="main"
if [[ "$VERSION" == 8.* ]]; then
GENERATOR_BRANCH="8.x"
fi
echo -e "\033[34;1mINFO: Generator branch: $GENERATOR_BRANCH"
docker run \ docker run \
--volume "$repo:/usr/src/elasticsearch-js" \ --volume "$repo:/usr/src/elasticsearch-js" \
--volume /usr/src/elasticsearch-js/node_modules \ --volume /usr/src/elasticsearch-js/node_modules \
@ -168,7 +176,7 @@ else
--rm \ --rm \
$product \ $product \
/bin/bash -c "cd /usr/src && \ /bin/bash -c "cd /usr/src && \
git clone https://$CLIENTS_GITHUB_TOKEN@github.com/elastic/elastic-client-generator-js.git && \ git clone --branch $GENERATOR_BRANCH https://$CLIENTS_GITHUB_TOKEN@github.com/elastic/elastic-client-generator-js.git && \
mkdir -p /usr/src/elastic-client-generator-js/output && \ mkdir -p /usr/src/elastic-client-generator-js/output && \
cd /usr/src/elasticsearch-js && \ cd /usr/src/elasticsearch-js && \
node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}" node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}"

View File

@ -11,10 +11,10 @@ jobs:
outputs: outputs:
src-only: "${{ steps.changes.outputs.src-only }}" src-only: "${{ steps.changes.outputs.src-only }}"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with: with:
persist-credentials: false persist-credentials: false
- uses: dorny/paths-filter/@v3.0.2 - uses: dorny/paths-filter/@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes id: changes
with: with:
filters: | filters: |
@ -32,16 +32,16 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node-version: [18.x, 20.x, 22.x] node-version: [18.x, 20.x, 22.x, 23.x]
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with: with:
persist-credentials: false persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
@ -57,17 +57,21 @@ jobs:
run: | run: |
npm run test:unit npm run test:unit
- name: ECMAScript module test
run: |
npm run test:esm
license: license:
name: License check name: License check
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with: with:
persist-credentials: false persist-credentials: false
- name: Use Node.js - name: Use Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with: with:
node-version: 22.x node-version: 22.x
@ -92,12 +96,12 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with: with:
persist-credentials: false persist-credentials: false
- name: Use Bun - name: Use Bun
uses: oven-sh/setup-bun@v2 uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
- name: Install - name: Install
run: | run: |
@ -111,12 +115,6 @@ jobs:
run: | run: |
bun run test:unit-bun bun run test:unit-bun
auto-approve: - name: ECMAScript module test
name: Auto-approve run: |
needs: [test, license] bun run test:esm
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: github.actor == 'elasticmachine'
steps:
- uses: hmarr/auto-approve-action@v4

View File

@ -12,11 +12,11 @@ jobs:
contents: write contents: write
id-token: write id-token: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with: with:
persist-credentials: false persist-credentials: false
ref: ${{ github.event.inputs.branch }} ref: ${{ github.event.inputs.branch }}
- uses: actions/setup-node@v4 - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with: with:
node-version: "22.x" node-version: "22.x"
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"

View File

@ -26,14 +26,14 @@ jobs:
) )
) )
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with: with:
persist-credentials: false persist-credentials: false
repository: elastic/elasticsearch-js repository: elastic/elasticsearch-js
ref: main ref: main
path: stack path: stack
fetch-depth: 0 fetch-depth: 0
- uses: actions/checkout@v4 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with: with:
persist-credentials: false persist-credentials: false
repository: elastic/elasticsearch-serverless-js repository: elastic/elasticsearch-serverless-js
@ -42,7 +42,7 @@ jobs:
- name: Apply patch from stack to serverless - name: Apply patch from stack to serverless
id: apply-patch id: apply-patch
run: $GITHUB_WORKSPACE/stack/.github/workflows/serverless-patch.sh run: $GITHUB_WORKSPACE/stack/.github/workflows/serverless-patch.sh
- uses: peter-evans/create-pull-request@v6 - uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6
with: with:
token: ${{ secrets.GH_TOKEN }} token: ${{ secrets.GH_TOKEN }}
path: serverless path: serverless

View File

@ -8,7 +8,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v8 - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8
with: with:
stale-issue-label: stale stale-issue-label: stale
stale-pr-label: stale stale-pr-label: stale

1
.gitignore vendored
View File

@ -67,3 +67,4 @@ junit-output
bun.lockb bun.lockb
test-results test-results
processinfo processinfo
.tap

View File

@ -73,3 +73,4 @@ CONTRIBUTING.md
src src
bun.lockb bun.lockb
.tap

View File

@ -42,6 +42,9 @@ spec:
main: main:
branch: "main" branch: "main"
cronline: "@daily" cronline: "@daily"
8_14: 8_x:
branch: "8.14" branch: "8.x"
cronline: "@daily"
8_14:
branch: "8.16"
cronline: "@daily" cronline: "@daily"

View File

@ -167,19 +167,11 @@ const client = new Client({
---- ----
|`nodeFilter` |`nodeFilter`
a|`function` - Filters which node not to use for a request. + a|`function` - Takes a `Connection` and returns `true` if it can be sent a request, otherwise `false`. +
_Default:_ _Default:_
[source,js] [source,js]
---- ----
function defaultNodeFilter (node) { () => true
// avoid master only nodes
if (node.roles.master === true &&
node.roles.data === false &&
node.roles.ingest === false) {
return false
}
return true
}
---- ----
|`nodeSelector` |`nodeSelector`

View File

@ -1,6 +1,75 @@
[[changelog-client]] [[changelog-client]]
== Release notes == Release notes
=== 8.18.0
[discrete]
==== Features
[discrete]
===== Support for Elasticsearch `v8.18`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.18/release-notes-8.18.0.html[here].
[discrete]
==== Fixes
[discrete]
===== Improved Cloud ID parsing
When using a Cloud ID as the `cloud` parameter to instantiate the client, that ID was assumed to be in the correct format. New assertions have been added to verify that format and throw a `ConfigurationError` if it is invalid. See https://github.com/elastic/elasticsearch-js/issues/2694[#2694].
[discrete]
=== 8.17.0
[discrete]
==== Features
[discrete]
===== Support for Elasticsearch `v8.17`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/release-notes-8.17.0.html[here].
[discrete]
=== 8.16.3
[discrete]
==== Fixes
[discrete]
===== Improved support for Elasticsearch `v8.16`
Updated TypeScript types based on fixes and improvements to the Elasticsearch specification.
[discrete]
=== 8.16.2
[discrete]
==== Fixes
[discrete]
===== Improved support for Elasticsearch `v8.16`
Updated TypeScript types based on fixes and improvements to the Elasticsearch specification.
[discrete]
===== Drop testing artifacts from npm package
Tap, the unit testing tool used by this project, was recently upgraded and started writing to a `.tap` directory. Since tests are run prior to an `npm publish` in CI, this directory was being included in the published package and bloating its size.
[discrete]
=== 8.16.1
[discrete]
==== Fixes
[discrete]
===== Fix ECMAScript imports
Fixed package configuration to correctly support native ECMAScript `import` syntax.
[discrete] [discrete]
=== 8.16.0 === 8.16.0
@ -26,11 +95,27 @@ The ES|QL helper can now return results as an Apache Arrow `Table` or `RecordBat
The client's `disablePrototypePoisoningProtection` option was set to `true` by default, but when it was set to any other value it was ignored, making it impossible to enable prototype poisoning protection without providing a custom serializer implementation. The client's `disablePrototypePoisoningProtection` option was set to `true` by default, but when it was set to any other value it was ignored, making it impossible to enable prototype poisoning protection without providing a custom serializer implementation.
[discrete]
=== 8.15.3
[discrete]
==== Fixes
[discrete]
===== Improved support for Elasticsearch `v8.15`
Updated TypeScript types based on fixes and improvements to the Elasticsearch specification.
[discrete]
===== Drop testing artifacts from npm package
Tap, the unit testing tool, was recently upgraded and started writing to a `.tap` directory. Since tests are run prior to an `npm publish` in CI, this directory was being included in the published package and bloating its size.
[discrete] [discrete]
=== 8.15.2 === 8.15.2
[discrete] [discrete]
==== Features ==== Fixes
[discrete] [discrete]
===== Improved support for Elasticsearch `v8.15` ===== Improved support for Elasticsearch `v8.15`
@ -41,7 +126,7 @@ Updated TypeScript types based on fixes and improvements to the Elasticsearch sp
=== 8.15.1 === 8.15.1
[discrete] [discrete]
==== Features ==== Fixes
[discrete] [discrete]
===== Improved support for Elasticsearch `v8.15` ===== Improved support for Elasticsearch `v8.15`

View File

@ -0,0 +1,11 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.getDataStream({
name: "my-data-stream",
filter_path: "data_streams.indices.index_name",
});
console.log(response);
----

View File

@ -0,0 +1,46 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "retrievers_example",
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
range: {
year: {
gt: 2023,
},
},
},
},
},
{
standard: {
query: {
term: {
topic: "elastic",
},
},
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
_source: false,
aggs: {
topics: {
terms: {
field: "topic",
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,18 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.inference.put({
task_type: "rerank",
inference_id: "my-rerank-model",
inference_config: {
service: "cohere",
service_settings: {
model_id: "rerank-english-v3.0",
api_key: "{{COHERE_API_KEY}}",
},
},
});
console.log(response);
----

View File

@ -3,9 +3,8 @@
[source, js] [source, js]
---- ----
const response = await client.cluster.getSettings({ const response = await client.indices.getMapping({
flat_settings: "true", index: "kibana_sample_data_ecommerce",
filter_path: "transient",
}); });
console.log(response); console.log(response);
---- ----

View File

@ -11,6 +11,8 @@ const response = await client.indices.putSettings({
"index.indexing.slowlog.threshold.index.debug": "2s", "index.indexing.slowlog.threshold.index.debug": "2s",
"index.indexing.slowlog.threshold.index.trace": "500ms", "index.indexing.slowlog.threshold.index.trace": "500ms",
"index.indexing.slowlog.source": "1000", "index.indexing.slowlog.source": "1000",
"index.indexing.slowlog.reformat": true,
"index.indexing.slowlog.include.user": true,
}, },
}); });
console.log(response); console.log(response);

View File

@ -0,0 +1,42 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.create({
index: "my-rank-vectors-bit",
mappings: {
properties: {
my_vector: {
type: "rank_vectors",
element_type: "bit",
},
},
},
});
console.log(response);
const response1 = await client.bulk({
index: "my-rank-vectors-bit",
refresh: "true",
operations: [
{
index: {
_id: "1",
},
},
{
my_vector: [127, -127, 0, 1, 42],
},
{
index: {
_id: "2",
},
},
{
my_vector: "8100012a7f",
},
],
});
console.log(response1);
----

View File

@ -0,0 +1,49 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "retrievers_example_nested",
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
nested: {
path: "nested_field",
inner_hits: {
name: "nested_vector",
_source: false,
fields: ["nested_field.paragraph_id"],
},
query: {
knn: {
field: "nested_field.nested_vector",
query_vector: [1, 0, 0.5],
k: 10,
},
},
},
},
},
},
{
standard: {
query: {
term: {
topic: "ai",
},
},
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
_source: ["topic"],
});
console.log(response);
----

View File

@ -3,8 +3,12 @@
[source, js] [source, js]
---- ----
const response = await client.esql.asyncQuery({ const response = await client.transport.request({
format: "json", method: "POST",
path: "/_query/async",
querystring: {
format: "json",
},
body: { body: {
query: query:
"\n FROM my-index-000001,cluster_one:my-index-000001,cluster_two:my-index*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ", "\n FROM my-index-000001,cluster_one:my-index-000001,cluster_two:my-index*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",

View File

@ -10,7 +10,7 @@ const response = await client.ingest.putPipeline({
{ {
attachment: { attachment: {
field: "data", field: "data",
remove_binary: false, remove_binary: true,
}, },
}, },
], ],

View File

@ -0,0 +1,57 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "retrievers_example",
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
term: {
topic: "elastic",
},
},
},
},
{
rrf: {
retrievers: [
{
standard: {
query: {
query_string: {
query:
"(information retrieval) OR (artificial intelligence)",
default_field: "text",
},
},
},
},
{
knn: {
field: "vector",
query_vector: [0.23, 0.67, 0.89],
k: 3,
num_candidates: 5,
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
_source: false,
size: 1,
explain: true,
});
console.log(response);
----

View File

@ -3,8 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.searchApplication.renderQuery({ const response = await client.transport.request({
name: "my-app", method: "POST",
path: "/_application/search_application/my-app/_render_query",
body: { body: {
params: { params: {
query_string: "my first query", query_string: "my first query",

View File

@ -1,15 +0,0 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.cluster.putSettings({
persistent: {
"cluster.routing.allocation.disk.watermark.low": "100gb",
"cluster.routing.allocation.disk.watermark.high": "50gb",
"cluster.routing.allocation.disk.watermark.flood_stage": "10gb",
"cluster.info.update.interval": "1m",
},
});
console.log(response);
----

View File

@ -4,9 +4,11 @@
[source, js] [source, js]
---- ----
const response = await client.indices.putSettings({ const response = await client.indices.putSettings({
index: "my-index-000001", index: ".reindexed-v9-ml-anomalies-custom-example",
settings: { settings: {
"index.blocks.read_only_allow_delete": null, index: {
number_of_replicas: "<original_number_of_replicas>",
},
}, },
}); });
console.log(response); console.log(response);

View File

@ -0,0 +1,20 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.transport.request({
method: "POST",
path: "/_inference/chat_completion/openai-completion/_stream",
body: {
model: "gpt-4o",
messages: [
{
role: "user",
content: "What is Elastic?",
},
],
},
});
console.log(response);
----

View File

@ -0,0 +1,11 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.addBlock({
index: ".ml-anomalies-custom-example",
block: "read_only",
});
console.log(response);
----

View File

@ -3,11 +3,13 @@
[source, js] [source, js]
---- ----
const response = await client.inference.inference({ const response = await client.inference.put({
task_type: "my-inference-endpoint", task_type: "my-inference-endpoint",
inference_id: "_update", inference_id: "_update",
service_settings: { inference_config: {
api_key: "<API_KEY>", service_settings: {
api_key: "<API_KEY>",
},
}, },
}); });
console.log(response); console.log(response);

View File

@ -11,7 +11,7 @@ const response = await client.searchApplication.put({
script: { script: {
lang: "mustache", lang: "mustache",
source: source:
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n \n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ', '\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
params: { params: {
query: "", query: "",
_es_filters: {}, _es_filters: {},

View File

@ -16,7 +16,7 @@ const response = await client.search({
}, },
}, },
field: "text", field: "text",
inference_id: "my-cohere-rerank-model", inference_id: "elastic-rerank",
inference_text: "How often does the moon hide the sun?", inference_text: "How often does the moon hide the sun?",
rank_window_size: 100, rank_window_size: 100,
min_score: 0.5, min_score: 0.5,

View File

@ -3,7 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.simulate.ingest({ const response = await client.transport.request({
method: "POST",
path: "/_ingest/_simulate",
body: { body: {
docs: [ docs: [
{ {

View File

@ -0,0 +1,19 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.security.queryRole({
query: {
bool: {
must_not: {
term: {
"metadata._reserved": true,
},
},
},
},
sort: ["name"],
});
console.log(response);
----

View File

@ -5,7 +5,7 @@
---- ----
const response = await client.ingest.putPipeline({ const response = await client.ingest.putPipeline({
id: "geoip", id: "geoip",
description: "Add geoip info", description: "Add ip geolocation info",
processors: [ processors: [
{ {
geoip: { geoip: {

View File

@ -3,8 +3,8 @@
[source, js] [source, js]
---- ----
const response = await client.security.queryRole({ const response = await client.indices.rollover({
sort: ["name"], alias: "datastream",
}); });
console.log(response); console.log(response);
---- ----

View File

@ -0,0 +1,67 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.create({
index: "my-rank-vectors-bit",
mappings: {
properties: {
my_vector: {
type: "rank_vectors",
element_type: "bit",
},
},
},
});
console.log(response);
const response1 = await client.bulk({
index: "my-rank-vectors-bit",
refresh: "true",
operations: [
{
index: {
_id: "1",
},
},
{
my_vector: [127, -127, 0, 1, 42],
},
{
index: {
_id: "2",
},
},
{
my_vector: "8100012a7f",
},
],
});
console.log(response1);
const response2 = await client.search({
index: "my-rank-vectors-bit",
query: {
script_score: {
query: {
match_all: {},
},
script: {
source: "maxSimDotProduct(params.query_vector, 'my_vector')",
params: {
query_vector: [
[
0.35, 0.77, 0.95, 0.15, 0.11, 0.08, 0.58, 0.06, 0.44, 0.52, 0.21,
0.62, 0.65, 0.16, 0.64, 0.39, 0.93, 0.06, 0.93, 0.31, 0.92, 0,
0.66, 0.86, 0.92, 0.03, 0.81, 0.31, 0.2, 0.92, 0.95, 0.64, 0.19,
0.26, 0.77, 0.64, 0.78, 0.32, 0.97, 0.84,
],
],
},
},
},
},
});
console.log(response2);
----

View File

@ -1,28 +0,0 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.esql.query({
format: "txt",
query:
"\n FROM library\n | SORT page_count DESC\n | KEEP name, author\n | LOOKUP era ON author\n | LIMIT 5\n ",
tables: {
era: {
author: {
keyword: [
"Frank Herbert",
"Peter F. Hamilton",
"Vernor Vinge",
"Alastair Reynolds",
"James S.A. Corey",
],
},
era: {
keyword: ["The New Wave", "Diamond", "Diamond", "Diamond", "Hadron"],
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,11 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.addBlock({
index: ".ml-anomalies-custom-example",
block: "write",
});
console.log(response);
----

View File

@ -3,7 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.security.oidcLogout({ const response = await client.transport.request({
method: "POST",
path: "/_security/oidc/logout",
body: { body: {
token: token:
"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",

View File

@ -0,0 +1,26 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "my-rank-vectors-float",
query: {
script_score: {
query: {
match_all: {},
},
script: {
source: "maxSimDotProduct(params.query_vector, 'my_vector')",
params: {
query_vector: [
[0.5, 10, 6],
[-0.5, 10, 10],
],
},
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,35 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.ingest.putPipeline({
id: "attachment",
description: "Extract attachment information including original binary",
processors: [
{
attachment: {
field: "data",
remove_binary: false,
},
},
],
});
console.log(response);
const response1 = await client.index({
index: "my-index-000001",
id: "my_id",
pipeline: "attachment",
document: {
data: "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=",
},
});
console.log(response1);
const response2 = await client.get({
index: "my-index-000001",
id: "my_id",
});
console.log(response2);
----

View File

@ -0,0 +1,24 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.create({
index: "test-index",
query: {
match: {
my_field: "Which country is Paris in?",
},
},
highlight: {
fields: {
my_field: {
type: "semantic",
number_of_fragments: 2,
order: "score",
},
},
},
});
console.log(response);
----

View File

@ -3,10 +3,12 @@
[source, js] [source, js]
---- ----
const response = await client.esql.asyncQueryGet({ const response = await client.transport.request({
id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", method: "GET",
wait_for_completion_timeout: "30s", path: "/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE&#x3D;",
body: null, querystring: {
wait_for_completion_timeout: "30s",
},
}); });
console.log(response); console.log(response);
---- ----

View File

@ -0,0 +1,23 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.create({
index: "test-index",
mappings: {
properties: {
source_field: {
type: "text",
fields: {
infer_field: {
type: "semantic_text",
inference_id: ".elser-2-elasticsearch",
},
},
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,23 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.inference.put({
task_type: "rerank",
inference_id: "my-elastic-rerank",
inference_config: {
service: "elasticsearch",
service_settings: {
model_id: ".rerank-v1",
num_threads: 1,
adaptive_allocations: {
enabled: true,
min_number_of_allocations: 1,
max_number_of_allocations: 4,
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,28 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "my-index-*",
query: {
bool: {
must: [
{
match: {
"user.id": "kimchy",
},
},
],
must_not: [
{
terms: {
_index: ["my-index-01"],
},
},
],
},
},
});
console.log(response);
----

View File

@ -0,0 +1,31 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.ilm.putLifecycle({
name: "my_policy",
policy: {
phases: {
hot: {
actions: {
rollover: {
max_primary_shard_size: "50gb",
},
searchable_snapshot: {
snapshot_repository: "backing_repo",
replicate_for: "14d",
},
},
},
delete: {
min_age: "28d",
actions: {
delete: {},
},
},
},
},
});
console.log(response);
----

View File

@ -14,6 +14,7 @@ const response = await client.indices.putSettings({
"index.search.slowlog.threshold.fetch.info": "800ms", "index.search.slowlog.threshold.fetch.info": "800ms",
"index.search.slowlog.threshold.fetch.debug": "500ms", "index.search.slowlog.threshold.fetch.debug": "500ms",
"index.search.slowlog.threshold.fetch.trace": "200ms", "index.search.slowlog.threshold.fetch.trace": "200ms",
"index.search.slowlog.include.user": true,
}, },
}); });
console.log(response); console.log(response);

View File

@ -5,7 +5,7 @@
---- ----
const response = await client.ingest.putPipeline({ const response = await client.ingest.putPipeline({
id: "geoip", id: "geoip",
description: "Add geoip info", description: "Add ip geolocation info",
processors: [ processors: [
{ {
geoip: { geoip: {

View File

@ -0,0 +1,70 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "movies",
size: 10,
retriever: {
rescorer: {
rescore: {
window_size: 50,
query: {
rescore_query: {
script_score: {
query: {
match_all: {},
},
script: {
source:
"cosineSimilarity(params.queryVector, 'product-vector_final_stage') + 1.0",
params: {
queryVector: [-0.5, 90, -10, 14.8, -156],
},
},
},
},
},
},
retriever: {
rrf: {
rank_window_size: 100,
retrievers: [
{
standard: {
query: {
sparse_vector: {
field: "plot_embedding",
inference_id: "my-elser-model",
query: "films that explore psychological depths",
},
},
},
},
{
standard: {
query: {
multi_match: {
query: "crime",
fields: ["plot", "title"],
},
},
},
},
{
knn: {
field: "vector",
query_vector: [10, 22, 77],
k: 10,
num_candidates: 10,
},
},
],
},
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,23 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.create({
index: "my-index",
settings: {
index: {
number_of_shards: 3,
"blocks.write": true,
},
},
mappings: {
properties: {
field1: {
type: "text",
},
},
},
});
console.log(response);
----

View File

@ -1,23 +0,0 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.bulk({
index: "test-index",
operations: [
{
update: {
_id: "1",
},
},
{
doc: {
infer_field: "updated inference field",
source_field: "updated source field",
},
},
],
});
console.log(response);
----

View File

@ -0,0 +1,19 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: ".ml-anomalies-custom-example",
size: 0,
aggs: {
job_ids: {
terms: {
field: "job_id",
size: 100,
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,61 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "retrievers_example",
retriever: {
linear: {
retrievers: [
{
retriever: {
standard: {
query: {
function_score: {
query: {
term: {
topic: "ai",
},
},
functions: [
{
script_score: {
script: {
source: "doc['timestamp'].value.millis",
},
},
},
],
boost_mode: "replace",
},
},
sort: {
timestamp: {
order: "asc",
},
},
},
},
weight: 2,
normalizer: "minmax",
},
{
retriever: {
knn: {
field: "vector",
query_vector: [0.23, 0.67, 0.89],
k: 3,
num_candidates: 5,
},
},
weight: 1.5,
},
],
rank_window_size: 10,
},
},
_source: false,
});
console.log(response);
----

View File

@ -0,0 +1,16 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.updateAliases({
actions: [
{
remove_index: {
index: "my-index-2099.05.06-000001",
},
},
],
});
console.log(response);
----

View File

@ -3,7 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.esql.asyncQuery({ const response = await client.transport.request({
method: "POST",
path: "/_query/async",
body: { body: {
query: query:
"\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", "\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ",

View File

@ -0,0 +1,18 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "kibana_sample_data_ecommerce",
size: 0,
aggs: {
order_stats: {
stats: {
field: "taxful_total_price",
},
},
},
});
console.log(response);
----

View File

@ -3,9 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.esql.asyncQueryGet({ const response = await client.transport.request({
id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=", method: "GET",
body: null, path: "/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM&#x3D;",
}); });
console.log(response); console.log(response);
---- ----

View File

@ -4,16 +4,12 @@
[source, js] [source, js]
---- ----
const response = await client.indices.create({ const response = await client.indices.create({
index: "semantic-embeddings", index: "jinaai-index",
mappings: { mappings: {
properties: { properties: {
semantic_text: {
type: "semantic_text",
inference_id: "my-elser-endpoint",
},
content: { content: {
type: "text", type: "semantic_text",
copy_to: "semantic_text", inference_id: "jinaai-embeddings",
}, },
}, },
}, },

View File

@ -0,0 +1,47 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.transport.request({
method: "POST",
path: "/_inference/chat_completion/openai-completion/_stream",
body: {
messages: [
{
role: "user",
content: [
{
type: "text",
text: "What's the price of a scarf?",
},
],
},
],
tools: [
{
type: "function",
function: {
name: "get_current_price",
description: "Get the current price of a item",
parameters: {
type: "object",
properties: {
item: {
id: "123",
},
},
},
},
},
],
tool_choice: {
type: "function",
function: {
name: "get_current_price",
},
},
},
});
console.log(response);
----

View File

@ -10,7 +10,8 @@ const response = await client.inference.put({
service: "openai", service: "openai",
service_settings: { service_settings: {
api_key: "<api_key>", api_key: "<api_key>",
model_id: "text-embedding-ada-002", model_id: "text-embedding-3-small",
dimensions: 128,
}, },
}, },
}); });

View File

@ -3,9 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.inference.streamInference({ const response = await client.transport.request({
task_type: "completion", method: "POST",
inference_id: "openai-completion", path: "/_inference/completion/openai-completion/_stream",
body: { body: {
input: "What is Elastic?", input: "What is Elastic?",
}, },

View File

@ -0,0 +1,17 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.inference.put({
task_type: "sparse_embedding",
inference_id: "elser-model-eis",
inference_config: {
service: "elastic",
service_settings: {
model_name: "elser",
},
},
});
console.log(response);
----

View File

@ -8,11 +8,6 @@ const response = await client.search({
query: { query: {
bool: { bool: {
must: [ must: [
{
term: {
"category.keyword": "Main Course",
},
},
{ {
term: { term: {
tags: "vegetarian", tags: "vegetarian",
@ -27,6 +22,11 @@ const response = await client.search({
}, },
], ],
should: [ should: [
{
term: {
category: "Main Course",
},
},
{ {
multi_match: { multi_match: {
query: "curry spicy", query: "curry spicy",

View File

@ -3,15 +3,18 @@
[source, js] [source, js]
---- ----
const response = await client.knnSearch({ const response = await client.search({
index: "my-index", index: "image-index",
knn: { knn: {
field: "image_vector", field: "image-vector",
query_vector: [0.3, 0.1, 1.2], query_vector: [-5, 9, -12],
k: 10, k: 10,
num_candidates: 100, num_candidates: 100,
rescore_vector: {
oversample: 2,
},
}, },
_source: ["name", "file_type"], fields: ["title", "file-type"],
}); });
console.log(response); console.log(response);
---- ----

View File

@ -5,7 +5,7 @@
---- ----
const response = await client.cluster.putSettings({ const response = await client.cluster.putSettings({
persistent: { persistent: {
"cluster.routing.allocation.disk.watermark.low": "30gb", "migrate.data_stream_reindex_max_request_per_second": 10000,
}, },
}); });
console.log(response); console.log(response);

View File

@ -0,0 +1,18 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.ingest.simulate({
id: "query_helper_pipeline",
docs: [
{
_source: {
content:
"artificial intelligence in medicine articles published in the last 12 months",
},
},
],
});
console.log(response);
----

View File

@ -3,7 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.security.oidcPrepareAuthentication({ const response = await client.transport.request({
method: "POST",
path: "/_security/oidc/prepare",
body: { body: {
realm: "oidc1", realm: "oidc1",
state: "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO", state: "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO",

View File

@ -0,0 +1,16 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "jinaai-index",
query: {
semantic: {
field: "content",
query: "who inspired taking care of the sea?",
},
},
});
console.log(response);
----

View File

@ -0,0 +1,10 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.getSettings({
index: ".reindexed-v9-ml-anomalies-custom-example",
});
console.log(response);
----

View File

@ -3,8 +3,12 @@
[source, js] [source, js]
---- ----
const response = await client.esql.asyncQuery({ const response = await client.transport.request({
format: "json", method: "POST",
path: "/_query/async",
querystring: {
format: "json",
},
body: { body: {
query: query:
"\n FROM cluster_one:my-index*,cluster_two:logs*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ", "\n FROM cluster_one:my-index*,cluster_two:logs*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",

View File

@ -4,7 +4,7 @@
[source, js] [source, js]
---- ----
const response = await client.security.putRole({ const response = await client.security.putRole({
name: "role_with_remote_indices", name: "only_remote_access_role",
remote_indices: [ remote_indices: [
{ {
clusters: ["my_remote"], clusters: ["my_remote"],
@ -12,6 +12,12 @@ const response = await client.security.putRole({
privileges: ["read", "read_cross_cluster", "view_index_metadata"], privileges: ["read", "read_cross_cluster", "view_index_metadata"],
}, },
], ],
remote_cluster: [
{
clusters: ["my_remote"],
privileges: ["monitor_stats"],
},
],
}); });
console.log(response); console.log(response);
---- ----

View File

@ -9,7 +9,6 @@ const response = await client.indices.create({
properties: { properties: {
inference_field: { inference_field: {
type: "semantic_text", type: "semantic_text",
inference_id: "my-elser-endpoint",
}, },
}, },
}, },

View File

@ -45,7 +45,7 @@ console.log(response);
const response1 = await client.indices.putIndexTemplate({ const response1 = await client.indices.putIndexTemplate({
name: 2, name: 2,
index_patterns: ["k8s*"], index_patterns: ["k9s*"],
composed_of: ["destination_template"], composed_of: ["destination_template"],
data_stream: {}, data_stream: {},
}); });

View File

@ -0,0 +1,15 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.putSettings({
index: "*",
settings: {
"index.search.slowlog.include.user": true,
"index.search.slowlog.threshold.fetch.warn": "30s",
"index.search.slowlog.threshold.query.warn": "30s",
},
});
console.log(response);
----

View File

@ -11,7 +11,7 @@ const response = await client.searchApplication.put({
script: { script: {
lang: "mustache", lang: "mustache",
source: source:
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n \n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ', '\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
params: { params: {
query: "", query: "",
_es_filters: {}, _es_filters: {},

View File

@ -6,14 +6,15 @@
const response = await client.search({ const response = await client.search({
index: "test-index", index: "test-index",
query: { query: {
nested: { match: {
path: "inference_field.inference.chunks", my_semantic_field: "Which country is Paris in?",
query: { },
sparse_vector: { },
field: "inference_field.inference.chunks.embeddings", highlight: {
inference_id: "my-inference-id", fields: {
query: "mountain lake", my_semantic_field: {
}, number_of_fragments: 2,
order: "score",
}, },
}, },
}, },

View File

@ -0,0 +1,16 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.reindex({
wait_for_completion: "false",
source: {
index: ".ml-anomalies-custom-example",
},
dest: {
index: ".reindexed-v9-ml-anomalies-custom-example",
},
});
console.log(response);
----

View File

@ -3,7 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.security.bulkUpdateApiKeys({ const response = await client.transport.request({
method: "POST",
path: "/_security/api_key/_bulk_update",
body: { body: {
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"], ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
}, },

View File

@ -12,6 +12,13 @@ const response = await client.search({
fields: ["my_field", "my_field._2gram", "my_field._3gram"], fields: ["my_field", "my_field._2gram", "my_field._3gram"],
}, },
}, },
highlight: {
fields: {
my_field: {
matched_fields: ["my_field._index_prefix"],
},
},
},
}); });
console.log(response); console.log(response);
---- ----

View File

@ -0,0 +1,24 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "my-index-000001",
query: {
prefix: {
full_name: {
value: "ki",
},
},
},
highlight: {
fields: {
full_name: {
matched_fields: ["full_name._index_prefix"],
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,33 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "kibana_sample_data_ecommerce",
size: 0,
aggs: {
daily_sales: {
date_histogram: {
field: "order_date",
calendar_interval: "day",
},
aggs: {
daily_revenue: {
sum: {
field: "taxful_total_price",
},
},
smoothed_revenue: {
moving_fn: {
buckets_path: "daily_revenue",
window: 3,
script: "MovingFunctions.unweightedAvg(values)",
},
},
},
},
},
});
console.log(response);
----

View File

@ -1,26 +0,0 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "test-index",
query: {
nested: {
path: "inference_field.inference.chunks",
query: {
knn: {
field: "inference_field.inference.chunks.embeddings",
query_vector_builder: {
text_embedding: {
model_id: "my_inference_id",
model_text: "mountain lake",
},
},
},
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,44 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "retrievers_example",
retriever: {
rrf: {
retrievers: [
{
knn: {
field: "vector",
query_vector: [0.23, 0.67, 0.89],
k: 3,
num_candidates: 5,
},
},
{
text_similarity_reranker: {
retriever: {
standard: {
query: {
term: {
topic: "ai",
},
},
},
},
field: "text",
inference_id: "my-rerank-model",
inference_text:
"Can I use generative AI to identify user intent and improve search relevance?",
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
_source: false,
});
console.log(response);
----

View File

@ -3,7 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.textStructure.findMessageStructure({ const response = await client.transport.request({
method: "POST",
path: "/_text_structure/find_message_structure",
body: { body: {
messages: [ messages: [
"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128", "[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128",

View File

@ -5,11 +5,8 @@
---- ----
const response = await client.cluster.putSettings({ const response = await client.cluster.putSettings({
persistent: { persistent: {
"cluster.indices.close.enable": false, "cluster.routing.allocation.disk.watermark.low": "90%",
"indices.recovery.max_bytes_per_sec": "50mb", "cluster.routing.allocation.disk.watermark.high": "95%",
},
transient: {
"*": null,
}, },
}); });
console.log(response); console.log(response);

View File

@ -0,0 +1,46 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "retrievers_example",
retriever: {
text_similarity_reranker: {
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
query_string: {
query:
"(information retrieval) OR (artificial intelligence)",
default_field: "text",
},
},
},
},
{
knn: {
field: "vector",
query_vector: [0.23, 0.67, 0.89],
k: 3,
num_candidates: 5,
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
field: "text",
inference_id: "my-rerank-model",
inference_text:
"What are the state of the art applications of AI in information retrieval?",
},
},
_source: false,
});
console.log(response);
----

View File

@ -0,0 +1,35 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
query: {
intervals: {
my_text: {
all_of: {
ordered: false,
max_gaps: 1,
intervals: [
{
match: {
query: "my favorite food",
max_gaps: 0,
ordered: true,
},
},
{
match: {
query: "cold porridge",
max_gaps: 4,
ordered: true,
},
},
],
},
},
},
},
});
console.log(response);
----

View File

@ -4,17 +4,18 @@
[source, js] [source, js]
---- ----
const response = await client.inference.put({ const response = await client.inference.put({
task_type: "sparse_embedding", task_type: "rerank",
inference_id: "my-elser-endpoint", inference_id: "my-elastic-rerank",
inference_config: { inference_config: {
service: "elser", service: "elasticsearch",
service_settings: { service_settings: {
model_id: ".rerank-v1",
num_threads: 1,
adaptive_allocations: { adaptive_allocations: {
enabled: true, enabled: true,
min_number_of_allocations: 3, min_number_of_allocations: 1,
max_number_of_allocations: 10, max_number_of_allocations: 10,
}, },
num_threads: 1,
}, },
}, },
}); });

View File

@ -4,7 +4,7 @@
[source, js] [source, js]
---- ----
const response = await client.indices.create({ const response = await client.indices.create({
index: "my-index-000002", index: "my-index-000003",
mappings: { mappings: {
properties: { properties: {
inference_field: { inference_field: {

View File

@ -5,7 +5,7 @@
---- ----
const response = await client.transport.request({ const response = await client.transport.request({
method: "DELETE", method: "DELETE",
path: "/_ingest/geoip/database/example-database-id", path: "/_ingest/ip_location/database/my-database-id",
}); });
console.log(response); console.log(response);
---- ----

View File

@ -7,14 +7,14 @@ const response = await client.indices.create({
index: "test-index", index: "test-index",
mappings: { mappings: {
properties: { properties: {
infer_field: {
type: "semantic_text",
inference_id: "my-elser-endpoint",
},
source_field: { source_field: {
type: "text", type: "text",
copy_to: "infer_field", copy_to: "infer_field",
}, },
infer_field: {
type: "semantic_text",
inference_id: ".elser-2-elasticsearch",
},
}, },
}, },
}); });

View File

@ -0,0 +1,37 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "kibana_sample_data_ecommerce",
size: 0,
aggs: {
daily_sales: {
date_histogram: {
field: "order_date",
calendar_interval: "day",
format: "yyyy-MM-dd",
},
aggs: {
revenue: {
sum: {
field: "taxful_total_price",
},
},
unique_customers: {
cardinality: {
field: "customer_id",
},
},
avg_basket_size: {
avg: {
field: "total_quantity",
},
},
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,34 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.ingest.putPipeline({
id: "ip_location",
description: "Add ip geolocation info",
processors: [
{
ip_location: {
field: "ip",
},
},
],
});
console.log(response);
const response1 = await client.index({
index: "my-index-000001",
id: "my_id",
pipeline: "ip_location",
document: {
ip: "80.231.5.0",
},
});
console.log(response1);
const response2 = await client.get({
index: "my-index-000001",
id: "my_id",
});
console.log(response2);
----

View File

@ -12,7 +12,7 @@ const response = await client.ingest.putPipeline({
field: "data", field: "data",
indexed_chars: 11, indexed_chars: 11,
indexed_chars_field: "max_size", indexed_chars_field: "max_size",
remove_binary: false, remove_binary: true,
}, },
}, },
], ],

View File

@ -3,7 +3,9 @@
[source, js] [source, js]
---- ----
const response = await client.security.bulkUpdateApiKeys({ const response = await client.transport.request({
method: "POST",
path: "/_security/api_key/_bulk_update",
body: { body: {
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"], ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
role_descriptors: { role_descriptors: {

View File

@ -0,0 +1,34 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.transport.request({
method: "POST",
path: "/_inference/chat_completion/openai-completion/_stream",
body: {
messages: [
{
role: "assistant",
content: "Let's find out what the weather is",
tool_calls: [
{
id: "call_KcAjWtAww20AihPHphUh46Gd",
type: "function",
function: {
name: "get_current_weather",
arguments: '{"location":"Boston, MA"}',
},
},
],
},
{
role: "tool",
content: "The weather is cold",
tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd",
},
],
},
});
console.log(response);
----

View File

@ -4,9 +4,11 @@
[source, js] [source, js]
---- ----
const response = await client.indices.putSettings({ const response = await client.indices.putSettings({
index: "my-index-000001", index: ".reindexed-v9-ml-anomalies-custom-example",
settings: { settings: {
"index.search.slowlog.include.user": true, index: {
number_of_replicas: 0,
},
}, },
}); });
console.log(response); console.log(response);

View File

@ -0,0 +1,12 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.esql.query({
query:
'\nFROM library\n| EVAL year = DATE_EXTRACT("year", release_date)\n| WHERE page_count > ? AND match(author, ?, {"minimum_should_match": ?})\n| LIMIT 5\n',
params: [300, "Frank Herbert", 2],
});
console.log(response);
----

View File

@ -9,7 +9,6 @@ const response = await client.indices.create({
properties: { properties: {
content: { content: {
type: "semantic_text", type: "semantic_text",
inference_id: "my-elser-endpoint",
}, },
}, },
}, },

View File

@ -3,8 +3,8 @@
[source, js] [source, js]
---- ----
const response = await client.indices.unfreeze({ const response = await client.indices.getAlias({
index: "my-index-000001", index: ".ml-anomalies-custom-example",
}); });
console.log(response); console.log(response);
---- ----

View File

@ -0,0 +1,39 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "kibana_sample_data_ecommerce",
size: 0,
aggs: {
categories: {
terms: {
field: "category.keyword",
size: 5,
order: {
total_revenue: "desc",
},
},
aggs: {
total_revenue: {
sum: {
field: "taxful_total_price",
},
},
avg_order_value: {
avg: {
field: "taxful_total_price",
},
},
total_items: {
sum: {
field: "total_quantity",
},
},
},
},
},
});
console.log(response);
----

Some files were not shown because too many files have changed in this diff Show More