Compare commits
77 Commits
v8.17.0
...
v9.0.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 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"
|
provider: "gcp"
|
||||||
image: family/core-ubuntu-2204
|
image: family/core-ubuntu-2204
|
||||||
plugins:
|
plugins:
|
||||||
- junit-annotate#v2.4.1:
|
- junit-annotate#v2.6.0:
|
||||||
artifacts: "junit-output/junit-*.xml"
|
artifacts: "junit-output/junit-*.xml"
|
||||||
job-uuid-file-pattern: "junit-(.*).xml"
|
job-uuid-file-pattern: "junit-(.*).xml"
|
||||||
fail-build-on-error: true
|
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
|
if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then
|
||||||
# fall back to branch name or `main` if no VERSION is set
|
# fall back to branch name or `main` if no VERSION is set
|
||||||
branch_name=$(git rev-parse --abbrev-ref HEAD)
|
branch_name=$(git rev-parse --abbrev-ref HEAD)
|
||||||
if [[ "$branch_name" =~ ^[0-9]+\.[0-9]+ ]]; then
|
if [[ "$branch_name" =~ ^[0-9]+\.([0-9]+|x) ]]; then
|
||||||
echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m"
|
echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m"
|
||||||
VERSION="$branch_name"
|
VERSION="$branch_name"
|
||||||
else
|
else
|
||||||
|
|||||||
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
|
|
||||||
21
.github/workflows/comment-on-asciidoc-changes.yml
vendored
Normal file
21
.github/workflows/comment-on-asciidoc-changes.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
name: Comment on PR for .asciidoc changes
|
||||||
|
|
||||||
|
on:
|
||||||
|
# We need to use pull_request_target to be able to comment on PRs from forks
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- synchronize
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
- "9.0"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
comment-on-asciidoc-change:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
uses: elastic/docs-builder/.github/workflows/comment-on-asciidoc-changes.yml@main
|
||||||
11
.github/workflows/npm-publish.yml
vendored
11
.github/workflows/npm-publish.yml
vendored
@ -23,15 +23,18 @@ jobs:
|
|||||||
- run: npm install -g npm
|
- run: npm install -g npm
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm test
|
- run: npm test
|
||||||
- run: npm publish --provenance --access public
|
- run: npm publish --provenance --access public --tag alpha
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
- run: |
|
- name: Publish version on GitHub
|
||||||
|
run: |
|
||||||
version=$(jq -r .version package.json)
|
version=$(jq -r .version package.json)
|
||||||
gh release create \
|
gh release create \
|
||||||
-n "[Changelog](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/$BRANCH_NAME/changelog-client.html)" \
|
-n "This is a 9.0.0 pre-release alpha. Changes may not be stable." \
|
||||||
|
--latest=false \
|
||||||
|
--prerelease \
|
||||||
--target "$BRANCH_NAME" \
|
--target "$BRANCH_NAME" \
|
||||||
-t "v$version" \
|
--title "v$version" \
|
||||||
"v$version"
|
"v$version"
|
||||||
env:
|
env:
|
||||||
BRANCH_NAME: ${{ github.event.inputs.branch }}
|
BRANCH_NAME: ${{ github.event.inputs.branch }}
|
||||||
|
|||||||
2
.github/workflows/serverless-patch.yml
vendored
2
.github/workflows/serverless-patch.yml
vendored
@ -42,7 +42,7 @@ jobs:
|
|||||||
- name: Apply patch from stack to serverless
|
- name: Apply patch from stack to serverless
|
||||||
id: apply-patch
|
id: apply-patch
|
||||||
run: $GITHUB_WORKSPACE/stack/.github/workflows/serverless-patch.sh
|
run: $GITHUB_WORKSPACE/stack/.github/workflows/serverless-patch.sh
|
||||||
- uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6
|
- uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
path: serverless
|
path: serverless
|
||||||
|
|||||||
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:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '30 1 * * *'
|
- cron: "30 1 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8
|
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9
|
||||||
with:
|
with:
|
||||||
stale-issue-label: stale
|
stale-issue-label: stale
|
||||||
stale-pr-label: stale
|
stale-pr-label: stale
|
||||||
days-before-stale: 90
|
days-before-stale: 90
|
||||||
days-before-close: 14
|
days-before-close: 14
|
||||||
exempt-issue-labels: 'good first issue'
|
exempt-issue-labels: "good first issue,tracking"
|
||||||
close-issue-label: closed-stale
|
close-issue-label: closed-stale
|
||||||
close-pr-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-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-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."
|
||||||
|
|||||||
@ -13,7 +13,6 @@ const client = new Client({
|
|||||||
cloud: { id: '<cloud-id>' },
|
cloud: { id: '<cloud-id>' },
|
||||||
auth: { apiKey: 'base64EncodedKey' },
|
auth: { apiKey: 'base64EncodedKey' },
|
||||||
maxRetries: 5,
|
maxRetries: 5,
|
||||||
requestTimeout: 60000,
|
|
||||||
sniffOnStart: true
|
sniffOnStart: true
|
||||||
})
|
})
|
||||||
----
|
----
|
||||||
@ -82,7 +81,7 @@ _Default:_ `3`
|
|||||||
|
|
||||||
|`requestTimeout`
|
|`requestTimeout`
|
||||||
|`number` - Max request timeout in milliseconds for each request. +
|
|`number` - Max request timeout in milliseconds for each request. +
|
||||||
_Default:_ `30000`
|
_Default:_ No value
|
||||||
|
|
||||||
|`pingTimeout`
|
|`pingTimeout`
|
||||||
|`number` - Max ping request timeout in milliseconds for each request. +
|
|`number` - Max ping request timeout in milliseconds for each request. +
|
||||||
|
|||||||
@ -1,6 +1,22 @@
|
|||||||
[[changelog-client]]
|
[[changelog-client]]
|
||||||
== Release notes
|
== 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]
|
[discrete]
|
||||||
=== 8.17.0
|
=== 8.17.0
|
||||||
|
|
||||||
@ -668,6 +684,7 @@ ac.abort()
|
|||||||
----
|
----
|
||||||
|
|
||||||
[discrete]
|
[discrete]
|
||||||
|
[[remove-body-key]]
|
||||||
===== Remove the body key from the request
|
===== Remove the body key from the request
|
||||||
|
|
||||||
*Breaking: Yes* | *Migration effort: Small*
|
*Breaking: Yes* | *Migration effort: Small*
|
||||||
|
|||||||
@ -28,7 +28,6 @@ const client = new Client({
|
|||||||
})
|
})
|
||||||
const child = client.child({
|
const child = client.child({
|
||||||
headers: { 'x-foo': 'bar' },
|
headers: { 'x-foo': 'bar' },
|
||||||
requestTimeout: 1000
|
|
||||||
})
|
})
|
||||||
|
|
||||||
client.info().then(console.log, console.log)
|
client.info().then(console.log, console.log)
|
||||||
|
|||||||
@ -414,8 +414,8 @@ The supported request specific options are:
|
|||||||
_Default:_ `null`
|
_Default:_ `null`
|
||||||
|
|
||||||
|`requestTimeout`
|
|`requestTimeout`
|
||||||
|`number | string` - Max request timeout for the request in milliseconds, it overrides the client default. +
|
|`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:_ `30000`
|
_Default:_ No timeout
|
||||||
|
|
||||||
|`retryOnTimeout`
|
|`retryOnTimeout`
|
||||||
|`boolean` - Retry requests that have timed out.
|
|`boolean` - Retry requests that have timed out.
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.unfreeze({
|
const response = await client.indices.getMapping({
|
||||||
index: "my-index-000001",
|
index: "kibana_sample_data_ecommerce",
|
||||||
});
|
});
|
||||||
console.log(response);
|
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.debug": "2s",
|
||||||
"index.indexing.slowlog.threshold.index.trace": "500ms",
|
"index.indexing.slowlog.threshold.index.trace": "500ms",
|
||||||
"index.indexing.slowlog.source": "1000",
|
"index.indexing.slowlog.source": "1000",
|
||||||
|
"index.indexing.slowlog.reformat": true,
|
||||||
|
"index.indexing.slowlog.include.user": true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
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);
|
||||||
|
----
|
||||||
@ -3,8 +3,12 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQuery({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_query/async",
|
||||||
|
querystring: {
|
||||||
format: "json",
|
format: "json",
|
||||||
|
},
|
||||||
body: {
|
body: {
|
||||||
query:
|
query:
|
||||||
"\n FROM my-index-000001,cluster_one:my-index-000001,cluster_two:my-index*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
|
"\n FROM my-index-000001,cluster_one:my-index-000001,cluster_two:my-index*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
|
||||||
|
|||||||
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.searchApplication.renderQuery({
|
const response = await client.transport.request({
|
||||||
name: "my-app",
|
method: "POST",
|
||||||
|
path: "/_application/search_application/my-app/_render_query",
|
||||||
body: {
|
body: {
|
||||||
params: {
|
params: {
|
||||||
query_string: "my first query",
|
query_string: "my first query",
|
||||||
|
|||||||
@ -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);
|
|
||||||
----
|
|
||||||
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);
|
||||||
|
----
|
||||||
@ -3,12 +3,14 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.inference({
|
const response = await client.inference.put({
|
||||||
task_type: "my-inference-endpoint",
|
task_type: "my-inference-endpoint",
|
||||||
inference_id: "_update",
|
inference_id: "_update",
|
||||||
|
inference_config: {
|
||||||
service_settings: {
|
service_settings: {
|
||||||
api_key: "<API_KEY>",
|
api_key: "<API_KEY>",
|
||||||
},
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
@ -1,22 +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: {
|
|
||||||
sparse_vector: {
|
|
||||||
field: "inference_field.inference.chunks.embeddings",
|
|
||||||
inference_id: "my-inference-id",
|
|
||||||
query: "mountain lake",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(response);
|
|
||||||
----
|
|
||||||
@ -11,7 +11,7 @@ const response = await client.searchApplication.put({
|
|||||||
script: {
|
script: {
|
||||||
lang: "mustache",
|
lang: "mustache",
|
||||||
source:
|
source:
|
||||||
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n \n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
|
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
|
||||||
params: {
|
params: {
|
||||||
query: "",
|
query: "",
|
||||||
_es_filters: {},
|
_es_filters: {},
|
||||||
|
|||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.simulate.ingest({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_ingest/_simulate",
|
||||||
body: {
|
body: {
|
||||||
docs: [
|
docs: [
|
||||||
{
|
{
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.oidcLogout({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/oidc/logout",
|
||||||
body: {
|
body: {
|
||||||
token:
|
token:
|
||||||
"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
|
"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -3,10 +3,12 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQueryGet({
|
const response = await client.transport.request({
|
||||||
id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
|
method: "GET",
|
||||||
|
path: "/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
|
||||||
|
querystring: {
|
||||||
wait_for_completion_timeout: "30s",
|
wait_for_completion_timeout: "30s",
|
||||||
body: null,
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -14,6 +14,7 @@ const response = await client.indices.putSettings({
|
|||||||
"index.search.slowlog.threshold.fetch.info": "800ms",
|
"index.search.slowlog.threshold.fetch.info": "800ms",
|
||||||
"index.search.slowlog.threshold.fetch.debug": "500ms",
|
"index.search.slowlog.threshold.fetch.debug": "500ms",
|
||||||
"index.search.slowlog.threshold.fetch.trace": "200ms",
|
"index.search.slowlog.threshold.fetch.trace": "200ms",
|
||||||
|
"index.search.slowlog.include.user": true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
67
docs/doc_examples/37f367ca81a16d3aef4ef7126ec33a2e.asciidoc
Normal file
67
docs/doc_examples/37f367ca81a16d3aef4ef7126ec33a2e.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.search({
|
||||||
|
index: "movies",
|
||||||
|
size: 10,
|
||||||
|
retriever: {
|
||||||
|
rescorer: {
|
||||||
|
rescore: {
|
||||||
|
query: {
|
||||||
|
window_size: 50,
|
||||||
|
rescore_query: {
|
||||||
|
script_score: {
|
||||||
|
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);
|
||||||
|
----
|
||||||
@ -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);
|
|
||||||
----
|
|
||||||
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);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQuery({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_query/async",
|
||||||
body: {
|
body: {
|
||||||
query:
|
query:
|
||||||
"\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ",
|
"\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ",
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQueryGet({
|
const response = await client.transport.request({
|
||||||
id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
|
method: "GET",
|
||||||
body: null,
|
path: "/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
|
||||||
});
|
});
|
||||||
console.log(response);
|
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);
|
||||||
|
----
|
||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.streamInference({
|
const response = await client.transport.request({
|
||||||
task_type: "completion",
|
method: "POST",
|
||||||
inference_id: "openai-completion",
|
path: "/_inference/completion/openai-completion/_stream",
|
||||||
body: {
|
body: {
|
||||||
input: "What is Elastic?",
|
input: "What is Elastic?",
|
||||||
},
|
},
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.oidcPrepareAuthentication({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/oidc/prepare",
|
||||||
body: {
|
body: {
|
||||||
realm: "oidc1",
|
realm: "oidc1",
|
||||||
state: "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO",
|
state: "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO",
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -3,8 +3,12 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQuery({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_query/async",
|
||||||
|
querystring: {
|
||||||
format: "json",
|
format: "json",
|
||||||
|
},
|
||||||
body: {
|
body: {
|
||||||
query:
|
query:
|
||||||
"\n FROM cluster_one:my-index*,cluster_two:logs*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
|
"\n FROM cluster_one:my-index*,cluster_two:logs*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
|
||||||
|
|||||||
@ -5,6 +5,9 @@
|
|||||||
----
|
----
|
||||||
const response = await client.indices.create({
|
const response = await client.indices.create({
|
||||||
index: "retrievers_example",
|
index: "retrievers_example",
|
||||||
|
settings: {
|
||||||
|
number_of_shards: 1,
|
||||||
|
},
|
||||||
mappings: {
|
mappings: {
|
||||||
properties: {
|
properties: {
|
||||||
vector: {
|
vector: {
|
||||||
@ -12,6 +15,9 @@ const response = await client.indices.create({
|
|||||||
dims: 3,
|
dims: 3,
|
||||||
similarity: "l2_norm",
|
similarity: "l2_norm",
|
||||||
index: true,
|
index: true,
|
||||||
|
index_options: {
|
||||||
|
type: "flat",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
type: "text",
|
type: "text",
|
||||||
@ -4,9 +4,11 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.putSettings({
|
const response = await client.indices.putSettings({
|
||||||
index: "my-index-000001",
|
index: "*",
|
||||||
settings: {
|
settings: {
|
||||||
"index.search.slowlog.include.user": true,
|
"index.search.slowlog.include.user": true,
|
||||||
|
"index.search.slowlog.threshold.fetch.warn": "30s",
|
||||||
|
"index.search.slowlog.threshold.query.warn": "30s",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
@ -11,7 +11,7 @@ const response = await client.searchApplication.put({
|
|||||||
script: {
|
script: {
|
||||||
lang: "mustache",
|
lang: "mustache",
|
||||||
source:
|
source:
|
||||||
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n \n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
|
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
|
||||||
params: {
|
params: {
|
||||||
query: "",
|
query: "",
|
||||||
_es_filters: {},
|
_es_filters: {},
|
||||||
|
|||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.bulkUpdateApiKeys({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/api_key/_bulk_update",
|
||||||
body: {
|
body: {
|
||||||
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -12,6 +12,13 @@ const response = await client.search({
|
|||||||
fields: ["my_field", "my_field._2gram", "my_field._3gram"],
|
fields: ["my_field", "my_field._2gram", "my_field._3gram"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
highlight: {
|
||||||
|
fields: {
|
||||||
|
my_field: {
|
||||||
|
matched_fields: ["my_field._index_prefix"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
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);
|
|
||||||
----
|
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.textStructure.findMessageStructure({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_text_structure/find_message_structure",
|
||||||
body: {
|
body: {
|
||||||
messages: [
|
messages: [
|
||||||
"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128",
|
"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128",
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
----
|
----
|
||||||
const response = await client.cluster.putSettings({
|
const response = await client.cluster.putSettings({
|
||||||
persistent: {
|
persistent: {
|
||||||
"cluster.routing.allocation.disk.watermark.low": "30gb",
|
"cluster.routing.allocation.disk.watermark.low": "90%",
|
||||||
|
"cluster.routing.allocation.disk.watermark.high": "95%",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
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);
|
||||||
|
----
|
||||||
11
docs/doc_examples/7ba29f0be2297b54a640b0a17d7ef5ca.asciidoc
Normal file
11
docs/doc_examples/7ba29f0be2297b54a640b0a17d7ef5ca.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.transport.request({
|
||||||
|
method: "DELETE",
|
||||||
|
path: "/_ingest/ip_location/database/my-database-id",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -7,14 +7,14 @@ const response = await client.indices.create({
|
|||||||
index: "test-index",
|
index: "test-index",
|
||||||
mappings: {
|
mappings: {
|
||||||
properties: {
|
properties: {
|
||||||
infer_field: {
|
|
||||||
type: "semantic_text",
|
|
||||||
inference_id: ".elser-2-elasticsearch",
|
|
||||||
},
|
|
||||||
source_field: {
|
source_field: {
|
||||||
type: "text",
|
type: "text",
|
||||||
copy_to: "infer_field",
|
copy_to: "infer_field",
|
||||||
},
|
},
|
||||||
|
infer_field: {
|
||||||
|
type: "semantic_text",
|
||||||
|
inference_id: ".elser-2-elasticsearch",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
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);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.bulkUpdateApiKeys({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/api_key/_bulk_update",
|
||||||
body: {
|
body: {
|
||||||
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
||||||
role_descriptors: {
|
role_descriptors: {
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
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);
|
||||||
|
----
|
||||||
17
docs/doc_examples/91e106a2affbc8df32cd940684a779ed.asciidoc
Normal file
17
docs/doc_examples/91e106a2affbc8df32cd940684a779ed.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.transport.request({
|
||||||
|
method: "PUT",
|
||||||
|
path: "/_ingest/ip_location/database/my-database-1",
|
||||||
|
body: {
|
||||||
|
name: "GeoIP2-Domain",
|
||||||
|
maxmind: {
|
||||||
|
account_id: "1234567",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
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({
|
const response = await client.indices.create({
|
||||||
index: "retrievers_example_nested",
|
index: "retrievers_example_nested",
|
||||||
|
settings: {
|
||||||
|
number_of_shards: 1,
|
||||||
|
},
|
||||||
mappings: {
|
mappings: {
|
||||||
properties: {
|
properties: {
|
||||||
nested_field: {
|
nested_field: {
|
||||||
@ -18,6 +21,9 @@ const response = await client.indices.create({
|
|||||||
dims: 3,
|
dims: 3,
|
||||||
similarity: "l2_norm",
|
similarity: "l2_norm",
|
||||||
index: true,
|
index: true,
|
||||||
|
index_options: {
|
||||||
|
type: "flat",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
11
docs/doc_examples/99fb82d49ac477e6a9dfdd71f9465374.asciidoc
Normal file
11
docs/doc_examples/99fb82d49ac477e6a9dfdd71f9465374.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.transport.request({
|
||||||
|
method: "DELETE",
|
||||||
|
path: "/_ingest/ip_location/database/example-database-id",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.searchApplication.postBehavioralAnalyticsEvent({
|
const response = await client.transport.request({
|
||||||
collection_name: "my_analytics_collection",
|
method: "POST",
|
||||||
event_type: "search_click",
|
path: "/_application/analytics/my_analytics_collection/event/search_click",
|
||||||
body: {
|
body: {
|
||||||
session: {
|
session: {
|
||||||
id: "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9",
|
id: "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9",
|
||||||
|
|||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.oidcAuthenticate({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/oidc/authenticate",
|
||||||
body: {
|
body: {
|
||||||
redirect_uri:
|
redirect_uri:
|
||||||
"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I",
|
"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I",
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.searchApplication.renderQuery({
|
const response = await client.transport.request({
|
||||||
name: "my_search_application",
|
method: "POST",
|
||||||
|
path: "/_application/search_application/my_search_application/_render_query",
|
||||||
body: {
|
body: {
|
||||||
params: {
|
params: {
|
||||||
query_string: "rock climbing",
|
query_string: "rock climbing",
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.searchApplication.renderQuery({
|
const response = await client.transport.request({
|
||||||
name: "my_search_application",
|
method: "POST",
|
||||||
body: null,
|
path: "/_application/search_application/my_search_application/_render_query",
|
||||||
});
|
});
|
||||||
console.log(response);
|
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);
|
||||||
|
----
|
||||||
@ -208,10 +208,13 @@ const response = await client.bulk({
|
|||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
||||||
const response1 = await client.textStructure.findFieldStructure({
|
const response1 = await client.transport.request({
|
||||||
|
method: "GET",
|
||||||
|
path: "/_text_structure/find_field_structure",
|
||||||
|
querystring: {
|
||||||
index: "test-logs",
|
index: "test-logs",
|
||||||
field: "message",
|
field: "message",
|
||||||
body: null,
|
},
|
||||||
});
|
});
|
||||||
console.log(response1);
|
console.log(response1);
|
||||||
----
|
----
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
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);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.simulate.ingest({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_ingest/_simulate",
|
||||||
body: {
|
body: {
|
||||||
docs: [
|
docs: [
|
||||||
{
|
{
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.bulkUpdateApiKeys({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/api_key/_bulk_update",
|
||||||
body: {
|
body: {
|
||||||
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
||||||
role_descriptors: {},
|
role_descriptors: {},
|
||||||
|
|||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.simulate.ingest({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_ingest/_simulate",
|
||||||
body: {
|
body: {
|
||||||
docs: [
|
docs: [
|
||||||
{
|
{
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.oidcPrepareAuthentication({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/oidc/prepare",
|
||||||
body: {
|
body: {
|
||||||
iss: "http://127.0.0.1:8080",
|
iss: "http://127.0.0.1:8080",
|
||||||
login_hint: "this_is_an_opaque_string",
|
login_hint: "this_is_an_opaque_string",
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
15
docs/doc_examples/d4df39f72d3a3b80cd4042f6a21c3f19.asciidoc
Normal file
15
docs/doc_examples/d4df39f72d3a3b80cd4042f6a21c3f19.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.transport.request({
|
||||||
|
method: "PUT",
|
||||||
|
path: "/_ingest/ip_location/database/my-database-2",
|
||||||
|
body: {
|
||||||
|
name: "standard_location",
|
||||||
|
ipinfo: {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
11
docs/doc_examples/d8c053ee26c1533ce936ec81101d8e1b.asciidoc
Normal file
11
docs/doc_examples/d8c053ee26c1533ce936ec81101d8e1b.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.transport.request({
|
||||||
|
method: "GET",
|
||||||
|
path: "/_ingest/ip_location/database/my-database-id",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.getSettings();
|
const response = await client.transport.request({
|
||||||
|
method: "GET",
|
||||||
|
path: "/_security/settings",
|
||||||
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
@ -7,7 +7,7 @@ const response = await client.inference.put({
|
|||||||
task_type: "sparse_embedding",
|
task_type: "sparse_embedding",
|
||||||
inference_id: "elser_embeddings",
|
inference_id: "elser_embeddings",
|
||||||
inference_config: {
|
inference_config: {
|
||||||
service: "elser",
|
service: "elasticsearch",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
num_allocations: 1,
|
num_allocations: 1,
|
||||||
num_threads: 1,
|
num_threads: 1,
|
||||||
@ -1,13 +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.indices.putSettings({
|
|
||||||
index: "my-index-000001",
|
|
||||||
settings: {
|
|
||||||
"index.blocks.read_only_allow_delete": null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(response);
|
|
||||||
----
|
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.oidcPrepareAuthentication({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/oidc/prepare",
|
||||||
body: {
|
body: {
|
||||||
realm: "oidc1",
|
realm: "oidc1",
|
||||||
},
|
},
|
||||||
|
|||||||
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,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.simulate.ingest({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_ingest/_simulate",
|
||||||
body: {
|
body: {
|
||||||
docs: [
|
docs: [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,9 +4,10 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.putSettings({
|
const response = await client.indices.putSettings({
|
||||||
index: "my-index-000001",
|
index: "*",
|
||||||
settings: {
|
settings: {
|
||||||
"index.indexing.slowlog.include.user": true,
|
"index.indexing.slowlog.include.user": true,
|
||||||
|
"index.indexing.slowlog.threshold.index.warn": "30s",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.connector.secretPost({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_connector/_secret",
|
||||||
body: {
|
body: {
|
||||||
value: "encoded_api_key",
|
value: "encoded_api_key",
|
||||||
},
|
},
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -4,7 +4,7 @@
|
|||||||
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.
|
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]
|
[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.
|
NOTE: Since this API uses the `HEAD` method, the body value will be boolean.
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
---------
|
----
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { Client } = require('@elastic/elasticsearch')
|
const { Client } = require('@elastic/elasticsearch')
|
||||||
@ -34,4 +34,4 @@ async function run () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run().catch(console.log)
|
run().catch(console.log)
|
||||||
---------
|
----
|
||||||
|
|||||||
@ -6,7 +6,7 @@ The following example gets a JSON document from an index called
|
|||||||
`game-of-thrones`, under a type called `_doc`, with id valued `'1'`.
|
`game-of-thrones`, under a type called `_doc`, with id valued `'1'`.
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
---------
|
----
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { Client } = require('@elastic/elasticsearch')
|
const { Client } = require('@elastic/elasticsearch')
|
||||||
@ -34,4 +34,4 @@ async function run () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run().catch(console.log)
|
run().catch(console.log)
|
||||||
---------
|
----
|
||||||
|
|||||||
@ -19,7 +19,7 @@ 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
|
parameter in the query string, which tells {es} how long it should keep the
|
||||||
“search context” alive.
|
“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]
|
[source,js]
|
||||||
----
|
----
|
||||||
|
|||||||
@ -6,7 +6,7 @@ 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.
|
a character has said the given quote, and then we will update the `times` field.
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
---------
|
----
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { Client } = require('@elastic/elasticsearch')
|
const { Client } = require('@elastic/elasticsearch')
|
||||||
@ -48,12 +48,12 @@ async function run () {
|
|||||||
|
|
||||||
run().catch(console.log)
|
run().catch(console.log)
|
||||||
|
|
||||||
---------
|
----
|
||||||
|
|
||||||
With the update API, you can also run a partial update of a document.
|
With the update API, you can also run a partial update of a document.
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
---------
|
----
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { Client } = require('@elastic/elasticsearch')
|
const { Client } = require('@elastic/elasticsearch')
|
||||||
@ -92,4 +92,4 @@ async function run () {
|
|||||||
run().catch(console.log)
|
run().catch(console.log)
|
||||||
|
|
||||||
|
|
||||||
---------
|
----
|
||||||
|
|||||||
@ -6,7 +6,7 @@ in the index without changing the source. This is useful to pick up a new
|
|||||||
property or some other online mapping change.
|
property or some other online mapping change.
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
---------
|
----
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { Client } = require('@elastic/elasticsearch')
|
const { Client } = require('@elastic/elasticsearch')
|
||||||
@ -57,4 +57,4 @@ async function run () {
|
|||||||
|
|
||||||
run().catch(console.log)
|
run().catch(console.log)
|
||||||
|
|
||||||
---------
|
----
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,8 @@
|
|||||||
[[timeout-best-practices]]
|
[[timeout-best-practices]]
|
||||||
=== 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 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.
|
||||||
* 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)
|
|
||||||
|
|||||||
17
package.json
17
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@elastic/elasticsearch",
|
"name": "@elastic/elasticsearch",
|
||||||
"version": "8.17.0",
|
"version": "9.0.0-alpha.3",
|
||||||
"versionCanary": "8.17.0-canary.0",
|
"versionCanary": "9.0.0-canary.0",
|
||||||
"description": "The official Elasticsearch client for Node.js",
|
"description": "The official Elasticsearch client for Node.js",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
@ -56,19 +56,18 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@elastic/request-converter": "8.16.1",
|
"@elastic/request-converter": "8.17.0",
|
||||||
"@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
|
"@sinonjs/fake-timers": "14.0.0",
|
||||||
"@types/debug": "4.1.12",
|
"@types/debug": "4.1.12",
|
||||||
"@types/ms": "0.7.34",
|
"@types/ms": "0.7.34",
|
||||||
"@types/node": "22.9.0",
|
"@types/node": "22.10.7",
|
||||||
"@types/sinonjs__fake-timers": "8.1.5",
|
"@types/sinonjs__fake-timers": "8.1.5",
|
||||||
"@types/split2": "4.2.3",
|
"@types/split2": "4.2.3",
|
||||||
"@types/stoppable": "1.1.3",
|
"@types/stoppable": "1.1.3",
|
||||||
"@types/tap": "15.0.12",
|
|
||||||
"chai": "5.1.2",
|
"chai": "5.1.2",
|
||||||
"cross-zip": "4.0.1",
|
"cross-zip": "4.0.1",
|
||||||
"desm": "1.3.1",
|
"desm": "1.3.1",
|
||||||
"into-stream": "7.0.0",
|
"into-stream": "8.0.1",
|
||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
"license-checker": "25.0.1",
|
"license-checker": "25.0.1",
|
||||||
"minimist": "1.2.8",
|
"minimist": "1.2.8",
|
||||||
@ -84,13 +83,13 @@
|
|||||||
"tap": "21.0.1",
|
"tap": "21.0.1",
|
||||||
"ts-node": "10.9.2",
|
"ts-node": "10.9.2",
|
||||||
"ts-standard": "12.0.2",
|
"ts-standard": "12.0.2",
|
||||||
"typescript": "5.6.3",
|
"typescript": "5.7.3",
|
||||||
"workq": "3.0.0",
|
"workq": "3.0.0",
|
||||||
"xmlbuilder2": "3.1.1",
|
"xmlbuilder2": "3.1.1",
|
||||||
"zx": "7.2.3"
|
"zx": "7.2.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@elastic/transport": "^8.9.1",
|
"@elastic/transport": "9.0.0-alpha.1",
|
||||||
"apache-arrow": "^18.0.0",
|
"apache-arrow": "^18.0.0",
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
},
|
},
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user