Compare commits

..

77 Commits

Author SHA1 Message Date
d2c63b4c5f bump 9.0.0 alpha.3 (#2591) 2025-01-30 11:45:47 -06:00
0ad42ff1a2 Drop default 30-second timeout (#2573) 2025-01-30 10:37:53 -06:00
6dbf91a9c3 github-action: Add AsciiDoc freeze warning (#2589)
* github-action: Add AsciiDoc freeze warning

* github-action: Add AsciiDoc freeze warning
2025-01-29 16:51:52 -08:00
39b2700add github-action: Add AsciiDoc freeze warning (#2588) 2025-01-28 15:55:26 -06:00
869174f953 Bump version to 9.0.0-alpha.2 (#2574) 2025-01-28 12:28:42 -06:00
5eb3554083 Auto-generated API code (#2577)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2025-01-28 12:26:27 -06:00
26ce906b5b Update actions/stale digest to 5bef64f (#2586)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-28 11:32:20 -06:00
5f9561d566 Update dependency @types/node to v22.10.7 (#2576)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-21 12:39:09 -06:00
3676c8229a Fix Renovate rules for Dockerfile (#2572) 2025-01-13 10:15:27 -06:00
2bcbd36d75 Update dependency typescript to v5.7.3 (#2565)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-13 10:09:10 -06:00
63104b5e5e Auto-generated code for main (#2566) 2025-01-13 09:44:45 -06:00
2b2a9947c7 Update dependency @types/node to v22.10.5 (#2547)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-08 13:21:31 -06:00
b95aa986b7 Auto-generated code for main (#2551) 2025-01-07 11:48:46 -06:00
0ee486bc9c Drop @types/tap for built-in types (#2561) 2025-01-07 11:06:18 -06:00
f835fa3b12 Update @sinonjs/fake-timers digest to 48f089f (#2527)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-06 12:50:24 -06:00
e688f36396 Update dependency @elastic/request-converter to v8.17.0 (#2555)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-06 12:39:44 -06:00
b8c3ac446e Update peter-evans/create-pull-request digest to 67ccf78 (#2556)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-06 12:34:18 -06:00
3a288cf86b Update buildkite plugin junit-annotate to v2.6.0 (#2554)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2025-01-06 12:31:13 -06:00
100be27ad1 Update changelog for 8.17.0 (#2545) 2024-12-12 11:48:57 -06:00
c490dd0821 Update changelog for 8.16.3 (#2541) 2024-12-12 09:35:45 -06:00
e992c329c3 Parse branch name during code gen including 'x' (#2534) 2024-12-10 10:32:18 -06:00
bfdae66333 Auto-generated code for main (#2530) 2024-12-10 10:03:40 -06:00
ed3cace127 Checkout correct branch of generator (#2531) 2024-12-10 09:58:14 -06:00
f33aa8cccd Publish 9.0 tags as prereleases (#2524) 2024-12-05 14:30:28 -06:00
7cb973a206 Update changelog for 9.0.0 body param removal (#2523) 2024-12-05 14:12:59 -06:00
a4315a905e Auto-generated code for main (#2522) 2024-12-05 13:28:38 -06:00
6447fc10bf Drop support for body param in helpers and tests (#2521)
* Update tests and bulk helper to stop using body param

* Update compatible-with content-type header for 9.0
2024-12-05 13:03:19 -06:00
e9c2f8b0af Bump version to 9.0.0-alpha.1 (#2516)
* Bump version to 9.0.0-alpha.1

* Update npm publish workflow for 9.0.0 alpha
2024-12-05 10:40:34 -06:00
15b9ee2f06 Codegen for 8.x clients should use the 8.x generator branch (#2515) 2024-12-05 10:37:46 -06:00
e30e964131 Update stale rules to keep tracking issues open (#2514) 2024-12-03 11:18:16 -06:00
0f187f47c4 Disable Dockerfile Node.js upgrades by Renovate (#2509) 2024-12-02 12:17:45 -06:00
101f34bd5e Update dependency into-stream to v8 (#2507)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-12-02 12:15:23 -06:00
ec0c561e36 Auto-generated code for main (#2504)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-12-02 12:12:27 -06:00
c1e90b12f0 Update dependency @elastic/request-converter to v8.16.2 (#2505)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-12-02 18:12:01 +00:00
5cb670256e Update dependency typescript to v5.7.2 (#2506)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-12-02 18:07:44 +00:00
86f488f68f Update dependency @types/node to v22.10.1 (#2499)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-12-02 12:03:41 -06:00
6009fab7fe Update changelog to include 8.16.2 and 8.15.3 (#2490) 2024-11-21 10:40:58 -06:00
26ae260058 Ignore tap artifacts (#2487) 2024-11-21 10:14:17 -06:00
fbbbece711 Add docstrings for Client class and related properties (#2484) 2024-11-20 14:43:36 -06:00
a30c3dca2d Add changelog for 8.16.1 (#2479) 2024-11-18 13:32:52 -06:00
36cfacc409 Fix ECMAScript import (#2475) 2024-11-18 12:14:58 -06:00
6dc83cd33e Auto-generated code for main (#2473)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-18 11:29:36 -06:00
7c7ce29127 Update dependency @elastic/request-converter to v8.16.1 (#2469)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-18 11:13:38 -06:00
2b890af355 Update integration test automation branches (#2463) 2024-11-14 09:37:36 -06:00
421f953b00 Upgrade ts-standard (#2460) 2024-11-13 10:42:33 -06:00
c5e4107181 Update peter-evans/create-pull-request action to v7 (#2456)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-12 13:44:49 -06:00
5880c84c13 Update dependency typescript to v5 (#2455)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-12 17:34:24 +00:00
290639d168 Update dependency chai to v5 (#2453)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-12 11:27:52 -06:00
0b90613694 Address feedback and add clarity (#2449) 2024-11-12 10:51:18 -06:00
1ad057abcc Update dependency @types/split2 to v4 (#2438)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-11 11:51:35 -06:00
44d890ec57 Update dependency @types/node to v22 (#2437)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-11-11 17:16:54 +00:00
2b2a2f03e6 Auto-generated code for main (#2439) 2024-11-11 11:05:18 -06:00
7bcd75bdb0 Add changelog for 8.15.2 (#2444) 2024-11-11 09:47:00 -06:00
2455dac4e5 Add _id to the result of helpers.search (#2432) 2024-11-06 12:20:10 -06:00
edb5563bf8 Update dependency @types/node to v18.19.64 (#2421)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-04 22:21:49 +00:00
11939fd22c Add streaming support to Arrow helper (#2407) 2024-11-04 15:47:53 -06:00
e0c613f898 Auto-generated code for main (#2425) 2024-11-04 10:06:34 -06:00
20f2c740cd Update buildkite plugin junit-annotate to v2.5.0 (#2422)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-04 10:01:14 -06:00
97bdca22d8 Update actions/stale action to v9 (#2423)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-11-04 10:00:38 -06:00
a7123f807d Auto-generated code for main (#2384) 2024-10-28 15:12:59 -05:00
20ac2a637e Skip flaky test (#2416) 2024-10-28 11:46:10 -05:00
e287c1edd9 Don't use hash-based Docker image version (#2414) 2024-10-28 11:19:02 -05:00
90d43f4f28 Pin dependencies (#2408)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-10-28 11:03:46 -05:00
572927b4f1 Don't generate coverage during standard unit test run (#2404) 2024-10-24 11:55:11 -05:00
86b4d4e2f9 Upgrade tap to latest (#2400) 2024-10-24 11:33:46 -05:00
8e79bf847a Enable Renovate (#2398) 2024-10-23 11:38:08 -05:00
cef328c93d Prep 8.16.0 (#2396) 2024-10-23 08:48:04 -05:00
c3247d0c66 Basic helper for ES|QL's Apache Arrow output format (#2391) 2024-10-22 15:00:18 -05:00
e9fdcb0647 Add doc about timeout best practices (#2381) 2024-10-18 11:13:41 -05:00
82acfc33a9 Respect disablePrototypePoisoningProtection option (#2380) 2024-10-16 14:19:44 -05:00
661caf8422 Update changelog for 8.15.1 (#2379) 2024-10-15 11:36:54 -05:00
3430734fe0 Auto-generated code for main (#2371)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-10-14 12:14:09 -05:00
810e009202 Update Github actions to reflect security best practices (#2375)
* Update Github actions to reflect security best practices

* Upgrade @types/node
2024-10-14 11:27:22 -05:00
c274b1b32f Upgraded @types/node package to v18 (#2374) 2024-10-14 11:13:55 -05:00
428a7b023d Auto-generated code for main (#2368) 2024-09-30 13:37:11 -05:00
aad41df231 Upgrade transport to 8.8.1 (#2366) 2024-09-26 13:29:27 -05:00
34704b2e5c Auto-generated code for main (#2362) 2024-09-23 14:54:43 -05:00
213 changed files with 16960 additions and 34786 deletions

View File

@ -1,20 +1,17 @@
---
agents:
provider: "gcp"
image: family/core-ubuntu-2204
memory: "8G"
cpu: "2"
steps:
- label: ":elasticsearch: :javascript: ES JavaScript ({{ matrix.nodejs }})"
- label: ":elasticsearch: :javascript: ES JavaScript ({{ matrix.nodejs }}) Test Suite: {{ matrix.suite }}"
agents:
provider: "gcp"
env:
NODE_VERSION: "{{ matrix.nodejs }}"
TEST_SUITE: "platinum"
STACK_VERSION: 9.0.0
GITHUB_TOKEN_PATH: "secret/ci/elastic-elasticsearch-js/github-token"
TEST_ES_STACK: "1"
TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.16.0
matrix:
setup:
suite:
- "free"
- "platinum"
nodejs:
- "18"
- "20"
@ -24,8 +21,11 @@ steps:
- wait: ~
continue_on_failure: true
- label: ":junit: Test results"
agents:
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

View File

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

View File

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

3
.github/CODEOWNERS vendored
View File

@ -1,3 +0,0 @@
package.json @joshmock
renovate.json @joshmock
catalog-info.yaml @joshmock

26
.github/stale.yml vendored
View File

@ -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

View 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

View File

@ -23,15 +23,18 @@ jobs:
- run: npm install -g npm
- run: npm install
- run: npm test
- run: npm publish --provenance --access public
- run: npm publish --provenance --access public --tag alpha
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)" \
-n "This is a 9.0.0 pre-release alpha. Changes may not be stable." \
--latest=false \
--prerelease \
--target "$BRANCH_NAME" \
-t "v$version" \
--title "v$version" \
"v$version"
env:
BRANCH_NAME: ${{ github.event.inputs.branch }}

View File

@ -42,7 +42,7 @@ jobs:
- 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@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6
- uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7
with:
token: ${{ secrets.GH_TOKEN }}
path: serverless

View File

@ -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@1160a2240286f5da8ec72b1c0816ce2481aabf84 # 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."

4
.gitignore vendored
View File

@ -68,7 +68,3 @@ bun.lockb
test-results
processinfo
.tap
rest-api-spec
yaml-rest-tests
generated-tests
schema

View File

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

View File

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

View File

@ -2,46 +2,20 @@
== Release notes
[discrete]
=== 8.18.2
=== 9.0.0
[discrete]
==== Fixes
==== Breaking changes
[discrete]
===== Ensure Apache Arrow ES|QL helper uses async iterator
===== Drop support for deprecated `body` parameter
The `esql.toArrowReader()` helper function was trying to return `RecordBatchStreamReader`, a synchronous iterator, despite the fact that the `apache-arrow` package was, in most cases, automatically coercing it to `AsyncRecordBatchStreamReader`, its asynchronous counterpart. It now is always returned as an async iterator.
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]
=== 8.18.1
===== Remove the default 30-second timeout on all requests sent to Elasticsearch
[discrete]
==== Fixes
[discrete]
===== Fix broken node roles and node filter
The docs note a `nodeFilter` option on the client that will, by default, filter the nodes based on any `roles` values that are set at instantition. At some point, this functionality was partially disabled. This brings the feature back, ensuring that it matches what the documentation has said it does all along.
[discrete]
=== 8.18.0
[discrete]
==== Features
[discrete]
===== Support for Elasticsearch `v8.18`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.18/release-notes-8.18.0.html[here].
[discrete]
==== Fixes
[discrete]
===== Improved Cloud ID parsing
When using a Cloud ID as the `cloud` parameter to instantiate the client, that ID was assumed to be in the correct format. New assertions have been added to verify that format and throw a `ConfigurationError` if it is invalid. See https://github.com/elastic/elasticsearch-js/issues/2694[#2694].
Setting HTTP timeouts on Elasticsearch requests goes against Elastic's recommendations. See <<timeout-best-practices>> for more information.
[discrete]
=== 8.17.0
@ -710,6 +684,7 @@ ac.abort()
----
[discrete]
[[remove-body-key]]
===== Remove the body key from the request
*Breaking: Yes* | *Migration effort: Small*

View File

@ -28,7 +28,6 @@ const client = new Client({
})
const child = client.child({
headers: { 'x-foo': 'bar' },
requestTimeout: 1000
})
client.info().then(console.log, console.log)

View File

@ -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.

View File

@ -1,11 +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.getDataStream({
name: "my-data-stream",
filter_path: "data_streams.indices.index_name",
});
console.log(response);
----

View File

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

View File

@ -3,8 +3,10 @@
[source, js]
----
const response = await client.searchApplication.renderQuery({
name: "my-app",
const response = await client.transport.request({
method: "POST",
path: "/_application/search_application/my-app/_render_query",
body: {
params: {
query_string: "my first query",
text_fields: [
@ -18,6 +20,7 @@ const response = await client.searchApplication.renderQuery({
},
],
},
},
});
console.log(response);
----

View File

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

View File

@ -3,9 +3,10 @@
[source, js]
----
const response = await client.inference.streamInference({
task_type: "chat_completion",
inference_id: "openai-completion",
const response = await client.transport.request({
method: "POST",
path: "/_inference/chat_completion/openai-completion/_stream",
body: {
model: "gpt-4o",
messages: [
{
@ -13,6 +14,7 @@ const response = await client.inference.streamInference({
content: "What is Elastic?",
},
],
},
});
console.log(response);
----

View File

@ -1,11 +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.addBlock({
index: ".ml-anomalies-custom-example",
block: "read_only",
});
console.log(response);
----

View File

@ -1,25 +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.createFrom({
source: "my-index",
dest: "my-new-index",
create_from: {
settings_override: {
index: {
number_of_shards: 5,
},
},
mappings_override: {
properties: {
field2: {
type: "boolean",
},
},
},
},
});
console.log(response);
----

View File

@ -3,8 +3,9 @@
[source, js]
----
const response = await client.inference.update({
inference_id: "my-inference-endpoint",
const response = await client.inference.put({
task_type: "my-inference-endpoint",
inference_id: "_update",
inference_config: {
service_settings: {
api_key: "<API_KEY>",

View File

@ -1,10 +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.cancelMigrateReindex({
index: "my-data-stream",
});
console.log(response);
----

View File

@ -1,12 +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.security.delegatePki({
x509_certificate_chain: [
"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==",
],
});
console.log(response);
----

View File

@ -3,7 +3,10 @@
[source, js]
----
const response = await client.simulate.ingest({
const response = await client.transport.request({
method: "POST",
path: "/_ingest/_simulate",
body: {
docs: [
{
_index: "my-index",
@ -20,6 +23,7 @@ const response = await client.simulate.ingest({
},
},
],
},
});
console.log(response);
----

View File

@ -1,19 +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.security.queryRole({
query: {
bool: {
must_not: {
term: {
"metadata._reserved": true,
},
},
},
},
sort: ["name"],
});
console.log(response);
----

View File

@ -1,11 +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.addBlock({
index: ".ml-anomalies-custom-example",
block: "write",
});
console.log(response);
----

View File

@ -1,15 +0,0 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.migrateReindex({
reindex: {
source: {
index: "my-data-stream",
},
mode: "upgrade",
},
});
console.log(response);
----

View File

@ -3,10 +3,14 @@
[source, js]
----
const response = await client.security.oidcLogout({
const response = await client.transport.request({
method: "POST",
path: "/_security/oidc/logout",
body: {
token:
"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
refresh_token: "vLBPvmAB6KvwvJZr27cS",
},
});
console.log(response);
----

View File

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

View File

@ -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.indices.createFrom({
source: "my-index",
dest: "my-new-index",
create_from: {
settings_override: {
index: {
"blocks.write": null,
"blocks.read": null,
"blocks.read_only": null,
"blocks.read_only_allow_delete": null,
"blocks.metadata": null,
},
},
},
});
console.log(response);
----

View File

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

View File

@ -1,31 +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.ilm.putLifecycle({
name: "my_policy",
policy: {
phases: {
hot: {
actions: {
rollover: {
max_primary_shard_size: "50gb",
},
searchable_snapshot: {
snapshot_repository: "backing_repo",
replicate_for: "14d",
},
},
},
delete: {
min_age: "28d",
actions: {
delete: {},
},
},
},
},
});
console.log(response);
----

View File

@ -6,7 +6,6 @@
const response = await client.indices.resolveCluster({
name: "not-present,clust*:my-index*,oldcluster:*",
ignore_unavailable: "false",
timeout: "5s",
});
console.log(response);
----

View File

@ -1,21 +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.create({
index: "semantic-embeddings",
mappings: {
properties: {
semantic_text: {
type: "semantic_text",
},
content: {
type: "text",
copy_to: "semantic_text",
},
},
},
});
console.log(response);
----

View File

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

View File

@ -9,13 +9,10 @@ const response = await client.search({
retriever: {
rescorer: {
rescore: {
window_size: 50,
query: {
window_size: 50,
rescore_query: {
script_score: {
query: {
match_all: {},
},
script: {
source:
"cosineSimilarity(params.queryVector, 'product-vector_final_stage') + 1.0",

View File

@ -1,19 +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: ".ml-anomalies-custom-example",
size: 0,
aggs: {
job_ids: {
terms: {
field: "job_id",
size: 100,
},
},
},
});
console.log(response);
----

View File

@ -1,61 +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: "retrievers_example",
retriever: {
linear: {
retrievers: [
{
retriever: {
standard: {
query: {
function_score: {
query: {
term: {
topic: "ai",
},
},
functions: [
{
script_score: {
script: {
source: "doc['timestamp'].value.millis",
},
},
},
],
boost_mode: "replace",
},
},
sort: {
timestamp: {
order: "asc",
},
},
},
},
weight: 2,
normalizer: "minmax",
},
{
retriever: {
knn: {
field: "vector",
query_vector: [0.23, 0.67, 0.89],
k: 3,
num_candidates: 5,
},
},
weight: 1.5,
},
],
rank_window_size: 10,
},
},
_source: false,
});
console.log(response);
----

View File

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

View File

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

View File

@ -6,11 +6,15 @@
const response = await client.update({
index: "test",
id: 1,
doc: {
product_price: 100,
script: {
source: "ctx._source.counter += params.count",
lang: "painless",
params: {
count: 4,
},
},
upsert: {
product_price: 50,
counter: 1,
},
});
console.log(response);

View File

@ -3,9 +3,10 @@
[source, js]
----
const response = await client.inference.streamInference({
task_type: "chat_completion",
inference_id: "openai-completion",
const response = await client.transport.request({
method: "POST",
path: "/_inference/chat_completion/openai-completion/_stream",
body: {
messages: [
{
role: "user",
@ -40,6 +41,7 @@ const response = await client.inference.streamInference({
name: "get_current_price",
},
},
},
});
console.log(response);
----

View File

@ -1,10 +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.getMigrateReindexStatus({
index: "my-data-stream",
});
console.log(response);
----

View File

@ -6,11 +6,6 @@
const response = await client.ml.startTrainedModelDeployment({
model_id: "my_model",
deployment_id: "my_model_for_search",
adaptive_allocations: {
enabled: true,
min_number_of_allocations: 3,
max_number_of_allocations: 10,
},
});
console.log(response);
----

View File

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

View File

@ -1,17 +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.inference.put({
task_type: "sparse_embedding",
inference_id: "elser-model-eis",
inference_config: {
service: "elastic",
service_settings: {
model_name: "elser",
},
},
});
console.log(response);
----

View File

@ -1,12 +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: {
"migrate.data_stream_reindex_max_request_per_second": 10000,
},
});
console.log(response);
----

View File

@ -3,10 +3,14 @@
[source, js]
----
const response = await client.security.oidcPrepareAuthentication({
const response = await client.transport.request({
method: "POST",
path: "/_security/oidc/prepare",
body: {
realm: "oidc1",
state: "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO",
nonce: "zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5",
},
});
console.log(response);
----

View File

@ -1,10 +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.getSettings({
index: ".reindexed-v9-ml-anomalies-custom-example",
});
console.log(response);
----

View File

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

View File

@ -1,11 +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.getDataLifecycleStats({
human: "true",
pretty: "true",
});
console.log(response);
----

View File

@ -1,12 +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.createFrom({
source: "my-index",
dest: "my-new-index",
create_from: null,
});
console.log(response);
----

View File

@ -1,10 +0,0 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.esql.asyncQueryDelete({
id: "FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=",
});
console.log(response);
----

View File

@ -28,9 +28,6 @@ const response = await client.indices.create({
topic: {
type: "keyword",
},
timestamp: {
type: "date",
},
},
},
});
@ -44,7 +41,6 @@ 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);
@ -57,7 +53,6 @@ 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);
@ -70,7 +65,6 @@ 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);
@ -83,7 +77,6 @@ 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);
@ -96,7 +89,6 @@ 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);

View File

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

View File

@ -1,16 +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.reindex({
wait_for_completion: "false",
source: {
index: ".ml-anomalies-custom-example",
},
dest: {
index: ".reindexed-v9-ml-anomalies-custom-example",
},
});
console.log(response);
----

View File

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

View File

@ -3,7 +3,10 @@
[source, js]
----
const response = await client.textStructure.findMessageStructure({
const response = await client.transport.request({
method: "POST",
path: "/_text_structure/find_message_structure",
body: {
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:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]",
@ -28,6 +31,7 @@ const response = await client.textStructure.findMessageStructure({
"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized",
"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...",
],
},
});
console.log(response);
----

View File

@ -3,8 +3,9 @@
[source, js]
----
const response = await client.ingest.deleteIpLocationDatabase({
id: "my-database-id",
const response = await client.transport.request({
method: "DELETE",
path: "/_ingest/ip_location/database/my-database-id",
});
console.log(response);
----

View File

@ -3,7 +3,10 @@
[source, js]
----
const response = await client.security.bulkUpdateApiKeys({
const response = await client.transport.request({
method: "POST",
path: "/_security/api_key/_bulk_update",
body: {
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
role_descriptors: {
"role-a": {
@ -23,6 +26,7 @@ const response = await client.security.bulkUpdateApiKeys({
},
},
expiration: "30d",
},
});
console.log(response);
----

View File

@ -3,9 +3,10 @@
[source, js]
----
const response = await client.inference.streamInference({
task_type: "chat_completion",
inference_id: "openai-completion",
const response = await client.transport.request({
method: "POST",
path: "/_inference/chat_completion/openai-completion/_stream",
body: {
messages: [
{
role: "assistant",
@ -27,6 +28,7 @@ const response = await client.inference.streamInference({
tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd",
},
],
},
});
console.log(response);
----

View File

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

View File

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

View File

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

View File

@ -1,10 +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.getAlias({
index: ".ml-anomalies-custom-example",
});
console.log(response);
----

View File

@ -3,9 +3,10 @@
[source, js]
----
const response = await client.ingest.putIpLocationDatabase({
id: "my-database-1",
configuration: {
const response = await client.transport.request({
method: "PUT",
path: "/_ingest/ip_location/database/my-database-1",
body: {
name: "GeoIP2-Domain",
maxmind: {
account_id: "1234567",

View File

@ -3,8 +3,9 @@
[source, js]
----
const response = await client.ingest.deleteIpLocationDatabase({
id: "example-database-id",
const response = await client.transport.request({
method: "DELETE",
path: "/_ingest/ip_location/database/example-database-id",
});
console.log(response);
----

View File

@ -30,13 +30,6 @@ const response = await client.search({
],
},
},
highlight: {
fields: {
semantic_text: {
number_of_fragments: 2,
},
},
},
});
console.log(response);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.searchApplication.postBehavioralAnalyticsEvent({
collection_name: "my_analytics_collection",
event_type: "search_click",
payload: {
const response = await client.transport.request({
method: "POST",
path: "/_application/analytics/my_analytics_collection/event/search_click",
body: {
session: {
id: "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9",
},

View File

@ -3,12 +3,16 @@
[source, js]
----
const response = await client.security.oidcAuthenticate({
const response = await client.transport.request({
method: "POST",
path: "/_security/oidc/authenticate",
body: {
redirect_uri:
"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I",
state: "4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I",
nonce: "WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM",
realm: "oidc1",
},
});
console.log(response);
----

View File

@ -3,11 +3,14 @@
[source, js]
----
const response = await client.searchApplication.renderQuery({
name: "my_search_application",
const response = await client.transport.request({
method: "POST",
path: "/_application/search_application/my_search_application/_render_query",
body: {
params: {
query_string: "rock climbing",
},
},
});
console.log(response);
----

View File

@ -1,12 +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.cat.indices({
index: ".ml-anomalies-custom-example",
v: "true",
h: "index,store.size",
});
console.log(response);
----

View File

@ -1,10 +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.cancelMigrateReindex({
index: "my-data-stream",
});
console.log(response);
----

View File

@ -1,12 +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.get({
index: ".migrated-ds-my-data-stream-2025.01.23-000001",
human: "true",
filter_path: "*.settings.index.version.created_string",
});
console.log(response);
----

View File

@ -1,10 +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.getMigrateReindexStatus({
index: "my-data-stream",
});
console.log(response);
----

View File

@ -3,8 +3,9 @@
[source, js]
----
const response = await client.searchApplication.renderQuery({
name: "my_search_application",
const response = await client.transport.request({
method: "POST",
path: "/_application/search_application/my_search_application/_render_query",
});
console.log(response);
----

View File

@ -1,10 +0,0 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.esql.asyncQueryStop({
id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
});
console.log(response);
----

View File

@ -208,9 +208,13 @@ const response = await client.bulk({
});
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",
field: "message",
},
});
console.log(response1);
----

View File

@ -3,7 +3,10 @@
[source, js]
----
const response = await client.simulate.ingest({
const response = await client.transport.request({
method: "POST",
path: "/_ingest/_simulate",
body: {
docs: [
{
_index: "my-index",
@ -31,6 +34,7 @@ const response = await client.simulate.ingest({
],
},
},
},
});
console.log(response);
----

View File

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

View File

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

View File

@ -3,7 +3,10 @@
[source, js]
----
const response = await client.simulate.ingest({
const response = await client.transport.request({
method: "POST",
path: "/_ingest/_simulate",
body: {
docs: [
{
_index: "my-index",
@ -65,6 +68,7 @@ const response = await client.simulate.ingest({
},
},
},
},
});
console.log(response);
----

View File

@ -6,13 +6,13 @@
const response = await client.indices.create({
index: "test-index",
query: {
match: {
my_field: "Which country is Paris in?",
semantic: {
field: "my_semantic_field",
},
},
highlight: {
fields: {
my_field: {
my_semantic_field: {
type: "semantic",
number_of_fragments: 2,
order: "score",

View File

@ -1,11 +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.state({
metric: "metadata",
filter_path: "metadata.indices.*.system",
});
console.log(response);
----

View File

@ -3,9 +3,13 @@
[source, js]
----
const response = await client.security.oidcPrepareAuthentication({
const response = await client.transport.request({
method: "POST",
path: "/_security/oidc/prepare",
body: {
iss: "http://127.0.0.1:8080",
login_hint: "this_is_an_opaque_string",
},
});
console.log(response);
----

View File

@ -1,44 +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: "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);
----

View File

@ -3,9 +3,10 @@
[source, js]
----
const response = await client.ingest.putIpLocationDatabase({
id: "my-database-2",
configuration: {
const response = await client.transport.request({
method: "PUT",
path: "/_ingest/ip_location/database/my-database-2",
body: {
name: "standard_location",
ipinfo: {},
},

View File

@ -1,17 +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.inference.put({
task_type: "chat_completion",
inference_id: "chat-completion-endpoint",
inference_config: {
service: "elastic",
service_settings: {
model_id: "model-1",
},
},
});
console.log(response);
----

View File

@ -3,8 +3,9 @@
[source, js]
----
const response = await client.ingest.getIpLocationDatabase({
id: "my-database-id",
const response = await client.transport.request({
method: "GET",
path: "/_ingest/ip_location/database/my-database-id",
});
console.log(response);
----

View File

@ -1,57 +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.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);
----

View File

@ -3,6 +3,9 @@
[source, js]
----
const response = await client.security.getSettings();
const response = await client.transport.request({
method: "GET",
path: "/_security/settings",
});
console.log(response);
----

View File

@ -1,14 +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.createFrom({
source: "my-index",
dest: "my-new-index",
create_from: {
remove_index_blocks: false,
},
});
console.log(response);
----

View File

@ -3,8 +3,12 @@
[source, js]
----
const response = await client.security.oidcPrepareAuthentication({
const response = await client.transport.request({
method: "POST",
path: "/_security/oidc/prepare",
body: {
realm: "oidc1",
},
});
console.log(response);
----

View File

@ -3,7 +3,10 @@
[source, js]
----
const response = await client.simulate.ingest({
const response = await client.transport.request({
method: "POST",
path: "/_ingest/_simulate",
body: {
docs: [
{
_index: "my-index",
@ -37,6 +40,7 @@ const response = await client.simulate.ingest({
},
},
},
},
});
console.log(response);
----

View File

@ -1,10 +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.migration.deprecations({
index: ".ml-anomalies-*",
});
console.log(response);
----

View File

@ -1,12 +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.createFrom({
source: ".ml-anomalies-custom-example",
dest: ".reindexed-v9-ml-anomalies-custom-example",
create_from: null,
});
console.log(response);
----

View File

@ -4,7 +4,7 @@
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]
----

View File

@ -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)
---------
----

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