Compare commits

...

85 Commits
main ... 8.18

Author SHA1 Message Date
73164d1779 Auto-generated API code (#2886) 2025-06-30 11:46:07 -05:00
2dafb2af94 Auto-generated API code (#2880) 2025-06-23 13:23:45 -04:00
2ac119fd05 Auto-generated API code (#2868) 2025-06-09 10:29:03 -05:00
94f6173483 Auto-generated API code (#2860) 2025-06-02 17:10:35 +00:00
a9d4d109f2 Auto-generated API code (#2853) 2025-05-27 15:14:42 +00:00
d524809eb5 Auto-generated API code (#2834) 2025-05-19 19:35:32 +00:00
14517d1015 Export helper types (#2822) (#2824)
(cherry picked from commit b030084f24)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-05-05 13:05:35 -05:00
f6ac48126c Auto-generated API code (#2820) 2025-05-05 11:21:20 -05:00
acdb0d6162 Auto-generated API code (#2808) 2025-04-28 10:41:15 -05:00
e8b4183b8b Bump to 8.18.2 (#2795) (#2796)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-25 10:47:18 -05:00
486cba656a 8.18.2 changelog (#2793) (#2794)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-25 10:43:06 -05:00
28e826d738 Use async reader for parsing Apache Arrow responses (#2788) (#2792) 2025-04-24 14:24:17 -05:00
48068562d1 Support Apache Arrow 19 (#2782) (#2785) 2025-04-22 10:32:50 -05:00
7cdbae220f Migrate integration tests to built JS files (#2750) (#2780) 2025-04-22 09:16:18 -05:00
48dcef4975 Release notes fo 8.18.1 (#2763) (#2778)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-21 13:52:25 -05:00
b5a36f37ab Improve deserialization docs (#2766) (#2767)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-17 15:10:45 -05:00
a31920b785 Put node roles support back (#2759) (#2762)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-17 13:55:18 -05:00
846c50b8bf Bump transport to latest 8.x version (#2757) (#2758)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-17 13:54:04 -05:00
5204faeb66 Bump to 8.18.1 (#2760) (#2761)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-04-16 13:42:12 -05:00
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
fceebae8ae Auto-generated code for 8.x (#2372) 2024-10-14 11:18:55 -05:00
e45ed28c05 Auto-generated code for 8.x (#2369) 2024-09-30 13:41:23 -05:00
430 changed files with 21715 additions and 6007 deletions

View File

@ -1,17 +1,20 @@
---
agents:
provider: "gcp"
image: family/core-ubuntu-2204
memory: "8G"
cpu: "2"
steps:
- label: ":elasticsearch: :javascript: ES JavaScript ({{ matrix.nodejs }}) Test Suite: {{ matrix.suite }}"
agents:
provider: "gcp"
- label: ":elasticsearch: :javascript: ES JavaScript ({{ matrix.nodejs }})"
env:
NODE_VERSION: "{{ matrix.nodejs }}"
TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.15.0
TEST_SUITE: "platinum"
STACK_VERSION: 9.0.0
GITHUB_TOKEN_PATH: "secret/ci/elastic-elasticsearch-js/github-token"
TEST_ES_STACK: "1"
matrix:
setup:
suite:
- "free"
- "platinum"
nodejs:
- "18"
- "20"
@ -21,9 +24,6 @@ steps:
- wait: ~
continue_on_failure: true
- label: ":junit: Test results"
agents:
provider: "gcp"
image: family/core-ubuntu-2204
plugins:
- junit-annotate#v2.4.1:
artifacts: "junit-output/junit-*.xml"

View File

@ -10,22 +10,29 @@ export NODE_VERSION=${NODE_VERSION:-18}
echo "--- :javascript: Building Docker image"
docker build \
--file "$script_path/Dockerfile" \
--tag elastic/elasticsearch-js \
--build-arg NODE_VERSION="$NODE_VERSION" \
.
--file "$script_path/Dockerfile" \
--tag elastic/elasticsearch-js \
--build-arg NODE_VERSION="$NODE_VERSION" \
.
echo "--- :javascript: Running $TEST_SUITE tests"
GITHUB_TOKEN=$(vault read -field=token "$GITHUB_TOKEN_PATH")
export GITHUB_TOKEN
echo "--- :javascript: Running tests"
mkdir -p "$repo/junit-output"
docker run \
--network="${network_name}" \
--env "TEST_ES_SERVER=${elasticsearch_url}" \
--env "ELASTIC_PASSWORD=${elastic_password}" \
--env "TEST_SUITE=${TEST_SUITE}" \
--env "ELASTIC_USER=elastic" \
--env "BUILDKITE=true" \
--volume "$repo/junit-output:/junit-output" \
--name elasticsearch-js \
--rm \
elastic/elasticsearch-js \
bash -c "npm run test:integration; [ -f ./$TEST_SUITE-report-junit.xml ] && mv ./$TEST_SUITE-report-junit.xml /junit-output/junit-$BUILDKITE_JOB_ID.xml || echo 'No JUnit artifact found'"
--network="${network_name}" \
--env TEST_ES_STACK \
--env STACK_VERSION \
--env GITHUB_TOKEN \
--env "TEST_ES_SERVER=${elasticsearch_url}" \
--env "ELASTIC_PASSWORD=${elastic_password}" \
--env "ELASTIC_USER=elastic" \
--env "BUILDKITE=true" \
--volume "/usr/src/app/node_modules" \
--volume "$repo:/usr/src/app" \
--volume "$repo/junit-output:/junit-output" \
--name elasticsearch-js \
--rm \
elastic/elasticsearch-js \
bash -c "npm run test:integration; [ -f ./report-junit.xml ] && mv ./report-junit.xml /junit-output/junit-$BUILDKITE_JOB_ID.xml || echo 'No JUnit artifact found'"

View File

@ -5,3 +5,7 @@ elasticsearch
.git
lib
junit-output
.tap
rest-api-spec
yaml-rest-tests
generated-tests

14
.github/make.sh vendored
View File

@ -65,7 +65,7 @@ codegen)
if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then
# fall back to branch name or `main` if no VERSION is set
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"
VERSION="$branch_name"
else
@ -150,7 +150,7 @@ if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x}
-u "$(id -u):$(id -g)" \
--volume "$repo:/usr/src/elasticsearch-js" \
--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" \
--name make-elasticsearch-js \
--rm \
@ -159,6 +159,14 @@ if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x}
node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}"
else
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 \
--volume "$repo:/usr/src/elasticsearch-js" \
--volume /usr/src/elasticsearch-js/node_modules \
@ -168,7 +176,7 @@ else
--rm \
$product \
/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 && \
cd /usr/src/elasticsearch-js && \
node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}"

View File

@ -1,18 +0,0 @@
name: Automerge
on:
pull_request_review:
types:
- submitted
jobs:
automerge:
runs-on: ubuntu-latest
if: github.event.review.state == 'approved'
steps:
- uses: reitermarkus/automerge@v2
with:
token: ${{ secrets.GH_TOKEN }}
merge-method: squash
pull-request-author-associations: OWNER
review-author-associations: OWNER,CONTRIBUTOR

View File

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

View File

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

View File

@ -26,26 +26,28 @@ jobs:
)
)
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
repository: elastic/elasticsearch-js
ref: main
path: stack
fetch-depth: 0
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
repository: elastic/elasticsearch-serverless-js
ref: main
path: serverless
- name: Apply patch from stack to serverless
id: apply-patch
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:
token: ${{ secrets.GH_TOKEN }}
path: serverless
title: 'Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}'
commit-message: 'Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}'
title: "Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}"
commit-message: "Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}"
body-path: /tmp/pr_body
draft: '${{ steps.apply-patch.outputs.PR_DRAFT }}'
add-paths: ':!*.rej'
draft: "${{ steps.apply-patch.outputs.PR_DRAFT }}"
add-paths: ":!*.rej"

View File

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

7
.gitignore vendored
View File

@ -65,3 +65,10 @@ test/bundlers/parcel-test/.parcel-cache
lib
junit-output
bun.lockb
test-results
processinfo
.tap
rest-api-spec
yaml-rest-tests
generated-tests
schema

View File

@ -73,3 +73,7 @@ CONTRIBUTING.md
src
bun.lockb
.tap
rest-api-spec
yaml-rest-tests
generated-tests

View File

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

View File

@ -167,16 +167,19 @@ const client = new Client({
----
|`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:_
[source,js]
----
function defaultNodeFilter (node) {
// avoid master only nodes
if (node.roles.master === true &&
node.roles.data === false &&
node.roles.ingest === false) {
return false
function defaultNodeFilter (conn) {
if (conn.roles != null) {
if (
// avoid master-only nodes
conn.roles.master &&
!conn.roles.data &&
!conn.roles.ingest &&
!conn.roles.ml
) return false
}
return true
}
@ -252,8 +255,8 @@ const client = new Client({
----
|`disablePrototypePoisoningProtection`
|`boolean`, `'proto'`, `'constructor'` - By the default the client will protect you against prototype poisoning attacks. Read https://web.archive.org/web/20200319091159/https://hueniverse.com/square-brackets-are-the-enemy-ff5b9fd8a3e8?gi=184a27ee2a08[this article] to learn more. If needed you can disable prototype poisoning protection entirely or one of the two checks. Read the `secure-json-parse` https://github.com/fastify/secure-json-parse[documentation] to learn more. +
_Default:_ `false`
|`boolean`, `'proto'`, `'constructor'` - The client can protect you against prototype poisoning attacks. Read https://web.archive.org/web/20200319091159/https://hueniverse.com/square-brackets-are-the-enemy-ff5b9fd8a3e8?gi=184a27ee2a08[this article] to learn more about this security concern. If needed, you can enable prototype poisoning protection entirely (`false`) or one of the two checks (`'proto'` or `'constructor'`). For performance reasons, it is disabled by default. Read the `secure-json-parse` https://github.com/fastify/secure-json-parse[documentation] to learn more. +
_Default:_ `true`
|`caFingerprint`
|`string` - If configured, verify that the fingerprint of the CA certificate that has signed the certificate of the server matches the supplied fingerprint. Only accepts SHA256 digest fingerprints. +

View File

@ -1,6 +1,161 @@
[[changelog-client]]
== Release notes
[discrete]
=== 8.18.2
[discrete]
==== Fixes
[discrete]
===== Ensure Apache Arrow ES|QL helper uses async iterator
The `esql.toArrowReader()` helper function was trying to return `RecordBatchStreamReader`, a synchronous iterator, despite the fact that the `apache-arrow` package was, in most cases, automatically coercing it to `AsyncRecordBatchStreamReader`, its asynchronous counterpart. It now is always returned as an async iterator.
[discrete]
=== 8.18.1
[discrete]
==== Fixes
[discrete]
===== Fix broken node roles and node filter
The docs note a `nodeFilter` option on the client that will, by default, filter the nodes based on any `roles` values that are set at instantition. At some point, this functionality was partially disabled. This brings the feature back, ensuring that it matches what the documentation has said it does all along.
[discrete]
=== 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]
=== 8.16.0
[discrete]
==== Features
[discrete]
===== Support for Elasticsearch `v8.16`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/release-notes-8.16.0.html[here].
[discrete]
===== Support Apache Arrow in ES|QL helper
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.
[discrete]
==== Fixes
[discrete]
===== Pass prototype poisoning options to serializer correctly
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]
=== 8.15.2
[discrete]
==== Fixes
[discrete]
===== Improved support for Elasticsearch `v8.15`
Updated TypeScript types based on fixes and improvements to the Elasticsearch specification.
[discrete]
=== 8.15.1
[discrete]
==== Fixes
[discrete]
===== Improved support for Elasticsearch `v8.15`
Updated TypeScript types based on fixes and improvements to the Elasticsearch specification.
[discrete]
=== 8.15.0

View File

@ -2,10 +2,11 @@
== Configuration
The client is designed to be easily configured for your needs. In the following
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.
* <<basic-config>>
* <<advanced-config>>
* <<timeout-best-practices>>
* <<child>>
* <<client-testing>>

View File

@ -1,7 +1,7 @@
[[client-connecting]]
== Connecting
== Connecting
This page contains the information you need to connect and use the Client with
This page contains the information you need to connect and use the Client with
{es}.
**On this page**
@ -19,7 +19,7 @@ This page contains the information you need to connect and use the Client with
[discrete]
=== Authentication
This document contains code snippets to show you how to connect to various {es}
This document contains code snippets to show you how to connect to various {es}
providers.
@ -27,18 +27,18 @@ providers.
[[auth-ec]]
==== Elastic Cloud
If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers
an easy way to connect to it via the `cloud` option. You must pass the Cloud ID
that you can find in the cloud console, then your username and password inside
If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers
an easy way to connect to it via the `cloud` option. You must pass the Cloud ID
that you can find in the cloud console, then your username and password inside
the `auth` option.
NOTE: When connecting to Elastic Cloud, the client will automatically enable
both request and response compression by default, since it yields significant
throughput improvements. Moreover, the client will also set the tls option
`secureProtocol` to `TLSv1_2_method` unless specified otherwise. You can still
NOTE: When connecting to Elastic Cloud, the client will automatically enable
both request and response compression by default, since it yields significant
throughput improvements. Moreover, the client will also set the tls option
`secureProtocol` to `TLSv1_2_method` unless specified otherwise. You can still
override this option by configuring them.
IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are
IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are
behind a load balancer, Elastic Cloud will take care of everything for you.
Take a look https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how[here]
to know more.
@ -61,18 +61,18 @@ const client = new Client({
[[connect-self-managed-new]]
=== Connecting to a self-managed cluster
By default {es} will start with security features like authentication and TLS
enabled. To connect to the {es} cluster you'll need to configure the Node.js {es}
client to use HTTPS with the generated CA certificate in order to make requests
By default {es} will start with security features like authentication and TLS
enabled. To connect to the {es} cluster you'll need to configure the Node.js {es}
client to use HTTPS with the generated CA certificate in order to make requests
successfully.
If you're just getting started with {es} we recommend reading the documentation
on https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html[configuring]
and
https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html[starting {es}]
If you're just getting started with {es} we recommend reading the documentation
on https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html[configuring]
and
https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html[starting {es}]
to ensure your cluster is running as expected.
When you start {es} for the first time you'll see a distinct block like the one
When you start {es} for the first time you'll see a distinct block like the one
below in the output from {es} (you may have to scroll up if it's been a while):
[source,sh]
@ -90,24 +90,24 @@ below in the output from {es} (you may have to scroll up if it's been a while):
----
Depending on the circumstances there are two options for verifying the HTTPS
connection, either verifying with the CA certificate itself or via the HTTP CA
Depending on the circumstances there are two options for verifying the HTTPS
connection, either verifying with the CA certificate itself or via the HTTP CA
certificate fingerprint.
[discrete]
[[auth-tls]]
==== TLS configuration
The generated root CA certificate can be found in the `certs` directory in your
{es} config location (`$ES_CONF_PATH/certs/http_ca.crt`). If you're running {es}
in Docker there is
The generated root CA certificate can be found in the `certs` directory in your
{es} config location (`$ES_CONF_PATH/certs/http_ca.crt`). If you're running {es}
in Docker there is
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html[additional documentation for retrieving the CA certificate].
Without any additional configuration you can specify `https://` node urls, and
the certificates used to sign these requests will be verified. To turn off
certificate verification, you must specify an `tls` object in the top level
config and set `rejectUnauthorized: false`. The default `tls` values are the
same that Node.js's https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[`tls.connect()`]
Without any additional configuration you can specify `https://` node urls, and
the certificates used to sign these requests will be verified. To turn off
certificate verification, you must specify an `tls` object in the top level
config and set `rejectUnauthorized: false`. The default `tls` values are the
same that Node.js's https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[`tls.connect()`]
uses.
[source,js]
@ -152,7 +152,7 @@ const client = new Client({
})
----
The certificate fingerprint can be calculated using `openssl x509` with the
The certificate fingerprint can be calculated using `openssl x509` with the
certificate file:
[source,sh]
@ -160,8 +160,8 @@ certificate file:
openssl x509 -fingerprint -sha256 -noout -in /path/to/http_ca.crt
----
If you don't have access to the generated CA file from {es} you can use the
following script to output the root CA fingerprint of the {es} instance with
If you don't have access to the generated CA file from {es} you can use the
following script to output the root CA fingerprint of the {es} instance with
`openssl s_client`:
[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
WARNING: Running {es} without security enabled is not recommended.
If your cluster is configured with
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html[security explicitly disabled]
If your cluster is configured with
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html[security explicitly disabled]
then you can connect via HTTP:
[source,js]
@ -208,14 +208,14 @@ Following you can find all the supported authentication strategies.
[[auth-apikey]]
==== ApiKey authentication
You can use the
{ref-7x}/security-api-create-api-key.html[ApiKey]
authentication by passing the `apiKey` parameter via the `auth` option. The
`apiKey` parameter can be either a base64 encoded string or an object with the
values that you can obtain from the
You can use the
{ref-7x}/security-api-create-api-key.html[ApiKey]
authentication by passing the `apiKey` parameter via the `auth` option. The
`apiKey` parameter can be either a base64 encoded string or an object with the
values that you can obtain from the
{ref-7x}/security-api-create-api-key.html[create api key endpoint].
NOTE: If you provide both basic authentication credentials and the ApiKey
NOTE: If you provide both basic authentication credentials and the ApiKey
configuration, the ApiKey takes precedence.
[source,js]
@ -268,10 +268,10 @@ const client = new Client({
[[auth-basic]]
==== Basic authentication
You can provide your credentials by passing the `username` and `password`
You can provide your credentials by passing the `username` and `password`
parameters via the `auth` option.
NOTE: If you provide both basic authentication credentials and the Api Key
NOTE: If you provide both basic authentication credentials and the Api Key
configuration, the Api Key will take precedence.
[source,js]
@ -342,14 +342,14 @@ const result = await client.search({
}, { meta: true })
----
In this case, the result will be:
In this case, the result will be:
[source,ts]
----
{
body: object | boolean
statusCode: number
headers: object
warnings: [string],
warnings: string[],
meta: object
}
----
@ -361,7 +361,7 @@ NOTE: The body is a boolean value when you use `HEAD` APIs.
If needed, you can abort a running request by using the `AbortController` standard.
CAUTION: If you abort a request, the request will fail with a
CAUTION: If you abort a request, the request will fail with a
`RequestAbortedError`.
@ -410,19 +410,23 @@ The supported request specific options are:
[cols=2*]
|===
|`ignore`
|`[number]` - HTTP status codes which should not be considered errors for this request. +
|`number[]` - HTTP status codes which should not be considered errors for this request. +
_Default:_ `null`
|`requestTimeout`
|`number` - Max request timeout for the request in milliseconds, it overrides the client default. +
|`number | string` - Max request timeout for the request in milliseconds, it overrides the client default. +
_Default:_ `30000`
|`retryOnTimeout`
|`boolean` - Retry requests that have timed out.
_Default:_ `false`
|`maxRetries`
|`number` - Max number of retries for the request, it overrides the client default. +
_Default:_ `3`
|`compression`
|`string, boolean` - Enables body compression for the request. +
|`string | boolean` - Enables body compression for the request. +
_Options:_ `false`, `'gzip'` +
_Default:_ `false`
@ -446,6 +450,10 @@ _Default:_ `null`
|`any` - Custom object per request. _(you can use it to pass data to the clients events)_ +
_Default:_ `null`
|`opaqueId`
|`string` - Set the `X-Opaque-Id` HTTP header. See {ref}/api-conventions.html#x-opaque-id
_Default:_ `null`
|`maxResponseSize`
|`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 +
_Default:_ `null`
@ -458,6 +466,17 @@ _Default:_ `null`
|`AbortSignal` - The AbortSignal instance to allow request abortion. +
_Default:_ `null`
|`meta`
|`boolean` - Rather than returning the body, return an object containing `body`, `statusCode`, `headers` and `meta` keys +
_Default_: `false`
|`redaction`
|`object` - Options for redacting potentially sensitive data from error metadata. See <<redaction>>.
|`retryBackoff`
|`(min: number, max: number, attempt: number) => number;` - A function that calculates how long to sleep, in seconds, before the next request retry +
_Default:_ A built-in function that uses exponential backoff with jitter.
|===
[discrete]
@ -537,8 +556,8 @@ Resources used to assess these recommendations:
~Added~ ~in~ ~`v7.10.0`~
If you need to pass through an http(s) proxy for connecting to {es}, the client
out of the box offers a handy configuration for helping you with it. Under the
If you need to pass through an http(s) proxy for connecting to {es}, the client
out of the box offers a handy configuration for helping you with it. Under the
hood, it uses the https://github.com/delvedor/hpagent[`hpagent`] module.
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
that it is communicating with. The product check requires one additional HTTP request to
be sent to the server as part of the request pipeline before the main API call is sent.
In most cases, this will succeed during the very first API call that the client sends.
Once the product check completes, no further product check HTTP requests are sent for
Once the product check completes, no further product check HTTP requests are sent for
subsequent API calls.

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

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
kwd: {
type: "keyword",

View File

@ -26,7 +26,7 @@ const response1 = await client.cluster.putComponentTemplate({
type: "keyword",
script: {
source:
"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))",
"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
},
},
},

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.tasks.list({
human: "true",
detailed: "true",
actions: "indices:data/write/bulk",
});
console.log(response);
----

View File

@ -4,7 +4,7 @@
[source, js]
----
const response = await client.ingest.putPipeline({
id: "alibabacloud_ai_search_embeddings",
id: "alibabacloud_ai_search_embeddings_pipeline",
processors: [
{
inference: {

View File

@ -0,0 +1,8 @@
// 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.reroute();
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.getMapping({
index: "kibana_sample_data_ecommerce",
});
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.trace": "500ms",
"index.indexing.slowlog.source": "1000",
"index.indexing.slowlog.reformat": true,
"index.indexing.slowlog.include.user": true,
},
});
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

@ -14,6 +14,7 @@ const response = await client.inference.put({
min_number_of_allocations: 3,
max_number_of_allocations: 10,
},
num_threads: 1,
model_id: ".multilingual-e5-small",
},
},

View File

@ -10,7 +10,7 @@ const response = await client.search({
type: "keyword",
script: {
source:
"emit(doc['@timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ROOT))",
"emit(doc['@timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
},
},
},

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

@ -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.transport.request({
method: "POST",
path: "/_query/async",
querystring: {
format: "json",
},
body: {
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 ",
include_ccs_metadata: true,
},
});
console.log(response);
----

View File

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

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: "cooking_blog",
query: {
match: {
title: {
query: "fluffy pancakes breakfast",
minimum_should_match: 2,
},
},
},
});
console.log(response);
----

View File

@ -9,7 +9,7 @@ const response = await client.connector.put({
name: "My Connector",
description: "My Connector to sync data to Elastic index from Google Drive",
service_type: "google_drive",
language: "english",
language: "en",
});
console.log(response);
----

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]
----
const response = await client.searchApplication.renderQuery({
name: "my-app",
const response = await client.transport.request({
method: "POST",
path: "/_application/search_application/my-app/_render_query",
body: {
params: {
query_string: "my first query",

View File

@ -0,0 +1,21 @@
// 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: "text_embedding",
inference_id: "watsonx-embeddings",
inference_config: {
service: "watsonxai",
service_settings: {
api_key: "<api_key>",
url: "<url>",
model_id: "ibm/slate-30m-english-rtrvr",
project_id: "<project_id>",
api_version: "2024-03-14",
},
},
});
console.log(response);
----

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]
----
const response = await client.indices.putSettings({
index: "my-index-000001",
index: ".reindexed-v9-ml-anomalies-custom-example",
settings: {
"index.merge.policy.max_merge_at_once_explicit": null,
index: {
number_of_replicas: "<original_number_of_replicas>",
},
},
});
console.log(response);

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.transport.request({
method: "GET",
path: "/_connector/_sync_job",
querystring: {
connector_id: "my-connector-id",
size: "1",
},
});
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

@ -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.update({
index: ".elastic-connectors",
id: "connector_id",
doc: {
features: {
native_connector_api_keys: {
enabled: true,
},
},
},
});
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.inference.put({
task_type: "my-inference-endpoint",
inference_id: "_update",
inference_config: {
service_settings: {
api_key: "<API_KEY>",
},
},
});
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.connector.updateConfiguration({
connector_id: "my-connector-id",
values: {
host: "127.0.0.1",
port: 5432,
username: "myuser",
password: "mypassword",
database: "chinook",
schema: "public",
tables: "album,artist",
},
});
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-bit-vectors",
query: {
script_score: {
query: {
match_all: {},
},
script: {
source: "dotProduct(params.query_vector, 'my_dense_vector')",
params: {
query_vector: [
0.23, 1.45, 3.67, 4.89, -0.56, 2.34, 3.21, 1.78, -2.45, 0.98, -0.12,
3.45, 4.56, 2.78, 1.23, 0.67, 3.89, 4.12, -2.34, 1.56, 0.78, 3.21,
4.12, 2.45, -1.67, 0.34, -3.45, 4.56, -2.78, 1.23, -0.67, 3.89,
-4.34, 2.12, -1.56, 0.78, -3.21, 4.45, 2.12, 1.67,
],
},
},
},
},
});
console.log(response);
----

View File

@ -11,7 +11,7 @@ const response = await client.searchApplication.put({
script: {
lang: "mustache",
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: {
query: "",
_es_filters: {},

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.delete({
index: "books",
});
console.log(response);
const response1 = await client.indices.delete({
index: "my-explicit-mappings-books",
});
console.log(response1);
----

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.security.createApiKey({
name: "my-connector-api-key",
role_descriptors: {
"my-connector-connector-role": {
cluster: ["monitor", "manage_connector"],
indices: [
{
names: [
"my-index_name",
".search-acl-filter-my-index_name",
".elastic-connectors*",
],
privileges: ["all"],
allow_restricted_indices: false,
},
],
},
},
});
console.log(response);
----

View File

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

View File

@ -3,8 +3,8 @@
[source, js]
----
const response = await client.cluster.reroute({
metric: "none",
const response = await client.indices.create({
index: "books",
});
console.log(response);
----

View File

@ -3,7 +3,9 @@
[source, js]
----
const response = await client.simulate.ingest({
const response = await client.transport.request({
method: "POST",
path: "/_ingest/_simulate",
body: {
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.index({
index: "mv",
refresh: "true",
document: {
a: [2, null, 1],
},
});
console.log(response);
const response1 = await client.esql.query({
query: "FROM mv | LIMIT 1",
});
console.log(response1);
----

View File

@ -4,7 +4,7 @@
[source, js]
----
const response = await client.ingest.putPipeline({
id: "hugging_face_embeddings",
id: "hugging_face_embeddings_pipeline",
processors: [
{
inference: {

View File

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

View File

@ -4,7 +4,7 @@
[source, js]
----
const response = await client.ingest.putPipeline({
id: "google_vertex_ai_embeddings",
id: "google_vertex_ai_embeddings_pipeline",
processors: [
{
inference: {

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

@ -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.security.createApiKey({
name: "john-api-key",
expiration: "1d",
role_descriptors: {
"sharepoint-online-role": {
index: [
{
names: ["sharepoint-search-application"],
privileges: ["read"],
query: {
template: {
params: {
access_control: ["john@example.co", "Engineering Members"],
},
source:
'\n {\n "bool": {\n "should": [\n {\n "bool": {\n "must_not": {\n "exists": {\n "field": "_allow_access_control"\n }\n }\n }\n },\n {\n "terms": {\n "_allow_access_control.enum": {{#toJson}}access_control{{/toJson}}\n }\n }\n ]\n }\n }\n ',
},
},
},
],
restriction: {
workflows: ["search_application_query"],
},
},
},
});
console.log(response);
----

View File

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

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
card: {
type: "wildcard",

View File

@ -3,8 +3,8 @@
[source, js]
----
const response = await client.indices.unfreeze({
index: "my-index-000001",
const response = await client.indices.rollover({
alias: "datastream",
});
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

@ -10,7 +10,7 @@ const response = await client.search({
"date.day_of_week": {
type: "keyword",
script:
"emit(doc['date'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))",
"emit(doc['date'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
},
},
aggs: {

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

@ -11,7 +11,7 @@ const response = await client.reindex({
},
dest: {
index: "azure-ai-studio-embeddings",
pipeline: "azure_ai_studio_embeddings",
pipeline: "azure_ai_studio_embeddings_pipeline",
},
});
console.log(response);

View File

@ -3,7 +3,9 @@
[source, js]
----
const response = await client.security.oidcLogout({
const response = await client.transport.request({
method: "POST",
path: "/_security/oidc/logout",
body: {
token:
"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]
----
const response = await client.esql.asyncQueryGet({
id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
wait_for_completion_timeout: "30s",
body: null,
const response = await client.transport.request({
method: "GET",
path: "/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE&#x3D;",
querystring: {
wait_for_completion_timeout: "30s",
},
});
console.log(response);
----

View File

@ -0,0 +1,77 @@
// 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-000001",
mappings: {
properties: {
attributes: {
type: "passthrough",
priority: 10,
properties: {
id: {
type: "keyword",
},
},
},
},
},
});
console.log(response);
const response1 = await client.index({
index: "my-index-000001",
id: 1,
document: {
attributes: {
id: "foo",
zone: 10,
},
},
});
console.log(response1);
const response2 = await client.search({
index: "my-index-000001",
query: {
bool: {
must: [
{
match: {
id: "foo",
},
},
{
match: {
zone: 10,
},
},
],
},
},
});
console.log(response2);
const response3 = await client.search({
index: "my-index-000001",
query: {
bool: {
must: [
{
match: {
"attributes.id": "foo",
},
},
{
match: {
"attributes.zone": 10,
},
},
],
},
},
});
console.log(response3);
----

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.indices.create({
index: "my-explicit-mappings-books",
mappings: {
dynamic: false,
properties: {
name: {
type: "text",
},
author: {
type: "text",
},
release_date: {
type: "date",
format: "yyyy-MM-dd",
},
page_count: {
type: "integer",
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,25 @@
// 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.index({
index: "idx_keep",
id: 1,
document: {
path: {
to: [
{
foo: [3, 2, 1],
},
{
foo: [30, 20, 10],
},
],
bar: "baz",
},
ids: [200, 100, 300, 100],
},
});
console.log(response);
----

View File

@ -0,0 +1,43 @@
// 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",
retriever: {
rule: {
match_criteria: {
query_string: "puggles",
user_country: "us",
},
ruleset_ids: ["my-ruleset"],
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
query_string: {
query: "pugs",
},
},
},
},
{
standard: {
query: {
query_string: {
query: "puggles",
},
},
},
},
],
},
},
},
},
});
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

@ -4,7 +4,7 @@
[source, js]
----
const response = await client.ingest.putPipeline({
id: "azure_ai_studio_embeddings",
id: "azure_ai_studio_embeddings_pipeline",
processors: [
{
inference: {

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.debug": "500ms",
"index.search.slowlog.threshold.fetch.trace": "200ms",
"index.search.slowlog.include.user": true,
},
});
console.log(response);

View File

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

View File

@ -0,0 +1,52 @@
// 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-bit-vectors",
mappings: {
properties: {
my_dense_vector: {
type: "dense_vector",
index: false,
element_type: "bit",
dims: 40,
},
},
},
});
console.log(response);
const response1 = await client.index({
index: "my-index-bit-vectors",
id: 1,
document: {
my_dense_vector: [8, 5, -15, 1, -7],
},
});
console.log(response1);
const response2 = await client.index({
index: "my-index-bit-vectors",
id: 2,
document: {
my_dense_vector: [-1, 115, -3, 4, -128],
},
});
console.log(response2);
const response3 = await client.index({
index: "my-index-bit-vectors",
id: 3,
document: {
my_dense_vector: [2, 18, -5, 0, -124],
},
});
console.log(response3);
const response4 = await client.indices.refresh({
index: "my-index-bit-vectors",
});
console.log(response4);
----

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

@ -11,7 +11,7 @@ const response = await client.reindex({
},
dest: {
index: "openai-embeddings",
pipeline: "openai_embeddings",
pipeline: "openai_embeddings_pipeline",
},
});
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,8 @@
// 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.nodes.hotThreads();
console.log(response);
----

View File

@ -11,7 +11,7 @@ const response = await client.reindex({
},
dest: {
index: "amazon-bedrock-embeddings",
pipeline: "amazon_bedrock_embeddings",
pipeline: "amazon_bedrock_embeddings_pipeline",
},
});
console.log(response);

View File

@ -29,6 +29,7 @@ const response = await client.indices.create({
"arabic_normalization",
"persian_normalization",
"persian_stop",
"persian_stem",
],
},
},

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

@ -6,15 +6,8 @@
const response = await client.indices.updateAliases({
actions: [
{
remove: {
index: "my-index-000001",
alias: "my-index",
},
},
{
add: {
index: "my-index-000002",
alias: "my-index",
remove_index: {
index: "my-index-2099.05.06-000001",
},
},
],

View File

@ -3,7 +3,9 @@
[source, js]
----
const response = await client.esql.asyncQuery({
const response = await client.transport.request({
method: "POST",
path: "/_query/async",
body: {
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 ",

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]
----
const response = await client.esql.asyncQueryGet({
id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
body: null,
const response = await client.transport.request({
method: "GET",
path: "/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM&#x3D;",
});
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.index({
index: "amazon-reviews",
id: 1,
document: {
review_text:
"This product is lifechanging! I'm telling all my friends about it.",
review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
},
});
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.indices.create({
index: "jinaai-index",
mappings: {
properties: {
content: {
type: "semantic_text",
inference_id: "jinaai-embeddings",
},
},
},
});
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.search({
index: "restaurants",
retriever: {
knn: {
field: "vector",
query_vector: [10, 22, 77],
k: 10,
num_candidates: 10,
},
},
});
console.log(response);
----

View File

@ -4,15 +4,16 @@
[source, js]
----
const response = await client.search({
index: "test-index",
index: "my-index-bit-vectors",
query: {
nested: {
path: "inference_field.inference.chunks",
script_score: {
query: {
sparse_vector: {
field: "inference_field.inference.chunks.embeddings",
inference_id: "my-inference-id",
query: "mountain lake",
match_all: {},
},
script: {
source: "dotProduct(params.query_vector, 'my_dense_vector')",
params: {
query_vector: [8, 5, -15, 1, -7],
},
},
},

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