Compare commits
96 Commits
v8.16.3
...
v9.0.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| ac231c859e | |||
| a22c4622d9 | |||
| 6f9e1062f3 | |||
| 7449adbd1f | |||
| d5a0f1171f | |||
| d86eb82e82 | |||
| a411cc7c7d | |||
| c99abab058 | |||
| c5b2915b5a | |||
| 20fb610d82 | |||
| c8504fe616 | |||
| 4795a8c0d5 | |||
| 9139662bcc | |||
| 9e4572f4e1 | |||
| a25bc97297 | |||
| 172180cb21 | |||
| 947e09e62a | |||
| 86169003b4 | |||
| 11ff146ae8 | |||
| d2c63b4c5f | |||
| 0ad42ff1a2 | |||
| 6dbf91a9c3 | |||
| 39b2700add | |||
| 869174f953 | |||
| 5eb3554083 | |||
| 26ce906b5b | |||
| 5f9561d566 | |||
| 3676c8229a | |||
| 2bcbd36d75 | |||
| 63104b5e5e | |||
| 2b2a9947c7 | |||
| b95aa986b7 | |||
| 0ee486bc9c | |||
| f835fa3b12 | |||
| e688f36396 | |||
| b8c3ac446e | |||
| 3a288cf86b | |||
| 100be27ad1 | |||
| c490dd0821 | |||
| e992c329c3 | |||
| bfdae66333 | |||
| ed3cace127 | |||
| f33aa8cccd | |||
| 7cb973a206 | |||
| a4315a905e | |||
| 6447fc10bf | |||
| e9c2f8b0af | |||
| 15b9ee2f06 | |||
| e30e964131 | |||
| 0f187f47c4 | |||
| 101f34bd5e | |||
| ec0c561e36 | |||
| c1e90b12f0 | |||
| 5cb670256e | |||
| 86f488f68f | |||
| 6009fab7fe | |||
| 26ae260058 | |||
| fbbbece711 | |||
| a30c3dca2d | |||
| 36cfacc409 | |||
| 6dc83cd33e | |||
| 7c7ce29127 | |||
| 2b890af355 | |||
| 421f953b00 | |||
| c5e4107181 | |||
| 5880c84c13 | |||
| 290639d168 | |||
| 0b90613694 | |||
| 1ad057abcc | |||
| 44d890ec57 | |||
| 2b2a2f03e6 | |||
| 7bcd75bdb0 | |||
| 2455dac4e5 | |||
| edb5563bf8 | |||
| 11939fd22c | |||
| e0c613f898 | |||
| 20f2c740cd | |||
| 97bdca22d8 | |||
| a7123f807d | |||
| 20ac2a637e | |||
| e287c1edd9 | |||
| 90d43f4f28 | |||
| 572927b4f1 | |||
| 86b4d4e2f9 | |||
| 8e79bf847a | |||
| cef328c93d | |||
| c3247d0c66 | |||
| e9fdcb0647 | |||
| 82acfc33a9 | |||
| 661caf8422 | |||
| 3430734fe0 | |||
| 810e009202 | |||
| c274b1b32f | |||
| 428a7b023d | |||
| aad41df231 | |||
| 34704b2e5c |
@ -25,7 +25,7 @@ steps:
|
||||
provider: "gcp"
|
||||
image: family/core-ubuntu-2204
|
||||
plugins:
|
||||
- junit-annotate#v2.4.1:
|
||||
- junit-annotate#v2.6.0:
|
||||
artifacts: "junit-output/junit-*.xml"
|
||||
job-uuid-file-pattern: "junit-(.*).xml"
|
||||
fail-build-on-error: true
|
||||
|
||||
2
.github/make.sh
vendored
2
.github/make.sh
vendored
@ -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
|
||||
|
||||
26
.github/stale.yml
vendored
26
.github/stale.yml
vendored
@ -1,26 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 15
|
||||
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- "discussion"
|
||||
- "feature request"
|
||||
- "bug"
|
||||
- "todo"
|
||||
- "good first issue"
|
||||
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: |
|
||||
We understand that this might be important for you, but this issue has been automatically marked as stale because it has not had recent activity either from our end or yours.
|
||||
It will be closed if no further activity occurs, please write a comment if you would like to keep this going.
|
||||
|
||||
Note: in the past months we have built a new client, that has just landed in master. If you want to open an issue or a pr for the legacy client, you should do that in https://github.com/elastic/elasticsearch-js-legacy
|
||||
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
19
.github/workflows/docs-build.yml
vendored
Normal file
19
.github/workflows/docs-build.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: docs-build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request_target: ~
|
||||
merge_group: ~
|
||||
|
||||
jobs:
|
||||
docs-preview:
|
||||
uses: elastic/docs-builder/.github/workflows/preview-build.yml@main
|
||||
with:
|
||||
path-pattern: docs/**
|
||||
permissions:
|
||||
deployments: write
|
||||
id-token: write
|
||||
contents: read
|
||||
pull-requests: read
|
||||
14
.github/workflows/docs-cleanup.yml
vendored
Normal file
14
.github/workflows/docs-cleanup.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
name: docs-cleanup
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
docs-preview:
|
||||
uses: elastic/docs-builder/.github/workflows/preview-cleanup.yml@main
|
||||
permissions:
|
||||
contents: none
|
||||
id-token: write
|
||||
deployments: write
|
||||
26
.github/workflows/nodejs.yml
vendored
26
.github/workflows/nodejs.yml
vendored
@ -11,10 +11,10 @@ jobs:
|
||||
outputs:
|
||||
src-only: "${{ steps.changes.outputs.src-only }}"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: dorny/paths-filter/@v3.0.2
|
||||
- uses: dorny/paths-filter/@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: changes
|
||||
with:
|
||||
filters: |
|
||||
@ -36,12 +36,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 Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
@ -66,12 +66,12 @@ jobs:
|
||||
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@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
|
||||
with:
|
||||
node-version: 22.x
|
||||
|
||||
@ -96,12 +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: |
|
||||
@ -118,13 +118,3 @@ jobs:
|
||||
- name: ECMAScript module test
|
||||
run: |
|
||||
bun run test:esm
|
||||
|
||||
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
|
||||
|
||||
40
.github/workflows/npm-publish.yml
vendored
40
.github/workflows/npm-publish.yml
vendored
@ -12,27 +12,49 @@ 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@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
|
||||
with:
|
||||
node-version: "22.x"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
- run: npm install -g npm
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
- run: npm publish --provenance --access public
|
||||
- name: npm publish
|
||||
run: |
|
||||
version=$(jq -r .version package.json)
|
||||
tag_meta=$(echo "$version" | cut -s -d '-' -f2)
|
||||
if [[ -z "$tag_meta" ]]; then
|
||||
npm publish --provenance --access public
|
||||
else
|
||||
tag=$(echo "$tag_meta" | cut -d '.' -f1)
|
||||
npm publish --provenance --access public --tag "$tag"
|
||||
fi
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
- run: |
|
||||
- name: Publish version on GitHub
|
||||
run: |
|
||||
version=$(jq -r .version package.json)
|
||||
gh release create \
|
||||
-n "[Changelog](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/$BRANCH_NAME/changelog-client.html)" \
|
||||
--target "$BRANCH_NAME" \
|
||||
-t "v$version" \
|
||||
"v$version"
|
||||
tag_meta=$(echo "$version" | cut -s -d '-' -f2)
|
||||
if [[ -z "$tag_meta" ]]; then
|
||||
gh release create \
|
||||
-n "[Changelog](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/$BRANCH_NAME/changelog-client.html)"
|
||||
--target "$BRANCH_NAME" \
|
||||
--title "v$version" \
|
||||
"v$version"
|
||||
else
|
||||
tag_main=$(echo "$version" | cut -d '-' -f1)
|
||||
gh release create \
|
||||
-n "This is a $tag_main pre-release. Changes may not be stable." \
|
||||
--latest=false \
|
||||
--prerelease \
|
||||
--target "$BRANCH_NAME" \
|
||||
--title "v$version" \
|
||||
"v$version"
|
||||
fi
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.event.inputs.branch }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
43
.github/workflows/serverless-patch.sh
vendored
43
.github/workflows/serverless-patch.sh
vendored
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -exuo pipefail
|
||||
|
||||
merge_commit_sha=$(jq -r '.pull_request.merge_commit_sha' "$GITHUB_EVENT_PATH")
|
||||
pull_request_id=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH")
|
||||
pr_shortcode="elastic/elasticsearch-js#$pull_request_id"
|
||||
|
||||
# generate patch file
|
||||
cd "$GITHUB_WORKSPACE/stack"
|
||||
git format-patch -1 --stdout "$merge_commit_sha" > /tmp/patch.diff
|
||||
|
||||
# set committer info
|
||||
git config --global user.email "elasticmachine@users.noreply.github.com"
|
||||
git config --global user.name "Elastic Machine"
|
||||
|
||||
# apply patch file
|
||||
cd "$GITHUB_WORKSPACE/serverless"
|
||||
git am -C1 --reject /tmp/patch.diff || git am --quit
|
||||
|
||||
# generate PR body comment
|
||||
comment="Patch applied from $pr_shortcode"
|
||||
|
||||
# enumerate rejected patches in PR comment
|
||||
has_rejects='false'
|
||||
for f in ./**/*.rej; do
|
||||
has_rejects='true'
|
||||
comment="$comment
|
||||
|
||||
## Rejected patch \`$f\` must be resolved:
|
||||
|
||||
\`\`\`diff
|
||||
$(cat "$f")
|
||||
\`\`\`
|
||||
"
|
||||
done
|
||||
|
||||
# delete .rej files
|
||||
rm -fv ./**/*.rej
|
||||
|
||||
# send data to output parameters
|
||||
echo "$comment" > /tmp/pr_body
|
||||
echo "PR_DRAFT=$has_rejects" >> "$GITHUB_OUTPUT"
|
||||
53
.github/workflows/serverless-patch.yml
vendored
53
.github/workflows/serverless-patch.yml
vendored
@ -1,53 +0,0 @@
|
||||
---
|
||||
name: Apply PR changes to serverless
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- closed
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
apply-patch:
|
||||
name: Apply patch
|
||||
runs-on: ubuntu-latest
|
||||
# Only react to merged PRs for security reasons.
|
||||
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
|
||||
if: >
|
||||
github.event.pull_request.merged
|
||||
&& (
|
||||
(
|
||||
github.event.action == 'closed'
|
||||
&& contains(github.event.pull_request.labels.*.name, 'apply-to-serverless')
|
||||
)
|
||||
||
|
||||
(
|
||||
github.event.action == 'labeled'
|
||||
&& github.event.label.name == 'apply-to-serverless'
|
||||
)
|
||||
)
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
repository: elastic/elasticsearch-js
|
||||
ref: main
|
||||
path: stack
|
||||
fetch-depth: 0
|
||||
- uses: actions/checkout@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
|
||||
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 }}"
|
||||
body-path: /tmp/pr_body
|
||||
draft: "${{ steps.apply-patch.outputs.PR_DRAFT }}"
|
||||
add-paths: ":!*.rej"
|
||||
12
.github/workflows/stale.yml
vendored
12
.github/workflows/stale.yml
vendored
@ -1,21 +1,21 @@
|
||||
---
|
||||
name: 'Close stale issues and PRs'
|
||||
name: "Close stale issues and PRs"
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
- cron: "30 1 * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v8
|
||||
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9
|
||||
with:
|
||||
stale-issue-label: stale
|
||||
stale-pr-label: stale
|
||||
days-before-stale: 90
|
||||
days-before-close: 14
|
||||
exempt-issue-labels: 'good first issue'
|
||||
exempt-issue-labels: "good first issue,tracking"
|
||||
close-issue-label: closed-stale
|
||||
close-pr-label: closed-stale
|
||||
stale-issue-message: 'This issue is stale because it has been open 90 days with no activity. Remove the `stale` label, or leave a comment, or this will be closed in 14 days.'
|
||||
stale-pr-message: 'This pull request is stale because it has been open 90 days with no activity. Remove the `stale` label, or leave a comment, or this will be closed in 14 days.'
|
||||
stale-issue-message: "This issue is stale because it has been open 90 days with no activity. Remove the `stale` label, or leave a comment, or this will be closed in 14 days."
|
||||
stale-pr-message: "This pull request is stale because it has been open 90 days with no activity. Remove the `stale` label, or leave a comment, or this will be closed in 14 days."
|
||||
|
||||
@ -28,6 +28,9 @@ spec:
|
||||
spec:
|
||||
repository: elastic/elasticsearch-js
|
||||
pipeline_file: .buildkite/pipeline.yml
|
||||
env:
|
||||
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: "true"
|
||||
SLACK_NOTIFICATIONS_CHANNEL: "#devtools-notify-javascript"
|
||||
teams:
|
||||
devtools-team:
|
||||
access_level: MANAGE_BUILD_AND_READ
|
||||
@ -42,6 +45,12 @@ spec:
|
||||
main:
|
||||
branch: "main"
|
||||
cronline: "@daily"
|
||||
8_14:
|
||||
branch: "8.14"
|
||||
8_x:
|
||||
branch: "8.x"
|
||||
cronline: "@daily"
|
||||
8_17:
|
||||
branch: "8.17"
|
||||
cronline: "@daily"
|
||||
8_18:
|
||||
branch: "8.18"
|
||||
cronline: "@daily"
|
||||
|
||||
@ -13,7 +13,6 @@ const client = new Client({
|
||||
cloud: { id: '<cloud-id>' },
|
||||
auth: { apiKey: 'base64EncodedKey' },
|
||||
maxRetries: 5,
|
||||
requestTimeout: 60000,
|
||||
sniffOnStart: true
|
||||
})
|
||||
----
|
||||
@ -82,7 +81,7 @@ _Default:_ `3`
|
||||
|
||||
|`requestTimeout`
|
||||
|`number` - Max request timeout in milliseconds for each request. +
|
||||
_Default:_ `30000`
|
||||
_Default:_ No value
|
||||
|
||||
|`pingTimeout`
|
||||
|`number` - Max ping request timeout in milliseconds for each request. +
|
||||
|
||||
@ -1,6 +1,66 @@
|
||||
[[changelog-client]]
|
||||
== Release notes
|
||||
|
||||
[discrete]
|
||||
=== 9.0.0
|
||||
|
||||
[discrete]
|
||||
==== Breaking changes
|
||||
|
||||
[discrete]
|
||||
===== Drop support for deprecated `body` parameter
|
||||
|
||||
In 8.0, the top-level `body` parameter that was available on all API functions <<remove-body-key,was deprecated>>. In 9.0 this property is completely removed.
|
||||
|
||||
[discrete]
|
||||
===== Remove the default 30-second timeout on all requests sent to Elasticsearch
|
||||
|
||||
Setting HTTP timeouts on Elasticsearch requests goes against Elastic's recommendations. See <<timeout-best-practices>> for more information.
|
||||
|
||||
[discrete]
|
||||
=== 8.17.1
|
||||
|
||||
[discrete]
|
||||
==== Fixes
|
||||
|
||||
[discrete]
|
||||
===== Improved support for Elasticsearch `v8.17`
|
||||
|
||||
Updated TypeScript types based on fixes and improvements to the Elasticsearch specification.
|
||||
|
||||
[discrete]
|
||||
===== Report correct transport connection type in telemetry
|
||||
|
||||
The client's telemetry reporting mechanism was incorrectly reporting all traffic as using `HttpConnection` when the default is `UndiciConnection`. https://github.com/elastic/elasticsearch-js/issues/2324[#2324]
|
||||
|
||||
[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.4
|
||||
|
||||
[discrete]
|
||||
==== Fixes
|
||||
|
||||
[discrete]
|
||||
===== Improved support for Elasticsearch `v8.16`
|
||||
|
||||
Updated TypeScript types based on fixes and improvements to the Elasticsearch specification.
|
||||
|
||||
[discrete]
|
||||
===== Report correct transport connection type in telemetry
|
||||
|
||||
The client's telemetry reporting mechanism was incorrectly reporting all traffic as using `HttpConnection` when the default is `UndiciConnection`. https://github.com/elastic/elasticsearch-js/issues/2324[#2324]
|
||||
|
||||
[discrete]
|
||||
=== 8.16.3
|
||||
|
||||
@ -656,6 +716,7 @@ ac.abort()
|
||||
----
|
||||
|
||||
[discrete]
|
||||
[[remove-body-key]]
|
||||
===== Remove the body key from the request
|
||||
|
||||
*Breaking: Yes* | *Migration effort: Small*
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
[[child]]
|
||||
=== Creating a child client
|
||||
|
||||
There are some use cases where you may need multiple instances of the client.
|
||||
You can easily do that by calling `new Client()` as many times as you need, but
|
||||
you will lose all the benefits of using one single client, such as the long
|
||||
living connections and the connection pool handling. To avoid this problem, the
|
||||
client offers a `child` API, which returns a new client instance that shares the
|
||||
There are some use cases where you may need multiple instances of the client.
|
||||
You can easily do that by calling `new Client()` as many times as you need, but
|
||||
you will lose all the benefits of using one single client, such as the long
|
||||
living connections and the connection pool handling. To avoid this problem, the
|
||||
client offers a `child` API, which returns a new client instance that shares the
|
||||
connection pool with the parent client.
|
||||
|
||||
NOTE: The event emitter is shared between the parent and the child(ren). If you
|
||||
extend the parent client, the child client will have the same extensions, while
|
||||
NOTE: The event emitter is shared between the parent and the child(ren). If you
|
||||
extend the parent client, the child client will have the same extensions, while
|
||||
if the child client adds an extension, the parent client will not be extended.
|
||||
|
||||
You can pass to the `child` every client option you would pass to a normal
|
||||
client, but the connection pool specific options (`ssl`, `agent`, `pingTimeout`,
|
||||
You can pass to the `child` every client option you would pass to a normal
|
||||
client, but the connection pool specific options (`ssl`, `agent`, `pingTimeout`,
|
||||
`Connection`, and `resurrectStrategy`).
|
||||
|
||||
CAUTION: If you call `close` in any of the parent/child clients, every client
|
||||
CAUTION: If you call `close` in any of the parent/child clients, every client
|
||||
will be closed.
|
||||
|
||||
[source,js]
|
||||
@ -28,9 +28,8 @@ const client = new Client({
|
||||
})
|
||||
const child = client.child({
|
||||
headers: { 'x-foo': 'bar' },
|
||||
requestTimeout: 1000
|
||||
})
|
||||
|
||||
client.info().then(console.log, console.log)
|
||||
child.info().then(console.log, console.log)
|
||||
----
|
||||
----
|
||||
|
||||
@ -414,8 +414,8 @@ The supported request specific options are:
|
||||
_Default:_ `null`
|
||||
|
||||
|`requestTimeout`
|
||||
|`number | string` - Max request timeout for the request in milliseconds, it overrides the client default. +
|
||||
_Default:_ `30000`
|
||||
|`number | string | null` - Max request timeout for the request in milliseconds. This overrides the client default, which is to not time out at all. See https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#_http_client_configuration[Elasticsearch best practices for HTML clients] for more info. +
|
||||
_Default:_ No timeout
|
||||
|
||||
|`retryOnTimeout`
|
||||
|`boolean` - Retry requests that have timed out.
|
||||
|
||||
11
docs/doc_examples/00ad41bde67beac991534ae0e04b1296.asciidoc
Normal file
11
docs/doc_examples/00ad41bde67beac991534ae0e04b1296.asciidoc
Normal 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);
|
||||
----
|
||||
10
docs/doc_examples/0722b302b2b3275a988d858044f99d5d.asciidoc
Normal file
10
docs/doc_examples/0722b302b2b3275a988d858044f99d5d.asciidoc
Normal 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);
|
||||
----
|
||||
@ -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);
|
||||
42
docs/doc_examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc
Normal file
42
docs/doc_examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc
Normal 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);
|
||||
----
|
||||
@ -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.blocks.read_only_allow_delete": null,
|
||||
index: {
|
||||
number_of_replicas: "<original_number_of_replicas>",
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
20
docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc
Normal file
20
docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc
Normal 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);
|
||||
----
|
||||
11
docs/doc_examples/12adea5d76f73d94d80d42f53f67563f.asciidoc
Normal file
11
docs/doc_examples/12adea5d76f73d94d80d42f53f67563f.asciidoc
Normal 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);
|
||||
----
|
||||
@ -3,11 +3,13 @@
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.inference.inference({
|
||||
const response = await client.inference.put({
|
||||
task_type: "my-inference-endpoint",
|
||||
inference_id: "_update",
|
||||
service_settings: {
|
||||
api_key: "<API_KEY>",
|
||||
inference_config: {
|
||||
service_settings: {
|
||||
api_key: "<API_KEY>",
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
19
docs/doc_examples/1ead35c954963e83f89872048dabdbe9.asciidoc
Normal file
19
docs/doc_examples/1ead35c954963e83f89872048dabdbe9.asciidoc
Normal 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);
|
||||
----
|
||||
67
docs/doc_examples/246763219ec06172f7aa57bba28d344a.asciidoc
Normal file
67
docs/doc_examples/246763219ec06172f7aa57bba28d344a.asciidoc
Normal 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);
|
||||
----
|
||||
11
docs/doc_examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc
Normal file
11
docs/doc_examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc
Normal 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);
|
||||
----
|
||||
26
docs/doc_examples/2a21674c40f9b182a8944769d20b2357.asciidoc
Normal file
26
docs/doc_examples/2a21674c40f9b182a8944769d20b2357.asciidoc
Normal 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);
|
||||
----
|
||||
@ -6,13 +6,13 @@
|
||||
const response = await client.indices.create({
|
||||
index: "test-index",
|
||||
query: {
|
||||
semantic: {
|
||||
field: "my_semantic_field",
|
||||
match: {
|
||||
my_field: "Which country is Paris in?",
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
fields: {
|
||||
my_semantic_field: {
|
||||
my_field: {
|
||||
type: "semantic",
|
||||
number_of_fragments: 2,
|
||||
order: "score",
|
||||
23
docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc
Normal file
23
docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc
Normal 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);
|
||||
----
|
||||
28
docs/doc_examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc
Normal file
28
docs/doc_examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc
Normal 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);
|
||||
----
|
||||
31
docs/doc_examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc
Normal file
31
docs/doc_examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc
Normal 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);
|
||||
----
|
||||
@ -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);
|
||||
70
docs/doc_examples/36792c81c053e0555407d1e83e7e054f.asciidoc
Normal file
70
docs/doc_examples/36792c81c053e0555407d1e83e7e054f.asciidoc
Normal 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);
|
||||
----
|
||||
23
docs/doc_examples/3722dad876023e0757138dd5a6d3240e.asciidoc
Normal file
23
docs/doc_examples/3722dad876023e0757138dd5a6d3240e.asciidoc
Normal 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);
|
||||
----
|
||||
@ -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);
|
||||
----
|
||||
19
docs/doc_examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc
Normal file
19
docs/doc_examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc
Normal 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);
|
||||
----
|
||||
61
docs/doc_examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc
Normal file
61
docs/doc_examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc
Normal 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);
|
||||
----
|
||||
16
docs/doc_examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc
Normal file
16
docs/doc_examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc
Normal 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);
|
||||
----
|
||||
18
docs/doc_examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc
Normal file
18
docs/doc_examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc
Normal 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);
|
||||
----
|
||||
18
docs/doc_examples/41d24383d29b2808a65258a0a3256e96.asciidoc
Normal file
18
docs/doc_examples/41d24383d29b2808a65258a0a3256e96.asciidoc
Normal 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);
|
||||
----
|
||||
47
docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc
Normal file
47
docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc
Normal 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);
|
||||
----
|
||||
17
docs/doc_examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc
Normal file
17
docs/doc_examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc
Normal 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);
|
||||
----
|
||||
20
docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc
Normal file
20
docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc
Normal 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.search({
|
||||
index: "image-index",
|
||||
knn: {
|
||||
field: "image-vector",
|
||||
query_vector: [-5, 9, -12],
|
||||
k: 10,
|
||||
num_candidates: 100,
|
||||
rescore_vector: {
|
||||
oversample: 2,
|
||||
},
|
||||
},
|
||||
fields: ["title", "file-type"],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -5,7 +5,7 @@
|
||||
----
|
||||
const response = await client.cluster.putSettings({
|
||||
persistent: {
|
||||
"cluster.routing.allocation.disk.watermark.low": "30gb",
|
||||
"migrate.data_stream_reindex_max_request_per_second": 10000,
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
16
docs/doc_examples/5836b09198feb1269ed12839b416123d.asciidoc
Normal file
16
docs/doc_examples/5836b09198feb1269ed12839b416123d.asciidoc
Normal 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);
|
||||
----
|
||||
10
docs/doc_examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc
Normal file
10
docs/doc_examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc
Normal 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);
|
||||
----
|
||||
15
docs/doc_examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc
Normal file
15
docs/doc_examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc
Normal 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);
|
||||
----
|
||||
@ -6,14 +6,15 @@
|
||||
const response = await client.search({
|
||||
index: "test-index",
|
||||
query: {
|
||||
nested: {
|
||||
path: "inference_field.inference.chunks",
|
||||
query: {
|
||||
sparse_vector: {
|
||||
field: "inference_field.inference.chunks.embeddings",
|
||||
inference_id: "my-inference-id",
|
||||
query: "mountain lake",
|
||||
},
|
||||
match: {
|
||||
my_semantic_field: "Which country is Paris in?",
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
fields: {
|
||||
my_semantic_field: {
|
||||
number_of_fragments: 2,
|
||||
order: "score",
|
||||
},
|
||||
},
|
||||
},
|
||||
16
docs/doc_examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc
Normal file
16
docs/doc_examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc
Normal 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);
|
||||
----
|
||||
@ -12,6 +12,13 @@ const response = await client.search({
|
||||
fields: ["my_field", "my_field._2gram", "my_field._3gram"],
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
fields: {
|
||||
my_field: {
|
||||
matched_fields: ["my_field._index_prefix"],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
24
docs/doc_examples/730045fae3743c39b612813a42c330c3.asciidoc
Normal file
24
docs/doc_examples/730045fae3743c39b612813a42c330c3.asciidoc
Normal 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);
|
||||
----
|
||||
33
docs/doc_examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc
Normal file
33
docs/doc_examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc
Normal 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);
|
||||
----
|
||||
@ -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);
|
||||
----
|
||||
@ -5,10 +5,8 @@
|
||||
----
|
||||
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",
|
||||
"cluster.routing.allocation.disk.watermark.low": "90%",
|
||||
"cluster.routing.allocation.disk.watermark.high": "95%",
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
35
docs/doc_examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc
Normal file
35
docs/doc_examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc
Normal 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);
|
||||
----
|
||||
@ -7,14 +7,14 @@ const response = await client.indices.create({
|
||||
index: "test-index",
|
||||
mappings: {
|
||||
properties: {
|
||||
infer_field: {
|
||||
type: "semantic_text",
|
||||
inference_id: ".elser-2-elasticsearch",
|
||||
},
|
||||
source_field: {
|
||||
type: "text",
|
||||
copy_to: "infer_field",
|
||||
},
|
||||
infer_field: {
|
||||
type: "semantic_text",
|
||||
inference_id: ".elser-2-elasticsearch",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
37
docs/doc_examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc
Normal file
37
docs/doc_examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc
Normal 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);
|
||||
----
|
||||
34
docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc
Normal file
34
docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc
Normal 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);
|
||||
----
|
||||
@ -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.search.slowlog.include.user": true,
|
||||
index: {
|
||||
number_of_replicas: 0,
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
12
docs/doc_examples/89f547649895176c246bb8c41313ff21.asciidoc
Normal file
12
docs/doc_examples/89f547649895176c246bb8c41313ff21.asciidoc
Normal 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);
|
||||
----
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.unfreeze({
|
||||
index: "my-index-000001",
|
||||
const response = await client.indices.getAlias({
|
||||
index: ".ml-anomalies-custom-example",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
39
docs/doc_examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc
Normal file
39
docs/doc_examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc
Normal 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);
|
||||
----
|
||||
42
docs/doc_examples/9250ac57ec81d5192e8ad4c462438489.asciidoc
Normal file
42
docs/doc_examples/9250ac57ec81d5192e8ad4c462438489.asciidoc
Normal 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.bulk({
|
||||
index: "jinaai-index",
|
||||
operations: [
|
||||
{
|
||||
index: {
|
||||
_index: "jinaai-index",
|
||||
_id: "1",
|
||||
},
|
||||
},
|
||||
{
|
||||
content:
|
||||
"Sarah Johnson is a talented marine biologist working at the Oceanographic Institute. Her groundbreaking research on coral reef ecosystems has garnered international attention and numerous accolades.",
|
||||
},
|
||||
{
|
||||
index: {
|
||||
_index: "jinaai-index",
|
||||
_id: "2",
|
||||
},
|
||||
},
|
||||
{
|
||||
content:
|
||||
"She spends months at a time diving in remote locations, meticulously documenting the intricate relationships between various marine species. ",
|
||||
},
|
||||
{
|
||||
index: {
|
||||
_index: "jinaai-index",
|
||||
_id: "3",
|
||||
},
|
||||
},
|
||||
{
|
||||
content:
|
||||
"Her dedication to preserving these delicate underwater environments has inspired a new generation of conservationists.",
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -5,6 +5,9 @@
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "retrievers_example_nested",
|
||||
settings: {
|
||||
number_of_shards: 1,
|
||||
},
|
||||
mappings: {
|
||||
properties: {
|
||||
nested_field: {
|
||||
@ -18,6 +21,9 @@ const response = await client.indices.create({
|
||||
dims: 3,
|
||||
similarity: "l2_norm",
|
||||
index: true,
|
||||
index_options: {
|
||||
type: "flat",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
30
docs/doc_examples/9cc952d4a03264b700136cbc45abc8c6.asciidoc
Normal file
30
docs/doc_examples/9cc952d4a03264b700136cbc45abc8c6.asciidoc
Normal file
@ -0,0 +1,30 @@
|
||||
// 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-byte",
|
||||
mappings: {
|
||||
properties: {
|
||||
my_vector: {
|
||||
type: "rank_vectors",
|
||||
element_type: "byte",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
|
||||
const response1 = await client.index({
|
||||
index: "my-rank-vectors-byte",
|
||||
id: 1,
|
||||
document: {
|
||||
my_vector: [
|
||||
[1, 2, 3],
|
||||
[4, 5, 6],
|
||||
],
|
||||
},
|
||||
});
|
||||
console.log(response1);
|
||||
----
|
||||
12
docs/doc_examples/a46f566ca031375658c22f89b87dc6d2.asciidoc
Normal file
12
docs/doc_examples/a46f566ca031375658c22f89b87dc6d2.asciidoc
Normal 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.cat.indices({
|
||||
index: ".ml-anomalies-custom-example",
|
||||
v: "true",
|
||||
h: "index,store.size",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
12
docs/doc_examples/a675fafa7c688cb3ea1be09bf887ebf0.asciidoc
Normal file
12
docs/doc_examples/a675fafa7c688cb3ea1be09bf887ebf0.asciidoc
Normal 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.indices.get({
|
||||
index: ".migrated-ds-my-data-stream-2025.01.23-000001",
|
||||
human: "true",
|
||||
filter_path: "*.settings.index.version.created_string",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
18
docs/doc_examples/b590241c4296299b836fbb5a95bdd2dc.asciidoc
Normal file
18
docs/doc_examples/b590241c4296299b836fbb5a95bdd2dc.asciidoc
Normal 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: {
|
||||
avg_order_value: {
|
||||
avg: {
|
||||
field: "taxful_total_price",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
21
docs/doc_examples/b6d278737d27973e498ac61cda9e5126.asciidoc
Normal file
21
docs/doc_examples/b6d278737d27973e498ac61cda9e5126.asciidoc
Normal 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.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
daily_orders: {
|
||||
date_histogram: {
|
||||
field: "order_date",
|
||||
calendar_interval: "day",
|
||||
format: "yyyy-MM-dd",
|
||||
min_doc_count: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -6,6 +6,7 @@
|
||||
const response = await client.indices.resolveCluster({
|
||||
name: "not-present,clust*:my-index*,oldcluster:*",
|
||||
ignore_unavailable: "false",
|
||||
timeout: "5s",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
12
docs/doc_examples/bccd4eb26b1a325d103b12e198a13c08.asciidoc
Normal file
12
docs/doc_examples/bccd4eb26b1a325d103b12e198a13c08.asciidoc
Normal 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.indices.getSettings({
|
||||
index: "_all",
|
||||
expand_wildcards: "all",
|
||||
filter_path: "*.settings.index.*.slowlog",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -6,15 +6,11 @@
|
||||
const response = await client.update({
|
||||
index: "test",
|
||||
id: 1,
|
||||
script: {
|
||||
source: "ctx._source.counter += params.count",
|
||||
lang: "painless",
|
||||
params: {
|
||||
count: 4,
|
||||
},
|
||||
doc: {
|
||||
product_price: 100,
|
||||
},
|
||||
upsert: {
|
||||
counter: 1,
|
||||
product_price: 50,
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
22
docs/doc_examples/bdc55256fa5f701680631a149dbb75a9.asciidoc
Normal file
22
docs/doc_examples/bdc55256fa5f701680631a149dbb75a9.asciidoc
Normal file
@ -0,0 +1,22 @@
|
||||
// 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: {
|
||||
sales_by_category: {
|
||||
terms: {
|
||||
field: "category.keyword",
|
||||
size: 5,
|
||||
order: {
|
||||
_count: "desc",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
31
docs/doc_examples/bdd28276618235487ac96bd6679bc206.asciidoc
Normal file
31
docs/doc_examples/bdd28276618235487ac96bd6679bc206.asciidoc
Normal 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.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
daily_sales: {
|
||||
date_histogram: {
|
||||
field: "order_date",
|
||||
calendar_interval: "day",
|
||||
},
|
||||
aggs: {
|
||||
revenue: {
|
||||
sum: {
|
||||
field: "taxful_total_price",
|
||||
},
|
||||
},
|
||||
cumulative_revenue: {
|
||||
cumulative_sum: {
|
||||
buckets_path: "revenue",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
22
docs/doc_examples/bf3c3bc41c593a80faebef1df353e483.asciidoc
Normal file
22
docs/doc_examples/bf3c3bc41c593a80faebef1df353e483.asciidoc
Normal file
@ -0,0 +1,22 @@
|
||||
// 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: "jinaai-rerank",
|
||||
inference_config: {
|
||||
service: "jinaai",
|
||||
service_settings: {
|
||||
api_key: "<api_key>",
|
||||
model_id: "jina-reranker-v2-base-multilingual",
|
||||
},
|
||||
task_settings: {
|
||||
top_n: 10,
|
||||
return_documents: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
11
docs/doc_examples/c3b77e11b16e37e9e37e28dec922432e.asciidoc
Normal file
11
docs/doc_examples/c3b77e11b16e37e9e37e28dec922432e.asciidoc
Normal 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.esql.query({
|
||||
query:
|
||||
'\nFROM library\n| WHERE match(author, "Frank Herbert", {"minimum_should_match": 2, "operator": "AND"})\n| LIMIT 5\n',
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
35
docs/doc_examples/cdb7613b445e6ed6e8b473f9cae1af90.asciidoc
Normal file
35
docs/doc_examples/cdb7613b445e6ed6e8b473f9cae1af90.asciidoc
Normal 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: true,
|
||||
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);
|
||||
----
|
||||
11
docs/doc_examples/d2e7dead222cfbebbd2c21a7cc1893b4.asciidoc
Normal file
11
docs/doc_examples/d2e7dead222cfbebbd2c21a7cc1893b4.asciidoc
Normal 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.cluster.state({
|
||||
metric: "metadata",
|
||||
filter_path: "metadata.indices.*.system",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
28
docs/doc_examples/d3672a87a857ddb87519788236e57497.asciidoc
Normal file
28
docs/doc_examples/d3672a87a857ddb87519788236e57497.asciidoc
Normal 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: "jinaai-index",
|
||||
retriever: {
|
||||
text_similarity_reranker: {
|
||||
retriever: {
|
||||
standard: {
|
||||
query: {
|
||||
semantic: {
|
||||
field: "content",
|
||||
query: "who inspired taking care of the sea?",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
field: "content",
|
||||
rank_window_size: 100,
|
||||
inference_id: "jinaai-rerank",
|
||||
inference_text: "who inspired taking care of the sea?",
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
44
docs/doc_examples/d3a0f648d0fd50b54a4e9ebe363c5047.asciidoc
Normal file
44
docs/doc_examples/d3a0f648d0fd50b54a4e9ebe363c5047.asciidoc
Normal 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: {
|
||||
linear: {
|
||||
retrievers: [
|
||||
{
|
||||
retriever: {
|
||||
standard: {
|
||||
query: {
|
||||
query_string: {
|
||||
query: "(information retrieval) OR (artificial intelligence)",
|
||||
default_field: "text",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
weight: 2,
|
||||
normalizer: "minmax",
|
||||
},
|
||||
{
|
||||
retriever: {
|
||||
knn: {
|
||||
field: "vector",
|
||||
query_vector: [0.23, 0.67, 0.89],
|
||||
k: 3,
|
||||
num_candidates: 5,
|
||||
},
|
||||
},
|
||||
weight: 1.5,
|
||||
normalizer: "minmax",
|
||||
},
|
||||
],
|
||||
rank_window_size: 10,
|
||||
},
|
||||
},
|
||||
_source: false,
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
17
docs/doc_examples/d6a4548b29e939fb197189c20c7c016f.asciidoc
Normal file
17
docs/doc_examples/d6a4548b29e939fb197189c20c7c016f.asciidoc
Normal 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: "chat_completion",
|
||||
inference_id: "chat-completion-endpoint",
|
||||
inference_config: {
|
||||
service: "elastic",
|
||||
service_settings: {
|
||||
model_id: "model-1",
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
57
docs/doc_examples/dd16c9c981551c9da47ebb5ef5105fa0.asciidoc
Normal file
57
docs/doc_examples/dd16c9c981551c9da47ebb5ef5105fa0.asciidoc
Normal 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.indices.updateAliases({
|
||||
actions: [
|
||||
{
|
||||
add: {
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
alias: ".ml-anomalies-example1",
|
||||
filter: {
|
||||
term: {
|
||||
job_id: {
|
||||
value: "example1",
|
||||
},
|
||||
},
|
||||
},
|
||||
is_hidden: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
add: {
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
alias: ".ml-anomalies-example2",
|
||||
filter: {
|
||||
term: {
|
||||
job_id: {
|
||||
value: "example2",
|
||||
},
|
||||
},
|
||||
},
|
||||
is_hidden: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
remove: {
|
||||
index: ".ml-anomalies-custom-example",
|
||||
aliases: ".ml-anomalies-*",
|
||||
},
|
||||
},
|
||||
{
|
||||
remove_index: {
|
||||
index: ".ml-anomalies-custom-example",
|
||||
},
|
||||
},
|
||||
{
|
||||
add: {
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
alias: ".ml-anomalies-custom-example",
|
||||
is_hidden: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -7,7 +7,7 @@ const response = await client.inference.put({
|
||||
task_type: "sparse_embedding",
|
||||
inference_id: "elser_embeddings",
|
||||
inference_config: {
|
||||
service: "elser",
|
||||
service: "elasticsearch",
|
||||
service_settings: {
|
||||
num_allocations: 1,
|
||||
num_threads: 1,
|
||||
29
docs/doc_examples/e375c7da666276c4df6664c6821cd5f4.asciidoc
Normal file
29
docs/doc_examples/e375c7da666276c4df6664c6821cd5f4.asciidoc
Normal file
@ -0,0 +1,29 @@
|
||||
// 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-float",
|
||||
mappings: {
|
||||
properties: {
|
||||
my_vector: {
|
||||
type: "rank_vectors",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
|
||||
const response1 = await client.index({
|
||||
index: "my-rank-vectors-float",
|
||||
id: 1,
|
||||
document: {
|
||||
my_vector: [
|
||||
[0.5, 10, 6],
|
||||
[-0.5, 10, 10],
|
||||
],
|
||||
},
|
||||
});
|
||||
console.log(response1);
|
||||
----
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.security.queryRole({
|
||||
sort: ["name"],
|
||||
const response = await client.migration.deprecations({
|
||||
index: ".ml-anomalies-*",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -4,9 +4,10 @@
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.putSettings({
|
||||
index: "my-index-000001",
|
||||
index: "*",
|
||||
settings: {
|
||||
"index.indexing.slowlog.include.user": true,
|
||||
"index.indexing.slowlog.threshold.index.warn": "30s",
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -30,6 +30,13 @@ const response = await client.search({
|
||||
],
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
fields: {
|
||||
semantic_text: {
|
||||
number_of_fragments: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -5,6 +5,9 @@
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "retrievers_example",
|
||||
settings: {
|
||||
number_of_shards: 1,
|
||||
},
|
||||
mappings: {
|
||||
properties: {
|
||||
vector: {
|
||||
@ -12,6 +15,9 @@ const response = await client.indices.create({
|
||||
dims: 3,
|
||||
similarity: "l2_norm",
|
||||
index: true,
|
||||
index_options: {
|
||||
type: "flat",
|
||||
},
|
||||
},
|
||||
text: {
|
||||
type: "text",
|
||||
@ -22,6 +28,9 @@ const response = await client.indices.create({
|
||||
topic: {
|
||||
type: "keyword",
|
||||
},
|
||||
timestamp: {
|
||||
type: "date",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -35,6 +44,7 @@ const response1 = await client.index({
|
||||
text: "Large language models are revolutionizing information retrieval by boosting search precision, deepening contextual understanding, and reshaping user experiences in data-rich environments.",
|
||||
year: 2024,
|
||||
topic: ["llm", "ai", "information_retrieval"],
|
||||
timestamp: "2021-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response1);
|
||||
@ -47,6 +57,7 @@ const response2 = await client.index({
|
||||
text: "Artificial intelligence is transforming medicine, from advancing diagnostics and tailoring treatment plans to empowering predictive patient care for improved health outcomes.",
|
||||
year: 2023,
|
||||
topic: ["ai", "medicine"],
|
||||
timestamp: "2022-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response2);
|
||||
@ -59,6 +70,7 @@ const response3 = await client.index({
|
||||
text: "AI is redefining security by enabling advanced threat detection, proactive risk analysis, and dynamic defenses against increasingly sophisticated cyber threats.",
|
||||
year: 2024,
|
||||
topic: ["ai", "security"],
|
||||
timestamp: "2023-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response3);
|
||||
@ -71,6 +83,7 @@ const response4 = await client.index({
|
||||
text: "Elastic introduces Elastic AI Assistant, the open, generative AI sidekick powered by ESRE to democratize cybersecurity and enable users of every skill level.",
|
||||
year: 2023,
|
||||
topic: ["ai", "elastic", "assistant"],
|
||||
timestamp: "2024-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response4);
|
||||
@ -83,6 +96,7 @@ const response5 = await client.index({
|
||||
text: "Learn how to spin up a deployment of our hosted Elasticsearch Service and use Elastic Observability to gain deeper insight into the behavior of your applications and systems.",
|
||||
year: 2024,
|
||||
topic: ["documentation", "observability", "elastic"],
|
||||
timestamp: "2025-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response5);
|
||||
18
docs/doc_examples/fff86117c47f974074284644e8a97a99.asciidoc
Normal file
18
docs/doc_examples/fff86117c47f974074284644e8a97a99.asciidoc
Normal 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: "text_embedding",
|
||||
inference_id: "jinaai-embeddings",
|
||||
inference_config: {
|
||||
service: "jinaai",
|
||||
service_settings: {
|
||||
model_id: "jina-embeddings-v3",
|
||||
api_key: "<api_key>",
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,10 +1,10 @@
|
||||
[[bulk_examples]]
|
||||
=== Bulk
|
||||
|
||||
With the {jsclient}/api-reference.html#_bulk[`bulk` API], you can perform multiple index/delete operations in a
|
||||
With the {jsclient}/api-reference.html#_bulk[`bulk` API], you can perform multiple index/delete operations in a
|
||||
single API call. The `bulk` API significantly increases indexing speed.
|
||||
|
||||
NOTE: You can also use the {jsclient}/client-helpers.html[bulk helper].
|
||||
NOTE: You can also use the <<bulk-helper,bulk helper>>.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
|
||||
@ -6,7 +6,7 @@ Check that the document `/game-of-thrones/1` exists.
|
||||
NOTE: Since this API uses the `HEAD` method, the body value will be boolean.
|
||||
|
||||
[source,js]
|
||||
---------
|
||||
----
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
@ -34,4 +34,4 @@ async function run () {
|
||||
}
|
||||
|
||||
run().catch(console.log)
|
||||
---------
|
||||
----
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
[[get_examples]]
|
||||
=== Get
|
||||
|
||||
The get API allows to get a typed JSON document from the index based on its id.
|
||||
The following example gets a JSON document from an index called
|
||||
The get API allows to get a typed JSON document from the index based on its id.
|
||||
The following example gets a JSON document from an index called
|
||||
`game-of-thrones`, under a type called `_doc`, with id valued `'1'`.
|
||||
|
||||
[source,js]
|
||||
---------
|
||||
----
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
@ -34,4 +34,4 @@ async function run () {
|
||||
}
|
||||
|
||||
run().catch(console.log)
|
||||
---------
|
||||
----
|
||||
|
||||
@ -62,4 +62,4 @@ async function run () {
|
||||
}
|
||||
|
||||
run().catch(console.log)
|
||||
----
|
||||
----
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
[[scroll_examples]]
|
||||
=== Scroll
|
||||
|
||||
While a search request returns a single “page” of results, the scroll API can be
|
||||
used to retrieve large numbers of results (or even all results) from a single
|
||||
search request, in much the same way as you would use a cursor on a traditional
|
||||
While a search request returns a single “page” of results, the scroll API can be
|
||||
used to retrieve large numbers of results (or even all results) from a single
|
||||
search request, in much the same way as you would use a cursor on a traditional
|
||||
database.
|
||||
|
||||
Scrolling is not intended for real time user requests, but rather for processing
|
||||
large amounts of data, for example in order to reindex the contents of one index
|
||||
Scrolling is not intended for real time user requests, but rather for processing
|
||||
large amounts of data, for example in order to reindex the contents of one index
|
||||
into a new index with a different configuration.
|
||||
|
||||
NOTE: The results that are returned from a scroll request reflect the state of
|
||||
the index at the time that the initial search request was made, like a snapshot
|
||||
in time. Subsequent changes to documents (index, update or delete) will only
|
||||
NOTE: The results that are returned from a scroll request reflect the state of
|
||||
the index at the time that the initial search request was made, like a snapshot
|
||||
in time. Subsequent changes to documents (index, update or delete) will only
|
||||
affect later search requests.
|
||||
|
||||
In order to use scrolling, the initial search request should specify the scroll
|
||||
parameter in the query string, which tells {es} how long it should keep the
|
||||
In order to use scrolling, the initial search request should specify the scroll
|
||||
parameter in the query string, which tells {es} how long it should keep the
|
||||
“search context” alive.
|
||||
|
||||
NOTE: Did you know that we provide an helper for sending scroll requests? You can find it {jsclient}/client-helpers.html[here].
|
||||
NOTE: Did you know that we provide an helper for sending scroll requests? You can find it <<scroll-search-helper,here>>.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
@ -113,7 +113,7 @@ async function run () {
|
||||
run().catch(console.log)
|
||||
----
|
||||
|
||||
Another cool usage of the `scroll` API can be done with Node.js ≥ 10, by using
|
||||
Another cool usage of the `scroll` API can be done with Node.js ≥ 10, by using
|
||||
async iteration!
|
||||
|
||||
[source,js]
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
[[update_examples]]
|
||||
=== Update
|
||||
|
||||
The update API allows updates of a specific document using the given script. In
|
||||
the following example, we will index a document that also tracks how many times
|
||||
The update API allows updates of a specific document using the given script. In
|
||||
the following example, we will index a document that also tracks how many times
|
||||
a character has said the given quote, and then we will update the `times` field.
|
||||
|
||||
[source,js]
|
||||
---------
|
||||
----
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
@ -48,12 +48,12 @@ async function run () {
|
||||
|
||||
run().catch(console.log)
|
||||
|
||||
---------
|
||||
----
|
||||
|
||||
With the update API, you can also run a partial update of a document.
|
||||
|
||||
[source,js]
|
||||
---------
|
||||
----
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
@ -92,4 +92,4 @@ async function run () {
|
||||
run().catch(console.log)
|
||||
|
||||
|
||||
---------
|
||||
----
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
[[update_by_query_examples]]
|
||||
=== Update By Query
|
||||
|
||||
The simplest usage of _update_by_query just performs an update on every document
|
||||
in the index without changing the source. This is useful to pick up a new
|
||||
The simplest usage of _update_by_query just performs an update on every document
|
||||
in the index without changing the source. This is useful to pick up a new
|
||||
property or some other online mapping change.
|
||||
|
||||
[source,js]
|
||||
---------
|
||||
----
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
@ -57,4 +57,4 @@ async function run () {
|
||||
|
||||
run().catch(console.log)
|
||||
|
||||
---------
|
||||
----
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,8 @@
|
||||
[[timeout-best-practices]]
|
||||
=== Timeout best practices
|
||||
|
||||
This client is configured by default to operate like many HTTP client libraries do, by using a relatively short (30 second) timeout on all requests sent to {es}, raising a `TimeoutError` when that time period has elapsed without receiving a response. However, {es} will always eventually respond to any request, even if it takes several minutes. The {ref}/modules-network.html#_http_client_configuration[official {es} recommendation] is to disable response timeouts entirely by default.
|
||||
Starting in 9.0.0, this client is configured to not time out any HTTP request by default. {es} will always eventually respond to any request, even if it takes several minutes. Reissuing a request that it has not responded to yet can cause performance side effects. See the {ref}/modules-network.html#_http_client_configuration[official {es} recommendations for HTTP clients] for more information.
|
||||
|
||||
Since changing this default would be a breaking change, we won't do that until the next major release. In the meantime, here is our recommendation for properly configuring your client:
|
||||
Prior to 9.0, this client was configured by default to operate like many HTTP client libraries do, by using a relatively short (30 second) timeout on all requests sent to {es}, raising a `TimeoutError` when that time period elapsed without receiving a response.
|
||||
|
||||
* Ensure keep-alive is enabled; this is the default, so no settings need to be changed, unless you have set `agent` to `false` or provided an alternate `agent` that disables keep-alive
|
||||
* If using the default `UndiciConnection`, disable request timeouts by setting `timeout` to `0`
|
||||
* If using the legacy `HttpConnection`, set `timeout` to a very large number (e.g. `86400000`, or one day)
|
||||
If your circumstances require you to set timeouts on Elasticsearch requests, setting the `requestTimeout` value to a millisecond value will cause this client to operate as it did prior to 9.0.
|
||||
|
||||
69
package.json
69
package.json
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@elastic/elasticsearch",
|
||||
"version": "8.16.3",
|
||||
"versionCanary": "8.16.3-canary.0",
|
||||
"version": "9.0.0-alpha.4",
|
||||
"versionCanary": "9.0.0-canary.0",
|
||||
"description": "The official Elasticsearch client for Node.js",
|
||||
"main": "./index.js",
|
||||
"types": "index.d.ts",
|
||||
@ -56,41 +56,40 @@
|
||||
"node": ">=18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@elastic/request-converter": "^8.16.1",
|
||||
"@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
|
||||
"@types/debug": "^4.1.7",
|
||||
"@types/ms": "^0.7.31",
|
||||
"@types/node": "^18.19.55",
|
||||
"@types/sinonjs__fake-timers": "^8.1.2",
|
||||
"@types/split2": "^3.2.1",
|
||||
"@types/stoppable": "^1.1.1",
|
||||
"@types/tap": "^15.0.7",
|
||||
"chai": "^4.3.7",
|
||||
"cross-zip": "^4.0.0",
|
||||
"desm": "^1.2.0",
|
||||
"into-stream": "^7.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"license-checker": "^25.0.1",
|
||||
"minimist": "^1.2.6",
|
||||
"ms": "^2.1.3",
|
||||
"node-abort-controller": "^3.0.1",
|
||||
"node-fetch": "^2.6.7",
|
||||
"ora": "^5.4.1",
|
||||
"proxy": "^1.0.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"semver": "^7.3.7",
|
||||
"split2": "^4.1.0",
|
||||
"stoppable": "^1.1.0",
|
||||
"tap": "^21.0.1",
|
||||
"ts-node": "^10.7.0",
|
||||
"ts-standard": "^12.0.2",
|
||||
"typescript": "^4.6.4",
|
||||
"workq": "^3.0.0",
|
||||
"xmlbuilder2": "^3.0.2",
|
||||
"zx": "^7.2.2"
|
||||
"@elastic/request-converter": "8.17.0",
|
||||
"@sinonjs/fake-timers": "14.0.0",
|
||||
"@types/debug": "4.1.12",
|
||||
"@types/ms": "0.7.34",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/sinonjs__fake-timers": "8.1.5",
|
||||
"@types/split2": "4.2.3",
|
||||
"@types/stoppable": "1.1.3",
|
||||
"chai": "5.2.0",
|
||||
"cross-zip": "4.0.1",
|
||||
"desm": "1.3.1",
|
||||
"into-stream": "8.0.1",
|
||||
"js-yaml": "4.1.0",
|
||||
"license-checker": "25.0.1",
|
||||
"minimist": "1.2.8",
|
||||
"ms": "2.1.3",
|
||||
"node-abort-controller": "3.1.1",
|
||||
"node-fetch": "2.7.0",
|
||||
"ora": "5.4.1",
|
||||
"proxy": "1.0.2",
|
||||
"rimraf": "3.0.2",
|
||||
"semver": "7.6.3",
|
||||
"split2": "4.2.0",
|
||||
"stoppable": "1.1.0",
|
||||
"tap": "21.0.2",
|
||||
"ts-node": "10.9.2",
|
||||
"ts-standard": "12.0.2",
|
||||
"typescript": "5.7.3",
|
||||
"workq": "3.0.0",
|
||||
"xmlbuilder2": "3.1.1",
|
||||
"zx": "7.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/transport": "^8.9.1",
|
||||
"@elastic/transport": "9.0.0-alpha.1",
|
||||
"apache-arrow": "^18.0.0",
|
||||
"tslib": "^2.4.0"
|
||||
},
|
||||
|
||||
32
renovate.json
Normal file
32
renovate.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"local>elastic/renovate-config"
|
||||
],
|
||||
"schedule": [
|
||||
"* * * * 0"
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"matchDepTypes": [
|
||||
"devDependencies"
|
||||
],
|
||||
"automerge": true,
|
||||
"labels": [
|
||||
"backport 8.x"
|
||||
]
|
||||
},
|
||||
{
|
||||
"matchManagers": [
|
||||
"dockerfile"
|
||||
],
|
||||
"pinDigests": false
|
||||
},
|
||||
{
|
||||
"matchDatasources": [
|
||||
"docker"
|
||||
],
|
||||
"pinDigests": false
|
||||
}
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user