diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 95ed83af2..2905191ce 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,17 +1,20 @@ --- +agents: + provider: "gcp" + image: family/core-ubuntu-2204 + memory: "8G" + cpu: "2" + steps: - - label: ":elasticsearch: :javascript: ES JavaScript ({{ matrix.nodejs }}) Test Suite: {{ matrix.suite }}" - agents: - provider: "gcp" + - label: ":elasticsearch: :javascript: ES JavaScript ({{ matrix.nodejs }})" env: NODE_VERSION: "{{ matrix.nodejs }}" - TEST_SUITE: "{{ matrix.suite }}" - STACK_VERSION: 8.15.0 + TEST_SUITE: "platinum" + STACK_VERSION: 9.0.0 + GITHUB_TOKEN_PATH: "secret/ci/elastic-elasticsearch-js/github-token" + TEST_ES_STACK: "1" matrix: setup: - suite: - - "free" - - "platinum" nodejs: - "18" - "20" @@ -21,9 +24,6 @@ steps: - wait: ~ continue_on_failure: true - label: ":junit: Test results" - agents: - provider: "gcp" - image: family/core-ubuntu-2204 plugins: - junit-annotate#v2.4.1: artifacts: "junit-output/junit-*.xml" diff --git a/.buildkite/run-client.sh b/.buildkite/run-client.sh index 59ed168e7..872d57812 100755 --- a/.buildkite/run-client.sh +++ b/.buildkite/run-client.sh @@ -10,22 +10,29 @@ export NODE_VERSION=${NODE_VERSION:-18} echo "--- :javascript: Building Docker image" docker build \ - --file "$script_path/Dockerfile" \ - --tag elastic/elasticsearch-js \ - --build-arg NODE_VERSION="$NODE_VERSION" \ - . + --file "$script_path/Dockerfile" \ + --tag elastic/elasticsearch-js \ + --build-arg NODE_VERSION="$NODE_VERSION" \ + . -echo "--- :javascript: Running $TEST_SUITE tests" +GITHUB_TOKEN=$(vault read -field=token "$GITHUB_TOKEN_PATH") +export GITHUB_TOKEN + +echo "--- :javascript: Running tests" mkdir -p "$repo/junit-output" docker run \ - --network="${network_name}" \ - --env "TEST_ES_SERVER=${elasticsearch_url}" \ - --env "ELASTIC_PASSWORD=${elastic_password}" \ - --env "TEST_SUITE=${TEST_SUITE}" \ - --env "ELASTIC_USER=elastic" \ - --env "BUILDKITE=true" \ - --volume "$repo/junit-output:/junit-output" \ - --name elasticsearch-js \ - --rm \ - elastic/elasticsearch-js \ - bash -c "npm run test:integration; [ -f ./$TEST_SUITE-report-junit.xml ] && mv ./$TEST_SUITE-report-junit.xml /junit-output/junit-$BUILDKITE_JOB_ID.xml || echo 'No JUnit artifact found'" + --network="${network_name}" \ + --env TEST_ES_STACK \ + --env STACK_VERSION \ + --env GITHUB_TOKEN \ + --env "TEST_ES_SERVER=${elasticsearch_url}" \ + --env "ELASTIC_PASSWORD=${elastic_password}" \ + --env "ELASTIC_USER=elastic" \ + --env "BUILDKITE=true" \ + --volume "/usr/src/app/node_modules" \ + --volume "$repo:/usr/src/app" \ + --volume "$repo/junit-output:/junit-output" \ + --name elasticsearch-js \ + --rm \ + elastic/elasticsearch-js \ + bash -c "npm run test:integration; [ -f ./report-junit.xml ] && mv ./report-junit.xml /junit-output/junit-$BUILDKITE_JOB_ID.xml || echo 'No JUnit artifact found'" diff --git a/.dockerignore b/.dockerignore index e34f9ff27..c2031b20f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,3 +5,7 @@ elasticsearch .git lib junit-output +.tap +rest-api-spec +yaml-rest-tests +generated-tests diff --git a/.github/make.sh b/.github/make.sh index f02663e97..d8d9cc391 100755 --- a/.github/make.sh +++ b/.github/make.sh @@ -65,7 +65,7 @@ codegen) if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then # fall back to branch name or `main` if no VERSION is set branch_name=$(git rev-parse --abbrev-ref HEAD) - if [[ "$branch_name" =~ ^[0-9]+\.[0-9]+ ]]; then + if [[ "$branch_name" =~ ^[0-9]+\.([0-9]+|x) ]]; then echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m" VERSION="$branch_name" else @@ -150,7 +150,7 @@ if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x} -u "$(id -u):$(id -g)" \ --volume "$repo:/usr/src/elasticsearch-js" \ --volume /usr/src/elasticsearch-js/node_modules \ - --volume "$(realpath $repo/../elastic-client-generator-js):/usr/src/elastic-client-generator-js" \ + --volume "$(realpath "$repo/../elastic-client-generator-js"):/usr/src/elastic-client-generator-js" \ --env "WORKFLOW=$WORKFLOW" \ --name make-elasticsearch-js \ --rm \ @@ -159,6 +159,14 @@ if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x} node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}" else echo -e "\033[34;1mINFO: Running in CI mode" + + # determine branch to clone + GENERATOR_BRANCH="main" + if [[ "$VERSION" == 8.* ]]; then + GENERATOR_BRANCH="8.x" + fi + echo -e "\033[34;1mINFO: Generator branch: $GENERATOR_BRANCH" + docker run \ --volume "$repo:/usr/src/elasticsearch-js" \ --volume /usr/src/elasticsearch-js/node_modules \ @@ -168,7 +176,7 @@ else --rm \ $product \ /bin/bash -c "cd /usr/src && \ - git clone https://$CLIENTS_GITHUB_TOKEN@github.com/elastic/elastic-client-generator-js.git && \ + git clone --branch $GENERATOR_BRANCH https://$CLIENTS_GITHUB_TOKEN@github.com/elastic/elastic-client-generator-js.git && \ mkdir -p /usr/src/elastic-client-generator-js/output && \ cd /usr/src/elasticsearch-js && \ node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}" diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml deleted file mode 100644 index f283bd655..000000000 --- a/.github/workflows/auto-merge.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Automerge - -on: - pull_request_review: - types: - - submitted - -jobs: - automerge: - runs-on: ubuntu-latest - if: github.event.review.state == 'approved' - steps: - - uses: reitermarkus/automerge@v2 - with: - token: ${{ secrets.GH_TOKEN }} - merge-method: squash - pull-request-author-associations: OWNER - review-author-associations: OWNER,CONTRIBUTOR diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 7dbec6fb0..85f8131d3 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -11,8 +11,10 @@ jobs: outputs: src-only: "${{ steps.changes.outputs.src-only }}" steps: - - uses: actions/checkout@v4 - - uses: dorny/paths-filter/@v3.0.2 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + persist-credentials: false + - uses: dorny/paths-filter/@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes with: filters: | @@ -30,14 +32,16 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.x] + node-version: [18.x, 20.x, 22.x, 23.x] os: [ubuntu-latest, windows-latest, macOS-latest] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + persist-credentials: false - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4 with: node-version: ${{ matrix.node-version }} @@ -53,15 +57,21 @@ jobs: run: | npm run test:unit + - name: ECMAScript module test + run: | + npm run test:esm + license: name: License check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + persist-credentials: false - name: Use Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4 with: node-version: 22.x @@ -86,10 +96,12 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + persist-credentials: false - name: Use Bun - uses: oven-sh/setup-bun@v2 + uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2 - name: Install run: | @@ -103,12 +115,6 @@ jobs: run: | bun run test:unit-bun - auto-approve: - name: Auto-approve - needs: [test, license] - runs-on: ubuntu-latest - permissions: - pull-requests: write - if: github.actor == 'elasticmachine' - steps: - - uses: hmarr/auto-approve-action@v4 + - name: ECMAScript module test + run: | + bun run test:esm diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 0b6d77877..68bb353d7 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -12,10 +12,11 @@ jobs: contents: write id-token: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: + persist-credentials: false ref: ${{ github.event.inputs.branch }} - - uses: actions/setup-node@v4 + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4 with: node-version: "22.x" registry-url: "https://registry.npmjs.org" diff --git a/.github/workflows/serverless-patch.yml b/.github/workflows/serverless-patch.yml index 9cf9926a4..2f583a7cd 100644 --- a/.github/workflows/serverless-patch.yml +++ b/.github/workflows/serverless-patch.yml @@ -26,26 +26,28 @@ jobs: ) ) steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: + persist-credentials: false repository: elastic/elasticsearch-js ref: main path: stack fetch-depth: 0 - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: + persist-credentials: false repository: elastic/elasticsearch-serverless-js ref: main path: serverless - name: Apply patch from stack to serverless id: apply-patch run: $GITHUB_WORKSPACE/stack/.github/workflows/serverless-patch.sh - - uses: peter-evans/create-pull-request@v6 + - uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6 with: token: ${{ secrets.GH_TOKEN }} path: serverless - title: 'Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}' - commit-message: 'Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}' + title: "Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}" + commit-message: "Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}" body-path: /tmp/pr_body - draft: '${{ steps.apply-patch.outputs.PR_DRAFT }}' - add-paths: ':!*.rej' + draft: "${{ steps.apply-patch.outputs.PR_DRAFT }}" + add-paths: ":!*.rej" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 3970f1d8d..020c87722 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,7 +8,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v8 + - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8 with: stale-issue-label: stale stale-pr-label: stale diff --git a/.gitignore b/.gitignore index 0dd9106ed..07e49ff7b 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,10 @@ test/bundlers/parcel-test/.parcel-cache lib junit-output bun.lockb +test-results +processinfo +.tap +rest-api-spec +yaml-rest-tests +generated-tests +schema diff --git a/.npmignore b/.npmignore index 08c1043f8..3f909d8c7 100644 --- a/.npmignore +++ b/.npmignore @@ -73,3 +73,7 @@ CONTRIBUTING.md src bun.lockb +.tap +rest-api-spec +yaml-rest-tests +generated-tests diff --git a/catalog-info.yaml b/catalog-info.yaml index 4ce58c0b7..80d0514aa 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -42,6 +42,9 @@ spec: main: branch: "main" cronline: "@daily" + 8_x: + branch: "8.x" + cronline: "@daily" 8_14: - branch: "8.14" + branch: "8.16" cronline: "@daily" diff --git a/docs/basic-config.asciidoc b/docs/basic-config.asciidoc index a71269961..ffc1d3486 100644 --- a/docs/basic-config.asciidoc +++ b/docs/basic-config.asciidoc @@ -167,16 +167,19 @@ const client = new Client({ ---- |`nodeFilter` -a|`function` - Filters which node not to use for a request. + +a|`function` - Takes a `Connection` and returns `true` if it can be sent a request, otherwise `false`. + _Default:_ [source,js] ---- -function defaultNodeFilter (node) { - // avoid master only nodes - if (node.roles.master === true && - node.roles.data === false && - node.roles.ingest === false) { - return false +function defaultNodeFilter (conn) { + if (conn.roles != null) { + if ( + // avoid master-only nodes + conn.roles.master && + !conn.roles.data && + !conn.roles.ingest && + !conn.roles.ml + ) return false } return true } @@ -252,8 +255,8 @@ const client = new Client({ ---- |`disablePrototypePoisoningProtection` -|`boolean`, `'proto'`, `'constructor'` - By the default the client will protect you against prototype poisoning attacks. Read https://web.archive.org/web/20200319091159/https://hueniverse.com/square-brackets-are-the-enemy-ff5b9fd8a3e8?gi=184a27ee2a08[this article] to learn more. If needed you can disable prototype poisoning protection entirely or one of the two checks. Read the `secure-json-parse` https://github.com/fastify/secure-json-parse[documentation] to learn more. + -_Default:_ `false` +|`boolean`, `'proto'`, `'constructor'` - The client can protect you against prototype poisoning attacks. Read https://web.archive.org/web/20200319091159/https://hueniverse.com/square-brackets-are-the-enemy-ff5b9fd8a3e8?gi=184a27ee2a08[this article] to learn more about this security concern. If needed, you can enable prototype poisoning protection entirely (`false`) or one of the two checks (`'proto'` or `'constructor'`). For performance reasons, it is disabled by default. Read the `secure-json-parse` https://github.com/fastify/secure-json-parse[documentation] to learn more. + +_Default:_ `true` |`caFingerprint` |`string` - If configured, verify that the fingerprint of the CA certificate that has signed the certificate of the server matches the supplied fingerprint. Only accepts SHA256 digest fingerprints. + diff --git a/docs/changelog.asciidoc b/docs/changelog.asciidoc index 508bb8b9d..ce4a101d4 100644 --- a/docs/changelog.asciidoc +++ b/docs/changelog.asciidoc @@ -1,6 +1,161 @@ [[changelog-client]] == Release notes +[discrete] +=== 8.18.2 + +[discrete] +==== Fixes + +[discrete] +===== Ensure Apache Arrow ES|QL helper uses async iterator + +The `esql.toArrowReader()` helper function was trying to return `RecordBatchStreamReader`, a synchronous iterator, despite the fact that the `apache-arrow` package was, in most cases, automatically coercing it to `AsyncRecordBatchStreamReader`, its asynchronous counterpart. It now is always returned as an async iterator. + +[discrete] +=== 8.18.1 + +[discrete] +==== Fixes + +[discrete] +===== Fix broken node roles and node filter + +The docs note a `nodeFilter` option on the client that will, by default, filter the nodes based on any `roles` values that are set at instantition. At some point, this functionality was partially disabled. This brings the feature back, ensuring that it matches what the documentation has said it does all along. + +[discrete] +=== 8.18.0 + +[discrete] +==== Features + +[discrete] +===== Support for Elasticsearch `v8.18` + +You can find all the API changes +https://www.elastic.co/guide/en/elasticsearch/reference/8.18/release-notes-8.18.0.html[here]. + +[discrete] +==== Fixes + +[discrete] +===== Improved Cloud ID parsing + +When using a Cloud ID as the `cloud` parameter to instantiate the client, that ID was assumed to be in the correct format. New assertions have been added to verify that format and throw a `ConfigurationError` if it is invalid. See https://github.com/elastic/elasticsearch-js/issues/2694[#2694]. + +[discrete] +=== 8.17.0 + +[discrete] +==== Features + +[discrete] +===== Support for Elasticsearch `v8.17` + +You can find all the API changes +https://www.elastic.co/guide/en/elasticsearch/reference/8.17/release-notes-8.17.0.html[here]. + +[discrete] +=== 8.16.3 + +[discrete] +==== Fixes + +[discrete] +===== Improved support for Elasticsearch `v8.16` + +Updated TypeScript types based on fixes and improvements to the Elasticsearch specification. + +[discrete] +=== 8.16.2 + +[discrete] +==== Fixes + +[discrete] +===== Improved support for Elasticsearch `v8.16` + +Updated TypeScript types based on fixes and improvements to the Elasticsearch specification. + +[discrete] +===== Drop testing artifacts from npm package + +Tap, the unit testing tool used by this project, was recently upgraded and started writing to a `.tap` directory. Since tests are run prior to an `npm publish` in CI, this directory was being included in the published package and bloating its size. + +[discrete] +=== 8.16.1 + +[discrete] +==== Fixes + +[discrete] +===== Fix ECMAScript imports + +Fixed package configuration to correctly support native ECMAScript `import` syntax. + +[discrete] +=== 8.16.0 + +[discrete] +==== Features + +[discrete] +===== Support for Elasticsearch `v8.16` + +You can find all the API changes +https://www.elastic.co/guide/en/elasticsearch/reference/8.16/release-notes-8.16.0.html[here]. + +[discrete] +===== Support Apache Arrow in ES|QL helper + +The ES|QL helper can now return results as an Apache Arrow `Table` or `RecordBatchReader`, which enables high-performance calculations on ES|QL results, even if the response data is larger than the system's available memory. See <> for more information. + +[discrete] +==== Fixes + +[discrete] +===== Pass prototype poisoning options to serializer correctly + +The client's `disablePrototypePoisoningProtection` option was set to `true` by default, but when it was set to any other value it was ignored, making it impossible to enable prototype poisoning protection without providing a custom serializer implementation. + +[discrete] +=== 8.15.3 + +[discrete] +==== Fixes + +[discrete] +===== Improved support for Elasticsearch `v8.15` + +Updated TypeScript types based on fixes and improvements to the Elasticsearch specification. + +[discrete] +===== Drop testing artifacts from npm package + +Tap, the unit testing tool, was recently upgraded and started writing to a `.tap` directory. Since tests are run prior to an `npm publish` in CI, this directory was being included in the published package and bloating its size. + +[discrete] +=== 8.15.2 + +[discrete] +==== Fixes + +[discrete] +===== Improved support for Elasticsearch `v8.15` + +Updated TypeScript types based on fixes and improvements to the Elasticsearch specification. + +[discrete] +=== 8.15.1 + +[discrete] +==== Fixes + +[discrete] +===== Improved support for Elasticsearch `v8.15` + +Updated TypeScript types based on fixes and improvements to the Elasticsearch specification. + [discrete] === 8.15.0 diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index e5c4f32f8..402c5e9a3 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -2,10 +2,11 @@ == Configuration -The client is designed to be easily configured for your needs. In the following +The client is designed to be easily configured for your needs. In the following section, you can see the possible options that you can use to configure it. * <> * <> +* <> * <> * <> diff --git a/docs/connecting.asciidoc b/docs/connecting.asciidoc index 15007ceb3..4646ee5f1 100644 --- a/docs/connecting.asciidoc +++ b/docs/connecting.asciidoc @@ -1,7 +1,7 @@ [[client-connecting]] -== Connecting +== Connecting -This page contains the information you need to connect and use the Client with +This page contains the information you need to connect and use the Client with {es}. **On this page** @@ -19,7 +19,7 @@ This page contains the information you need to connect and use the Client with [discrete] === Authentication -This document contains code snippets to show you how to connect to various {es} +This document contains code snippets to show you how to connect to various {es} providers. @@ -27,18 +27,18 @@ providers. [[auth-ec]] ==== Elastic Cloud -If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers -an easy way to connect to it via the `cloud` option. You must pass the Cloud ID -that you can find in the cloud console, then your username and password inside +If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers +an easy way to connect to it via the `cloud` option. You must pass the Cloud ID +that you can find in the cloud console, then your username and password inside the `auth` option. -NOTE: When connecting to Elastic Cloud, the client will automatically enable -both request and response compression by default, since it yields significant -throughput improvements. Moreover, the client will also set the tls option -`secureProtocol` to `TLSv1_2_method` unless specified otherwise. You can still +NOTE: When connecting to Elastic Cloud, the client will automatically enable +both request and response compression by default, since it yields significant +throughput improvements. Moreover, the client will also set the tls option +`secureProtocol` to `TLSv1_2_method` unless specified otherwise. You can still override this option by configuring them. -IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are +IMPORTANT: Do not enable sniffing when using Elastic Cloud, since the nodes are behind a load balancer, Elastic Cloud will take care of everything for you. Take a look https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how[here] to know more. @@ -61,18 +61,18 @@ const client = new Client({ [[connect-self-managed-new]] === Connecting to a self-managed cluster -By default {es} will start with security features like authentication and TLS -enabled. To connect to the {es} cluster you'll need to configure the Node.js {es} -client to use HTTPS with the generated CA certificate in order to make requests +By default {es} will start with security features like authentication and TLS +enabled. To connect to the {es} cluster you'll need to configure the Node.js {es} +client to use HTTPS with the generated CA certificate in order to make requests successfully. -If you're just getting started with {es} we recommend reading the documentation -on https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html[configuring] -and -https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html[starting {es}] +If you're just getting started with {es} we recommend reading the documentation +on https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html[configuring] +and +https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html[starting {es}] to ensure your cluster is running as expected. -When you start {es} for the first time you'll see a distinct block like the one +When you start {es} for the first time you'll see a distinct block like the one below in the output from {es} (you may have to scroll up if it's been a while): [source,sh] @@ -90,24 +90,24 @@ below in the output from {es} (you may have to scroll up if it's been a while): ---- -Depending on the circumstances there are two options for verifying the HTTPS -connection, either verifying with the CA certificate itself or via the HTTP CA +Depending on the circumstances there are two options for verifying the HTTPS +connection, either verifying with the CA certificate itself or via the HTTP CA certificate fingerprint. [discrete] [[auth-tls]] ==== TLS configuration -The generated root CA certificate can be found in the `certs` directory in your -{es} config location (`$ES_CONF_PATH/certs/http_ca.crt`). If you're running {es} -in Docker there is +The generated root CA certificate can be found in the `certs` directory in your +{es} config location (`$ES_CONF_PATH/certs/http_ca.crt`). If you're running {es} +in Docker there is https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html[additional documentation for retrieving the CA certificate]. -Without any additional configuration you can specify `https://` node urls, and -the certificates used to sign these requests will be verified. To turn off -certificate verification, you must specify an `tls` object in the top level -config and set `rejectUnauthorized: false`. The default `tls` values are the -same that Node.js's https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[`tls.connect()`] +Without any additional configuration you can specify `https://` node urls, and +the certificates used to sign these requests will be verified. To turn off +certificate verification, you must specify an `tls` object in the top level +config and set `rejectUnauthorized: false`. The default `tls` values are the +same that Node.js's https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[`tls.connect()`] uses. [source,js] @@ -152,7 +152,7 @@ const client = new Client({ }) ---- -The certificate fingerprint can be calculated using `openssl x509` with the +The certificate fingerprint can be calculated using `openssl x509` with the certificate file: [source,sh] @@ -160,8 +160,8 @@ certificate file: openssl x509 -fingerprint -sha256 -noout -in /path/to/http_ca.crt ---- -If you don't have access to the generated CA file from {es} you can use the -following script to output the root CA fingerprint of the {es} instance with +If you don't have access to the generated CA file from {es} you can use the +following script to output the root CA fingerprint of the {es} instance with `openssl s_client`: [source,sh] @@ -186,8 +186,8 @@ SHA256 Fingerprint=A5:2D:D9:35:11:E8:C6:04:5E:21:F1:66:54:B7:7C:9E:E0:F3:4A:EA:2 WARNING: Running {es} without security enabled is not recommended. -If your cluster is configured with -https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html[security explicitly disabled] +If your cluster is configured with +https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html[security explicitly disabled] then you can connect via HTTP: [source,js] @@ -208,14 +208,14 @@ Following you can find all the supported authentication strategies. [[auth-apikey]] ==== ApiKey authentication -You can use the -{ref-7x}/security-api-create-api-key.html[ApiKey] -authentication by passing the `apiKey` parameter via the `auth` option. The -`apiKey` parameter can be either a base64 encoded string or an object with the -values that you can obtain from the +You can use the +{ref-7x}/security-api-create-api-key.html[ApiKey] +authentication by passing the `apiKey` parameter via the `auth` option. The +`apiKey` parameter can be either a base64 encoded string or an object with the +values that you can obtain from the {ref-7x}/security-api-create-api-key.html[create api key endpoint]. -NOTE: If you provide both basic authentication credentials and the ApiKey +NOTE: If you provide both basic authentication credentials and the ApiKey configuration, the ApiKey takes precedence. [source,js] @@ -268,10 +268,10 @@ const client = new Client({ [[auth-basic]] ==== Basic authentication -You can provide your credentials by passing the `username` and `password` +You can provide your credentials by passing the `username` and `password` parameters via the `auth` option. -NOTE: If you provide both basic authentication credentials and the Api Key +NOTE: If you provide both basic authentication credentials and the Api Key configuration, the Api Key will take precedence. [source,js] @@ -342,14 +342,14 @@ const result = await client.search({ }, { meta: true }) ---- -In this case, the result will be: +In this case, the result will be: [source,ts] ---- { body: object | boolean statusCode: number headers: object - warnings: [string], + warnings: string[], meta: object } ---- @@ -361,7 +361,7 @@ NOTE: The body is a boolean value when you use `HEAD` APIs. If needed, you can abort a running request by using the `AbortController` standard. -CAUTION: If you abort a request, the request will fail with a +CAUTION: If you abort a request, the request will fail with a `RequestAbortedError`. @@ -410,19 +410,23 @@ The supported request specific options are: [cols=2*] |=== |`ignore` -|`[number]` -  HTTP status codes which should not be considered errors for this request. + +|`number[]` -  HTTP status codes which should not be considered errors for this request. + _Default:_ `null` |`requestTimeout` -|`number` - Max request timeout for the request in milliseconds, it overrides the client default. + +|`number | string` - Max request timeout for the request in milliseconds, it overrides the client default. + _Default:_ `30000` +|`retryOnTimeout` +|`boolean` - Retry requests that have timed out. +_Default:_ `false` + |`maxRetries` |`number` - Max number of retries for the request, it overrides the client default. + _Default:_ `3` |`compression` -|`string, boolean` - Enables body compression for the request. + +|`string | boolean` - Enables body compression for the request. + _Options:_ `false`, `'gzip'` + _Default:_ `false` @@ -446,6 +450,10 @@ _Default:_ `null` |`any` - Custom object per request. _(you can use it to pass data to the clients events)_ + _Default:_ `null` +|`opaqueId` +|`string` - Set the `X-Opaque-Id` HTTP header. See {ref}/api-conventions.html#x-opaque-id +_Default:_ `null` + |`maxResponseSize` |`number` - When configured, it verifies that the uncompressed response size is lower than the configured number, if it's higher it will abort the request. It cannot be higher than buffer.constants.MAX_STRING_LENTGH + _Default:_ `null` @@ -458,6 +466,17 @@ _Default:_ `null` |`AbortSignal` - The AbortSignal instance to allow request abortion. + _Default:_ `null` +|`meta` +|`boolean` - Rather than returning the body, return an object containing `body`, `statusCode`, `headers` and `meta` keys + +_Default_: `false` + +|`redaction` +|`object` - Options for redacting potentially sensitive data from error metadata. See <>. + +|`retryBackoff` +|`(min: number, max: number, attempt: number) => number;` - A function that calculates how long to sleep, in seconds, before the next request retry + +_Default:_ A built-in function that uses exponential backoff with jitter. + |=== [discrete] @@ -537,8 +556,8 @@ Resources used to assess these recommendations: ~Added~ ~in~ ~`v7.10.0`~ -If you need to pass through an http(s) proxy for connecting to {es}, the client -out of the box offers a handy configuration for helping you with it. Under the +If you need to pass through an http(s) proxy for connecting to {es}, the client +out of the box offers a handy configuration for helping you with it. Under the hood, it uses the https://github.com/delvedor/hpagent[`hpagent`] module. IMPORTANT: In versions 8.0+ of the client, the default `Connection` type is set to `UndiciConnection`, which does not support proxy configurations. @@ -715,5 +734,5 @@ This pre-flight product check allows the client to establish the version of Elas that it is communicating with. The product check requires one additional HTTP request to be sent to the server as part of the request pipeline before the main API call is sent. In most cases, this will succeed during the very first API call that the client sends. -Once the product check completes, no further product check HTTP requests are sent for +Once the product check completes, no further product check HTTP requests are sent for subsequent API calls. diff --git a/docs/doc_examples/00ad41bde67beac991534ae0e04b1296.asciidoc b/docs/doc_examples/00ad41bde67beac991534ae0e04b1296.asciidoc new file mode 100644 index 000000000..aad48ff29 --- /dev/null +++ b/docs/doc_examples/00ad41bde67beac991534ae0e04b1296.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.getDataStream({ + name: "my-data-stream", + filter_path: "data_streams.indices.index_name", +}); +console.log(response); +---- diff --git a/docs/doc_examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc b/docs/doc_examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc new file mode 100644 index 000000000..dc90ae673 --- /dev/null +++ b/docs/doc_examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc @@ -0,0 +1,46 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "retrievers_example", + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + range: { + year: { + gt: 2023, + }, + }, + }, + }, + }, + { + standard: { + query: { + term: { + topic: "elastic", + }, + }, + }, + }, + ], + rank_window_size: 10, + rank_constant: 1, + }, + }, + _source: false, + aggs: { + topics: { + terms: { + field: "topic", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/0165d22da5f2fc7678392b31d8eb5566.asciidoc b/docs/doc_examples/0165d22da5f2fc7678392b31d8eb5566.asciidoc new file mode 100644 index 000000000..279e91656 --- /dev/null +++ b/docs/doc_examples/0165d22da5f2fc7678392b31d8eb5566.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "rerank", + inference_id: "my-rerank-model", + inference_config: { + service: "cohere", + service_settings: { + model_id: "rerank-english-v3.0", + api_key: "{{COHERE_API_KEY}}", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/77113c65e1755313183a8969233a5a07.asciidoc b/docs/doc_examples/01ae196538fac197eedbbf458a4ef31b.asciidoc similarity index 81% rename from docs/doc_examples/77113c65e1755313183a8969233a5a07.asciidoc rename to docs/doc_examples/01ae196538fac197eedbbf458a4ef31b.asciidoc index b9dea4e56..487139330 100644 --- a/docs/doc_examples/77113c65e1755313183a8969233a5a07.asciidoc +++ b/docs/doc_examples/01ae196538fac197eedbbf458a4ef31b.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { kwd: { type: "keyword", diff --git a/docs/doc_examples/e944653610f311fa06148d5b0afdf697.asciidoc b/docs/doc_examples/01b23f09d2b7f140faf649eadbbf3ac3.asciidoc similarity index 94% rename from docs/doc_examples/e944653610f311fa06148d5b0afdf697.asciidoc rename to docs/doc_examples/01b23f09d2b7f140faf649eadbbf3ac3.asciidoc index 4982ab849..2752b8336 100644 --- a/docs/doc_examples/e944653610f311fa06148d5b0afdf697.asciidoc +++ b/docs/doc_examples/01b23f09d2b7f140faf649eadbbf3ac3.asciidoc @@ -26,7 +26,7 @@ const response1 = await client.cluster.putComponentTemplate({ type: "keyword", script: { source: - "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))", + "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))", }, }, }, diff --git a/docs/doc_examples/01cd0ea360282a2c591a366679d7187d.asciidoc b/docs/doc_examples/01cd0ea360282a2c591a366679d7187d.asciidoc new file mode 100644 index 000000000..71f3092da --- /dev/null +++ b/docs/doc_examples/01cd0ea360282a2c591a366679d7187d.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.tasks.list({ + human: "true", + detailed: "true", + actions: "indices:data/write/bulk", +}); +console.log(response); +---- diff --git a/docs/doc_examples/9868ce609f4450702934fcbf4c340bf1.asciidoc b/docs/doc_examples/05e637284bc3bedd46e0b7c26ad983c4.asciidoc similarity index 89% rename from docs/doc_examples/9868ce609f4450702934fcbf4c340bf1.asciidoc rename to docs/doc_examples/05e637284bc3bedd46e0b7c26ad983c4.asciidoc index efbc3834d..1b9967b11 100644 --- a/docs/doc_examples/9868ce609f4450702934fcbf4c340bf1.asciidoc +++ b/docs/doc_examples/05e637284bc3bedd46e0b7c26ad983c4.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "alibabacloud_ai_search_embeddings", + id: "alibabacloud_ai_search_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/0709a38613d2de90d418ce12b36af30e.asciidoc b/docs/doc_examples/0709a38613d2de90d418ce12b36af30e.asciidoc new file mode 100644 index 000000000..dfe9d6be5 --- /dev/null +++ b/docs/doc_examples/0709a38613d2de90d418ce12b36af30e.asciidoc @@ -0,0 +1,8 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.cluster.reroute(); +console.log(response); +---- diff --git a/docs/doc_examples/0722b302b2b3275a988d858044f99d5d.asciidoc b/docs/doc_examples/0722b302b2b3275a988d858044f99d5d.asciidoc new file mode 100644 index 000000000..84abd3971 --- /dev/null +++ b/docs/doc_examples/0722b302b2b3275a988d858044f99d5d.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.getMapping({ + index: "kibana_sample_data_ecommerce", +}); +console.log(response); +---- diff --git a/docs/doc_examples/844928da2ff9a1394af5347a5e2e4f78.asciidoc b/docs/doc_examples/074e4602d1ca54412380a40867d078bc.asciidoc similarity index 85% rename from docs/doc_examples/844928da2ff9a1394af5347a5e2e4f78.asciidoc rename to docs/doc_examples/074e4602d1ca54412380a40867d078bc.asciidoc index b0acfaa1d..9d98d539a 100644 --- a/docs/doc_examples/844928da2ff9a1394af5347a5e2e4f78.asciidoc +++ b/docs/doc_examples/074e4602d1ca54412380a40867d078bc.asciidoc @@ -11,6 +11,8 @@ const response = await client.indices.putSettings({ "index.indexing.slowlog.threshold.index.debug": "2s", "index.indexing.slowlog.threshold.index.trace": "500ms", "index.indexing.slowlog.source": "1000", + "index.indexing.slowlog.reformat": true, + "index.indexing.slowlog.include.user": true, }, }); console.log(response); diff --git a/docs/doc_examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc b/docs/doc_examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc new file mode 100644 index 000000000..269067032 --- /dev/null +++ b/docs/doc_examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/840f8c863c30b04abcf2dd66b846f157.asciidoc b/docs/doc_examples/083b92e8ea264e49bf9fd40fc6a3094b.asciidoc similarity index 96% rename from docs/doc_examples/840f8c863c30b04abcf2dd66b846f157.asciidoc rename to docs/doc_examples/083b92e8ea264e49bf9fd40fc6a3094b.asciidoc index e16ea6560..16eda0fcc 100644 --- a/docs/doc_examples/840f8c863c30b04abcf2dd66b846f157.asciidoc +++ b/docs/doc_examples/083b92e8ea264e49bf9fd40fc6a3094b.asciidoc @@ -14,6 +14,7 @@ const response = await client.inference.put({ min_number_of_allocations: 3, max_number_of_allocations: 10, }, + num_threads: 1, model_id: ".multilingual-e5-small", }, }, diff --git a/docs/doc_examples/46025fc47dfbfa410790df0dd6bdad8d.asciidoc b/docs/doc_examples/0b4e50f1b5a0537cbb1a41276bb51c54.asciidoc similarity index 91% rename from docs/doc_examples/46025fc47dfbfa410790df0dd6bdad8d.asciidoc rename to docs/doc_examples/0b4e50f1b5a0537cbb1a41276bb51c54.asciidoc index 40e7af427..6f9ec7de2 100644 --- a/docs/doc_examples/46025fc47dfbfa410790df0dd6bdad8d.asciidoc +++ b/docs/doc_examples/0b4e50f1b5a0537cbb1a41276bb51c54.asciidoc @@ -10,7 +10,7 @@ const response = await client.search({ type: "keyword", script: { source: - "emit(doc['@timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ROOT))", + "emit(doc['@timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ENGLISH))", }, }, }, diff --git a/docs/doc_examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc b/docs/doc_examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc new file mode 100644 index 000000000..01200be80 --- /dev/null +++ b/docs/doc_examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc @@ -0,0 +1,49 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "retrievers_example_nested", + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + nested: { + path: "nested_field", + inner_hits: { + name: "nested_vector", + _source: false, + fields: ["nested_field.paragraph_id"], + }, + query: { + knn: { + field: "nested_field.nested_vector", + query_vector: [1, 0, 0.5], + k: 10, + }, + }, + }, + }, + }, + }, + { + standard: { + query: { + term: { + topic: "ai", + }, + }, + }, + }, + ], + rank_window_size: 10, + rank_constant: 1, + }, + }, + _source: ["topic"], +}); +console.log(response); +---- diff --git a/docs/doc_examples/0bee07a581c5776e068f6f4efad5a399.asciidoc b/docs/doc_examples/0bee07a581c5776e068f6f4efad5a399.asciidoc new file mode 100644 index 000000000..506e4ff5b --- /dev/null +++ b/docs/doc_examples/0bee07a581c5776e068f6f4efad5a399.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.transport.request({ + method: "POST", + path: "/_query/async", + querystring: { + format: "json", + }, + body: { + query: + "\n FROM my-index-000001,cluster_one:my-index-000001,cluster_two:my-index*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ", + include_ccs_metadata: true, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/160986f49758f4e8345d183a842f6351.asciidoc b/docs/doc_examples/0c52af573c9401a2a687e86a4beb182b.asciidoc similarity index 92% rename from docs/doc_examples/160986f49758f4e8345d183a842f6351.asciidoc rename to docs/doc_examples/0c52af573c9401a2a687e86a4beb182b.asciidoc index 3aeb9d6f4..e0413d7dd 100644 --- a/docs/doc_examples/160986f49758f4e8345d183a842f6351.asciidoc +++ b/docs/doc_examples/0c52af573c9401a2a687e86a4beb182b.asciidoc @@ -10,7 +10,7 @@ const response = await client.ingest.putPipeline({ { attachment: { field: "data", - remove_binary: false, + remove_binary: true, }, }, ], diff --git a/docs/doc_examples/0c8be7aec84ea86b243904f5d4162f5a.asciidoc b/docs/doc_examples/0c8be7aec84ea86b243904f5d4162f5a.asciidoc new file mode 100644 index 000000000..54759101e --- /dev/null +++ b/docs/doc_examples/0c8be7aec84ea86b243904f5d4162f5a.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "cooking_blog", + query: { + match: { + title: { + query: "fluffy pancakes breakfast", + minimum_should_match: 2, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/ce13afc0c976c5e1f424b58e0c97fd64.asciidoc b/docs/doc_examples/0d30077cd34e93377a3a86f2ebd69415.asciidoc similarity index 94% rename from docs/doc_examples/ce13afc0c976c5e1f424b58e0c97fd64.asciidoc rename to docs/doc_examples/0d30077cd34e93377a3a86f2ebd69415.asciidoc index e06ff8a73..fb9189c62 100644 --- a/docs/doc_examples/ce13afc0c976c5e1f424b58e0c97fd64.asciidoc +++ b/docs/doc_examples/0d30077cd34e93377a3a86f2ebd69415.asciidoc @@ -9,7 +9,7 @@ const response = await client.connector.put({ name: "My Connector", description: "My Connector to sync data to Elastic index from Google Drive", service_type: "google_drive", - language: "english", + language: "en", }); console.log(response); ---- diff --git a/docs/doc_examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc b/docs/doc_examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc new file mode 100644 index 000000000..c95b502ca --- /dev/null +++ b/docs/doc_examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc @@ -0,0 +1,57 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "retrievers_example", + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + term: { + topic: "elastic", + }, + }, + }, + }, + { + rrf: { + retrievers: [ + { + standard: { + query: { + query_string: { + query: + "(information retrieval) OR (artificial intelligence)", + default_field: "text", + }, + }, + }, + }, + { + knn: { + field: "vector", + query_vector: [0.23, 0.67, 0.89], + k: 3, + num_candidates: 5, + }, + }, + ], + rank_window_size: 10, + rank_constant: 1, + }, + }, + ], + rank_window_size: 10, + rank_constant: 1, + }, + }, + _source: false, + size: 1, + explain: true, +}); +console.log(response); +---- diff --git a/docs/doc_examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc b/docs/doc_examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc index 3801b625f..045036fa2 100644 --- a/docs/doc_examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc +++ b/docs/doc_examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc @@ -3,8 +3,9 @@ [source, js] ---- -const response = await client.searchApplication.renderQuery({ - name: "my-app", +const response = await client.transport.request({ + method: "POST", + path: "/_application/search_application/my-app/_render_query", body: { params: { query_string: "my first query", diff --git a/docs/doc_examples/0e31b8ad176b31028becf9500989bcbd.asciidoc b/docs/doc_examples/0e31b8ad176b31028becf9500989bcbd.asciidoc new file mode 100644 index 000000000..53fcff58d --- /dev/null +++ b/docs/doc_examples/0e31b8ad176b31028becf9500989bcbd.asciidoc @@ -0,0 +1,21 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "watsonx-embeddings", + inference_config: { + service: "watsonxai", + service_settings: { + api_key: "", + url: "", + model_id: "ibm/slate-30m-english-rtrvr", + project_id: "", + api_version: "2024-03-14", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/0e83f140237d75469a428ff403564bb5.asciidoc b/docs/doc_examples/0e83f140237d75469a428ff403564bb5.asciidoc deleted file mode 100644 index aac173f77..000000000 --- a/docs/doc_examples/0e83f140237d75469a428ff403564bb5.asciidoc +++ /dev/null @@ -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); ----- diff --git a/docs/doc_examples/2f67db5e4d6c958258c3d70fb2d0b1c8.asciidoc b/docs/doc_examples/0f028f71f04c1d569fab402869565a84.asciidoc similarity index 64% rename from docs/doc_examples/2f67db5e4d6c958258c3d70fb2d0b1c8.asciidoc rename to docs/doc_examples/0f028f71f04c1d569fab402869565a84.asciidoc index 839a4d359..007f558d8 100644 --- a/docs/doc_examples/2f67db5e4d6c958258c3d70fb2d0b1c8.asciidoc +++ b/docs/doc_examples/0f028f71f04c1d569fab402869565a84.asciidoc @@ -4,9 +4,11 @@ [source, js] ---- const response = await client.indices.putSettings({ - index: "my-index-000001", + index: ".reindexed-v9-ml-anomalies-custom-example", settings: { - "index.merge.policy.max_merge_at_once_explicit": null, + index: { + number_of_replicas: "", + }, }, }); console.log(response); diff --git a/docs/doc_examples/11be807bdeaeecc8174dec88e0851ea7.asciidoc b/docs/doc_examples/11be807bdeaeecc8174dec88e0851ea7.asciidoc new file mode 100644 index 000000000..9e732ae71 --- /dev/null +++ b/docs/doc_examples/11be807bdeaeecc8174dec88e0851ea7.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.transport.request({ + method: "GET", + path: "/_connector/_sync_job", + querystring: { + connector_id: "my-connector-id", + size: "1", + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc b/docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc new file mode 100644 index 000000000..f6c1cb881 --- /dev/null +++ b/docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/12adea5d76f73d94d80d42f53f67563f.asciidoc b/docs/doc_examples/12adea5d76f73d94d80d42f53f67563f.asciidoc new file mode 100644 index 000000000..83d87f9c6 --- /dev/null +++ b/docs/doc_examples/12adea5d76f73d94d80d42f53f67563f.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.addBlock({ + index: ".ml-anomalies-custom-example", + block: "read_only", +}); +console.log(response); +---- diff --git a/docs/doc_examples/12e9e758f7f18a6cbf27e9d0aea57a19.asciidoc b/docs/doc_examples/12e9e758f7f18a6cbf27e9d0aea57a19.asciidoc new file mode 100644 index 000000000..ba95e73e9 --- /dev/null +++ b/docs/doc_examples/12e9e758f7f18a6cbf27e9d0aea57a19.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.update({ + index: ".elastic-connectors", + id: "connector_id", + doc: { + features: { + native_connector_api_keys: { + enabled: true, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc b/docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc new file mode 100644 index 000000000..7d7aeab98 --- /dev/null +++ b/docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc @@ -0,0 +1,16 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "my-inference-endpoint", + inference_id: "_update", + inference_config: { + service_settings: { + api_key: "", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/1522a9297151d7046e6345b9b27539ca.asciidoc b/docs/doc_examples/1522a9297151d7046e6345b9b27539ca.asciidoc new file mode 100644 index 000000000..2dab45f96 --- /dev/null +++ b/docs/doc_examples/1522a9297151d7046e6345b9b27539ca.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.connector.updateConfiguration({ + connector_id: "my-connector-id", + values: { + host: "127.0.0.1", + port: 5432, + username: "myuser", + password: "mypassword", + database: "chinook", + schema: "public", + tables: "album,artist", + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/15f769bbd7b5fddeb3353ae726b71b14.asciidoc b/docs/doc_examples/15f769bbd7b5fddeb3353ae726b71b14.asciidoc new file mode 100644 index 000000000..0db865fe6 --- /dev/null +++ b/docs/doc_examples/15f769bbd7b5fddeb3353ae726b71b14.asciidoc @@ -0,0 +1,28 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "my-index-bit-vectors", + query: { + script_score: { + query: { + match_all: {}, + }, + script: { + source: "dotProduct(params.query_vector, 'my_dense_vector')", + params: { + query_vector: [ + 0.23, 1.45, 3.67, 4.89, -0.56, 2.34, 3.21, 1.78, -2.45, 0.98, -0.12, + 3.45, 4.56, 2.78, 1.23, 0.67, 3.89, 4.12, -2.34, 1.56, 0.78, 3.21, + 4.12, 2.45, -1.67, 0.34, -3.45, 4.56, -2.78, 1.23, -0.67, 3.89, + -4.34, 2.12, -1.56, 0.78, -3.21, 4.45, 2.12, 1.67, + ], + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/16634cfa7916cf4e8048a1d70e6240f2.asciidoc b/docs/doc_examples/16634cfa7916cf4e8048a1d70e6240f2.asciidoc index 64aa8e2d1..8771d32f7 100644 --- a/docs/doc_examples/16634cfa7916cf4e8048a1d70e6240f2.asciidoc +++ b/docs/doc_examples/16634cfa7916cf4e8048a1d70e6240f2.asciidoc @@ -11,7 +11,7 @@ const response = await client.searchApplication.put({ script: { lang: "mustache", source: - '\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n \n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ', + '\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ', params: { query: "", _es_filters: {}, diff --git a/docs/doc_examples/16a7ce08b4a6b3af269f27eecc71d664.asciidoc b/docs/doc_examples/16a7ce08b4a6b3af269f27eecc71d664.asciidoc new file mode 100644 index 000000000..72589cd8f --- /dev/null +++ b/docs/doc_examples/16a7ce08b4a6b3af269f27eecc71d664.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.delete({ + index: "books", +}); +console.log(response); + +const response1 = await client.indices.delete({ + index: "my-explicit-mappings-books", +}); +console.log(response1); +---- diff --git a/docs/doc_examples/17316a81c9dbdd120b7754116bf0461c.asciidoc b/docs/doc_examples/17316a81c9dbdd120b7754116bf0461c.asciidoc new file mode 100644 index 000000000..13415ca5b --- /dev/null +++ b/docs/doc_examples/17316a81c9dbdd120b7754116bf0461c.asciidoc @@ -0,0 +1,26 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.security.createApiKey({ + name: "my-connector-api-key", + role_descriptors: { + "my-connector-connector-role": { + cluster: ["monitor", "manage_connector"], + indices: [ + { + names: [ + "my-index_name", + ".search-acl-filter-my-index_name", + ".elastic-connectors*", + ], + privileges: ["all"], + allow_restricted_indices: false, + }, + ], + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/c02c2916b97b6fa7db82dbc7f0378310.asciidoc b/docs/doc_examples/17b1647c8509543f2388c886f2584a20.asciidoc similarity index 92% rename from docs/doc_examples/c02c2916b97b6fa7db82dbc7f0378310.asciidoc rename to docs/doc_examples/17b1647c8509543f2388c886f2584a20.asciidoc index df440d14e..e1f4fbd3c 100644 --- a/docs/doc_examples/c02c2916b97b6fa7db82dbc7f0378310.asciidoc +++ b/docs/doc_examples/17b1647c8509543f2388c886f2584a20.asciidoc @@ -16,7 +16,7 @@ const response = await client.search({ }, }, field: "text", - inference_id: "my-cohere-rerank-model", + inference_id: "elastic-rerank", inference_text: "How often does the moon hide the sun?", rank_window_size: 100, min_score: 0.5, diff --git a/docs/doc_examples/611c1e05f4ebb48a1a8c8488238ce34d.asciidoc b/docs/doc_examples/193704020a19714dec390452a4e75e8d.asciidoc similarity index 72% rename from docs/doc_examples/611c1e05f4ebb48a1a8c8488238ce34d.asciidoc rename to docs/doc_examples/193704020a19714dec390452a4e75e8d.asciidoc index 8303a5630..1fcacfbd1 100644 --- a/docs/doc_examples/611c1e05f4ebb48a1a8c8488238ce34d.asciidoc +++ b/docs/doc_examples/193704020a19714dec390452a4e75e8d.asciidoc @@ -3,8 +3,8 @@ [source, js] ---- -const response = await client.cluster.reroute({ - metric: "none", +const response = await client.indices.create({ + index: "books", }); console.log(response); ---- diff --git a/docs/doc_examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc b/docs/doc_examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc index c5453ffaf..724b30762 100644 --- a/docs/doc_examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc +++ b/docs/doc_examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc @@ -3,7 +3,9 @@ [source, js] ---- -const response = await client.simulate.ingest({ +const response = await client.transport.request({ + method: "POST", + path: "/_ingest/_simulate", body: { docs: [ { diff --git a/docs/doc_examples/1a7483796087053ba55029d0dc2ab356.asciidoc b/docs/doc_examples/1a7483796087053ba55029d0dc2ab356.asciidoc new file mode 100644 index 000000000..a5696747c --- /dev/null +++ b/docs/doc_examples/1a7483796087053ba55029d0dc2ab356.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.index({ + index: "mv", + refresh: "true", + document: { + a: [2, null, 1], + }, +}); +console.log(response); + +const response1 = await client.esql.query({ + query: "FROM mv | LIMIT 1", +}); +console.log(response1); +---- diff --git a/docs/doc_examples/be30ea12f605fd61acba689b68e00bbe.asciidoc b/docs/doc_examples/1c330f0fc9eac19d0edeb8c4017b9b93.asciidoc similarity index 91% rename from docs/doc_examples/be30ea12f605fd61acba689b68e00bbe.asciidoc rename to docs/doc_examples/1c330f0fc9eac19d0edeb8c4017b9b93.asciidoc index b3f5d0d2b..0c57e6552 100644 --- a/docs/doc_examples/be30ea12f605fd61acba689b68e00bbe.asciidoc +++ b/docs/doc_examples/1c330f0fc9eac19d0edeb8c4017b9b93.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "hugging_face_embeddings", + id: "hugging_face_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/8b144b3eb20872595fd7cbc6c245c7c8.asciidoc b/docs/doc_examples/1c9dac4183a3532c91dbd1a46907729b.asciidoc similarity index 71% rename from docs/doc_examples/8b144b3eb20872595fd7cbc6c245c7c8.asciidoc rename to docs/doc_examples/1c9dac4183a3532c91dbd1a46907729b.asciidoc index 3bccba38f..b563e314b 100644 --- a/docs/doc_examples/8b144b3eb20872595fd7cbc6c245c7c8.asciidoc +++ b/docs/doc_examples/1c9dac4183a3532c91dbd1a46907729b.asciidoc @@ -3,8 +3,8 @@ [source, js] ---- -const response = await client.security.queryRole({ - sort: ["name"], +const response = await client.indices.delete({ + index: "music", }); console.log(response); ---- diff --git a/docs/doc_examples/7c63a1d2fbec5283e913ff39fafd0604.asciidoc b/docs/doc_examples/1cbecd19be22979aefb45b4f160e77ea.asciidoc similarity index 90% rename from docs/doc_examples/7c63a1d2fbec5283e913ff39fafd0604.asciidoc rename to docs/doc_examples/1cbecd19be22979aefb45b4f160e77ea.asciidoc index d83687e37..91636c2e3 100644 --- a/docs/doc_examples/7c63a1d2fbec5283e913ff39fafd0604.asciidoc +++ b/docs/doc_examples/1cbecd19be22979aefb45b4f160e77ea.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "google_vertex_ai_embeddings", + id: "google_vertex_ai_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/1ead35c954963e83f89872048dabdbe9.asciidoc b/docs/doc_examples/1ead35c954963e83f89872048dabdbe9.asciidoc new file mode 100644 index 000000000..347f3152e --- /dev/null +++ b/docs/doc_examples/1ead35c954963e83f89872048dabdbe9.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.security.queryRole({ + query: { + bool: { + must_not: { + term: { + "metadata._reserved": true, + }, + }, + }, + }, + sort: ["name"], +}); +console.log(response); +---- diff --git a/docs/doc_examples/1fb2c77c0988bc6545040b20e3afa7e9.asciidoc b/docs/doc_examples/1fb2c77c0988bc6545040b20e3afa7e9.asciidoc new file mode 100644 index 000000000..aced9c9d6 --- /dev/null +++ b/docs/doc_examples/1fb2c77c0988bc6545040b20e3afa7e9.asciidoc @@ -0,0 +1,33 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.security.createApiKey({ + name: "john-api-key", + expiration: "1d", + role_descriptors: { + "sharepoint-online-role": { + index: [ + { + names: ["sharepoint-search-application"], + privileges: ["read"], + query: { + template: { + params: { + access_control: ["john@example.co", "Engineering Members"], + }, + source: + '\n {\n "bool": {\n "should": [\n {\n "bool": {\n "must_not": {\n "exists": {\n "field": "_allow_access_control"\n }\n }\n }\n },\n {\n "terms": {\n "_allow_access_control.enum": {{#toJson}}access_control{{/toJson}}\n }\n }\n ]\n }\n }\n ', + }, + }, + }, + ], + restriction: { + workflows: ["search_application_query"], + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/3fab530a2e43807929c0ef3ebf7d268c.asciidoc b/docs/doc_examples/216e24f05cbb82c1718713fbab8623d2.asciidoc similarity index 94% rename from docs/doc_examples/3fab530a2e43807929c0ef3ebf7d268c.asciidoc rename to docs/doc_examples/216e24f05cbb82c1718713fbab8623d2.asciidoc index e7b6ae812..dbaac1815 100644 --- a/docs/doc_examples/3fab530a2e43807929c0ef3ebf7d268c.asciidoc +++ b/docs/doc_examples/216e24f05cbb82c1718713fbab8623d2.asciidoc @@ -5,7 +5,7 @@ ---- const response = await client.ingest.putPipeline({ id: "geoip", - description: "Add geoip info", + description: "Add ip geolocation info", processors: [ { geoip: { diff --git a/docs/doc_examples/983a867c90e63e070518f2f709f659ee.asciidoc b/docs/doc_examples/21d41e8cbd107fbdf0901f885834dafc.asciidoc similarity index 80% rename from docs/doc_examples/983a867c90e63e070518f2f709f659ee.asciidoc rename to docs/doc_examples/21d41e8cbd107fbdf0901f885834dafc.asciidoc index 117b811b7..01d52961a 100644 --- a/docs/doc_examples/983a867c90e63e070518f2f709f659ee.asciidoc +++ b/docs/doc_examples/21d41e8cbd107fbdf0901f885834dafc.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { card: { type: "wildcard", diff --git a/docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc b/docs/doc_examples/22b176a184517cf1b5801f5eb4f17f97.asciidoc similarity index 69% rename from docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc rename to docs/doc_examples/22b176a184517cf1b5801f5eb4f17f97.asciidoc index 36c1c5a79..a0c450d19 100644 --- a/docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc +++ b/docs/doc_examples/22b176a184517cf1b5801f5eb4f17f97.asciidoc @@ -3,8 +3,8 @@ [source, js] ---- -const response = await client.indices.unfreeze({ - index: "my-index-000001", +const response = await client.indices.rollover({ + alias: "datastream", }); console.log(response); ---- diff --git a/docs/doc_examples/246763219ec06172f7aa57bba28d344a.asciidoc b/docs/doc_examples/246763219ec06172f7aa57bba28d344a.asciidoc new file mode 100644 index 000000000..deabe9511 --- /dev/null +++ b/docs/doc_examples/246763219ec06172f7aa57bba28d344a.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/da3cecc36a7313385d32c7f52ccfb7e3.asciidoc b/docs/doc_examples/24a037008e0fc2550ecb6a5d36c04a93.asciidoc similarity index 93% rename from docs/doc_examples/da3cecc36a7313385d32c7f52ccfb7e3.asciidoc rename to docs/doc_examples/24a037008e0fc2550ecb6a5d36c04a93.asciidoc index 4439e3423..6972b07c9 100644 --- a/docs/doc_examples/da3cecc36a7313385d32c7f52ccfb7e3.asciidoc +++ b/docs/doc_examples/24a037008e0fc2550ecb6a5d36c04a93.asciidoc @@ -10,7 +10,7 @@ const response = await client.search({ "date.day_of_week": { type: "keyword", script: - "emit(doc['date'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))", + "emit(doc['date'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))", }, }, aggs: { diff --git a/docs/doc_examples/2577acb462b95bd4394523cf2f8a661f.asciidoc b/docs/doc_examples/2577acb462b95bd4394523cf2f8a661f.asciidoc deleted file mode 100644 index 9c0aff110..000000000 --- a/docs/doc_examples/2577acb462b95bd4394523cf2f8a661f.asciidoc +++ /dev/null @@ -1,28 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// Use `node scripts/generate-docs-examples.js` to generate the docs examples - -[source, js] ----- -const response = await client.esql.query({ - format: "txt", - query: - "\n FROM library\n | SORT page_count DESC\n | KEEP name, author\n | LOOKUP era ON author\n | LIMIT 5\n ", - tables: { - era: { - author: { - keyword: [ - "Frank Herbert", - "Peter F. Hamilton", - "Vernor Vinge", - "Alastair Reynolds", - "James S.A. Corey", - ], - }, - era: { - keyword: ["The New Wave", "Diamond", "Diamond", "Diamond", "Hadron"], - }, - }, - }, -}); -console.log(response); ----- diff --git a/docs/doc_examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc b/docs/doc_examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc new file mode 100644 index 000000000..5a65c9753 --- /dev/null +++ b/docs/doc_examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.addBlock({ + index: ".ml-anomalies-custom-example", + block: "write", +}); +console.log(response); +---- diff --git a/docs/doc_examples/dfcdadcf91529d3a399e05684195028e.asciidoc b/docs/doc_examples/2968ffb8135f77ba3a9b876dd4918119.asciidoc similarity index 87% rename from docs/doc_examples/dfcdadcf91529d3a399e05684195028e.asciidoc rename to docs/doc_examples/2968ffb8135f77ba3a9b876dd4918119.asciidoc index a9c2986d4..7a6220c32 100644 --- a/docs/doc_examples/dfcdadcf91529d3a399e05684195028e.asciidoc +++ b/docs/doc_examples/2968ffb8135f77ba3a9b876dd4918119.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "azure-ai-studio-embeddings", - pipeline: "azure_ai_studio_embeddings", + pipeline: "azure_ai_studio_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc b/docs/doc_examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc index 4853ab9a3..b3545c105 100644 --- a/docs/doc_examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc +++ b/docs/doc_examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc @@ -3,7 +3,9 @@ [source, js] ---- -const response = await client.security.oidcLogout({ +const response = await client.transport.request({ + method: "POST", + path: "/_security/oidc/logout", body: { token: "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", diff --git a/docs/doc_examples/2a21674c40f9b182a8944769d20b2357.asciidoc b/docs/doc_examples/2a21674c40f9b182a8944769d20b2357.asciidoc new file mode 100644 index 000000000..07c3eb29d --- /dev/null +++ b/docs/doc_examples/2a21674c40f9b182a8944769d20b2357.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/2a67608dadbf220a2f040f3a79d3677d.asciidoc b/docs/doc_examples/2a67608dadbf220a2f040f3a79d3677d.asciidoc new file mode 100644 index 000000000..93ccfa9d8 --- /dev/null +++ b/docs/doc_examples/2a67608dadbf220a2f040f3a79d3677d.asciidoc @@ -0,0 +1,35 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.ingest.putPipeline({ + id: "attachment", + description: "Extract attachment information including original binary", + processors: [ + { + attachment: { + field: "data", + remove_binary: false, + }, + }, + ], +}); +console.log(response); + +const response1 = await client.index({ + index: "my-index-000001", + id: "my_id", + pipeline: "attachment", + document: { + data: "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=", + }, +}); +console.log(response1); + +const response2 = await client.get({ + index: "my-index-000001", + id: "my_id", +}); +console.log(response2); +---- diff --git a/docs/doc_examples/2afd49985950cbcccf727fa858d00067.asciidoc b/docs/doc_examples/2afd49985950cbcccf727fa858d00067.asciidoc new file mode 100644 index 000000000..38aa159a8 --- /dev/null +++ b/docs/doc_examples/2afd49985950cbcccf727fa858d00067.asciidoc @@ -0,0 +1,24 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.create({ + index: "test-index", + query: { + match: { + my_field: "Which country is Paris in?", + }, + }, + highlight: { + fields: { + my_field: { + type: "semantic", + number_of_fragments: 2, + order: "score", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc b/docs/doc_examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc index 44648b27c..e05299751 100644 --- a/docs/doc_examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc +++ b/docs/doc_examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc @@ -3,10 +3,12 @@ [source, js] ---- -const response = await client.esql.asyncQueryGet({ - id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", - wait_for_completion_timeout: "30s", - body: null, +const response = await client.transport.request({ + method: "GET", + path: "/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + querystring: { + wait_for_completion_timeout: "30s", + }, }); console.log(response); ---- diff --git a/docs/doc_examples/2c079d1ae4819a0c206b9e1aa5623523.asciidoc b/docs/doc_examples/2c079d1ae4819a0c206b9e1aa5623523.asciidoc new file mode 100644 index 000000000..9e9cb47ce --- /dev/null +++ b/docs/doc_examples/2c079d1ae4819a0c206b9e1aa5623523.asciidoc @@ -0,0 +1,77 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.create({ + index: "my-index-000001", + mappings: { + properties: { + attributes: { + type: "passthrough", + priority: 10, + properties: { + id: { + type: "keyword", + }, + }, + }, + }, + }, +}); +console.log(response); + +const response1 = await client.index({ + index: "my-index-000001", + id: 1, + document: { + attributes: { + id: "foo", + zone: 10, + }, + }, +}); +console.log(response1); + +const response2 = await client.search({ + index: "my-index-000001", + query: { + bool: { + must: [ + { + match: { + id: "foo", + }, + }, + { + match: { + zone: 10, + }, + }, + ], + }, + }, +}); +console.log(response2); + +const response3 = await client.search({ + index: "my-index-000001", + query: { + bool: { + must: [ + { + match: { + "attributes.id": "foo", + }, + }, + { + match: { + "attributes.zone": 10, + }, + }, + ], + }, + }, +}); +console.log(response3); +---- diff --git a/docs/doc_examples/2c86840a46242a38cf82024a9321be46.asciidoc b/docs/doc_examples/2c86840a46242a38cf82024a9321be46.asciidoc new file mode 100644 index 000000000..3bda37c4b --- /dev/null +++ b/docs/doc_examples/2c86840a46242a38cf82024a9321be46.asciidoc @@ -0,0 +1,28 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.create({ + index: "my-explicit-mappings-books", + mappings: { + dynamic: false, + properties: { + name: { + type: "text", + }, + author: { + type: "text", + }, + release_date: { + type: "date", + format: "yyyy-MM-dd", + }, + page_count: { + type: "integer", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/2d0244c020075595acb625aa5ba8f455.asciidoc b/docs/doc_examples/2d0244c020075595acb625aa5ba8f455.asciidoc new file mode 100644 index 000000000..e7a2117c4 --- /dev/null +++ b/docs/doc_examples/2d0244c020075595acb625aa5ba8f455.asciidoc @@ -0,0 +1,25 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.index({ + index: "idx_keep", + id: 1, + document: { + path: { + to: [ + { + foo: [3, 2, 1], + }, + { + foo: [30, 20, 10], + }, + ], + bar: "baz", + }, + ids: [200, 100, 300, 100], + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/2e7844477b41fcfa9efefee4ec0e7101.asciidoc b/docs/doc_examples/2e7844477b41fcfa9efefee4ec0e7101.asciidoc new file mode 100644 index 000000000..e19fb83da --- /dev/null +++ b/docs/doc_examples/2e7844477b41fcfa9efefee4ec0e7101.asciidoc @@ -0,0 +1,43 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "my-index-000001", + retriever: { + rule: { + match_criteria: { + query_string: "puggles", + user_country: "us", + }, + ruleset_ids: ["my-ruleset"], + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + query_string: { + query: "pugs", + }, + }, + }, + }, + { + standard: { + query: { + query_string: { + query: "puggles", + }, + }, + }, + }, + ], + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc b/docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc new file mode 100644 index 000000000..e1edb8658 --- /dev/null +++ b/docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/30d051f534aeb884176eedb2c11dac85.asciidoc b/docs/doc_examples/30d051f534aeb884176eedb2c11dac85.asciidoc new file mode 100644 index 000000000..0ea31b07a --- /dev/null +++ b/docs/doc_examples/30d051f534aeb884176eedb2c11dac85.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "rerank", + inference_id: "my-elastic-rerank", + inference_config: { + service: "elasticsearch", + service_settings: { + model_id: ".rerank-v1", + num_threads: 1, + adaptive_allocations: { + enabled: true, + min_number_of_allocations: 1, + max_number_of_allocations: 4, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/5f8d90515995a5eee189d722abe3b111.asciidoc b/docs/doc_examples/310bdfb0d0d75bac7bff036a3fe51d4d.asciidoc similarity index 90% rename from docs/doc_examples/5f8d90515995a5eee189d722abe3b111.asciidoc rename to docs/doc_examples/310bdfb0d0d75bac7bff036a3fe51d4d.asciidoc index 028813b2e..34cfe5d2f 100644 --- a/docs/doc_examples/5f8d90515995a5eee189d722abe3b111.asciidoc +++ b/docs/doc_examples/310bdfb0d0d75bac7bff036a3fe51d4d.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "azure_ai_studio_embeddings", + id: "azure_ai_studio_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc b/docs/doc_examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc new file mode 100644 index 000000000..e61007e9c --- /dev/null +++ b/docs/doc_examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc @@ -0,0 +1,28 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "my-index-*", + query: { + bool: { + must: [ + { + match: { + "user.id": "kimchy", + }, + }, + ], + must_not: [ + { + terms: { + _index: ["my-index-01"], + }, + }, + ], + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc b/docs/doc_examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc new file mode 100644 index 000000000..dcc8ff429 --- /dev/null +++ b/docs/doc_examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc @@ -0,0 +1,31 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.ilm.putLifecycle({ + name: "my_policy", + policy: { + phases: { + hot: { + actions: { + rollover: { + max_primary_shard_size: "50gb", + }, + searchable_snapshot: { + snapshot_repository: "backing_repo", + replicate_for: "14d", + }, + }, + }, + delete: { + min_age: "28d", + actions: { + delete: {}, + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/23af230e824f48b9cd56a4cf973d788c.asciidoc b/docs/doc_examples/3312c82f81816bf76629db9582991812.asciidoc similarity index 93% rename from docs/doc_examples/23af230e824f48b9cd56a4cf973d788c.asciidoc rename to docs/doc_examples/3312c82f81816bf76629db9582991812.asciidoc index 693b70a4f..f1ba5e168 100644 --- a/docs/doc_examples/23af230e824f48b9cd56a4cf973d788c.asciidoc +++ b/docs/doc_examples/3312c82f81816bf76629db9582991812.asciidoc @@ -14,6 +14,7 @@ const response = await client.indices.putSettings({ "index.search.slowlog.threshold.fetch.info": "800ms", "index.search.slowlog.threshold.fetch.debug": "500ms", "index.search.slowlog.threshold.fetch.trace": "200ms", + "index.search.slowlog.include.user": true, }, }); console.log(response); diff --git a/docs/doc_examples/d3a558ef226e9dccc1c7c61e1167547f.asciidoc b/docs/doc_examples/334811cfceb6858aeec5b3461717dd63.asciidoc similarity index 93% rename from docs/doc_examples/d3a558ef226e9dccc1c7c61e1167547f.asciidoc rename to docs/doc_examples/334811cfceb6858aeec5b3461717dd63.asciidoc index 4c5e7872e..1e3f14f12 100644 --- a/docs/doc_examples/d3a558ef226e9dccc1c7c61e1167547f.asciidoc +++ b/docs/doc_examples/334811cfceb6858aeec5b3461717dd63.asciidoc @@ -5,7 +5,7 @@ ---- const response = await client.ingest.putPipeline({ id: "geoip", - description: "Add geoip info", + description: "Add ip geolocation info", processors: [ { geoip: { diff --git a/docs/doc_examples/339c4e5af9f9069ad9912aa574488b59.asciidoc b/docs/doc_examples/339c4e5af9f9069ad9912aa574488b59.asciidoc new file mode 100644 index 000000000..905e21821 --- /dev/null +++ b/docs/doc_examples/339c4e5af9f9069ad9912aa574488b59.asciidoc @@ -0,0 +1,52 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.create({ + index: "my-index-bit-vectors", + mappings: { + properties: { + my_dense_vector: { + type: "dense_vector", + index: false, + element_type: "bit", + dims: 40, + }, + }, + }, +}); +console.log(response); + +const response1 = await client.index({ + index: "my-index-bit-vectors", + id: 1, + document: { + my_dense_vector: [8, 5, -15, 1, -7], + }, +}); +console.log(response1); + +const response2 = await client.index({ + index: "my-index-bit-vectors", + id: 2, + document: { + my_dense_vector: [-1, 115, -3, 4, -128], + }, +}); +console.log(response2); + +const response3 = await client.index({ + index: "my-index-bit-vectors", + id: 3, + document: { + my_dense_vector: [2, 18, -5, 0, -124], + }, +}); +console.log(response3); + +const response4 = await client.indices.refresh({ + index: "my-index-bit-vectors", +}); +console.log(response4); +---- diff --git a/docs/doc_examples/36792c81c053e0555407d1e83e7e054f.asciidoc b/docs/doc_examples/36792c81c053e0555407d1e83e7e054f.asciidoc new file mode 100644 index 000000000..2256f4c94 --- /dev/null +++ b/docs/doc_examples/36792c81c053e0555407d1e83e7e054f.asciidoc @@ -0,0 +1,70 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "movies", + size: 10, + retriever: { + rescorer: { + rescore: { + window_size: 50, + query: { + rescore_query: { + script_score: { + query: { + match_all: {}, + }, + script: { + source: + "cosineSimilarity(params.queryVector, 'product-vector_final_stage') + 1.0", + params: { + queryVector: [-0.5, 90, -10, 14.8, -156], + }, + }, + }, + }, + }, + }, + retriever: { + rrf: { + rank_window_size: 100, + retrievers: [ + { + standard: { + query: { + sparse_vector: { + field: "plot_embedding", + inference_id: "my-elser-model", + query: "films that explore psychological depths", + }, + }, + }, + }, + { + standard: { + query: { + multi_match: { + query: "crime", + fields: ["plot", "title"], + }, + }, + }, + }, + { + knn: { + field: "vector", + query_vector: [10, 22, 77], + k: 10, + num_candidates: 10, + }, + }, + ], + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/65e892a362d940e4a74965f21c15ca09.asciidoc b/docs/doc_examples/36ac0ef9ea63efc431580f7ade8ad53c.asciidoc similarity index 88% rename from docs/doc_examples/65e892a362d940e4a74965f21c15ca09.asciidoc rename to docs/doc_examples/36ac0ef9ea63efc431580f7ade8ad53c.asciidoc index fdab99f78..eead102c5 100644 --- a/docs/doc_examples/65e892a362d940e4a74965f21c15ca09.asciidoc +++ b/docs/doc_examples/36ac0ef9ea63efc431580f7ade8ad53c.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "openai-embeddings", - pipeline: "openai_embeddings", + pipeline: "openai_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/3722dad876023e0757138dd5a6d3240e.asciidoc b/docs/doc_examples/3722dad876023e0757138dd5a6d3240e.asciidoc new file mode 100644 index 000000000..e071509a9 --- /dev/null +++ b/docs/doc_examples/3722dad876023e0757138dd5a6d3240e.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.create({ + index: "my-index", + settings: { + index: { + number_of_shards: 3, + "blocks.write": true, + }, + }, + mappings: { + properties: { + field1: { + type: "text", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/38ba93890494bfa7beece58dffa44f98.asciidoc b/docs/doc_examples/38ba93890494bfa7beece58dffa44f98.asciidoc deleted file mode 100644 index f9dca64fb..000000000 --- a/docs/doc_examples/38ba93890494bfa7beece58dffa44f98.asciidoc +++ /dev/null @@ -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); ----- diff --git a/docs/doc_examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc b/docs/doc_examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc new file mode 100644 index 000000000..087b6dc1b --- /dev/null +++ b/docs/doc_examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: ".ml-anomalies-custom-example", + size: 0, + aggs: { + job_ids: { + terms: { + field: "job_id", + size: 100, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/3a489743e49902df38e3368cae00717a.asciidoc b/docs/doc_examples/3a489743e49902df38e3368cae00717a.asciidoc new file mode 100644 index 000000000..5aec6e804 --- /dev/null +++ b/docs/doc_examples/3a489743e49902df38e3368cae00717a.asciidoc @@ -0,0 +1,8 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.nodes.hotThreads(); +console.log(response); +---- diff --git a/docs/doc_examples/60d689aae3f8de1e6830329dfd69a6a6.asciidoc b/docs/doc_examples/3a4953663a5a3809b692c27446e16b7f.asciidoc similarity index 87% rename from docs/doc_examples/60d689aae3f8de1e6830329dfd69a6a6.asciidoc rename to docs/doc_examples/3a4953663a5a3809b692c27446e16b7f.asciidoc index dabaf1110..1d6946015 100644 --- a/docs/doc_examples/60d689aae3f8de1e6830329dfd69a6a6.asciidoc +++ b/docs/doc_examples/3a4953663a5a3809b692c27446e16b7f.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "amazon-bedrock-embeddings", - pipeline: "amazon_bedrock_embeddings", + pipeline: "amazon_bedrock_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/d1a285aa244ec461d68f13e7078a33c0.asciidoc b/docs/doc_examples/3ab8f65fcb55a0e3664c55749ec41efd.asciidoc similarity index 96% rename from docs/doc_examples/d1a285aa244ec461d68f13e7078a33c0.asciidoc rename to docs/doc_examples/3ab8f65fcb55a0e3664c55749ec41efd.asciidoc index e21b336f5..e498feff3 100644 --- a/docs/doc_examples/d1a285aa244ec461d68f13e7078a33c0.asciidoc +++ b/docs/doc_examples/3ab8f65fcb55a0e3664c55749ec41efd.asciidoc @@ -29,6 +29,7 @@ const response = await client.indices.create({ "arabic_normalization", "persian_normalization", "persian_stop", + "persian_stem", ], }, }, diff --git a/docs/doc_examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc b/docs/doc_examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc new file mode 100644 index 000000000..929ab0ee8 --- /dev/null +++ b/docs/doc_examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc @@ -0,0 +1,61 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "retrievers_example", + retriever: { + linear: { + retrievers: [ + { + retriever: { + standard: { + query: { + function_score: { + query: { + term: { + topic: "ai", + }, + }, + functions: [ + { + script_score: { + script: { + source: "doc['timestamp'].value.millis", + }, + }, + }, + ], + boost_mode: "replace", + }, + }, + sort: { + timestamp: { + order: "asc", + }, + }, + }, + }, + weight: 2, + normalizer: "minmax", + }, + { + retriever: { + knn: { + field: "vector", + query_vector: [0.23, 0.67, 0.89], + k: 3, + num_candidates: 5, + }, + }, + weight: 1.5, + }, + ], + rank_window_size: 10, + }, + }, + _source: false, +}); +console.log(response); +---- diff --git a/docs/doc_examples/7a32f44a1511ecb0d3f0b0ff2aca5c44.asciidoc b/docs/doc_examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc similarity index 60% rename from docs/doc_examples/7a32f44a1511ecb0d3f0b0ff2aca5c44.asciidoc rename to docs/doc_examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc index ab73f60fd..32f004a99 100644 --- a/docs/doc_examples/7a32f44a1511ecb0d3f0b0ff2aca5c44.asciidoc +++ b/docs/doc_examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc @@ -6,15 +6,8 @@ const response = await client.indices.updateAliases({ actions: [ { - remove: { - index: "my-index-000001", - alias: "my-index", - }, - }, - { - add: { - index: "my-index-000002", - alias: "my-index", + remove_index: { + index: "my-index-2099.05.06-000001", }, }, ], diff --git a/docs/doc_examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc b/docs/doc_examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc index b8e2ede87..221e42b58 100644 --- a/docs/doc_examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc +++ b/docs/doc_examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc @@ -3,7 +3,9 @@ [source, js] ---- -const response = await client.esql.asyncQuery({ +const response = await client.transport.request({ + method: "POST", + path: "/_query/async", body: { query: "\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", diff --git a/docs/doc_examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc b/docs/doc_examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc new file mode 100644 index 000000000..7818a3f0c --- /dev/null +++ b/docs/doc_examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc b/docs/doc_examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc index ab0617ea6..40d330c9d 100644 --- a/docs/doc_examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc +++ b/docs/doc_examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc @@ -3,9 +3,9 @@ [source, js] ---- -const response = await client.esql.asyncQueryGet({ - id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=", - body: null, +const response = await client.transport.request({ + method: "GET", + path: "/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=", }); console.log(response); ---- diff --git a/docs/doc_examples/40f287bf733420bbab134b74c7d0ea5d.asciidoc b/docs/doc_examples/40f287bf733420bbab134b74c7d0ea5d.asciidoc new file mode 100644 index 000000000..5b94aaeb7 --- /dev/null +++ b/docs/doc_examples/40f287bf733420bbab134b74c7d0ea5d.asciidoc @@ -0,0 +1,16 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.index({ + index: "amazon-reviews", + id: 1, + document: { + review_text: + "This product is lifechanging! I'm telling all my friends about it.", + review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/41d24383d29b2808a65258a0a3256e96.asciidoc b/docs/doc_examples/41d24383d29b2808a65258a0a3256e96.asciidoc new file mode 100644 index 000000000..67b3c97a4 --- /dev/null +++ b/docs/doc_examples/41d24383d29b2808a65258a0a3256e96.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/43d9e314431336a6f084cea76dfd6489.asciidoc b/docs/doc_examples/43d9e314431336a6f084cea76dfd6489.asciidoc new file mode 100644 index 000000000..bccc8d81f --- /dev/null +++ b/docs/doc_examples/43d9e314431336a6f084cea76dfd6489.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "restaurants", + retriever: { + knn: { + field: "vector", + query_vector: [10, 22, 77], + k: 10, + num_candidates: 10, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/1420a22aa817c7a996baaed0ad366d6f.asciidoc b/docs/doc_examples/44198781d164a15be633d4469485a544.asciidoc similarity index 51% rename from docs/doc_examples/1420a22aa817c7a996baaed0ad366d6f.asciidoc rename to docs/doc_examples/44198781d164a15be633d4469485a544.asciidoc index ce7709b43..f3125224a 100644 --- a/docs/doc_examples/1420a22aa817c7a996baaed0ad366d6f.asciidoc +++ b/docs/doc_examples/44198781d164a15be633d4469485a544.asciidoc @@ -4,15 +4,16 @@ [source, js] ---- const response = await client.search({ - index: "test-index", + index: "my-index-bit-vectors", query: { - nested: { - path: "inference_field.inference.chunks", + script_score: { query: { - sparse_vector: { - field: "inference_field.inference.chunks.embeddings", - inference_id: "my-inference-id", - query: "mountain lake", + match_all: {}, + }, + script: { + source: "dotProduct(params.query_vector, 'my_dense_vector')", + params: { + query_vector: [8, 5, -15, 1, -7], }, }, }, diff --git a/docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc b/docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc new file mode 100644 index 000000000..a2ff623e6 --- /dev/null +++ b/docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/9f16fca9813304e398ee052aa857dbcd.asciidoc b/docs/doc_examples/48e142e6c69014e0509d4c9251749d77.asciidoc similarity index 85% rename from docs/doc_examples/9f16fca9813304e398ee052aa857dbcd.asciidoc rename to docs/doc_examples/48e142e6c69014e0509d4c9251749d77.asciidoc index 6be472e3b..7c4401c7d 100644 --- a/docs/doc_examples/9f16fca9813304e398ee052aa857dbcd.asciidoc +++ b/docs/doc_examples/48e142e6c69014e0509d4c9251749d77.asciidoc @@ -10,7 +10,8 @@ const response = await client.inference.put({ service: "openai", service_settings: { api_key: "", - model_id: "text-embedding-ada-002", + model_id: "text-embedding-3-small", + dimensions: 128, }, }, }); diff --git a/docs/doc_examples/49a19615ebe2c013b8321152163478ab.asciidoc b/docs/doc_examples/49a19615ebe2c013b8321152163478ab.asciidoc new file mode 100644 index 000000000..0c497534a --- /dev/null +++ b/docs/doc_examples/49a19615ebe2c013b8321152163478ab.asciidoc @@ -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.index({ + index: "my-index-000001", + id: 1, + refresh: "true", + document: { + text: "quick brown fox", + }, +}); +console.log(response); + +const response1 = await client.index({ + index: "my-index-000001", + id: 2, + refresh: "true", + document: { + text: "quick fox", + }, +}); +console.log(response1); + +const response2 = await client.search({ + index: "my-index-000001", + query: { + script_score: { + query: { + match: { + text: "quick brown fox", + }, + }, + script: { + source: "_termStats.termFreq().getAverage()", + }, + }, + }, +}); +console.log(response2); +---- diff --git a/docs/doc_examples/cc28a3dafcd5056f2a3ec07f6fda5091.asciidoc b/docs/doc_examples/4a72c68b96f44e80463084dfc0449d51.asciidoc similarity index 92% rename from docs/doc_examples/cc28a3dafcd5056f2a3ec07f6fda5091.asciidoc rename to docs/doc_examples/4a72c68b96f44e80463084dfc0449d51.asciidoc index 4f6f802d9..002ca35ca 100644 --- a/docs/doc_examples/cc28a3dafcd5056f2a3ec07f6fda5091.asciidoc +++ b/docs/doc_examples/4a72c68b96f44e80463084dfc0449d51.asciidoc @@ -10,7 +10,7 @@ const response = await client.search({ type: "keyword", script: { source: - "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))", + "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))", }, }, }, diff --git a/docs/doc_examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc b/docs/doc_examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc new file mode 100644 index 000000000..823515f74 --- /dev/null +++ b/docs/doc_examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc @@ -0,0 +1,14 @@ +// 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/completion/openai-completion/_stream", + body: { + input: "What is Elastic?", + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/4da0cb8693e9ceceee2ba3b558014bbf.asciidoc b/docs/doc_examples/4da0cb8693e9ceceee2ba3b558014bbf.asciidoc new file mode 100644 index 000000000..effb6d63d --- /dev/null +++ b/docs/doc_examples/4da0cb8693e9ceceee2ba3b558014bbf.asciidoc @@ -0,0 +1,38 @@ +// 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.updateByQuery({ + index: "INDEX_NAME", + conflicts: "proceed", + query: { + bool: { + filter: [ + { + match: { + object_type: "drive_item", + }, + }, + { + exists: { + field: "file", + }, + }, + { + range: { + lastModifiedDateTime: { + lte: "now-180d", + }, + }, + }, + ], + }, + }, + script: { + source: "ctx._source.body = ''", + lang: "painless", + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/a53ff77d83222c0e76453e630d64787e.asciidoc b/docs/doc_examples/4dc151eebefd484a28aed1a175743364.asciidoc similarity index 92% rename from docs/doc_examples/a53ff77d83222c0e76453e630d64787e.asciidoc rename to docs/doc_examples/4dc151eebefd484a28aed1a175743364.asciidoc index 2113b36ee..f7f5c27d2 100644 --- a/docs/doc_examples/a53ff77d83222c0e76453e630d64787e.asciidoc +++ b/docs/doc_examples/4dc151eebefd484a28aed1a175743364.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "openai_embeddings", + id: "openai_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/bdb671866e2f0195f8dfbdb7f20bf591.asciidoc b/docs/doc_examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc similarity index 74% rename from docs/doc_examples/bdb671866e2f0195f8dfbdb7f20bf591.asciidoc rename to docs/doc_examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc index f758ada37..22100f235 100644 --- a/docs/doc_examples/bdb671866e2f0195f8dfbdb7f20bf591.asciidoc +++ b/docs/doc_examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc @@ -5,12 +5,11 @@ ---- const response = await client.inference.put({ task_type: "sparse_embedding", - inference_id: "my-elser-endpoint", + inference_id: "elser-model-eis", inference_config: { - service: "elser", + service: "elastic", service_settings: { - num_allocations: 1, - num_threads: 1, + model_name: "elser", }, }, }); diff --git a/docs/doc_examples/4edfb5934d14ad7655bd7e19a112b5c0.asciidoc b/docs/doc_examples/4edfb5934d14ad7655bd7e19a112b5c0.asciidoc new file mode 100644 index 000000000..3bce99ecc --- /dev/null +++ b/docs/doc_examples/4edfb5934d14ad7655bd7e19a112b5c0.asciidoc @@ -0,0 +1,55 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "cooking_blog", + query: { + bool: { + must: [ + { + term: { + tags: "vegetarian", + }, + }, + { + range: { + rating: { + gte: 4.5, + }, + }, + }, + ], + should: [ + { + term: { + category: "Main Course", + }, + }, + { + multi_match: { + query: "curry spicy", + fields: ["title^2", "description"], + }, + }, + { + range: { + date: { + gte: "now-1M/d", + }, + }, + }, + ], + must_not: [ + { + term: { + "category.keyword": "Dessert", + }, + }, + ], + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/c9373ff5ed6b026173428fbb92ca2d9f.asciidoc b/docs/doc_examples/4eeded40f30949e359714a5bb6c88612.asciidoc similarity index 88% rename from docs/doc_examples/c9373ff5ed6b026173428fbb92ca2d9f.asciidoc rename to docs/doc_examples/4eeded40f30949e359714a5bb6c88612.asciidoc index 21b881926..435c2eaff 100644 --- a/docs/doc_examples/c9373ff5ed6b026173428fbb92ca2d9f.asciidoc +++ b/docs/doc_examples/4eeded40f30949e359714a5bb6c88612.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "elser-embeddings", - pipeline: "elser_embeddings", + pipeline: "elser_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/4f6694ef147a73b1163bde3c13779d26.asciidoc b/docs/doc_examples/4f6694ef147a73b1163bde3c13779d26.asciidoc new file mode 100644 index 000000000..0793b4e08 --- /dev/null +++ b/docs/doc_examples/4f6694ef147a73b1163bde3c13779d26.asciidoc @@ -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.nodes.stats({ + human: "true", + filter_path: "nodes.*.indexing_pressure", +}); +console.log(response); +---- diff --git a/docs/doc_examples/49b31e23f8b9667b6a7b2734d55fb6ed.asciidoc b/docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc similarity index 51% rename from docs/doc_examples/49b31e23f8b9667b6a7b2734d55fb6ed.asciidoc rename to docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc index d66581f09..3c92986f6 100644 --- a/docs/doc_examples/49b31e23f8b9667b6a7b2734d55fb6ed.asciidoc +++ b/docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc @@ -3,15 +3,18 @@ [source, js] ---- -const response = await client.knnSearch({ - index: "my-index", +const response = await client.search({ + index: "image-index", knn: { - field: "image_vector", - query_vector: [0.3, 0.1, 1.2], + field: "image-vector", + query_vector: [-5, 9, -12], k: 10, num_candidates: 100, + rescore_vector: { + oversample: 2, + }, }, - _source: ["name", "file_type"], + fields: ["title", "file-type"], }); console.log(response); ---- diff --git a/docs/doc_examples/529671ffaf7cc75fe83a81d729788be4.asciidoc b/docs/doc_examples/529671ffaf7cc75fe83a81d729788be4.asciidoc new file mode 100644 index 000000000..c493ead5a --- /dev/null +++ b/docs/doc_examples/529671ffaf7cc75fe83a81d729788be4.asciidoc @@ -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.update({ + index: ".elastic-connectors", + id: "connector_id", + doc: { + configuration: { + field_a: { + type: "str", + value: "", + }, + field_b: { + type: "bool", + value: false, + }, + field_c: { + type: "int", + value: 1, + }, + field_d: { + type: "list", + value: "a,b", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc b/docs/doc_examples/537bce129338d9227bccb6a0283dab45.asciidoc similarity index 79% rename from docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc rename to docs/doc_examples/537bce129338d9227bccb6a0283dab45.asciidoc index b10da9a05..cfeed0dff 100644 --- a/docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc +++ b/docs/doc_examples/537bce129338d9227bccb6a0283dab45.asciidoc @@ -5,7 +5,7 @@ ---- const response = await client.cluster.putSettings({ persistent: { - "cluster.routing.allocation.disk.watermark.low": "30gb", + "migrate.data_stream_reindex_max_request_per_second": 10000, }, }); console.log(response); diff --git a/docs/doc_examples/53d9d2ec9cb8d211772d764e76fe6890.asciidoc b/docs/doc_examples/53d9d2ec9cb8d211772d764e76fe6890.asciidoc new file mode 100644 index 000000000..58eee5923 --- /dev/null +++ b/docs/doc_examples/53d9d2ec9cb8d211772d764e76fe6890.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.ingest.simulate({ + id: "query_helper_pipeline", + docs: [ + { + _source: { + content: + "artificial intelligence in medicine articles published in the last 12 months", + }, + }, + ], +}); +console.log(response); +---- diff --git a/docs/doc_examples/3a7a6ab88a49b484fafb10c8eb09b562.asciidoc b/docs/doc_examples/548a9b6f447bb820380c1c23e57c18c3.asciidoc similarity index 92% rename from docs/doc_examples/3a7a6ab88a49b484fafb10c8eb09b562.asciidoc rename to docs/doc_examples/548a9b6f447bb820380c1c23e57c18c3.asciidoc index 1362f5945..376f11be8 100644 --- a/docs/doc_examples/3a7a6ab88a49b484fafb10c8eb09b562.asciidoc +++ b/docs/doc_examples/548a9b6f447bb820380c1c23e57c18c3.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "cohere_embeddings", + id: "cohere_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/54a47b5d07e7bfbea75c77f35eaae18d.asciidoc b/docs/doc_examples/54a47b5d07e7bfbea75c77f35eaae18d.asciidoc new file mode 100644 index 000000000..3cd177602 --- /dev/null +++ b/docs/doc_examples/54a47b5d07e7bfbea75c77f35eaae18d.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.putMapping({ + index: ".elastic-connectors-sync-jobs-v1", + properties: { + job_type: { + type: "keyword", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/55085e6a2891040b6ac696561d0787c8.asciidoc b/docs/doc_examples/55085e6a2891040b6ac696561d0787c8.asciidoc new file mode 100644 index 000000000..eebda22c2 --- /dev/null +++ b/docs/doc_examples/55085e6a2891040b6ac696561d0787c8.asciidoc @@ -0,0 +1,32 @@ +// 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-000002", + mappings: { + properties: { + attributes: { + type: "passthrough", + priority: 10, + properties: { + id: { + type: "keyword", + }, + }, + }, + "resource.attributes": { + type: "passthrough", + priority: 20, + properties: { + id: { + type: "keyword", + }, + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/b468d0124dc485385a34504d5b7af82a.asciidoc b/docs/doc_examples/551467688d8c701315d0a371850a4056.asciidoc similarity index 87% rename from docs/doc_examples/b468d0124dc485385a34504d5b7af82a.asciidoc rename to docs/doc_examples/551467688d8c701315d0a371850a4056.asciidoc index cafdc3e63..cc9792da6 100644 --- a/docs/doc_examples/b468d0124dc485385a34504d5b7af82a.asciidoc +++ b/docs/doc_examples/551467688d8c701315d0a371850a4056.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "hugging-face-embeddings", - pipeline: "hugging_face_embeddings", + pipeline: "hugging_face_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/97f260817b60f3deb7f7034d7dee7e12.asciidoc b/docs/doc_examples/551799fef2f86e393db83a967e4a30d1.asciidoc similarity index 84% rename from docs/doc_examples/97f260817b60f3deb7f7034d7dee7e12.asciidoc rename to docs/doc_examples/551799fef2f86e393db83a967e4a30d1.asciidoc index de62cbe9d..ee97fb114 100644 --- a/docs/doc_examples/97f260817b60f3deb7f7034d7dee7e12.asciidoc +++ b/docs/doc_examples/551799fef2f86e393db83a967e4a30d1.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { agg_metric: { type: "aggregate_metric_double", diff --git a/docs/doc_examples/1b60ad542abb511cbd926ac8c55b609c.asciidoc b/docs/doc_examples/565386eee0951865a684e41fab53b40c.asciidoc similarity index 95% rename from docs/doc_examples/1b60ad542abb511cbd926ac8c55b609c.asciidoc rename to docs/doc_examples/565386eee0951865a684e41fab53b40c.asciidoc index 160884d3b..149cff486 100644 --- a/docs/doc_examples/1b60ad542abb511cbd926ac8c55b609c.asciidoc +++ b/docs/doc_examples/565386eee0951865a684e41fab53b40c.asciidoc @@ -14,6 +14,7 @@ const response = await client.inference.put({ min_number_of_allocations: 3, max_number_of_allocations: 10, }, + num_threads: 1, }, }, }); diff --git a/docs/doc_examples/5db5349162a4fbe74bffb646926a2495.asciidoc b/docs/doc_examples/56da252798b8e7b006738428aa1a7f4c.asciidoc similarity index 81% rename from docs/doc_examples/5db5349162a4fbe74bffb646926a2495.asciidoc rename to docs/doc_examples/56da252798b8e7b006738428aa1a7f4c.asciidoc index 2f634da70..8f272acdb 100644 --- a/docs/doc_examples/5db5349162a4fbe74bffb646926a2495.asciidoc +++ b/docs/doc_examples/56da252798b8e7b006738428aa1a7f4c.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { my_range: { type: "long_range", diff --git a/docs/doc_examples/57dc15e5ad663c342fd5c1d86fcd1b29.asciidoc b/docs/doc_examples/57dc15e5ad663c342fd5c1d86fcd1b29.asciidoc index dcf9e4b2e..2598c7bce 100644 --- a/docs/doc_examples/57dc15e5ad663c342fd5c1d86fcd1b29.asciidoc +++ b/docs/doc_examples/57dc15e5ad663c342fd5c1d86fcd1b29.asciidoc @@ -3,7 +3,9 @@ [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", diff --git a/docs/doc_examples/5836b09198feb1269ed12839b416123d.asciidoc b/docs/doc_examples/5836b09198feb1269ed12839b416123d.asciidoc new file mode 100644 index 000000000..12ea79855 --- /dev/null +++ b/docs/doc_examples/5836b09198feb1269ed12839b416123d.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/58dd26afc919722e21358c91e112b27a.asciidoc b/docs/doc_examples/58dd26afc919722e21358c91e112b27a.asciidoc new file mode 100644 index 000000000..61938b700 --- /dev/null +++ b/docs/doc_examples/58dd26afc919722e21358c91e112b27a.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "cooking_blog", + query: { + range: { + date: { + gte: "2023-05-01", + lte: "2023-05-31", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc b/docs/doc_examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc new file mode 100644 index 000000000..61ac89373 --- /dev/null +++ b/docs/doc_examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.getSettings({ + index: ".reindexed-v9-ml-anomalies-custom-example", +}); +console.log(response); +---- diff --git a/docs/doc_examples/5bba213a7f543190139d1a69ab2ed076.asciidoc b/docs/doc_examples/5bba213a7f543190139d1a69ab2ed076.asciidoc new file mode 100644 index 000000000..46cd0a13e --- /dev/null +++ b/docs/doc_examples/5bba213a7f543190139d1a69ab2ed076.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.transport.request({ + method: "POST", + path: "/_query/async", + querystring: { + format: "json", + }, + body: { + query: + "\n FROM 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); +---- diff --git a/docs/doc_examples/5ceb734e3affe00e2cdc29af748d95bf.asciidoc b/docs/doc_examples/5ceb734e3affe00e2cdc29af748d95bf.asciidoc new file mode 100644 index 000000000..e2a1539c1 --- /dev/null +++ b/docs/doc_examples/5ceb734e3affe00e2cdc29af748d95bf.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "sparse_embedding", + inference_id: "small_chunk_size", + inference_config: { + service: "elasticsearch", + service_settings: { + num_allocations: 1, + num_threads: 1, + }, + chunking_settings: { + strategy: "sentence", + max_chunk_size: 100, + sentence_overlap: 0, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/5cf12cc4f98d98dc79bead7e6556679c.asciidoc b/docs/doc_examples/5cf12cc4f98d98dc79bead7e6556679c.asciidoc new file mode 100644 index 000000000..423a609ea --- /dev/null +++ b/docs/doc_examples/5cf12cc4f98d98dc79bead7e6556679c.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.create({ + index: "idx", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/1d827ae674970692643ea81991e5396e.asciidoc b/docs/doc_examples/5daf8ede198be9b118da5bee9896cb00.asciidoc similarity index 85% rename from docs/doc_examples/1d827ae674970692643ea81991e5396e.asciidoc rename to docs/doc_examples/5daf8ede198be9b118da5bee9896cb00.asciidoc index ac92b9868..d554caaf0 100644 --- a/docs/doc_examples/1d827ae674970692643ea81991e5396e.asciidoc +++ b/docs/doc_examples/5daf8ede198be9b118da5bee9896cb00.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { flattened: { type: "flattened", diff --git a/docs/doc_examples/4b113c7f475cfe484a150ddbb8e6c5c7.asciidoc b/docs/doc_examples/5e021307d331a4483a5aa2198168451b.asciidoc similarity index 73% rename from docs/doc_examples/4b113c7f475cfe484a150ddbb8e6c5c7.asciidoc rename to docs/doc_examples/5e021307d331a4483a5aa2198168451b.asciidoc index 949a81873..329574d90 100644 --- a/docs/doc_examples/4b113c7f475cfe484a150ddbb8e6c5c7.asciidoc +++ b/docs/doc_examples/5e021307d331a4483a5aa2198168451b.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.security.putRole({ - name: "role_with_remote_indices", + name: "only_remote_access_role", remote_indices: [ { clusters: ["my_remote"], @@ -12,6 +12,12 @@ const response = await client.security.putRole({ privileges: ["read", "read_cross_cluster", "view_index_metadata"], }, ], + remote_cluster: [ + { + clusters: ["my_remote"], + privileges: ["monitor_stats"], + }, + ], }); console.log(response); ---- diff --git a/docs/doc_examples/19f1f9f25933f8e7aba59a10881c648b.asciidoc b/docs/doc_examples/5f16358ebb5d14b86f57612d5f92d923.asciidoc similarity index 89% rename from docs/doc_examples/19f1f9f25933f8e7aba59a10881c648b.asciidoc rename to docs/doc_examples/5f16358ebb5d14b86f57612d5f92d923.asciidoc index 1d9708b3c..454dd9502 100644 --- a/docs/doc_examples/19f1f9f25933f8e7aba59a10881c648b.asciidoc +++ b/docs/doc_examples/5f16358ebb5d14b86f57612d5f92d923.asciidoc @@ -9,7 +9,6 @@ const response = await client.indices.create({ properties: { inference_field: { type: "semantic_text", - inference_id: "my-elser-endpoint", }, }, }, diff --git a/docs/doc_examples/60d3f9a99cc91b43aaa7524a9a74dba0.asciidoc b/docs/doc_examples/60d3f9a99cc91b43aaa7524a9a74dba0.asciidoc new file mode 100644 index 000000000..627606897 --- /dev/null +++ b/docs/doc_examples/60d3f9a99cc91b43aaa7524a9a74dba0.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.nodes.stats({ + metric: "breaker", +}); +console.log(response); +---- diff --git a/docs/doc_examples/6329fb2840a4373ff6d342f2653247cb.asciidoc b/docs/doc_examples/6329fb2840a4373ff6d342f2653247cb.asciidoc new file mode 100644 index 000000000..cbb113a2e --- /dev/null +++ b/docs/doc_examples/6329fb2840a4373ff6d342f2653247cb.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.getMapping({ + index: "books", +}); +console.log(response); +---- diff --git a/docs/doc_examples/63a53fcb0717ae9033a679cbfc932851.asciidoc b/docs/doc_examples/63a53fcb0717ae9033a679cbfc932851.asciidoc new file mode 100644 index 000000000..742fed240 --- /dev/null +++ b/docs/doc_examples/63a53fcb0717ae9033a679cbfc932851.asciidoc @@ -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.inference.put({ + task_type: "completion", + inference_id: "alibabacloud_ai_search_completion", + inference_config: { + service: "alibabacloud-ai-search", + service_settings: { + host: "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + api_key: "{{API_KEY}}", + service_id: "ops-qwen-turbo", + workspace: "default", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/640dbeecb736bd25f6f2b392b76a7531.asciidoc b/docs/doc_examples/640dbeecb736bd25f6f2b392b76a7531.asciidoc new file mode 100644 index 000000000..54d88b41e --- /dev/null +++ b/docs/doc_examples/640dbeecb736bd25f6f2b392b76a7531.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.cluster.stats({ + include_remotes: "true", +}); +console.log(response); +---- diff --git a/docs/doc_examples/2fd458d37aab509fe2d970c0b6e2a10f.asciidoc b/docs/doc_examples/68d7f7d4d268ee98caead5aef19933d6.asciidoc similarity index 97% rename from docs/doc_examples/2fd458d37aab509fe2d970c0b6e2a10f.asciidoc rename to docs/doc_examples/68d7f7d4d268ee98caead5aef19933d6.asciidoc index 2f15a5eb4..021aa7e19 100644 --- a/docs/doc_examples/2fd458d37aab509fe2d970c0b6e2a10f.asciidoc +++ b/docs/doc_examples/68d7f7d4d268ee98caead5aef19933d6.asciidoc @@ -45,7 +45,7 @@ console.log(response); const response1 = await client.indices.putIndexTemplate({ name: 2, - index_patterns: ["k8s*"], + index_patterns: ["k9s*"], composed_of: ["destination_template"], data_stream: {}, }); diff --git a/docs/doc_examples/69541f0bb81ab3797926bb2a00607cda.asciidoc b/docs/doc_examples/69541f0bb81ab3797926bb2a00607cda.asciidoc new file mode 100644 index 000000000..bf62637fc --- /dev/null +++ b/docs/doc_examples/69541f0bb81ab3797926bb2a00607cda.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "rerank", + inference_id: "my-msmarco-minilm-model", + inference_config: { + service: "elasticsearch", + service_settings: { + num_allocations: 1, + num_threads: 1, + model_id: "cross-encoder__ms-marco-minilm-l-6-v2", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/34cdeefb09bbbe5206957a8bc1bd513d.asciidoc b/docs/doc_examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc similarity index 69% rename from docs/doc_examples/34cdeefb09bbbe5206957a8bc1bd513d.asciidoc rename to docs/doc_examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc index 9537a8386..3226a57c7 100644 --- a/docs/doc_examples/34cdeefb09bbbe5206957a8bc1bd513d.asciidoc +++ b/docs/doc_examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc @@ -4,9 +4,11 @@ [source, js] ---- const response = await client.indices.putSettings({ - index: "my-index-000001", + index: "*", settings: { "index.search.slowlog.include.user": true, + "index.search.slowlog.threshold.fetch.warn": "30s", + "index.search.slowlog.threshold.query.warn": "30s", }, }); console.log(response); diff --git a/docs/doc_examples/a69c7c3412af73758f629e76263063b5.asciidoc b/docs/doc_examples/6b6e275efe3d2aafe0fc3443f2c96868.asciidoc similarity index 86% rename from docs/doc_examples/a69c7c3412af73758f629e76263063b5.asciidoc rename to docs/doc_examples/6b6e275efe3d2aafe0fc3443f2c96868.asciidoc index 2312ca864..ddb9c53f2 100644 --- a/docs/doc_examples/a69c7c3412af73758f629e76263063b5.asciidoc +++ b/docs/doc_examples/6b6e275efe3d2aafe0fc3443f2c96868.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "google-vertex-ai-embeddings", - pipeline: "google_vertex_ai_embeddings", + pipeline: "google_vertex_ai_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/6b6fd0a5942dfb9762ad2790cf421a80.asciidoc b/docs/doc_examples/6b6fd0a5942dfb9762ad2790cf421a80.asciidoc index 3dff97a73..30adbe22e 100644 --- a/docs/doc_examples/6b6fd0a5942dfb9762ad2790cf421a80.asciidoc +++ b/docs/doc_examples/6b6fd0a5942dfb9762ad2790cf421a80.asciidoc @@ -11,7 +11,7 @@ const response = await client.searchApplication.put({ script: { lang: "mustache", source: - '\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n \n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "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: { query: "", _es_filters: {}, diff --git a/docs/doc_examples/6baf72c04d48cb04c2f8be609ff3b3b5.asciidoc b/docs/doc_examples/6baf72c04d48cb04c2f8be609ff3b3b5.asciidoc new file mode 100644 index 000000000..41c42d206 --- /dev/null +++ b/docs/doc_examples/6baf72c04d48cb04c2f8be609ff3b3b5.asciidoc @@ -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.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); +---- diff --git a/docs/doc_examples/10535507a9735fcf06600444b9067d4c.asciidoc b/docs/doc_examples/6cb1dae368c945ecf7c9ec332a5743a2.asciidoc similarity index 84% rename from docs/doc_examples/10535507a9735fcf06600444b9067d4c.asciidoc rename to docs/doc_examples/6cb1dae368c945ecf7c9ec332a5743a2.asciidoc index c7bc3b58e..fd3ab96e4 100644 --- a/docs/doc_examples/10535507a9735fcf06600444b9067d4c.asciidoc +++ b/docs/doc_examples/6cb1dae368c945ecf7c9ec332a5743a2.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { text: { type: "text", diff --git a/docs/doc_examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc b/docs/doc_examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc new file mode 100644 index 000000000..fdd6ab8f3 --- /dev/null +++ b/docs/doc_examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc @@ -0,0 +1,16 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.reindex({ + wait_for_completion: "false", + source: { + index: ".ml-anomalies-custom-example", + }, + dest: { + index: ".reindexed-v9-ml-anomalies-custom-example", + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/6e6b78e6b689a5d6aa637271b6d084e2.asciidoc b/docs/doc_examples/6e6b78e6b689a5d6aa637271b6d084e2.asciidoc new file mode 100644 index 000000000..a541500cb --- /dev/null +++ b/docs/doc_examples/6e6b78e6b689a5d6aa637271b6d084e2.asciidoc @@ -0,0 +1,45 @@ +// 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", + retriever: { + rrf: { + 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); +---- diff --git a/docs/doc_examples/6f3b723bf6179b96c3413597ed7f49e1.asciidoc b/docs/doc_examples/6f3b723bf6179b96c3413597ed7f49e1.asciidoc index 26bbeb20a..f5995e6b6 100644 --- a/docs/doc_examples/6f3b723bf6179b96c3413597ed7f49e1.asciidoc +++ b/docs/doc_examples/6f3b723bf6179b96c3413597ed7f49e1.asciidoc @@ -3,7 +3,9 @@ [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"], }, diff --git a/docs/doc_examples/6f8bdca97e43aac75e32de655aa4314a.asciidoc b/docs/doc_examples/6f8bdca97e43aac75e32de655aa4314a.asciidoc new file mode 100644 index 000000000..b1295fe7d --- /dev/null +++ b/docs/doc_examples/6f8bdca97e43aac75e32de655aa4314a.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.connector.delete({ + connector_id: "my-connector-id&delete_sync_jobs=true", +}); +console.log(response); +---- diff --git a/docs/doc_examples/f9ee5d55a73f4c1fe7d507609047aefd.asciidoc b/docs/doc_examples/6fa02c2ad485bbe91f44b321158250f3.asciidoc similarity index 76% rename from docs/doc_examples/f9ee5d55a73f4c1fe7d507609047aefd.asciidoc rename to docs/doc_examples/6fa02c2ad485bbe91f44b321158250f3.asciidoc index 0c7b48ea7..afea3d985 100644 --- a/docs/doc_examples/f9ee5d55a73f4c1fe7d507609047aefd.asciidoc +++ b/docs/doc_examples/6fa02c2ad485bbe91f44b321158250f3.asciidoc @@ -12,6 +12,13 @@ const response = await client.search({ fields: ["my_field", "my_field._2gram", "my_field._3gram"], }, }, + highlight: { + fields: { + my_field: { + matched_fields: ["my_field._index_prefix"], + }, + }, + }, }); console.log(response); ---- diff --git a/docs/doc_examples/4dab4c5168047ba596af1beb0e55b845.asciidoc b/docs/doc_examples/7163346755400594d1dd7e445aa19ff0.asciidoc similarity index 69% rename from docs/doc_examples/4dab4c5168047ba596af1beb0e55b845.asciidoc rename to docs/doc_examples/7163346755400594d1dd7e445aa19ff0.asciidoc index 0ba906074..cbb6b62da 100644 --- a/docs/doc_examples/4dab4c5168047ba596af1beb0e55b845.asciidoc +++ b/docs/doc_examples/7163346755400594d1dd7e445aa19ff0.asciidoc @@ -3,8 +3,8 @@ [source, js] ---- -const response = await client.cluster.getSettings({ - flat_settings: "true", +const response = await client.search({ + index: "music", }); console.log(response); ---- diff --git a/docs/doc_examples/8bf51fd50195b46bacbf872f460ebec2.asciidoc b/docs/doc_examples/71998bb300ac2a58419b0772cdc1c586.asciidoc similarity index 81% rename from docs/doc_examples/8bf51fd50195b46bacbf872f460ebec2.asciidoc rename to docs/doc_examples/71998bb300ac2a58419b0772cdc1c586.asciidoc index 84bfecb7b..2efade53d 100644 --- a/docs/doc_examples/8bf51fd50195b46bacbf872f460ebec2.asciidoc +++ b/docs/doc_examples/71998bb300ac2a58419b0772cdc1c586.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { versions: { type: "version", diff --git a/docs/doc_examples/730045fae3743c39b612813a42c330c3.asciidoc b/docs/doc_examples/730045fae3743c39b612813a42c330c3.asciidoc new file mode 100644 index 000000000..b2400e39b --- /dev/null +++ b/docs/doc_examples/730045fae3743c39b612813a42c330c3.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/a4ec42130f3c75fc9d1d5f7cb6222cd5.asciidoc b/docs/doc_examples/745864ef2427188241a4702b94ea57be.asciidoc similarity index 95% rename from docs/doc_examples/a4ec42130f3c75fc9d1d5f7cb6222cd5.asciidoc rename to docs/doc_examples/745864ef2427188241a4702b94ea57be.asciidoc index 2f5f16ec0..a33976eea 100644 --- a/docs/doc_examples/a4ec42130f3c75fc9d1d5f7cb6222cd5.asciidoc +++ b/docs/doc_examples/745864ef2427188241a4702b94ea57be.asciidoc @@ -11,7 +11,7 @@ const response = await client.search({ filter: { range: { price: { - to: "500", + lte: "500", }, }, }, diff --git a/docs/doc_examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc b/docs/doc_examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc new file mode 100644 index 000000000..047487632 --- /dev/null +++ b/docs/doc_examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/74b229a6e020113e5749099451979c89.asciidoc b/docs/doc_examples/74b229a6e020113e5749099451979c89.asciidoc deleted file mode 100644 index b99aa857f..000000000 --- a/docs/doc_examples/74b229a6e020113e5749099451979c89.asciidoc +++ /dev/null @@ -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); ----- diff --git a/docs/doc_examples/35b686d9d9e915d0dea7a4251781767d.asciidoc b/docs/doc_examples/750ac969f9a05567f5cdf4f93d6244b6.asciidoc similarity index 95% rename from docs/doc_examples/35b686d9d9e915d0dea7a4251781767d.asciidoc rename to docs/doc_examples/750ac969f9a05567f5cdf4f93d6244b6.asciidoc index 918d625f6..8a82d0135 100644 --- a/docs/doc_examples/35b686d9d9e915d0dea7a4251781767d.asciidoc +++ b/docs/doc_examples/750ac969f9a05567f5cdf4f93d6244b6.asciidoc @@ -4,7 +4,6 @@ [source, js] ---- const response = await client.cluster.reroute({ - metric: "none", commands: [ { allocate_empty_primary: { diff --git a/docs/doc_examples/76c73b54f3f1e5cb1c0fcccd7c3fd18e.asciidoc b/docs/doc_examples/76c73b54f3f1e5cb1c0fcccd7c3fd18e.asciidoc new file mode 100644 index 000000000..b40a8f8d9 --- /dev/null +++ b/docs/doc_examples/76c73b54f3f1e5cb1c0fcccd7c3fd18e.asciidoc @@ -0,0 +1,52 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.bulk({ + operations: [ + { + index: { + _index: "amazon-reviews", + _id: "2", + }, + }, + { + review_text: "This product is amazing! I love it.", + review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], + }, + { + index: { + _index: "amazon-reviews", + _id: "3", + }, + }, + { + review_text: "This product is terrible. I hate it.", + review_vector: [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], + }, + { + index: { + _index: "amazon-reviews", + _id: "4", + }, + }, + { + review_text: "This product is great. I can do anything with it.", + review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], + }, + { + index: { + _index: "amazon-reviews", + _id: "5", + }, + }, + { + review_text: + "This product has ruined my life and the lives of my family and friends.", + review_vector: [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], + }, + ], +}); +console.log(response); +---- diff --git a/docs/doc_examples/76e02434835630cb830724beb92df354.asciidoc b/docs/doc_examples/76e02434835630cb830724beb92df354.asciidoc new file mode 100644 index 000000000..ab4d1fc80 --- /dev/null +++ b/docs/doc_examples/76e02434835630cb830724beb92df354.asciidoc @@ -0,0 +1,44 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "retrievers_example", + retriever: { + rrf: { + retrievers: [ + { + knn: { + field: "vector", + query_vector: [0.23, 0.67, 0.89], + k: 3, + num_candidates: 5, + }, + }, + { + text_similarity_reranker: { + retriever: { + standard: { + query: { + term: { + topic: "ai", + }, + }, + }, + }, + field: "text", + inference_id: "my-rerank-model", + inference_text: + "Can I use generative AI to identify user intent and improve search relevance?", + }, + }, + ], + rank_window_size: 10, + rank_constant: 1, + }, + }, + _source: false, +}); +console.log(response); +---- diff --git a/docs/doc_examples/77082b1ffaae9ac52dfc133fa597baa7.asciidoc b/docs/doc_examples/77082b1ffaae9ac52dfc133fa597baa7.asciidoc new file mode 100644 index 000000000..9bd1c1eea --- /dev/null +++ b/docs/doc_examples/77082b1ffaae9ac52dfc133fa597baa7.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "cooking_blog", + query: { + match: { + description: { + query: "fluffy pancakes", + operator: "and", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/77518e8c6198acfe77c0934fd2fe65cb.asciidoc b/docs/doc_examples/77518e8c6198acfe77c0934fd2fe65cb.asciidoc index 107aebead..ebe4fce86 100644 --- a/docs/doc_examples/77518e8c6198acfe77c0934fd2fe65cb.asciidoc +++ b/docs/doc_examples/77518e8c6198acfe77c0934fd2fe65cb.asciidoc @@ -3,7 +3,9 @@ [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", diff --git a/docs/doc_examples/2bb41b0b4876ce98cd0cd8fb6d337f18.asciidoc b/docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc similarity index 65% rename from docs/doc_examples/2bb41b0b4876ce98cd0cd8fb6d337f18.asciidoc rename to docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc index 5317e039e..a09e089bb 100644 --- a/docs/doc_examples/2bb41b0b4876ce98cd0cd8fb6d337f18.asciidoc +++ b/docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc @@ -5,11 +5,8 @@ ---- const response = await client.cluster.putSettings({ persistent: { - "cluster.indices.close.enable": false, - "indices.recovery.max_bytes_per_sec": "50mb", - }, - transient: { - "*": null, + "cluster.routing.allocation.disk.watermark.low": "90%", + "cluster.routing.allocation.disk.watermark.high": "95%", }, }); console.log(response); diff --git a/docs/doc_examples/78043831fd32004a82930c8ac8a1d809.asciidoc b/docs/doc_examples/78043831fd32004a82930c8ac8a1d809.asciidoc new file mode 100644 index 000000000..5151bb769 --- /dev/null +++ b/docs/doc_examples/78043831fd32004a82930c8ac8a1d809.asciidoc @@ -0,0 +1,46 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "retrievers_example", + retriever: { + text_similarity_reranker: { + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + query_string: { + query: + "(information retrieval) OR (artificial intelligence)", + default_field: "text", + }, + }, + }, + }, + { + knn: { + field: "vector", + query_vector: [0.23, 0.67, 0.89], + k: 3, + num_candidates: 5, + }, + }, + ], + rank_window_size: 10, + rank_constant: 1, + }, + }, + field: "text", + inference_id: "my-rerank-model", + inference_text: + "What are the state of the art applications of AI in information retrieval?", + }, + }, + _source: false, +}); +console.log(response); +---- diff --git a/docs/doc_examples/84490ee2c6c07dbd2101ce2e3751e1aa.asciidoc b/docs/doc_examples/7888c509774a2abfe82ca370c43d8789.asciidoc similarity index 88% rename from docs/doc_examples/84490ee2c6c07dbd2101ce2e3751e1aa.asciidoc rename to docs/doc_examples/7888c509774a2abfe82ca370c43d8789.asciidoc index 572e30e93..d4e0c4db6 100644 --- a/docs/doc_examples/84490ee2c6c07dbd2101ce2e3751e1aa.asciidoc +++ b/docs/doc_examples/7888c509774a2abfe82ca370c43d8789.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "cohere-embeddings", - pipeline: "cohere_embeddings", + pipeline: "cohere_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc b/docs/doc_examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc new file mode 100644 index 000000000..d5144150f --- /dev/null +++ b/docs/doc_examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/79d206a528be704050a437adce2496dd.asciidoc b/docs/doc_examples/79d206a528be704050a437adce2496dd.asciidoc new file mode 100644 index 000000000..60583c320 --- /dev/null +++ b/docs/doc_examples/79d206a528be704050a437adce2496dd.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "rerank", + inference_id: "my-elastic-rerank", + inference_config: { + service: "elasticsearch", + service_settings: { + model_id: ".rerank-v1", + num_threads: 1, + adaptive_allocations: { + enabled: true, + min_number_of_allocations: 1, + max_number_of_allocations: 10, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/79ff4e7fa5c004226d05d7e2bfb5dc1e.asciidoc b/docs/doc_examples/79ff4e7fa5c004226d05d7e2bfb5dc1e.asciidoc new file mode 100644 index 000000000..13de04136 --- /dev/null +++ b/docs/doc_examples/79ff4e7fa5c004226d05d7e2bfb5dc1e.asciidoc @@ -0,0 +1,49 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.putIndexTemplate({ + name: "my-metrics", + index_patterns: ["metrics-mymetrics-*"], + priority: 200, + data_stream: {}, + template: { + settings: { + "index.mode": "time_series", + }, + mappings: { + properties: { + attributes: { + type: "passthrough", + priority: 10, + time_series_dimension: true, + properties: { + "host.name": { + type: "keyword", + }, + }, + }, + cpu: { + type: "integer", + time_series_metric: "counter", + }, + }, + }, + }, +}); +console.log(response); + +const response1 = await client.index({ + index: "metrics-mymetrics-test", + document: { + "@timestamp": "2020-01-01T00:00:00.000Z", + attributes: { + "host.name": "foo", + zone: "bar", + }, + cpu: 10, + }, +}); +console.log(response1); +---- diff --git a/docs/doc_examples/7a27336a61284d079f3cc3994cf927d1.asciidoc b/docs/doc_examples/7a27336a61284d079f3cc3994cf927d1.asciidoc new file mode 100644 index 000000000..a289078cb --- /dev/null +++ b/docs/doc_examples/7a27336a61284d079f3cc3994cf927d1.asciidoc @@ -0,0 +1,50 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.security.createApiKey({ + name: "my-api-key", + role_descriptors: { + "role-source1": { + indices: [ + { + names: ["source1"], + privileges: ["read"], + query: { + template: { + params: { + access_control: [ + "example.user@example.com", + "source1-user-group", + ], + }, + }, + source: "...", + }, + }, + ], + }, + "role-source2": { + indices: [ + { + names: ["source2"], + privileges: ["read"], + query: { + template: { + params: { + access_control: [ + "example.user@example.com", + "source2-user-group", + ], + }, + }, + source: "...", + }, + }, + ], + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/7a2fdfd7b0553d63440af7598f9ad867.asciidoc b/docs/doc_examples/7a2fdfd7b0553d63440af7598f9ad867.asciidoc new file mode 100644 index 000000000..63fb1f69a --- /dev/null +++ b/docs/doc_examples/7a2fdfd7b0553d63440af7598f9ad867.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.create({ + index: "my-index-000003", + mappings: { + properties: { + inference_field: { + type: "semantic_text", + inference_id: "my-elser-endpoint-for-ingest", + search_inference_id: "my-elser-endpoint-for-search", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/7af1f62b0cf496cbf593d83d30b472cc.asciidoc b/docs/doc_examples/7af1f62b0cf496cbf593d83d30b472cc.asciidoc new file mode 100644 index 000000000..838cdbbbd --- /dev/null +++ b/docs/doc_examples/7af1f62b0cf496cbf593d83d30b472cc.asciidoc @@ -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.security.createApiKey({ + name: "music-connector", + role_descriptors: { + "music-connector-role": { + cluster: ["monitor", "manage_connector"], + indices: [ + { + names: ["music", ".search-acl-filter-music", ".elastic-connectors*"], + privileges: ["all"], + allow_restricted_indices: false, + }, + ], + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/19d60e4890cc57151d596326484d9076.asciidoc b/docs/doc_examples/7ba29f0be2297b54a640b0a17d7ef5ca.asciidoc similarity index 81% rename from docs/doc_examples/19d60e4890cc57151d596326484d9076.asciidoc rename to docs/doc_examples/7ba29f0be2297b54a640b0a17d7ef5ca.asciidoc index 6f918e3b2..d1fcf443c 100644 --- a/docs/doc_examples/19d60e4890cc57151d596326484d9076.asciidoc +++ b/docs/doc_examples/7ba29f0be2297b54a640b0a17d7ef5ca.asciidoc @@ -5,7 +5,7 @@ ---- const response = await client.transport.request({ method: "DELETE", - path: "/_ingest/geoip/database/my-database-id", + path: "/_ingest/ip_location/database/my-database-id", }); console.log(response); ---- diff --git a/docs/doc_examples/8593715fcc70315a0816b435551258e0.asciidoc b/docs/doc_examples/7bdc283b96c7a965fae23013647b8578.asciidoc similarity index 90% rename from docs/doc_examples/8593715fcc70315a0816b435551258e0.asciidoc rename to docs/doc_examples/7bdc283b96c7a965fae23013647b8578.asciidoc index aae698a6f..7f416d2de 100644 --- a/docs/doc_examples/8593715fcc70315a0816b435551258e0.asciidoc +++ b/docs/doc_examples/7bdc283b96c7a965fae23013647b8578.asciidoc @@ -7,14 +7,14 @@ const response = await client.indices.create({ index: "test-index", mappings: { properties: { - infer_field: { - type: "semantic_text", - inference_id: "my-elser-endpoint", - }, source_field: { type: "text", copy_to: "infer_field", }, + infer_field: { + type: "semantic_text", + inference_id: ".elser-2-elasticsearch", + }, }, }, }); diff --git a/docs/doc_examples/7c8f207e43115ea8f20d2298be5aaebc.asciidoc b/docs/doc_examples/7c8f207e43115ea8f20d2298be5aaebc.asciidoc deleted file mode 100644 index eb0ee1488..000000000 --- a/docs/doc_examples/7c8f207e43115ea8f20d2298be5aaebc.asciidoc +++ /dev/null @@ -1,39 +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.simulate.ingest({ - body: { - docs: [ - { - _index: "my-index", - _id: "id", - _source: { - foo: "bar", - }, - }, - { - _index: "my-index", - _id: "id", - _source: { - foo: "rab", - }, - }, - ], - pipeline_substitutions: { - "my-pipeline": { - processors: [ - { - set: { - field: "field3", - value: "value3", - }, - }, - ], - }, - }, - }, -}); -console.log(response); ----- diff --git a/docs/doc_examples/f3574cfee3971d98417b8dc574a91be0.asciidoc b/docs/doc_examples/7d3a74fe0ba3fe95d1c3275365ff9315.asciidoc similarity index 85% rename from docs/doc_examples/f3574cfee3971d98417b8dc574a91be0.asciidoc rename to docs/doc_examples/7d3a74fe0ba3fe95d1c3275365ff9315.asciidoc index 0ae64f8ad..b319e1c28 100644 --- a/docs/doc_examples/f3574cfee3971d98417b8dc574a91be0.asciidoc +++ b/docs/doc_examples/7d3a74fe0ba3fe95d1c3275365ff9315.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { flattened: { type: "flattened", diff --git a/docs/doc_examples/7db09cab02d71f3a10d91071216d80fc.asciidoc b/docs/doc_examples/7db09cab02d71f3a10d91071216d80fc.asciidoc new file mode 100644 index 000000000..94a971289 --- /dev/null +++ b/docs/doc_examples/7db09cab02d71f3a10d91071216d80fc.asciidoc @@ -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: "amazon-reviews", + retriever: { + knn: { + field: "review_vector", + query_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], + k: 2, + num_candidates: 5, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/7db798942cf2d334456e30ef5fcb801b.asciidoc b/docs/doc_examples/7db798942cf2d334456e30ef5fcb801b.asciidoc new file mode 100644 index 000000000..79ead4d92 --- /dev/null +++ b/docs/doc_examples/7db798942cf2d334456e30ef5fcb801b.asciidoc @@ -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.search({ + index: "cooking_blog", + query: { + match: { + description: { + query: "fluffy pancakes", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc b/docs/doc_examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc new file mode 100644 index 000000000..733c366ba --- /dev/null +++ b/docs/doc_examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/7f1fade93225f8cf6000b93334d76ce4.asciidoc b/docs/doc_examples/7f1fade93225f8cf6000b93334d76ce4.asciidoc new file mode 100644 index 000000000..9d18e53eb --- /dev/null +++ b/docs/doc_examples/7f1fade93225f8cf6000b93334d76ce4.asciidoc @@ -0,0 +1,34 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.ingest.putPipeline({ + id: "ip_location", + description: "Add ip geolocation info", + processors: [ + { + ip_location: { + field: "ip", + }, + }, + ], +}); +console.log(response); + +const response1 = await client.index({ + index: "my-index-000001", + id: "my_id", + pipeline: "ip_location", + document: { + ip: "80.231.5.0", + }, +}); +console.log(response1); + +const response2 = await client.get({ + index: "my-index-000001", + id: "my_id", +}); +console.log(response2); +---- diff --git a/docs/doc_examples/f4d0ef2e0f76babee83d999fe35127f2.asciidoc b/docs/doc_examples/80135e8c644e34cc70ce8a4e7915d1a2.asciidoc similarity index 96% rename from docs/doc_examples/f4d0ef2e0f76babee83d999fe35127f2.asciidoc rename to docs/doc_examples/80135e8c644e34cc70ce8a4e7915d1a2.asciidoc index 0bf72b678..bb8174e35 100644 --- a/docs/doc_examples/f4d0ef2e0f76babee83d999fe35127f2.asciidoc +++ b/docs/doc_examples/80135e8c644e34cc70ce8a4e7915d1a2.asciidoc @@ -12,7 +12,7 @@ const response = await client.ingest.putPipeline({ field: "data", indexed_chars: 11, indexed_chars_field: "max_size", - remove_binary: false, + remove_binary: true, }, }, ], diff --git a/docs/doc_examples/8080cd9e24a8785728ce7c372ec4acf1.asciidoc b/docs/doc_examples/8080cd9e24a8785728ce7c372ec4acf1.asciidoc new file mode 100644 index 000000000..2904d2dc7 --- /dev/null +++ b/docs/doc_examples/8080cd9e24a8785728ce7c372ec4acf1.asciidoc @@ -0,0 +1,14 @@ +// 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: "/_watcher/settings", + body: { + "index.routing.allocation.include.role": "watcher", + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/80dd7f5882c59b9c1c90e8351937441f.asciidoc b/docs/doc_examples/80dd7f5882c59b9c1c90e8351937441f.asciidoc index 659fc0e47..28fdff4a5 100644 --- a/docs/doc_examples/80dd7f5882c59b9c1c90e8351937441f.asciidoc +++ b/docs/doc_examples/80dd7f5882c59b9c1c90e8351937441f.asciidoc @@ -3,7 +3,9 @@ [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: { diff --git a/docs/doc_examples/828f0045747fde4888a947bb99e190e3.asciidoc b/docs/doc_examples/828f0045747fde4888a947bb99e190e3.asciidoc new file mode 100644 index 000000000..a4e4969f9 --- /dev/null +++ b/docs/doc_examples/828f0045747fde4888a947bb99e190e3.asciidoc @@ -0,0 +1,27 @@ +// 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", + retriever: { + rule: { + match_criteria: { + query_string: "harry potter", + }, + ruleset_ids: ["my-ruleset"], + retriever: { + standard: { + query: { + query_string: { + query: "harry potter", + }, + }, + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc b/docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc new file mode 100644 index 000000000..7c7a7cba1 --- /dev/null +++ b/docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/9aa2327ae315c39f2bce2bd22e0deb1b.asciidoc b/docs/doc_examples/8417d8d35ec5fc5665dfb2f95d6d1101.asciidoc similarity index 94% rename from docs/doc_examples/9aa2327ae315c39f2bce2bd22e0deb1b.asciidoc rename to docs/doc_examples/8417d8d35ec5fc5665dfb2f95d6d1101.asciidoc index b6c3a9585..12610d1a5 100644 --- a/docs/doc_examples/9aa2327ae315c39f2bce2bd22e0deb1b.asciidoc +++ b/docs/doc_examples/8417d8d35ec5fc5665dfb2f95d6d1101.asciidoc @@ -17,7 +17,7 @@ const response = await client.search({ { range: { "result.execution_time": { - from: "now-10s", + gte: "now-10s", }, }, }, diff --git a/docs/doc_examples/84237aa9da49ab4b4c4e2b21d2548df2.asciidoc b/docs/doc_examples/84237aa9da49ab4b4c4e2b21d2548df2.asciidoc new file mode 100644 index 000000000..ae893a16e --- /dev/null +++ b/docs/doc_examples/84237aa9da49ab4b4c4e2b21d2548df2.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.snapshot.repositoryVerifyIntegrity({ + name: "my_repository", +}); +console.log(response); +---- diff --git a/docs/doc_examples/84ef9fe951c6d3caa7438238a5b23319.asciidoc b/docs/doc_examples/84ef9fe951c6d3caa7438238a5b23319.asciidoc new file mode 100644 index 000000000..5d2ef1d8d --- /dev/null +++ b/docs/doc_examples/84ef9fe951c6d3caa7438238a5b23319.asciidoc @@ -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.search({ + index: "cooking_blog", + query: { + term: { + "author.keyword": "Maria Rodriguez", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/853fc710cea79fb4e1a85fb6d149f9c5.asciidoc b/docs/doc_examples/853fc710cea79fb4e1a85fb6d149f9c5.asciidoc new file mode 100644 index 000000000..0ca3674f6 --- /dev/null +++ b/docs/doc_examples/853fc710cea79fb4e1a85fb6d149f9c5.asciidoc @@ -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.search({ + index: "movies", + retriever: { + rule: { + match_criteria: { + query_string: "harry potter", + }, + ruleset_ids: ["my-ruleset"], + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + query_string: { + query: "sorcerer's stone", + }, + }, + }, + }, + { + standard: { + query: { + query_string: { + query: "chamber of secrets", + }, + }, + }, + }, + ], + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/85f9fc6f98e8573efed9b034e853d5ae.asciidoc b/docs/doc_examples/85f9fc6f98e8573efed9b034e853d5ae.asciidoc new file mode 100644 index 000000000..9bc60ea81 --- /dev/null +++ b/docs/doc_examples/85f9fc6f98e8573efed9b034e853d5ae.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "sparse_embedding", + inference_id: "use_existing_deployment", + inference_config: { + service: "elasticsearch", + service_settings: { + deployment_id: ".elser_model_2", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/1d918e206ad8dab916e59183da24d9ec.asciidoc b/docs/doc_examples/8621c05cc7cf3880bde751f6670a0c3a.asciidoc similarity index 70% rename from docs/doc_examples/1d918e206ad8dab916e59183da24d9ec.asciidoc rename to docs/doc_examples/8621c05cc7cf3880bde751f6670a0c3a.asciidoc index 6e0a57866..7cb4b44d1 100644 --- a/docs/doc_examples/1d918e206ad8dab916e59183da24d9ec.asciidoc +++ b/docs/doc_examples/8621c05cc7cf3880bde751f6670a0c3a.asciidoc @@ -4,9 +4,11 @@ [source, js] ---- const response = await client.indices.putSettings({ - index: ".watches", + index: ".reindexed-v9-ml-anomalies-custom-example", settings: { - "index.routing.allocation.include.role": "watcher", + index: { + number_of_replicas: 0, + }, }, }); console.log(response); diff --git a/docs/doc_examples/113ac8466084ee6ac4ed272e342dc468.asciidoc b/docs/doc_examples/894fce12d8f0d01e4c4083885a0c0077.asciidoc similarity index 88% rename from docs/doc_examples/113ac8466084ee6ac4ed272e342dc468.asciidoc rename to docs/doc_examples/894fce12d8f0d01e4c4083885a0c0077.asciidoc index 406ed089e..5a195c6f2 100644 --- a/docs/doc_examples/113ac8466084ee6ac4ed272e342dc468.asciidoc +++ b/docs/doc_examples/894fce12d8f0d01e4c4083885a0c0077.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "mistral-embeddings", - pipeline: "mistral_embeddings", + pipeline: "mistral_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/89f547649895176c246bb8c41313ff21.asciidoc b/docs/doc_examples/89f547649895176c246bb8c41313ff21.asciidoc new file mode 100644 index 000000000..571f64436 --- /dev/null +++ b/docs/doc_examples/89f547649895176c246bb8c41313ff21.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.esql.query({ + query: + '\nFROM library\n| EVAL year = DATE_EXTRACT("year", release_date)\n| WHERE page_count > ? AND match(author, ?, {"minimum_should_match": ?})\n| LIMIT 5\n', + params: [300, "Frank Herbert", 2], +}); +console.log(response); +---- diff --git a/docs/doc_examples/804cdf477ec829740e3d045140400c3b.asciidoc b/docs/doc_examples/8a0b5f759de3f27f0801c1176e616117.asciidoc similarity index 72% rename from docs/doc_examples/804cdf477ec829740e3d045140400c3b.asciidoc rename to docs/doc_examples/8a0b5f759de3f27f0801c1176e616117.asciidoc index 255b2df23..5ac85568d 100644 --- a/docs/doc_examples/804cdf477ec829740e3d045140400c3b.asciidoc +++ b/docs/doc_examples/8a0b5f759de3f27f0801c1176e616117.asciidoc @@ -7,13 +7,8 @@ const response = await client.indices.create({ index: "semantic-embeddings", mappings: { properties: { - semantic_text: { - type: "semantic_text", - inference_id: "my-elser-endpoint", - }, content: { - type: "text", - copy_to: "semantic_text", + type: "semantic_text", }, }, }, diff --git a/docs/doc_examples/8b8b6aac2111b2d8b93758ac737e6543.asciidoc b/docs/doc_examples/8b8b6aac2111b2d8b93758ac737e6543.asciidoc new file mode 100644 index 000000000..9bee24620 --- /dev/null +++ b/docs/doc_examples/8b8b6aac2111b2d8b93758ac737e6543.asciidoc @@ -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.indices.create({ + index: "idx_keep", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, + }, + }, + mappings: { + properties: { + path: { + type: "object", + synthetic_source_keep: "all", + }, + ids: { + type: "integer", + synthetic_source_keep: "arrays", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/1745ac9e6d22a2ffe7ac381f9ba238f9.asciidoc b/docs/doc_examples/8c47c80139f40f25db44f5781ca2dfbe.asciidoc similarity index 65% rename from docs/doc_examples/1745ac9e6d22a2ffe7ac381f9ba238f9.asciidoc rename to docs/doc_examples/8c47c80139f40f25db44f5781ca2dfbe.asciidoc index 5c00b0b5c..680f24481 100644 --- a/docs/doc_examples/1745ac9e6d22a2ffe7ac381f9ba238f9.asciidoc +++ b/docs/doc_examples/8c47c80139f40f25db44f5781ca2dfbe.asciidoc @@ -3,8 +3,8 @@ [source, js] ---- -const response = await client.nodes.hotThreads({ - node_id: "my-node,my-other-node", +const response = await client.indices.getAlias({ + index: ".ml-anomalies-custom-example", }); console.log(response); ---- diff --git a/docs/doc_examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc b/docs/doc_examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc new file mode 100644 index 000000000..aa09492cf --- /dev/null +++ b/docs/doc_examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/8d05862be1f9e7edaba162b1888b5677.asciidoc b/docs/doc_examples/8d05862be1f9e7edaba162b1888b5677.asciidoc new file mode 100644 index 000000000..0241e351c --- /dev/null +++ b/docs/doc_examples/8d05862be1f9e7edaba162b1888b5677.asciidoc @@ -0,0 +1,61 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.putMapping({ + index: "cooking_blog", + properties: { + title: { + type: "text", + analyzer: "standard", + fields: { + keyword: { + type: "keyword", + ignore_above: 256, + }, + }, + }, + description: { + type: "text", + fields: { + keyword: { + type: "keyword", + }, + }, + }, + author: { + type: "text", + fields: { + keyword: { + type: "keyword", + }, + }, + }, + date: { + type: "date", + format: "yyyy-MM-dd", + }, + category: { + type: "text", + fields: { + keyword: { + type: "keyword", + }, + }, + }, + tags: { + type: "text", + fields: { + keyword: { + type: "keyword", + }, + }, + }, + rating: { + type: "float", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/9169d19a80175ec94f80865d0f9bef4c.asciidoc b/docs/doc_examples/9169d19a80175ec94f80865d0f9bef4c.asciidoc new file mode 100644 index 000000000..39f61a37a --- /dev/null +++ b/docs/doc_examples/9169d19a80175ec94f80865d0f9bef4c.asciidoc @@ -0,0 +1,36 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "restaurants", + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + multi_match: { + query: "Austria", + fields: ["city", "region"], + }, + }, + }, + }, + { + knn: { + field: "vector", + query_vector: [10, 22, 77], + k: 10, + num_candidates: 10, + }, + }, + ], + rank_constant: 1, + rank_window_size: 50, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/981b331db1404b39c1a612a135e4e76d.asciidoc b/docs/doc_examples/91e106a2affbc8df32cd940684a779ed.asciidoc similarity index 78% rename from docs/doc_examples/981b331db1404b39c1a612a135e4e76d.asciidoc rename to docs/doc_examples/91e106a2affbc8df32cd940684a779ed.asciidoc index 0d3cdbbe3..8d9b9da8b 100644 --- a/docs/doc_examples/981b331db1404b39c1a612a135e4e76d.asciidoc +++ b/docs/doc_examples/91e106a2affbc8df32cd940684a779ed.asciidoc @@ -5,11 +5,11 @@ ---- const response = await client.transport.request({ method: "PUT", - path: "/_ingest/geoip/database/my-database-id", + path: "/_ingest/ip_location/database/my-database-1", body: { name: "GeoIP2-Domain", maxmind: { - account_id: "1025402", + account_id: "1234567", }, }, }); diff --git a/docs/doc_examples/9250ac57ec81d5192e8ad4c462438489.asciidoc b/docs/doc_examples/9250ac57ec81d5192e8ad4c462438489.asciidoc new file mode 100644 index 000000000..8a6e40755 --- /dev/null +++ b/docs/doc_examples/9250ac57ec81d5192e8ad4c462438489.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/9313f534e1aa266cde7d4af74665497f.asciidoc b/docs/doc_examples/9313f534e1aa266cde7d4af74665497f.asciidoc new file mode 100644 index 000000000..86e737ce5 --- /dev/null +++ b/docs/doc_examples/9313f534e1aa266cde7d4af74665497f.asciidoc @@ -0,0 +1,13 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.connector.put({ + connector_id: "my-{service-name-stub}-connector", + index_name: "my-elasticsearch-index", + name: "Content synced from {service-name}", + service_type: "{service-name-stub}", +}); +console.log(response); +---- diff --git a/docs/doc_examples/931817b168e055ecf738785c721125dd.asciidoc b/docs/doc_examples/931817b168e055ecf738785c721125dd.asciidoc new file mode 100644 index 000000000..3d34dce97 --- /dev/null +++ b/docs/doc_examples/931817b168e055ecf738785c721125dd.asciidoc @@ -0,0 +1,32 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.ingest.putPipeline({ + id: "query_helper_pipeline", + processors: [ + { + script: { + source: + "ctx.prompt = 'Please generate an elasticsearch search query on index `articles_index` for the following natural language query. Dates are in the field `@timestamp`, document types are in the field `type` (options are `news`, `publication`), categories in the field `category` and can be multiple (options are `medicine`, `pharmaceuticals`, `technology`), and document names are in the field `title` which should use a fuzzy match. Ignore fields which cannot be determined from the natural language query context: ' + ctx.content", + }, + }, + { + inference: { + model_id: "openai_chat_completions", + input_output: { + input_field: "prompt", + output_field: "query", + }, + }, + }, + { + remove: { + field: "prompt", + }, + }, + ], +}); +console.log(response); +---- diff --git a/docs/doc_examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc b/docs/doc_examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc new file mode 100644 index 000000000..5a4bb2510 --- /dev/null +++ b/docs/doc_examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc @@ -0,0 +1,89 @@ +// 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: "retrievers_example_nested", + settings: { + number_of_shards: 1, + }, + mappings: { + properties: { + nested_field: { + type: "nested", + properties: { + paragraph_id: { + type: "keyword", + }, + nested_vector: { + type: "dense_vector", + dims: 3, + similarity: "l2_norm", + index: true, + index_options: { + type: "flat", + }, + }, + }, + }, + topic: { + type: "keyword", + }, + }, + }, +}); +console.log(response); + +const response1 = await client.index({ + index: "retrievers_example_nested", + id: 1, + document: { + nested_field: [ + { + paragraph_id: "1a", + nested_vector: [-1.12, -0.59, 0.78], + }, + { + paragraph_id: "1b", + nested_vector: [-0.12, 1.56, 0.42], + }, + { + paragraph_id: "1c", + nested_vector: [1, -1, 0], + }, + ], + topic: ["ai"], + }, +}); +console.log(response1); + +const response2 = await client.index({ + index: "retrievers_example_nested", + id: 2, + document: { + nested_field: [ + { + paragraph_id: "2a", + nested_vector: [0.23, 1.24, 0.65], + }, + ], + topic: ["information_retrieval"], + }, +}); +console.log(response2); + +const response3 = await client.index({ + index: "retrievers_example_nested", + id: 3, + document: { + topic: ["ai"], + }, +}); +console.log(response3); + +const response4 = await client.indices.refresh({ + index: "retrievers_example_nested", +}); +console.log(response4); +---- diff --git a/docs/doc_examples/7e5bee18e61d950e823782da1b733903.asciidoc b/docs/doc_examples/968fb5b92aa65af09544f7c002b0953e.asciidoc similarity index 91% rename from docs/doc_examples/7e5bee18e61d950e823782da1b733903.asciidoc rename to docs/doc_examples/968fb5b92aa65af09544f7c002b0953e.asciidoc index f63ee943b..410d4fc38 100644 --- a/docs/doc_examples/7e5bee18e61d950e823782da1b733903.asciidoc +++ b/docs/doc_examples/968fb5b92aa65af09544f7c002b0953e.asciidoc @@ -7,7 +7,7 @@ const response = await client.search({ index: "semantic-embeddings", query: { semantic: { - field: "semantic_text", + field: "content", query: "How to avoid muscle soreness while running?", }, }, diff --git a/docs/doc_examples/18de6782bd18f4a9baec2feec8c02a8b.asciidoc b/docs/doc_examples/96e88611f99e6834bd64b58dc8a282c1.asciidoc similarity index 74% rename from docs/doc_examples/18de6782bd18f4a9baec2feec8c02a8b.asciidoc rename to docs/doc_examples/96e88611f99e6834bd64b58dc8a282c1.asciidoc index d89eb07d1..d3786611f 100644 --- a/docs/doc_examples/18de6782bd18f4a9baec2feec8c02a8b.asciidoc +++ b/docs/doc_examples/96e88611f99e6834bd64b58dc8a282c1.asciidoc @@ -7,9 +7,9 @@ const response = await client.indices.create({ index: "my-index-000002", mappings: { properties: { - datetime: { - type: "date", - format: "uuuu/MM/dd HH:mm:ss||uuuu/MM/dd||epoch_millis", + inference_field: { + type: "semantic_text", + inference_id: "my-openai-endpoint", }, }, }, diff --git a/docs/doc_examples/971fd23adb81bb5842c7750e0379336a.asciidoc b/docs/doc_examples/971fd23adb81bb5842c7750e0379336a.asciidoc new file mode 100644 index 000000000..e1b27bc79 --- /dev/null +++ b/docs/doc_examples/971fd23adb81bb5842c7750e0379336a.asciidoc @@ -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: "movies", + retriever: { + text_similarity_reranker: { + retriever: { + standard: { + query: { + match: { + genre: "drama", + }, + }, + }, + }, + field: "plot", + inference_id: "my-msmarco-minilm-model", + inference_text: "films that explore psychological depths", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/97c6c07f46f4177f0565a04bc50924a3.asciidoc b/docs/doc_examples/97c6c07f46f4177f0565a04bc50924a3.asciidoc new file mode 100644 index 000000000..ae96b5501 --- /dev/null +++ b/docs/doc_examples/97c6c07f46f4177f0565a04bc50924a3.asciidoc @@ -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: "retrievers_example", + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + query_string: { + query: "(information retrieval) OR (artificial intelligence)", + default_field: "text", + }, + }, + }, + }, + { + knn: { + field: "vector", + query_vector: [0.23, 0.67, 0.89], + k: 3, + num_candidates: 5, + }, + }, + ], + rank_window_size: 10, + rank_constant: 1, + }, + }, + _source: false, +}); +console.log(response); +---- diff --git a/docs/doc_examples/998c8479c8704bca0e121d5969859517.asciidoc b/docs/doc_examples/998c8479c8704bca0e121d5969859517.asciidoc new file mode 100644 index 000000000..130ceb562 --- /dev/null +++ b/docs/doc_examples/998c8479c8704bca0e121d5969859517.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.count({ + index: "music", +}); +console.log(response); +---- diff --git a/docs/doc_examples/533087d787b48878a0bf3fa8d0851b64.asciidoc b/docs/doc_examples/99fb82d49ac477e6a9dfdd71f9465374.asciidoc similarity index 79% rename from docs/doc_examples/533087d787b48878a0bf3fa8d0851b64.asciidoc rename to docs/doc_examples/99fb82d49ac477e6a9dfdd71f9465374.asciidoc index 65425b66a..3f2ffdf6b 100644 --- a/docs/doc_examples/533087d787b48878a0bf3fa8d0851b64.asciidoc +++ b/docs/doc_examples/99fb82d49ac477e6a9dfdd71f9465374.asciidoc @@ -5,7 +5,7 @@ ---- const response = await client.transport.request({ method: "DELETE", - path: "/_ingest/geoip/database/example-database-id", + path: "/_ingest/ip_location/database/example-database-id", }); console.log(response); ---- diff --git a/docs/doc_examples/2cd8439db5054c93c49f1bf50433e1bb.asciidoc b/docs/doc_examples/9aedc45f83e022732789e8d796f5a43c.asciidoc similarity index 96% rename from docs/doc_examples/2cd8439db5054c93c49f1bf50433e1bb.asciidoc rename to docs/doc_examples/9aedc45f83e022732789e8d796f5a43c.asciidoc index fb87919cd..f4f4c1e5d 100644 --- a/docs/doc_examples/2cd8439db5054c93c49f1bf50433e1bb.asciidoc +++ b/docs/doc_examples/9aedc45f83e022732789e8d796f5a43c.asciidoc @@ -4,7 +4,6 @@ [source, js] ---- const response = await client.cluster.reroute({ - metric: "none", commands: [ { move: { diff --git a/docs/doc_examples/9afa0844883b7471883aa378a8dd10b4.asciidoc b/docs/doc_examples/9afa0844883b7471883aa378a8dd10b4.asciidoc index 46c6ad610..0cf3aea4d 100644 --- a/docs/doc_examples/9afa0844883b7471883aa378a8dd10b4.asciidoc +++ b/docs/doc_examples/9afa0844883b7471883aa378a8dd10b4.asciidoc @@ -3,9 +3,9 @@ [source, js] ---- -const response = await client.searchApplication.postBehavioralAnalyticsEvent({ - collection_name: "my_analytics_collection", - event_type: "search_click", +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", diff --git a/docs/doc_examples/9bd5a470ee6d2b4a1f5280adc39675d2.asciidoc b/docs/doc_examples/9bd5a470ee6d2b4a1f5280adc39675d2.asciidoc new file mode 100644 index 000000000..2a2b518d4 --- /dev/null +++ b/docs/doc_examples/9bd5a470ee6d2b4a1f5280adc39675d2.asciidoc @@ -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.update({ + index: ".elastic-connectors", + id: "connector_id", + doc: { + configuration: { + tables: { + type: "list", + value: "*", + }, + ssl_enabled: { + type: "bool", + value: false, + }, + ssl_ca: { + type: "str", + value: "", + }, + fetch_size: { + type: "int", + value: 50, + }, + retry_count: { + type: "int", + value: 3, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/9c01db07c9ac395b6370e3b33965c21f.asciidoc b/docs/doc_examples/9c01db07c9ac395b6370e3b33965c21f.asciidoc index 64e6db48e..8e19908d0 100644 --- a/docs/doc_examples/9c01db07c9ac395b6370e3b33965c21f.asciidoc +++ b/docs/doc_examples/9c01db07c9ac395b6370e3b33965c21f.asciidoc @@ -3,7 +3,9 @@ [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", diff --git a/docs/doc_examples/5b86d54900e2c4c043a54ca7ae2df0f0.asciidoc b/docs/doc_examples/9c2ce0132e4527077443f007d27b1158.asciidoc similarity index 81% rename from docs/doc_examples/5b86d54900e2c4c043a54ca7ae2df0f0.asciidoc rename to docs/doc_examples/9c2ce0132e4527077443f007d27b1158.asciidoc index 9e0654221..a85d946d2 100644 --- a/docs/doc_examples/5b86d54900e2c4c043a54ca7ae2df0f0.asciidoc +++ b/docs/doc_examples/9c2ce0132e4527077443f007d27b1158.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { flattened: { type: "flattened", diff --git a/docs/doc_examples/9cc952d4a03264b700136cbc45abc8c6.asciidoc b/docs/doc_examples/9cc952d4a03264b700136cbc45abc8c6.asciidoc new file mode 100644 index 000000000..1bc8b2cc7 --- /dev/null +++ b/docs/doc_examples/9cc952d4a03264b700136cbc45abc8c6.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/50ddf374cfa8128538ea092ee98b723d.asciidoc b/docs/doc_examples/9d66cb59711f24e6b4ff85608c9b5a1b.asciidoc similarity index 79% rename from docs/doc_examples/50ddf374cfa8128538ea092ee98b723d.asciidoc rename to docs/doc_examples/9d66cb59711f24e6b4ff85608c9b5a1b.asciidoc index ff7c02793..8c361f48c 100644 --- a/docs/doc_examples/50ddf374cfa8128538ea092ee98b723d.asciidoc +++ b/docs/doc_examples/9d66cb59711f24e6b4ff85608c9b5a1b.asciidoc @@ -4,7 +4,9 @@ [source, js] ---- const response = await client.tasks.list({ - filter_path: "nodes.*.tasks", + pretty: "true", + human: "true", + detailed: "true", }); console.log(response); ---- diff --git a/docs/doc_examples/a162eb50853331c80596f5994e9d1c38.asciidoc b/docs/doc_examples/a162eb50853331c80596f5994e9d1c38.asciidoc index 6b9a54625..afaf9d7dc 100644 --- a/docs/doc_examples/a162eb50853331c80596f5994e9d1c38.asciidoc +++ b/docs/doc_examples/a162eb50853331c80596f5994e9d1c38.asciidoc @@ -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", body: { params: { query_string: "rock climbing", diff --git a/docs/doc_examples/f38262ef72f73816ec35fa4c9c85760d.asciidoc b/docs/doc_examples/a1b668795243398f5bc40bcc9bead884.asciidoc similarity index 85% rename from docs/doc_examples/f38262ef72f73816ec35fa4c9c85760d.asciidoc rename to docs/doc_examples/a1b668795243398f5bc40bcc9bead884.asciidoc index ec74a3eb1..31d504f3c 100644 --- a/docs/doc_examples/f38262ef72f73816ec35fa4c9c85760d.asciidoc +++ b/docs/doc_examples/a1b668795243398f5bc40bcc9bead884.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { my_range: { type: "long_range", diff --git a/docs/doc_examples/a1dda7e7c01be96a4acf7b725d70385f.asciidoc b/docs/doc_examples/a1dda7e7c01be96a4acf7b725d70385f.asciidoc new file mode 100644 index 000000000..fffbd6549 --- /dev/null +++ b/docs/doc_examples/a1dda7e7c01be96a4acf7b725d70385f.asciidoc @@ -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: "index", + retriever: { + text_similarity_reranker: { + retriever: { + standard: { + query: { + match_phrase: { + text: "landmark in Paris", + }, + }, + }, + }, + field: "text", + inference_id: "my-cohere-rerank-model", + inference_text: "Most famous landmark in Paris", + rank_window_size: 100, + min_score: 0.5, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/a3646b59da66b9ab68bdbc8dc2e6a9be.asciidoc b/docs/doc_examples/a3646b59da66b9ab68bdbc8dc2e6a9be.asciidoc new file mode 100644 index 000000000..abe4e885c --- /dev/null +++ b/docs/doc_examples/a3646b59da66b9ab68bdbc8dc2e6a9be.asciidoc @@ -0,0 +1,32 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "restaurants", + retriever: { + standard: { + query: { + bool: { + should: [ + { + match: { + region: "Austria", + }, + }, + ], + filter: [ + { + term: { + year: "2019", + }, + }, + ], + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/a3779f21f132787c48681bfb50453592.asciidoc b/docs/doc_examples/a3779f21f132787c48681bfb50453592.asciidoc new file mode 100644 index 000000000..aa591634b --- /dev/null +++ b/docs/doc_examples/a3779f21f132787c48681bfb50453592.asciidoc @@ -0,0 +1,34 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.ingest.putPipeline({ + id: "ip_location", + description: "Add ip geolocation info", + processors: [ + { + ip_location: { + field: "ip", + }, + }, + ], +}); +console.log(response); + +const response1 = await client.index({ + index: "my-index-000001", + id: "my_id", + pipeline: "ip_location", + document: { + ip: "89.160.20.128", + }, +}); +console.log(response1); + +const response2 = await client.get({ + index: "my-index-000001", + id: "my_id", +}); +console.log(response2); +---- diff --git a/docs/doc_examples/a46f566ca031375658c22f89b87dc6d2.asciidoc b/docs/doc_examples/a46f566ca031375658c22f89b87dc6d2.asciidoc new file mode 100644 index 000000000..f11302fa4 --- /dev/null +++ b/docs/doc_examples/a46f566ca031375658c22f89b87dc6d2.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.cat.indices({ + index: ".ml-anomalies-custom-example", + v: "true", + h: "index,store.size", +}); +console.log(response); +---- diff --git a/docs/doc_examples/14a49c13c399840e64c00b487aa820c9.asciidoc b/docs/doc_examples/a5aeb2c8bdf91f6146026ec8edc476b6.asciidoc similarity index 81% rename from docs/doc_examples/14a49c13c399840e64c00b487aa820c9.asciidoc rename to docs/doc_examples/a5aeb2c8bdf91f6146026ec8edc476b6.asciidoc index 0ad43b3d4..43cce7452 100644 --- a/docs/doc_examples/14a49c13c399840e64c00b487aa820c9.asciidoc +++ b/docs/doc_examples/a5aeb2c8bdf91f6146026ec8edc476b6.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { date: { type: "date_nanos", diff --git a/docs/doc_examples/a675fafa7c688cb3ea1be09bf887ebf0.asciidoc b/docs/doc_examples/a675fafa7c688cb3ea1be09bf887ebf0.asciidoc new file mode 100644 index 000000000..2837854a9 --- /dev/null +++ b/docs/doc_examples/a675fafa7c688cb3ea1be09bf887ebf0.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.get({ + index: ".migrated-ds-my-data-stream-2025.01.23-000001", + human: "true", + filter_path: "*.settings.index.version.created_string", +}); +console.log(response); +---- diff --git a/docs/doc_examples/82eff1d681a5d0d1538ef011bb32ab9a.asciidoc b/docs/doc_examples/a769d696bf12f5e9de4b3250646d250c.asciidoc similarity index 85% rename from docs/doc_examples/82eff1d681a5d0d1538ef011bb32ab9a.asciidoc rename to docs/doc_examples/a769d696bf12f5e9de4b3250646d250c.asciidoc index c7b1a1209..6bce3ee50 100644 --- a/docs/doc_examples/82eff1d681a5d0d1538ef011bb32ab9a.asciidoc +++ b/docs/doc_examples/a769d696bf12f5e9de4b3250646d250c.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "alibabacloud-ai-search-embeddings", - pipeline: "alibabacloud_ai_search_embeddings", + pipeline: "alibabacloud_ai_search_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/2826510e4aeb1c0d8dc43d317ed7624a.asciidoc b/docs/doc_examples/a7d814caf2a995d2aeadecc3495011be.asciidoc similarity index 80% rename from docs/doc_examples/2826510e4aeb1c0d8dc43d317ed7624a.asciidoc rename to docs/doc_examples/a7d814caf2a995d2aeadecc3495011be.asciidoc index 722ee1661..782a1c3cd 100644 --- a/docs/doc_examples/2826510e4aeb1c0d8dc43d317ed7624a.asciidoc +++ b/docs/doc_examples/a7d814caf2a995d2aeadecc3495011be.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { bool: { type: "boolean", diff --git a/docs/doc_examples/794d9a321b944347d2a8834a07b5eb22.asciidoc b/docs/doc_examples/a8dff54362184b2732b9bd248cf6df8a.asciidoc similarity index 81% rename from docs/doc_examples/794d9a321b944347d2a8834a07b5eb22.asciidoc rename to docs/doc_examples/a8dff54362184b2732b9bd248cf6df8a.asciidoc index b72e43b07..e9c4ba6ea 100644 --- a/docs/doc_examples/794d9a321b944347d2a8834a07b5eb22.asciidoc +++ b/docs/doc_examples/a8dff54362184b2732b9bd248cf6df8a.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { my_range: { type: "integer_range", diff --git a/docs/doc_examples/0ba5acede9d43af424e85428e7d35420.asciidoc b/docs/doc_examples/a95ae76fca7c3e273e4bd10323b3caa6.asciidoc similarity index 91% rename from docs/doc_examples/0ba5acede9d43af424e85428e7d35420.asciidoc rename to docs/doc_examples/a95ae76fca7c3e273e4bd10323b3caa6.asciidoc index a279b534c..fbff6cd91 100644 --- a/docs/doc_examples/0ba5acede9d43af424e85428e7d35420.asciidoc +++ b/docs/doc_examples/a95ae76fca7c3e273e4bd10323b3caa6.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "azure_openai_embeddings", + id: "azure_openai_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/a9f14efc26fdd3c37a71f06c310163d9.asciidoc b/docs/doc_examples/a9f14efc26fdd3c37a71f06c310163d9.asciidoc new file mode 100644 index 000000000..488fb5205 --- /dev/null +++ b/docs/doc_examples/a9f14efc26fdd3c37a71f06c310163d9.asciidoc @@ -0,0 +1,27 @@ +// 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({ + retriever: { + text_similarity_reranker: { + retriever: { + standard: { + query: { + match: { + text: "How often does the moon hide the sun?", + }, + }, + }, + }, + field: "text", + inference_id: "my-elastic-rerank", + inference_text: "How often does the moon hide the sun?", + rank_window_size: 100, + min_score: 0.5, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/aa814309ad5f1630886ba75255b444f5.asciidoc b/docs/doc_examples/aa814309ad5f1630886ba75255b444f5.asciidoc new file mode 100644 index 000000000..736d58e62 --- /dev/null +++ b/docs/doc_examples/aa814309ad5f1630886ba75255b444f5.asciidoc @@ -0,0 +1,8 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.cluster.pendingTasks(); +console.log(response); +---- diff --git a/docs/doc_examples/aab810de3314d5e11bd564ea096785b8.asciidoc b/docs/doc_examples/aab810de3314d5e11bd564ea096785b8.asciidoc new file mode 100644 index 000000000..5ab6d8d6d --- /dev/null +++ b/docs/doc_examples/aab810de3314d5e11bd564ea096785b8.asciidoc @@ -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: "cooking_blog", + query: { + bool: { + filter: [ + { + term: { + "category.keyword": "Breakfast", + }, + }, + ], + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc b/docs/doc_examples/aad7d80990a6a3c391ff555ce09ae9dc.asciidoc similarity index 80% rename from docs/doc_examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc rename to docs/doc_examples/aad7d80990a6a3c391ff555ce09ae9dc.asciidoc index 05cd6d517..bc29bce3b 100644 --- a/docs/doc_examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc +++ b/docs/doc_examples/aad7d80990a6a3c391ff555ce09ae9dc.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { f: { type: "scaled_float", diff --git a/docs/doc_examples/ac22cc2b0f4ad659055feed2852a2d59.asciidoc b/docs/doc_examples/ac22cc2b0f4ad659055feed2852a2d59.asciidoc new file mode 100644 index 000000000..0e3921a75 --- /dev/null +++ b/docs/doc_examples/ac22cc2b0f4ad659055feed2852a2d59.asciidoc @@ -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: "retrievers_example", + retriever: { + text_similarity_reranker: { + retriever: { + text_similarity_reranker: { + retriever: { + knn: { + field: "vector", + query_vector: [0.23, 0.67, 0.89], + k: 3, + num_candidates: 5, + }, + }, + rank_window_size: 100, + field: "text", + inference_id: "my-rerank-model", + inference_text: + "What are the state of the art applications of AI in information retrieval?", + }, + }, + rank_window_size: 10, + field: "text", + inference_id: "my-other-more-expensive-rerank-model", + inference_text: + "Applications of Large Language Models in technology and their impact on user satisfaction", + }, + }, + _source: false, +}); +console.log(response); +---- diff --git a/docs/doc_examples/f9cb2547ab04461a12bfd25a35be5f96.asciidoc b/docs/doc_examples/ac5b91aa75696f9880451c9439fd9eec.asciidoc similarity index 84% rename from docs/doc_examples/f9cb2547ab04461a12bfd25a35be5f96.asciidoc rename to docs/doc_examples/ac5b91aa75696f9880451c9439fd9eec.asciidoc index 75d369723..08b6a99c8 100644 --- a/docs/doc_examples/f9cb2547ab04461a12bfd25a35be5f96.asciidoc +++ b/docs/doc_examples/ac5b91aa75696f9880451c9439fd9eec.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { my_range: { type: "date_range", diff --git a/docs/doc_examples/8f0a3d7b5fbdf5351750a23c493cc078.asciidoc b/docs/doc_examples/acc44366a9908684b2c8c2b119a4fb2b.asciidoc similarity index 71% rename from docs/doc_examples/8f0a3d7b5fbdf5351750a23c493cc078.asciidoc rename to docs/doc_examples/acc44366a9908684b2c8c2b119a4fb2b.asciidoc index 8f14d2f77..2dcd961c6 100644 --- a/docs/doc_examples/8f0a3d7b5fbdf5351750a23c493cc078.asciidoc +++ b/docs/doc_examples/acc44366a9908684b2c8c2b119a4fb2b.asciidoc @@ -5,11 +5,15 @@ ---- const response = await client.search({ index: "my-index-000001", - query: { + retriever: { rule: { - organic: { - query_string: { - query: "puggles", + retriever: { + standard: { + query: { + query_string: { + query: "puggles", + }, + }, }, }, match_criteria: { diff --git a/docs/doc_examples/ad9889fd8a4b5930e312a51f3bc996dc.asciidoc b/docs/doc_examples/ad9889fd8a4b5930e312a51f3bc996dc.asciidoc new file mode 100644 index 000000000..ca15245b8 --- /dev/null +++ b/docs/doc_examples/ad9889fd8a4b5930e312a51f3bc996dc.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "sparse_embedding", + inference_id: "my-elser-model", + inference_config: { + service: "elasticsearch", + service_settings: { + adaptive_allocations: { + enabled: true, + min_number_of_allocations: 1, + max_number_of_allocations: 4, + }, + num_threads: 1, + model_id: ".elser_model_2", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/add82cbe7cd95c4be5ce1c9958f2f208.asciidoc b/docs/doc_examples/add82cbe7cd95c4be5ce1c9958f2f208.asciidoc new file mode 100644 index 000000000..f924148c0 --- /dev/null +++ b/docs/doc_examples/add82cbe7cd95c4be5ce1c9958f2f208.asciidoc @@ -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: "cooking_blog", + query: { + multi_match: { + query: "vegetarian curry", + fields: ["title^3", "description^2", "tags"], + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/ae3473adaf1515afcf7773f26c018e5c.asciidoc b/docs/doc_examples/ae3473adaf1515afcf7773f26c018e5c.asciidoc new file mode 100644 index 000000000..67a3d5d75 --- /dev/null +++ b/docs/doc_examples/ae3473adaf1515afcf7773f26c018e5c.asciidoc @@ -0,0 +1,14 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.connector.put({ + connector_id: "my-{service-name-stub}-connector", + index_name: "my-elasticsearch-index", + name: "Content synced from {service-name}", + service_type: "{service-name-stub}", + is_native: true, +}); +console.log(response); +---- diff --git a/docs/doc_examples/88ec7fa6768a7e13cd2158667a69e97f.asciidoc b/docs/doc_examples/b09f155602f9b2a6c40fe7c4a5436b7a.asciidoc similarity index 90% rename from docs/doc_examples/88ec7fa6768a7e13cd2158667a69e97f.asciidoc rename to docs/doc_examples/b09f155602f9b2a6c40fe7c4a5436b7a.asciidoc index 517644e96..ef0a0529b 100644 --- a/docs/doc_examples/88ec7fa6768a7e13cd2158667a69e97f.asciidoc +++ b/docs/doc_examples/b09f155602f9b2a6c40fe7c4a5436b7a.asciidoc @@ -8,7 +8,7 @@ const response = await client.search({ day_of_week: { type: "keyword", script: - "\n emit(doc['timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ROOT))\n ", + "\n emit(doc['timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ENGLISH))\n ", }, }, size: 0, diff --git a/docs/doc_examples/b0bddf2ffaa83049b195829c06b875cd.asciidoc b/docs/doc_examples/b0bddf2ffaa83049b195829c06b875cd.asciidoc index 6ce163623..5186df2ae 100644 --- a/docs/doc_examples/b0bddf2ffaa83049b195829c06b875cd.asciidoc +++ b/docs/doc_examples/b0bddf2ffaa83049b195829c06b875cd.asciidoc @@ -3,9 +3,9 @@ [source, js] ---- -const response = await client.searchApplication.renderQuery({ - name: "my_search_application", - body: null, +const response = await client.transport.request({ + method: "POST", + path: "/_application/search_application/my_search_application/_render_query", }); console.log(response); ---- diff --git a/docs/doc_examples/b577e7e7eb5ce9d16cb582356e2cc45c.asciidoc b/docs/doc_examples/b0ee6f19875fe5bad8aab02d60e3532c.asciidoc similarity index 93% rename from docs/doc_examples/b577e7e7eb5ce9d16cb582356e2cc45c.asciidoc rename to docs/doc_examples/b0ee6f19875fe5bad8aab02d60e3532c.asciidoc index 2bad68c5e..abe2a362d 100644 --- a/docs/doc_examples/b577e7e7eb5ce9d16cb582356e2cc45c.asciidoc +++ b/docs/doc_examples/b0ee6f19875fe5bad8aab02d60e3532c.asciidoc @@ -5,7 +5,7 @@ ---- const response = await client.ingest.putPipeline({ id: "geoip", - description: "Add geoip info", + description: "Add ip geolocation info", processors: [ { geoip: { diff --git a/docs/doc_examples/c1bb395546102279296534522061829f.asciidoc b/docs/doc_examples/b3479ee4586c15020549afae58d94d65.asciidoc similarity index 83% rename from docs/doc_examples/c1bb395546102279296534522061829f.asciidoc rename to docs/doc_examples/b3479ee4586c15020549afae58d94d65.asciidoc index 791890046..68cc5ab9c 100644 --- a/docs/doc_examples/c1bb395546102279296534522061829f.asciidoc +++ b/docs/doc_examples/b3479ee4586c15020549afae58d94d65.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { point: { type: "geo_point", diff --git a/docs/doc_examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc b/docs/doc_examples/b3cd07f02059165fd62a2f148be3dc58.asciidoc similarity index 80% rename from docs/doc_examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc rename to docs/doc_examples/b3cd07f02059165fd62a2f148be3dc58.asciidoc index af0f597cc..98b1807e4 100644 --- a/docs/doc_examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc +++ b/docs/doc_examples/b3cd07f02059165fd62a2f148be3dc58.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { long: { type: "long", diff --git a/docs/doc_examples/51390ca10aa22d7104e8970f09ea4512.asciidoc b/docs/doc_examples/b3f442a7d9eb391121dcab991787f9d6.asciidoc similarity index 81% rename from docs/doc_examples/51390ca10aa22d7104e8970f09ea4512.asciidoc rename to docs/doc_examples/b3f442a7d9eb391121dcab991787f9d6.asciidoc index a717a783b..15dcc7ae9 100644 --- a/docs/doc_examples/51390ca10aa22d7104e8970f09ea4512.asciidoc +++ b/docs/doc_examples/b3f442a7d9eb391121dcab991787f9d6.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { binary: { type: "binary", diff --git a/docs/doc_examples/b590241c4296299b836fbb5a95bdd2dc.asciidoc b/docs/doc_examples/b590241c4296299b836fbb5a95bdd2dc.asciidoc new file mode 100644 index 000000000..f71aebf61 --- /dev/null +++ b/docs/doc_examples/b590241c4296299b836fbb5a95bdd2dc.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/b62eaa20c4e0e48134a6d1d1b3c30b26.asciidoc b/docs/doc_examples/b62eaa20c4e0e48134a6d1d1b3c30b26.asciidoc index 30687161f..57b7fb69d 100644 --- a/docs/doc_examples/b62eaa20c4e0e48134a6d1d1b3c30b26.asciidoc +++ b/docs/doc_examples/b62eaa20c4e0e48134a6d1d1b3c30b26.asciidoc @@ -208,10 +208,13 @@ const response = await client.bulk({ }); console.log(response); -const response1 = await client.textStructure.findFieldStructure({ - index: "test-logs", - field: "message", - body: null, +const response1 = await client.transport.request({ + method: "GET", + path: "/_text_structure/find_field_structure", + querystring: { + index: "test-logs", + field: "message", + }, }); console.log(response1); ---- diff --git a/docs/doc_examples/b6d278737d27973e498ac61cda9e5126.asciidoc b/docs/doc_examples/b6d278737d27973e498ac61cda9e5126.asciidoc new file mode 100644 index 000000000..446bba938 --- /dev/null +++ b/docs/doc_examples/b6d278737d27973e498ac61cda9e5126.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/b8400dbe39215705060500f0e569f452.asciidoc b/docs/doc_examples/b8400dbe39215705060500f0e569f452.asciidoc new file mode 100644 index 000000000..efd531967 --- /dev/null +++ b/docs/doc_examples/b8400dbe39215705060500f0e569f452.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.connector.get({ + connector_id: "my-connector-id", +}); +console.log(response); +---- diff --git a/docs/doc_examples/e20037f66bf54bcac7d10f536f031f34.asciidoc b/docs/doc_examples/b9ba66209b7fcc111a7bcef0b3e00052.asciidoc similarity index 63% rename from docs/doc_examples/e20037f66bf54bcac7d10f536f031f34.asciidoc rename to docs/doc_examples/b9ba66209b7fcc111a7bcef0b3e00052.asciidoc index 3b4f9251b..61939766d 100644 --- a/docs/doc_examples/e20037f66bf54bcac7d10f536f031f34.asciidoc +++ b/docs/doc_examples/b9ba66209b7fcc111a7bcef0b3e00052.asciidoc @@ -3,10 +3,14 @@ [source, js] ---- -const response = await client.indices.putSettings({ +const response = await client.index({ index: "my-index-000001", - settings: { - "index.blocks.read_only_allow_delete": null, + id: 1, + document: { + attributes: { + id: "foo", + }, + id: "bar", }, }); console.log(response); diff --git a/docs/doc_examples/357edc9d10e98ed776401c7a439a1a55.asciidoc b/docs/doc_examples/ba0e7e0b18fc9ec6c623d40186d1f61b.asciidoc similarity index 94% rename from docs/doc_examples/357edc9d10e98ed776401c7a439a1a55.asciidoc rename to docs/doc_examples/ba0e7e0b18fc9ec6c623d40186d1f61b.asciidoc index 088bda3bc..42c6d4763 100644 --- a/docs/doc_examples/357edc9d10e98ed776401c7a439a1a55.asciidoc +++ b/docs/doc_examples/ba0e7e0b18fc9ec6c623d40186d1f61b.asciidoc @@ -6,6 +6,7 @@ const response = await client.indices.resolveCluster({ name: "not-present,clust*:my-index*,oldcluster:*", ignore_unavailable: "false", + timeout: "5s", }); console.log(response); ---- diff --git a/docs/doc_examples/fe6a21b4a6b33cd6abc522947d6f3ea2.asciidoc b/docs/doc_examples/ba650046f9063f6c43d76f47e0f94403.asciidoc similarity index 81% rename from docs/doc_examples/fe6a21b4a6b33cd6abc522947d6f3ea2.asciidoc rename to docs/doc_examples/ba650046f9063f6c43d76f47e0f94403.asciidoc index dadf119aa..ec556c8dc 100644 --- a/docs/doc_examples/fe6a21b4a6b33cd6abc522947d6f3ea2.asciidoc +++ b/docs/doc_examples/ba650046f9063f6c43d76f47e0f94403.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { date: { type: "date", diff --git a/docs/doc_examples/bb2ba5d1885f87506f90dbb002e518f4.asciidoc b/docs/doc_examples/bb2ba5d1885f87506f90dbb002e518f4.asciidoc new file mode 100644 index 000000000..ac5f2bf5b --- /dev/null +++ b/docs/doc_examples/bb2ba5d1885f87506f90dbb002e518f4.asciidoc @@ -0,0 +1,45 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "retrievers_example", + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + query_string: { + query: "(information retrieval) OR (artificial intelligence)", + default_field: "text", + }, + }, + }, + }, + { + knn: { + field: "vector", + query_vector: [0.23, 0.67, 0.89], + k: 3, + num_candidates: 5, + }, + }, + ], + rank_window_size: 10, + rank_constant: 1, + }, + }, + highlight: { + fields: { + text: { + fragment_size: 150, + number_of_fragments: 3, + }, + }, + }, + _source: false, +}); +console.log(response); +---- diff --git a/docs/doc_examples/bb5a67e3d2d9cd3016e487e627769fe8.asciidoc b/docs/doc_examples/bb5a67e3d2d9cd3016e487e627769fe8.asciidoc new file mode 100644 index 000000000..d73057f5b --- /dev/null +++ b/docs/doc_examples/bb5a67e3d2d9cd3016e487e627769fe8.asciidoc @@ -0,0 +1,88 @@ +// 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: "cooking_blog", + refresh: "wait_for", + operations: [ + { + index: { + _id: "1", + }, + }, + { + title: "Perfect Pancakes: A Fluffy Breakfast Delight", + description: + "Learn the secrets to making the fluffiest pancakes, so amazing you won't believe your tastebuds. This recipe uses buttermilk and a special folding technique to create light, airy pancakes that are perfect for lazy Sunday mornings.", + author: "Maria Rodriguez", + date: "2023-05-01", + category: "Breakfast", + tags: ["pancakes", "breakfast", "easy recipes"], + rating: 4.8, + }, + { + index: { + _id: "2", + }, + }, + { + title: "Spicy Thai Green Curry: A Vegetarian Adventure", + description: + "Dive into the flavors of Thailand with this vibrant green curry. Packed with vegetables and aromatic herbs, this dish is both healthy and satisfying. Don't worry about the heat - you can easily adjust the spice level to your liking.", + author: "Liam Chen", + date: "2023-05-05", + category: "Main Course", + tags: ["thai", "vegetarian", "curry", "spicy"], + rating: 4.6, + }, + { + index: { + _id: "3", + }, + }, + { + title: "Classic Beef Stroganoff: A Creamy Comfort Food", + description: + "Indulge in this rich and creamy beef stroganoff. Tender strips of beef in a savory mushroom sauce, served over a bed of egg noodles. It's the ultimate comfort food for chilly evenings.", + author: "Emma Watson", + date: "2023-05-10", + category: "Main Course", + tags: ["beef", "pasta", "comfort food"], + rating: 4.7, + }, + { + index: { + _id: "4", + }, + }, + { + title: "Vegan Chocolate Avocado Mousse", + description: + "Discover the magic of avocado in this rich, vegan chocolate mousse. Creamy, indulgent, and secretly healthy, it's the perfect guilt-free dessert for chocolate lovers.", + author: "Alex Green", + date: "2023-05-15", + category: "Dessert", + tags: ["vegan", "chocolate", "avocado", "healthy dessert"], + rating: 4.5, + }, + { + index: { + _id: "5", + }, + }, + { + title: "Crispy Oven-Fried Chicken", + description: + "Get that perfect crunch without the deep fryer! This oven-fried chicken recipe delivers crispy, juicy results every time. A healthier take on the classic comfort food.", + author: "Maria Rodriguez", + date: "2023-05-20", + category: "Main Course", + tags: ["chicken", "oven-fried", "healthy"], + rating: 4.9, + }, + ], +}); +console.log(response); +---- diff --git a/docs/doc_examples/bc01aee2ab2ce1690986374bd836e1c7.asciidoc b/docs/doc_examples/bc01aee2ab2ce1690986374bd836e1c7.asciidoc new file mode 100644 index 000000000..59eabf7be --- /dev/null +++ b/docs/doc_examples/bc01aee2ab2ce1690986374bd836e1c7.asciidoc @@ -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: "cooking_blog", + query: { + multi_match: { + query: "vegetarian curry", + fields: ["title", "description", "tags"], + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/bccd4eb26b1a325d103b12e198a13c08.asciidoc b/docs/doc_examples/bccd4eb26b1a325d103b12e198a13c08.asciidoc new file mode 100644 index 000000000..e63a33d34 --- /dev/null +++ b/docs/doc_examples/bccd4eb26b1a325d103b12e198a13c08.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/436d50b85fc8f0977d02059eec00719b.asciidoc b/docs/doc_examples/bcd1afb793240b1dddd9fa5d3f21192b.asciidoc similarity index 65% rename from docs/doc_examples/436d50b85fc8f0977d02059eec00719b.asciidoc rename to docs/doc_examples/bcd1afb793240b1dddd9fa5d3f21192b.asciidoc index d1a2f84de..5dc68e409 100644 --- a/docs/doc_examples/436d50b85fc8f0977d02059eec00719b.asciidoc +++ b/docs/doc_examples/bcd1afb793240b1dddd9fa5d3f21192b.asciidoc @@ -6,15 +6,11 @@ const response = await client.update({ index: "test", id: 1, - script: { - source: "ctx._source.counter += params.count", - lang: "painless", - params: { - count: 4, - }, + doc: { + product_price: 100, }, upsert: { - counter: 1, + product_price: 50, }, }); console.log(response); diff --git a/docs/doc_examples/bcdfaa4487747249699a86a0dcd22f5e.asciidoc b/docs/doc_examples/bcdfaa4487747249699a86a0dcd22f5e.asciidoc index 06b5f58ec..80d974285 100644 --- a/docs/doc_examples/bcdfaa4487747249699a86a0dcd22f5e.asciidoc +++ b/docs/doc_examples/bcdfaa4487747249699a86a0dcd22f5e.asciidoc @@ -3,7 +3,9 @@ [source, js] ---- -const response = await client.simulate.ingest({ +const response = await client.transport.request({ + method: "POST", + path: "/_ingest/_simulate", body: { docs: [ { diff --git a/docs/doc_examples/63d1c07d22a3ca3b0ec6d950547c011c.asciidoc b/docs/doc_examples/bdaf00d791706d7fde25fd65d3735b94.asciidoc similarity index 80% rename from docs/doc_examples/63d1c07d22a3ca3b0ec6d950547c011c.asciidoc rename to docs/doc_examples/bdaf00d791706d7fde25fd65d3735b94.asciidoc index 6d46c2baa..f8485a4c3 100644 --- a/docs/doc_examples/63d1c07d22a3ca3b0ec6d950547c011c.asciidoc +++ b/docs/doc_examples/bdaf00d791706d7fde25fd65d3735b94.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { kwd: { type: "keyword", diff --git a/docs/doc_examples/bdc55256fa5f701680631a149dbb75a9.asciidoc b/docs/doc_examples/bdc55256fa5f701680631a149dbb75a9.asciidoc new file mode 100644 index 000000000..4e074487d --- /dev/null +++ b/docs/doc_examples/bdc55256fa5f701680631a149dbb75a9.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/bdd28276618235487ac96bd6679bc206.asciidoc b/docs/doc_examples/bdd28276618235487ac96bd6679bc206.asciidoc new file mode 100644 index 000000000..b518cae85 --- /dev/null +++ b/docs/doc_examples/bdd28276618235487ac96bd6679bc206.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/befa73a8a419fcf3b7798548b54a20bf.asciidoc b/docs/doc_examples/befa73a8a419fcf3b7798548b54a20bf.asciidoc new file mode 100644 index 000000000..2e7e049df --- /dev/null +++ b/docs/doc_examples/befa73a8a419fcf3b7798548b54a20bf.asciidoc @@ -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: "my-index", + size: 10, + knn: { + query_vector: [0.04283529, 0.85670587, -0.51402352, 0], + field: "my_int4_vector", + k: 20, + num_candidates: 50, + }, + rescore: { + window_size: 20, + query: { + rescore_query: { + script_score: { + query: { + match_all: {}, + }, + script: { + source: "(dotProduct(params.queryVector, 'my_int4_vector') + 1.0)", + params: { + queryVector: [0.04283529, 0.85670587, -0.51402352, 0], + }, + }, + }, + }, + query_weight: 0, + rescore_query_weight: 1, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/bf3c3bc41c593a80faebef1df353e483.asciidoc b/docs/doc_examples/bf3c3bc41c593a80faebef1df353e483.asciidoc new file mode 100644 index 000000000..b0b47f121 --- /dev/null +++ b/docs/doc_examples/bf3c3bc41c593a80faebef1df353e483.asciidoc @@ -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: "", + model_id: "jina-reranker-v2-base-multilingual", + }, + task_settings: { + top_n: 10, + return_documents: true, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/8575c966b004fb124c7afd6bb5827b50.asciidoc b/docs/doc_examples/c26b185952ddf9842e18493aca2de147.asciidoc similarity index 100% rename from docs/doc_examples/8575c966b004fb124c7afd6bb5827b50.asciidoc rename to docs/doc_examples/c26b185952ddf9842e18493aca2de147.asciidoc diff --git a/docs/doc_examples/c3b77e11b16e37e9e37e28dec922432e.asciidoc b/docs/doc_examples/c3b77e11b16e37e9e37e28dec922432e.asciidoc new file mode 100644 index 000000000..f80f1ac99 --- /dev/null +++ b/docs/doc_examples/c3b77e11b16e37e9e37e28dec922432e.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.esql.query({ + query: + '\nFROM library\n| WHERE match(author, "Frank Herbert", {"minimum_should_match": 2, "operator": "AND"})\n| LIMIT 5\n', +}); +console.log(response); +---- diff --git a/docs/doc_examples/c580990a70028bb49cca8a6bde86bbf6.asciidoc b/docs/doc_examples/c580990a70028bb49cca8a6bde86bbf6.asciidoc index 2a14bb328..abc332dd4 100644 --- a/docs/doc_examples/c580990a70028bb49cca8a6bde86bbf6.asciidoc +++ b/docs/doc_examples/c580990a70028bb49cca8a6bde86bbf6.asciidoc @@ -3,7 +3,9 @@ [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: {}, diff --git a/docs/doc_examples/e566e898902e432bc7ea0568400f0c50.asciidoc b/docs/doc_examples/c793efe7280e9b6e09981c4d4f832348.asciidoc similarity index 83% rename from docs/doc_examples/e566e898902e432bc7ea0568400f0c50.asciidoc rename to docs/doc_examples/c793efe7280e9b6e09981c4d4f832348.asciidoc index 8a135621a..ca162517a 100644 --- a/docs/doc_examples/e566e898902e432bc7ea0568400f0c50.asciidoc +++ b/docs/doc_examples/c793efe7280e9b6e09981c4d4f832348.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { ip: { type: "ip", diff --git a/docs/doc_examples/c8aa8e8c0ac160b8c4efd1ac3b9f48f3.asciidoc b/docs/doc_examples/c8aa8e8c0ac160b8c4efd1ac3b9f48f3.asciidoc new file mode 100644 index 000000000..1bd714230 --- /dev/null +++ b/docs/doc_examples/c8aa8e8c0ac160b8c4efd1ac3b9f48f3.asciidoc @@ -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: "amazon-reviews", + mappings: { + properties: { + review_vector: { + type: "dense_vector", + dims: 8, + index: true, + similarity: "cosine", + }, + review_text: { + type: "text", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/ccc613951c61f0b17e1ed8a2d3ae54a2.asciidoc b/docs/doc_examples/ccc613951c61f0b17e1ed8a2d3ae54a2.asciidoc new file mode 100644 index 000000000..d44a7b669 --- /dev/null +++ b/docs/doc_examples/ccc613951c61f0b17e1ed8a2d3ae54a2.asciidoc @@ -0,0 +1,74 @@ +// 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: "/_ingest/_simulate", + body: { + docs: [ + { + _index: "my-index", + _id: "id", + _source: { + foo: "bar", + }, + }, + { + _index: "my-index", + _id: "id", + _source: { + foo: "rab", + }, + }, + ], + pipeline_substitutions: { + "my-pipeline": { + processors: [ + { + set: { + field: "field3", + value: "value3", + }, + }, + ], + }, + }, + component_template_substitutions: { + "my-component-template": { + template: { + mappings: { + dynamic: "true", + properties: { + field3: { + type: "keyword", + }, + }, + }, + settings: { + index: { + default_pipeline: "my-pipeline", + }, + }, + }, + }, + }, + index_template_substitutions: { + "my-index-template": { + index_patterns: ["my-index-*"], + composed_of: ["component_template_1", "component_template_2"], + }, + }, + mapping_addition: { + dynamic: "strict", + properties: { + foo: { + type: "keyword", + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/cdb7613b445e6ed6e8b473f9cae1af90.asciidoc b/docs/doc_examples/cdb7613b445e6ed6e8b473f9cae1af90.asciidoc new file mode 100644 index 000000000..ee14809f6 --- /dev/null +++ b/docs/doc_examples/cdb7613b445e6ed6e8b473f9cae1af90.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/b26b5574438e4eaf146b2428bf537c51.asciidoc b/docs/doc_examples/cecfaa659af6646b3b67d7b311586fa0.asciidoc similarity index 96% rename from docs/doc_examples/b26b5574438e4eaf146b2428bf537c51.asciidoc rename to docs/doc_examples/cecfaa659af6646b3b67d7b311586fa0.asciidoc index 8945d602e..bae03c0ff 100644 --- a/docs/doc_examples/b26b5574438e4eaf146b2428bf537c51.asciidoc +++ b/docs/doc_examples/cecfaa659af6646b3b67d7b311586fa0.asciidoc @@ -14,7 +14,7 @@ const response = await client.ingest.putPipeline({ attachment: { target_field: "_ingest._value.attachment", field: "_ingest._value.data", - remove_binary: false, + remove_binary: true, }, }, }, diff --git a/docs/doc_examples/d01a590fa9ea8a0cb34ed8dda502296c.asciidoc b/docs/doc_examples/d01a590fa9ea8a0cb34ed8dda502296c.asciidoc deleted file mode 100644 index ec1e35374..000000000 --- a/docs/doc_examples/d01a590fa9ea8a0cb34ed8dda502296c.asciidoc +++ /dev/null @@ -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.getSettings({ - flat_settings: "true", - filter_path: "transient", -}); -console.log(response); ----- diff --git a/docs/doc_examples/d1ea13e1e8372cbf1480a414723ff55a.asciidoc b/docs/doc_examples/d1ea13e1e8372cbf1480a414723ff55a.asciidoc new file mode 100644 index 000000000..8f098647f --- /dev/null +++ b/docs/doc_examples/d1ea13e1e8372cbf1480a414723ff55a.asciidoc @@ -0,0 +1,26 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.security.createApiKey({ + name: "connector_name-connector-api-key", + role_descriptors: { + "connector_name-connector-role": { + cluster: ["monitor", "manage_connector"], + indices: [ + { + names: [ + "index_name", + ".search-acl-filter-index_name", + ".elastic-connectors*", + ], + privileges: ["all"], + allow_restricted_indices: false, + }, + ], + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/d2e7dead222cfbebbd2c21a7cc1893b4.asciidoc b/docs/doc_examples/d2e7dead222cfbebbd2c21a7cc1893b4.asciidoc new file mode 100644 index 000000000..ff0c652e4 --- /dev/null +++ b/docs/doc_examples/d2e7dead222cfbebbd2c21a7cc1893b4.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.cluster.state({ + metric: "metadata", + filter_path: "metadata.indices.*.system", +}); +console.log(response); +---- diff --git a/docs/doc_examples/443f0e8fbba83777b2df624879d188d5.asciidoc b/docs/doc_examples/d3440ec81dde5f1a01c0206cb35e539c.asciidoc similarity index 87% rename from docs/doc_examples/443f0e8fbba83777b2df624879d188d5.asciidoc rename to docs/doc_examples/d3440ec81dde5f1a01c0206cb35e539c.asciidoc index 30dfcbd4f..8a5eced01 100644 --- a/docs/doc_examples/443f0e8fbba83777b2df624879d188d5.asciidoc +++ b/docs/doc_examples/d3440ec81dde5f1a01c0206cb35e539c.asciidoc @@ -11,7 +11,7 @@ const response = await client.reindex({ }, dest: { index: "azure-openai-embeddings", - pipeline: "azure_openai_embeddings", + pipeline: "azure_openai_embeddings_pipeline", }, }); console.log(response); diff --git a/docs/doc_examples/d35c8cf7a98b3f112e1de8797ec6689d.asciidoc b/docs/doc_examples/d35c8cf7a98b3f112e1de8797ec6689d.asciidoc index 51dea2365..21bcc10b8 100644 --- a/docs/doc_examples/d35c8cf7a98b3f112e1de8797ec6689d.asciidoc +++ b/docs/doc_examples/d35c8cf7a98b3f112e1de8797ec6689d.asciidoc @@ -3,7 +3,9 @@ [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", diff --git a/docs/doc_examples/d3672a87a857ddb87519788236e57497.asciidoc b/docs/doc_examples/d3672a87a857ddb87519788236e57497.asciidoc new file mode 100644 index 000000000..dad59f975 --- /dev/null +++ b/docs/doc_examples/d3672a87a857ddb87519788236e57497.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/d3a0f648d0fd50b54a4e9ebe363c5047.asciidoc b/docs/doc_examples/d3a0f648d0fd50b54a4e9ebe363c5047.asciidoc new file mode 100644 index 000000000..46940cf06 --- /dev/null +++ b/docs/doc_examples/d3a0f648d0fd50b54a4e9ebe363c5047.asciidoc @@ -0,0 +1,44 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "retrievers_example", + retriever: { + linear: { + retrievers: [ + { + retriever: { + standard: { + query: { + query_string: { + query: "(information retrieval) OR (artificial intelligence)", + default_field: "text", + }, + }, + }, + }, + weight: 2, + normalizer: "minmax", + }, + { + retriever: { + knn: { + field: "vector", + query_vector: [0.23, 0.67, 0.89], + k: 3, + num_candidates: 5, + }, + }, + weight: 1.5, + normalizer: "minmax", + }, + ], + rank_window_size: 10, + }, + }, + _source: false, +}); +console.log(response); +---- diff --git a/docs/doc_examples/d4158d486e7fee2702a14068b69e3b33.asciidoc b/docs/doc_examples/d4158d486e7fee2702a14068b69e3b33.asciidoc new file mode 100644 index 000000000..ccee5c776 --- /dev/null +++ b/docs/doc_examples/d4158d486e7fee2702a14068b69e3b33.asciidoc @@ -0,0 +1,154 @@ +// 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.putIndexTemplate({ + name: "datastream_template", + index_patterns: ["datastream*"], + data_stream: {}, + template: { + lifecycle: { + downsampling: [ + { + after: "1m", + fixed_interval: "1h", + }, + ], + }, + settings: { + index: { + mode: "time_series", + }, + }, + mappings: { + properties: { + "@timestamp": { + type: "date", + }, + kubernetes: { + properties: { + container: { + properties: { + cpu: { + properties: { + usage: { + properties: { + core: { + properties: { + ns: { + type: "long", + }, + }, + }, + limit: { + properties: { + pct: { + type: "float", + }, + }, + }, + nanocores: { + type: "long", + time_series_metric: "gauge", + }, + node: { + properties: { + pct: { + type: "float", + }, + }, + }, + }, + }, + }, + }, + memory: { + properties: { + available: { + properties: { + bytes: { + type: "long", + time_series_metric: "gauge", + }, + }, + }, + majorpagefaults: { + type: "long", + }, + pagefaults: { + type: "long", + time_series_metric: "gauge", + }, + rss: { + properties: { + bytes: { + type: "long", + time_series_metric: "gauge", + }, + }, + }, + usage: { + properties: { + bytes: { + type: "long", + time_series_metric: "gauge", + }, + limit: { + properties: { + pct: { + type: "float", + }, + }, + }, + node: { + properties: { + pct: { + type: "float", + }, + }, + }, + }, + }, + workingset: { + properties: { + bytes: { + type: "long", + time_series_metric: "gauge", + }, + }, + }, + }, + }, + name: { + type: "keyword", + }, + start_time: { + type: "date", + }, + }, + }, + host: { + type: "keyword", + time_series_dimension: true, + }, + namespace: { + type: "keyword", + time_series_dimension: true, + }, + node: { + type: "keyword", + time_series_dimension: true, + }, + pod: { + type: "keyword", + time_series_dimension: true, + }, + }, + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/d4df39f72d3a3b80cd4042f6a21c3f19.asciidoc b/docs/doc_examples/d4df39f72d3a3b80cd4042f6a21c3f19.asciidoc new file mode 100644 index 000000000..592744a30 --- /dev/null +++ b/docs/doc_examples/d4df39f72d3a3b80cd4042f6a21c3f19.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/35fd9549350926f8d57dc1765e2f40d3.asciidoc b/docs/doc_examples/d5242b1ab0213f25e5e0742032274ce6.asciidoc similarity index 96% rename from docs/doc_examples/35fd9549350926f8d57dc1765e2f40d3.asciidoc rename to docs/doc_examples/d5242b1ab0213f25e5e0742032274ce6.asciidoc index 3302992dc..865d407f9 100644 --- a/docs/doc_examples/35fd9549350926f8d57dc1765e2f40d3.asciidoc +++ b/docs/doc_examples/d5242b1ab0213f25e5e0742032274ce6.asciidoc @@ -10,7 +10,7 @@ const response = await client.ingest.putPipeline({ { attachment: { field: "data", - remove_binary: false, + remove_binary: true, }, }, ], diff --git a/docs/doc_examples/d6a4548b29e939fb197189c20c7c016f.asciidoc b/docs/doc_examples/d6a4548b29e939fb197189c20c7c016f.asciidoc new file mode 100644 index 000000000..745cb7efe --- /dev/null +++ b/docs/doc_examples/d6a4548b29e939fb197189c20c7c016f.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.inference.put({ + task_type: "chat_completion", + inference_id: "chat-completion-endpoint", + inference_config: { + service: "elastic", + service_settings: { + model_id: "model-1", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/3b6718257421b5419bf4cd6a7303c57e.asciidoc b/docs/doc_examples/d8c053ee26c1533ce936ec81101d8e1b.asciidoc similarity index 81% rename from docs/doc_examples/3b6718257421b5419bf4cd6a7303c57e.asciidoc rename to docs/doc_examples/d8c053ee26c1533ce936ec81101d8e1b.asciidoc index 7ad8dcc20..e80e90ffd 100644 --- a/docs/doc_examples/3b6718257421b5419bf4cd6a7303c57e.asciidoc +++ b/docs/doc_examples/d8c053ee26c1533ce936ec81101d8e1b.asciidoc @@ -5,7 +5,7 @@ ---- const response = await client.transport.request({ method: "GET", - path: "/_ingest/geoip/database/my-database-id", + path: "/_ingest/ip_location/database/my-database-id", }); console.log(response); ---- diff --git a/docs/doc_examples/dcf82f3aacae49c0bb4ccbc673f13e9f.asciidoc b/docs/doc_examples/dcf82f3aacae49c0bb4ccbc673f13e9f.asciidoc new file mode 100644 index 000000000..384d005bd --- /dev/null +++ b/docs/doc_examples/dcf82f3aacae49c0bb4ccbc673f13e9f.asciidoc @@ -0,0 +1,28 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "my-index", + size: 10, + query: { + script_score: { + query: { + knn: { + query_vector: [0.04283529, 0.85670587, -0.51402352, 0], + field: "my_int4_vector", + num_candidates: 20, + }, + }, + script: { + source: "(dotProduct(params.queryVector, 'my_int4_vector') + 1.0)", + params: { + queryVector: [0.04283529, 0.85670587, -0.51402352, 0], + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/dd16c9c981551c9da47ebb5ef5105fa0.asciidoc b/docs/doc_examples/dd16c9c981551c9da47ebb5ef5105fa0.asciidoc new file mode 100644 index 000000000..c00660b74 --- /dev/null +++ b/docs/doc_examples/dd16c9c981551c9da47ebb5ef5105fa0.asciidoc @@ -0,0 +1,57 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.updateAliases({ + actions: [ + { + add: { + index: ".reindexed-v9-ml-anomalies-custom-example", + alias: ".ml-anomalies-example1", + filter: { + term: { + job_id: { + value: "example1", + }, + }, + }, + is_hidden: true, + }, + }, + { + add: { + index: ".reindexed-v9-ml-anomalies-custom-example", + alias: ".ml-anomalies-example2", + filter: { + term: { + job_id: { + value: "example2", + }, + }, + }, + is_hidden: true, + }, + }, + { + remove: { + index: ".ml-anomalies-custom-example", + aliases: ".ml-anomalies-*", + }, + }, + { + remove_index: { + index: ".ml-anomalies-custom-example", + }, + }, + { + add: { + index: ".reindexed-v9-ml-anomalies-custom-example", + alias: ".ml-anomalies-custom-example", + is_hidden: true, + }, + }, + ], +}); +console.log(response); +---- diff --git a/docs/doc_examples/3ff634a50e2e4556bad7ea8553576992.asciidoc b/docs/doc_examples/dd3ee00ab2af607b32532180d60a41d4.asciidoc similarity index 94% rename from docs/doc_examples/3ff634a50e2e4556bad7ea8553576992.asciidoc rename to docs/doc_examples/dd3ee00ab2af607b32532180d60a41d4.asciidoc index 48e3ffcda..ad777029c 100644 --- a/docs/doc_examples/3ff634a50e2e4556bad7ea8553576992.asciidoc +++ b/docs/doc_examples/dd3ee00ab2af607b32532180d60a41d4.asciidoc @@ -16,7 +16,7 @@ const response = await client.indices.create({ filter: { my_snow: { type: "snowball", - language: "Lovins", + language: "English", }, }, }, diff --git a/docs/doc_examples/dd71b0c9f9197684ff29c61062c55660.asciidoc b/docs/doc_examples/dd71b0c9f9197684ff29c61062c55660.asciidoc index ff630da8a..1fe5e6b4c 100644 --- a/docs/doc_examples/dd71b0c9f9197684ff29c61062c55660.asciidoc +++ b/docs/doc_examples/dd71b0c9f9197684ff29c61062c55660.asciidoc @@ -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); ---- diff --git a/docs/doc_examples/0e3abd15dde97a2334621190c4ad4f96.asciidoc b/docs/doc_examples/dd7814258121d3c2e576a7f00469d7e3.asciidoc similarity index 92% rename from docs/doc_examples/0e3abd15dde97a2334621190c4ad4f96.asciidoc rename to docs/doc_examples/dd7814258121d3c2e576a7f00469d7e3.asciidoc index 17e833805..da4ac42b8 100644 --- a/docs/doc_examples/0e3abd15dde97a2334621190c4ad4f96.asciidoc +++ b/docs/doc_examples/dd7814258121d3c2e576a7f00469d7e3.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "mistral_embeddings", + id: "mistral_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/a225fc8c134cb21a85bc6025dac9368b.asciidoc b/docs/doc_examples/df81b88a2192dd6f9912e0c948a44487.asciidoc similarity index 92% rename from docs/doc_examples/a225fc8c134cb21a85bc6025dac9368b.asciidoc rename to docs/doc_examples/df81b88a2192dd6f9912e0c948a44487.asciidoc index da9071e2c..d4a4521d5 100644 --- a/docs/doc_examples/a225fc8c134cb21a85bc6025dac9368b.asciidoc +++ b/docs/doc_examples/df81b88a2192dd6f9912e0c948a44487.asciidoc @@ -7,7 +7,7 @@ const response = await client.inference.put({ task_type: "sparse_embedding", inference_id: "elser_embeddings", inference_config: { - service: "elser", + service: "elasticsearch", service_settings: { num_allocations: 1, num_threads: 1, diff --git a/docs/doc_examples/e017c2de6f93a8dd97f5c6e002dd5c4f.asciidoc b/docs/doc_examples/e017c2de6f93a8dd97f5c6e002dd5c4f.asciidoc new file mode 100644 index 000000000..153d1a4ff --- /dev/null +++ b/docs/doc_examples/e017c2de6f93a8dd97f5c6e002dd5c4f.asciidoc @@ -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.ml.postCalendarEvents({ + calendar_id: "dst-germany", + events: [ + { + description: "Fall 2024", + start_time: 1729994400000, + end_time: 1730167200000, + skip_result: false, + skip_model_update: false, + force_time_shift: -3600, + }, + { + description: "Spring 2025", + start_time: 1743296400000, + end_time: 1743469200000, + skip_result: false, + skip_model_update: false, + force_time_shift: 3600, + }, + ], +}); +console.log(response); +---- diff --git a/docs/doc_examples/0bef1fdefeb2956d60d52d3f38397cad.asciidoc b/docs/doc_examples/e04267ffc50d916800b919c6cdc9622a.asciidoc similarity index 73% rename from docs/doc_examples/0bef1fdefeb2956d60d52d3f38397cad.asciidoc rename to docs/doc_examples/e04267ffc50d916800b919c6cdc9622a.asciidoc index 950e6fd01..5893b52d1 100644 --- a/docs/doc_examples/0bef1fdefeb2956d60d52d3f38397cad.asciidoc +++ b/docs/doc_examples/e04267ffc50d916800b919c6cdc9622a.asciidoc @@ -4,11 +4,9 @@ [source, js] ---- const response = await client.indices.create({ - index: "idx", - mappings: { - _source: { - mode: "synthetic", - }, + index: "my-index-000001", + settings: { + "index.mapping.ignore_above": 256, }, }); console.log(response); diff --git a/docs/doc_examples/e22a1da3c622611be6855e534c0709ae.asciidoc b/docs/doc_examples/e22a1da3c622611be6855e534c0709ae.asciidoc new file mode 100644 index 000000000..26c4b9b0a --- /dev/null +++ b/docs/doc_examples/e22a1da3c622611be6855e534c0709ae.asciidoc @@ -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.transport.request({ + method: "POST", + path: "/_query_rules/my-ruleset/_test", + body: { + match_criteria: { + query_string: "puggles", + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/e3019fd5f23458ae49ad9854c97d321c.asciidoc b/docs/doc_examples/e3019fd5f23458ae49ad9854c97d321c.asciidoc index 5a02c157a..febdc3354 100644 --- a/docs/doc_examples/e3019fd5f23458ae49ad9854c97d321c.asciidoc +++ b/docs/doc_examples/e3019fd5f23458ae49ad9854c97d321c.asciidoc @@ -3,7 +3,9 @@ [source, js] ---- -const response = await client.security.oidcPrepareAuthentication({ +const response = await client.transport.request({ + method: "POST", + path: "/_security/oidc/prepare", body: { realm: "oidc1", }, diff --git a/docs/doc_examples/e308899a306e61d1a590868308689955.asciidoc b/docs/doc_examples/e308899a306e61d1a590868308689955.asciidoc new file mode 100644 index 000000000..28a832c3a --- /dev/null +++ b/docs/doc_examples/e308899a306e61d1a590868308689955.asciidoc @@ -0,0 +1,36 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.ingest.putPipeline({ + id: "ip_location", + description: "Add ip geolocation info", + processors: [ + { + ip_location: { + field: "ip", + target_field: "geo", + database_file: "GeoLite2-Country.mmdb", + }, + }, + ], +}); +console.log(response); + +const response1 = await client.index({ + index: "my-index-000001", + id: "my_id", + pipeline: "ip_location", + document: { + ip: "89.160.20.128", + }, +}); +console.log(response1); + +const response2 = await client.get({ + index: "my-index-000001", + id: "my_id", +}); +console.log(response2); +---- diff --git a/docs/doc_examples/e375c7da666276c4df6664c6821cd5f4.asciidoc b/docs/doc_examples/e375c7da666276c4df6664c6821cd5f4.asciidoc new file mode 100644 index 000000000..da7018754 --- /dev/null +++ b/docs/doc_examples/e375c7da666276c4df6664c6821cd5f4.asciidoc @@ -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); +---- diff --git a/docs/doc_examples/e3fe842951dc873d7d00c8f6a010c53f.asciidoc b/docs/doc_examples/e3fe842951dc873d7d00c8f6a010c53f.asciidoc new file mode 100644 index 000000000..33c2f68ce --- /dev/null +++ b/docs/doc_examples/e3fe842951dc873d7d00c8f6a010c53f.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.tasks.list({ + human: "true", + detailed: "true", + actions: "indices:data/write/search", +}); +console.log(response); +---- diff --git a/docs/doc_examples/e4b38973c74037335378d8480f1ce894.asciidoc b/docs/doc_examples/e4b38973c74037335378d8480f1ce894.asciidoc new file mode 100644 index 000000000..ba52d081d --- /dev/null +++ b/docs/doc_examples/e4b38973c74037335378d8480f1ce894.asciidoc @@ -0,0 +1,46 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.transport.request({ + method: "POST", + path: "/_ingest/_simulate", + body: { + docs: [ + { + _index: "my-index", + _id: "123", + _source: { + foo: "foo", + }, + }, + { + _index: "my-index", + _id: "456", + _source: { + bar: "rab", + }, + }, + ], + component_template_substitutions: { + "my-mappings_template": { + template: { + mappings: { + dynamic: "strict", + properties: { + foo: { + type: "keyword", + }, + bar: { + type: "keyword", + }, + }, + }, + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/e6f6d3aeea7ecea47cfd5c3d727f7004.asciidoc b/docs/doc_examples/e6f6d3aeea7ecea47cfd5c3d727f7004.asciidoc new file mode 100644 index 000000000..a0bffb528 --- /dev/null +++ b/docs/doc_examples/e6f6d3aeea7ecea47cfd5c3d727f7004.asciidoc @@ -0,0 +1,44 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "retrievers_example", + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + query_string: { + query: "(information retrieval) OR (artificial intelligence)", + default_field: "text", + }, + }, + }, + }, + { + knn: { + field: "vector", + query_vector: [0.23, 0.67, 0.89], + k: 3, + num_candidates: 5, + }, + }, + ], + rank_window_size: 10, + rank_constant: 1, + }, + }, + collapse: { + field: "year", + inner_hits: { + name: "topic related documents", + _source: ["year"], + }, + }, + _source: false, +}); +console.log(response); +---- diff --git a/docs/doc_examples/e715fb8c792bf09ac98f0ceca99beb84.asciidoc b/docs/doc_examples/e715fb8c792bf09ac98f0ceca99beb84.asciidoc new file mode 100644 index 000000000..1b37d265b --- /dev/null +++ b/docs/doc_examples/e715fb8c792bf09ac98f0ceca99beb84.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.migration.deprecations({ + index: ".ml-anomalies-*", +}); +console.log(response); +---- diff --git a/docs/doc_examples/5ba32ebaa7ee28a339c7693696d305ca.asciidoc b/docs/doc_examples/e77c2f41a7eca765b0c5f734a66d919f.asciidoc similarity index 93% rename from docs/doc_examples/5ba32ebaa7ee28a339c7693696d305ca.asciidoc rename to docs/doc_examples/e77c2f41a7eca765b0c5f734a66d919f.asciidoc index d17ba0b28..76351698d 100644 --- a/docs/doc_examples/5ba32ebaa7ee28a339c7693696d305ca.asciidoc +++ b/docs/doc_examples/e77c2f41a7eca765b0c5f734a66d919f.asciidoc @@ -11,7 +11,7 @@ const response = await client.ingest.putPipeline({ attachment: { field: "data", properties: ["content", "title"], - remove_binary: false, + remove_binary: true, }, }, ], diff --git a/docs/doc_examples/4655c3dea0c61935b7ecf1e57441df66.asciidoc b/docs/doc_examples/e9625da419bff6470ffd9927c59ca159.asciidoc similarity index 82% rename from docs/doc_examples/4655c3dea0c61935b7ecf1e57441df66.asciidoc rename to docs/doc_examples/e9625da419bff6470ffd9927c59ca159.asciidoc index c9f7520c1..d3ff499f4 100644 --- a/docs/doc_examples/4655c3dea0c61935b7ecf1e57441df66.asciidoc +++ b/docs/doc_examples/e9625da419bff6470ffd9927c59ca159.asciidoc @@ -5,7 +5,7 @@ ---- const response = await client.cat.threadPool({ v: "true", - h: "id,name,active,rejected,completed", + h: "id,name,queue,active,rejected,completed", }); console.log(response); ---- diff --git a/docs/doc_examples/bb5a1319c496acc862c670cc7224e59a.asciidoc b/docs/doc_examples/ea8c4229afa6dd4f1321355542be9912.asciidoc similarity index 96% rename from docs/doc_examples/bb5a1319c496acc862c670cc7224e59a.asciidoc rename to docs/doc_examples/ea8c4229afa6dd4f1321355542be9912.asciidoc index d3998b385..c4744fb4e 100644 --- a/docs/doc_examples/bb5a1319c496acc862c670cc7224e59a.asciidoc +++ b/docs/doc_examples/ea8c4229afa6dd4f1321355542be9912.asciidoc @@ -12,7 +12,7 @@ const response = await client.ingest.putPipeline({ field: "data", indexed_chars: 11, indexed_chars_field: "max_size", - remove_binary: false, + remove_binary: true, }, }, ], diff --git a/docs/doc_examples/2f07b81fd47ec3b074242a760f0c4e9e.asciidoc b/docs/doc_examples/ec4b43c3ebd8816799fa004596b2f0cb.asciidoc similarity index 80% rename from docs/doc_examples/2f07b81fd47ec3b074242a760f0c4e9e.asciidoc rename to docs/doc_examples/ec4b43c3ebd8816799fa004596b2f0cb.asciidoc index d2f122662..5c1d8b6ed 100644 --- a/docs/doc_examples/2f07b81fd47ec3b074242a760f0c4e9e.asciidoc +++ b/docs/doc_examples/ec4b43c3ebd8816799fa004596b2f0cb.asciidoc @@ -4,9 +4,10 @@ [source, js] ---- const response = await client.indices.putSettings({ - index: "my-index-000001", + index: "*", settings: { "index.indexing.slowlog.include.user": true, + "index.indexing.slowlog.threshold.index.warn": "30s", }, }); console.log(response); diff --git a/docs/doc_examples/4f792d86ff79dcfe4643cd95505f8d5f.asciidoc b/docs/doc_examples/ef46c42d473b2acc151a6a41272e0f14.asciidoc similarity index 92% rename from docs/doc_examples/4f792d86ff79dcfe4643cd95505f8d5f.asciidoc rename to docs/doc_examples/ef46c42d473b2acc151a6a41272e0f14.asciidoc index 8d47d41ed..5fbb3c8b7 100644 --- a/docs/doc_examples/4f792d86ff79dcfe4643cd95505f8d5f.asciidoc +++ b/docs/doc_examples/ef46c42d473b2acc151a6a41272e0f14.asciidoc @@ -12,7 +12,7 @@ const response = await client.indices.create({ type: "keyword", script: { source: - "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))", + "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))", }, }, }, diff --git a/docs/doc_examples/ef643bab44e7de6ddddde23a2eece5c7.asciidoc b/docs/doc_examples/ef643bab44e7de6ddddde23a2eece5c7.asciidoc new file mode 100644 index 000000000..3f692157d --- /dev/null +++ b/docs/doc_examples/ef643bab44e7de6ddddde23a2eece5c7.asciidoc @@ -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.index({ + index: "books", + document: { + name: "The Great Gatsby", + author: "F. Scott Fitzgerald", + release_date: "1925-04-10", + page_count: 180, + language: "EN", + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/4fe78a4dfb747fd5dc34145ec6b76183.asciidoc b/docs/doc_examples/efbd4936cca1a752493d8fa2ba6ad1a3.asciidoc similarity index 92% rename from docs/doc_examples/4fe78a4dfb747fd5dc34145ec6b76183.asciidoc rename to docs/doc_examples/efbd4936cca1a752493d8fa2ba6ad1a3.asciidoc index 87df83fca..0dca28ff5 100644 --- a/docs/doc_examples/4fe78a4dfb747fd5dc34145ec6b76183.asciidoc +++ b/docs/doc_examples/efbd4936cca1a752493d8fa2ba6ad1a3.asciidoc @@ -11,7 +11,7 @@ const response = await client.indices.create({ type: "keyword", script: { source: - "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))", + "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))", }, }, }, diff --git a/docs/doc_examples/349823d86980d40ac45248c19a59e339.asciidoc b/docs/doc_examples/f03352bb1129938a89f97e4b650038dd.asciidoc similarity index 91% rename from docs/doc_examples/349823d86980d40ac45248c19a59e339.asciidoc rename to docs/doc_examples/f03352bb1129938a89f97e4b650038dd.asciidoc index 93a193897..f39a62d6f 100644 --- a/docs/doc_examples/349823d86980d40ac45248c19a59e339.asciidoc +++ b/docs/doc_examples/f03352bb1129938a89f97e4b650038dd.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "amazon_bedrock_embeddings", + id: "amazon_bedrock_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/f1bf0c03581b79c3324cfa3246a60e4d.asciidoc b/docs/doc_examples/f1bf0c03581b79c3324cfa3246a60e4d.asciidoc new file mode 100644 index 000000000..78223bc2b --- /dev/null +++ b/docs/doc_examples/f1bf0c03581b79c3324cfa3246a60e4d.asciidoc @@ -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.indices.create({ + index: "my-byte-quantized-index", + mappings: { + properties: { + my_vector: { + type: "dense_vector", + dims: 64, + index: true, + index_options: { + type: "bbq_hnsw", + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/f321d4e92aa83d573ecf52bf56b0b774.asciidoc b/docs/doc_examples/f321d4e92aa83d573ecf52bf56b0b774.asciidoc new file mode 100644 index 000000000..8e0dd2359 --- /dev/null +++ b/docs/doc_examples/f321d4e92aa83d573ecf52bf56b0b774.asciidoc @@ -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: "POST", + path: "/_connector/_sync_job", + body: { + id: "my-connector-id", + job_type: "full", + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/67154a4837cf996a9a9c3e61d6e9d1b3.asciidoc b/docs/doc_examples/f625fdbbe78c4198d9e40b35f3f008b3.asciidoc similarity index 57% rename from docs/doc_examples/67154a4837cf996a9a9c3e61d6e9d1b3.asciidoc rename to docs/doc_examples/f625fdbbe78c4198d9e40b35f3f008b3.asciidoc index c60551fda..c506a9e44 100644 --- a/docs/doc_examples/67154a4837cf996a9a9c3e61d6e9d1b3.asciidoc +++ b/docs/doc_examples/f625fdbbe78c4198d9e40b35f3f008b3.asciidoc @@ -3,12 +3,11 @@ [source, js] ---- -const response = await client.reindex({ - source: { - index: "my-index-000001", - }, - dest: { - index: "my-index-000002", +const response = await client.update({ + index: ".elastic-connectors", + id: "connector-id", + doc: { + custom_scheduling: {}, }, }); console.log(response); diff --git a/docs/doc_examples/f679e414de48b8fe25e458844be05618.asciidoc b/docs/doc_examples/f679e414de48b8fe25e458844be05618.asciidoc new file mode 100644 index 000000000..1c0fa96c5 --- /dev/null +++ b/docs/doc_examples/f679e414de48b8fe25e458844be05618.asciidoc @@ -0,0 +1,13 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.connector.put({ + connector_id: "my-connector-id", + name: "Music catalog", + index_name: "music", + service_type: "postgresql", +}); +console.log(response); +---- diff --git a/docs/doc_examples/f6f647eb644a2d236637ff05f833cb73.asciidoc b/docs/doc_examples/f6f647eb644a2d236637ff05f833cb73.asciidoc new file mode 100644 index 000000000..b7fdbd587 --- /dev/null +++ b/docs/doc_examples/f6f647eb644a2d236637ff05f833cb73.asciidoc @@ -0,0 +1,14 @@ +// 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: "/_connector/_secret", + body: { + value: "encoded_api_key", + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/f8525c2460a577edfef156c13f55b8a7.asciidoc b/docs/doc_examples/f7b20e4bb8366f6d2e4486f3bf4211bc.asciidoc similarity index 95% rename from docs/doc_examples/f8525c2460a577edfef156c13f55b8a7.asciidoc rename to docs/doc_examples/f7b20e4bb8366f6d2e4486f3bf4211bc.asciidoc index 96afb8772..a673f8da2 100644 --- a/docs/doc_examples/f8525c2460a577edfef156c13f55b8a7.asciidoc +++ b/docs/doc_examples/f7b20e4bb8366f6d2e4486f3bf4211bc.asciidoc @@ -11,7 +11,7 @@ const response = await client.search({ filter: { range: { price: { - to: "500", + lte: "500", }, }, }, diff --git a/docs/doc_examples/517d291044c3e4448b8804322616ab4a.asciidoc b/docs/doc_examples/f86337e13526c968848cfe29a52d658f.asciidoc similarity index 92% rename from docs/doc_examples/517d291044c3e4448b8804322616ab4a.asciidoc rename to docs/doc_examples/f86337e13526c968848cfe29a52d658f.asciidoc index 67bb14a80..d244f1a1e 100644 --- a/docs/doc_examples/517d291044c3e4448b8804322616ab4a.asciidoc +++ b/docs/doc_examples/f86337e13526c968848cfe29a52d658f.asciidoc @@ -4,7 +4,7 @@ [source, js] ---- const response = await client.ingest.putPipeline({ - id: "elser_embeddings", + id: "elser_embeddings_pipeline", processors: [ { inference: { diff --git a/docs/doc_examples/f8f960550104c33e00dc78bc8723ccef.asciidoc b/docs/doc_examples/f8f960550104c33e00dc78bc8723ccef.asciidoc new file mode 100644 index 000000000..8d3d91597 --- /dev/null +++ b/docs/doc_examples/f8f960550104c33e00dc78bc8723ccef.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.create({ + index: "cooking_blog", +}); +console.log(response); +---- diff --git a/docs/doc_examples/1af9742c71ce0587cd49a73ec7fc1f6c.asciidoc b/docs/doc_examples/f95a4d7ab02bf400246c8822f0245f02.asciidoc similarity index 94% rename from docs/doc_examples/1af9742c71ce0587cd49a73ec7fc1f6c.asciidoc rename to docs/doc_examples/f95a4d7ab02bf400246c8822f0245f02.asciidoc index 5294ec4fa..90668404a 100644 --- a/docs/doc_examples/1af9742c71ce0587cd49a73ec7fc1f6c.asciidoc +++ b/docs/doc_examples/f95a4d7ab02bf400246c8822f0245f02.asciidoc @@ -5,7 +5,7 @@ ---- const response = await client.cat.mlTrainedModels({ h: "c,o,l,ct,v", - v: "ture", + v: "true", }); console.log(response); ---- diff --git a/docs/doc_examples/f994498dd6576be657dedce2822d2b9e.asciidoc b/docs/doc_examples/f994498dd6576be657dedce2822d2b9e.asciidoc new file mode 100644 index 000000000..21a737450 --- /dev/null +++ b/docs/doc_examples/f994498dd6576be657dedce2822d2b9e.asciidoc @@ -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.search({ + index: "semantic-embeddings", + retriever: { + rrf: { + retrievers: [ + { + standard: { + query: { + match: { + content: "How to avoid muscle soreness while running?", + }, + }, + }, + }, + { + standard: { + query: { + semantic: { + field: "semantic_text", + query: "How to avoid muscle soreness while running?", + }, + }, + }, + }, + ], + }, + }, + highlight: { + fields: { + semantic_text: { + number_of_fragments: 2, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/1e0f203aced9344382081ab095c44dde.asciidoc b/docs/doc_examples/f9bad6fd369764185e1cb09b89ee39cc.asciidoc similarity index 83% rename from docs/doc_examples/1e0f203aced9344382081ab095c44dde.asciidoc rename to docs/doc_examples/f9bad6fd369764185e1cb09b89ee39cc.asciidoc index bd8639ace..2045d9c7d 100644 --- a/docs/doc_examples/1e0f203aced9344382081ab095c44dde.asciidoc +++ b/docs/doc_examples/f9bad6fd369764185e1cb09b89ee39cc.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { text: { type: "text", diff --git a/docs/doc_examples/633c8a9fc57268979d8735c557705809.asciidoc b/docs/doc_examples/fb0152f6c70f647a8b6709969113486d.asciidoc similarity index 81% rename from docs/doc_examples/633c8a9fc57268979d8735c557705809.asciidoc rename to docs/doc_examples/fb0152f6c70f647a8b6709969113486d.asciidoc index 7b7b0f2b8..cd8a962e0 100644 --- a/docs/doc_examples/633c8a9fc57268979d8735c557705809.asciidoc +++ b/docs/doc_examples/fb0152f6c70f647a8b6709969113486d.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { kwd: { type: "keyword", diff --git a/docs/doc_examples/fb56c2ac77d4c308d7702b6b33698382.asciidoc b/docs/doc_examples/fb56c2ac77d4c308d7702b6b33698382.asciidoc new file mode 100644 index 000000000..1405a070d --- /dev/null +++ b/docs/doc_examples/fb56c2ac77d4c308d7702b6b33698382.asciidoc @@ -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.connector.updateApiKeyId({ + connector_id: "my_connector_id>", + api_key_id: "API key_id", + api_key_secret_id: "secret_id", +}); +console.log(response); +---- diff --git a/docs/doc_examples/1fcc4a3280be399753dcfd5c489ff682.asciidoc b/docs/doc_examples/fe6429d0d82174aa5acf95e96e237380.asciidoc similarity index 82% rename from docs/doc_examples/1fcc4a3280be399753dcfd5c489ff682.asciidoc rename to docs/doc_examples/fe6429d0d82174aa5acf95e96e237380.asciidoc index 5bc970622..0e51c7393 100644 --- a/docs/doc_examples/1fcc4a3280be399753dcfd5c489ff682.asciidoc +++ b/docs/doc_examples/fe6429d0d82174aa5acf95e96e237380.asciidoc @@ -5,10 +5,16 @@ ---- const response = await client.indices.create({ index: "idx", - mappings: { - _source: { - mode: "synthetic", + settings: { + index: { + mapping: { + source: { + mode: "synthetic", + }, + }, }, + }, + mappings: { properties: { my_range: { type: "ip_range", diff --git a/docs/doc_examples/ffda10edaa7ce087703193c3cb95a426.asciidoc b/docs/doc_examples/ffda10edaa7ce087703193c3cb95a426.asciidoc new file mode 100644 index 000000000..0ccb2c77a --- /dev/null +++ b/docs/doc_examples/ffda10edaa7ce087703193c3cb95a426.asciidoc @@ -0,0 +1,108 @@ +// 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: "retrievers_example", + settings: { + number_of_shards: 1, + }, + mappings: { + properties: { + vector: { + type: "dense_vector", + dims: 3, + similarity: "l2_norm", + index: true, + index_options: { + type: "flat", + }, + }, + text: { + type: "text", + }, + year: { + type: "integer", + }, + topic: { + type: "keyword", + }, + timestamp: { + type: "date", + }, + }, + }, +}); +console.log(response); + +const response1 = await client.index({ + index: "retrievers_example", + id: 1, + document: { + vector: [0.23, 0.67, 0.89], + 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); + +const response2 = await client.index({ + index: "retrievers_example", + id: 2, + document: { + vector: [0.12, 0.56, 0.78], + 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); + +const response3 = await client.index({ + index: "retrievers_example", + id: 3, + document: { + vector: [0.45, 0.32, 0.91], + 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); + +const response4 = await client.index({ + index: "retrievers_example", + id: 4, + document: { + vector: [0.34, 0.21, 0.98], + 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); + +const response5 = await client.index({ + index: "retrievers_example", + id: 5, + document: { + vector: [0.11, 0.65, 0.47], + 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); + +const response6 = await client.indices.refresh({ + index: "retrievers_example", +}); +console.log(response6); +---- diff --git a/docs/doc_examples/fff86117c47f974074284644e8a97a99.asciidoc b/docs/doc_examples/fff86117c47f974074284644e8a97a99.asciidoc new file mode 100644 index 000000000..339435f69 --- /dev/null +++ b/docs/doc_examples/fff86117c47f974074284644e8a97a99.asciidoc @@ -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: "", + }, + }, +}); +console.log(response); +---- diff --git a/docs/examples/bulk.asciidoc b/docs/examples/bulk.asciidoc index e35052e0e..74725c9e9 100644 --- a/docs/examples/bulk.asciidoc +++ b/docs/examples/bulk.asciidoc @@ -1,10 +1,10 @@ [[bulk_examples]] === Bulk -The `bulk` API makes it possible to perform many index/delete operations in a -single API call. This can greatly increase the indexing speed. +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: Did you know that we provide an helper for sending bulk request? You can find it {jsclient}/client-helpers.html[here]. +NOTE: You can also use the {jsclient}/client-helpers.html[bulk helper]. [source,js] ---- diff --git a/docs/helpers.asciidoc b/docs/helpers.asciidoc index fa8394a9d..435207c91 100644 --- a/docs/helpers.asciidoc +++ b/docs/helpers.asciidoc @@ -1,10 +1,10 @@ [[client-helpers]] == Client helpers -The client comes with an handy collection of helpers to give you a more +The client comes with an handy collection of helpers to give you a more comfortable experience with some APIs. -CAUTION: The client helpers are experimental, and the API may change in the next +CAUTION: The client helpers are experimental, and the API may change in the next minor releases. The helpers will not work in any Node.js version lower than 10. @@ -14,7 +14,7 @@ minor releases. The helpers will not work in any Node.js version lower than 10. ~Added~ ~in~ ~`v7.7.0`~ -Running bulk requests can be complex due to the shape of the API, this helper +Running bulk requests can be complex due to the shape of the API, this helper aims to provide a nicer developer experience around the Bulk API. @@ -52,7 +52,7 @@ console.log(result) // } ---- -To create a new instance of the Bulk helper, access it as shown in the example +To create a new instance of the Bulk helper, access it as shown in the example above, the configuration options are: [cols=2*] |=== @@ -83,7 +83,7 @@ const b = client.helpers.bulk({ return { index: { _index: 'my-index' } } - } + } }) ---- @@ -94,7 +94,7 @@ a|A function that is called for everytime a document can't be indexed and it has const b = client.helpers.bulk({ onDrop (doc) { console.log(doc) - } + } }) ---- @@ -105,7 +105,7 @@ a|A function that is called for each successful operation in the bulk request, w const b = client.helpers.bulk({ onSuccess ({ result, document }) { console.log(`SUCCESS: Document ${result.index._id} indexed to ${result.index._index}`) - } + } }) ---- @@ -249,11 +249,11 @@ client.helpers.bulk({ [discrete] ==== Abort a bulk operation -If needed, you can abort a bulk operation at any time. The bulk helper returns a +If needed, you can abort a bulk operation at any time. The bulk helper returns a https://promisesaplus.com/[thenable], which has an `abort` method. -NOTE: The abort method stops the execution of the bulk operation, but if you -are using a concurrency higher than one, the operations that are already running +NOTE: The abort method stops the execution of the bulk operation, but if you +are using a concurrency higher than one, the operations that are already running will not be stopped. [source,js] @@ -275,7 +275,7 @@ const b = client.helpers.bulk({ }, onDrop (doc) { b.abort() - } + } }) console.log(await b) @@ -285,8 +285,8 @@ console.log(await b) [discrete] ==== Passing custom options to the Bulk API -You can pass any option supported by the link: -{ref}/docs-bulk.html#docs-bulk-api-query-params[Bulk API] to the helper, and the +You can pass any option supported by the link: +{ref}/docs-bulk.html#docs-bulk-api-query-params[Bulk API] to the helper, and the helper uses those options in conjunction with the Bulk API call. [source,js] @@ -371,10 +371,10 @@ console.log(result) ~Added~ ~in~ ~`v7.8.0`~ -If you send search request at a high rate, this helper might be useful -for you. It uses the multi search API under the hood to batch the requests -and improve the overall performances of your application. The `result` exposes a -`documents` property as well, which allows you to access directly the hits +If you send search request at a high rate, this helper might be useful +for you. It uses the multi search API under the hood to batch the requests +and improve the overall performances of your application. The `result` exposes a +`documents` property as well, which allows you to access directly the hits sources. @@ -399,7 +399,7 @@ m.search( .catch(err => console.error(err)) ---- -To create a new instance of the multi search (msearch) helper, you should access +To create a new instance of the multi search (msearch) helper, you should access it as shown in the example above, the configuration options are: [cols=2*] |=== @@ -459,18 +459,18 @@ const m = client.helpers.msearch({ [discrete] ==== Stopping the msearch helper -If needed, you can stop an msearch processor at any time. The msearch helper +If needed, you can stop an msearch processor at any time. The msearch helper returns a https://promisesaplus.com/[thenable], which has an `stop` method. -If you are creating multiple msearch helpers instances and using them for a -limitied period of time, remember to always use the `stop` method once you have +If you are creating multiple msearch helpers instances and using them for a +limitied period of time, remember to always use the `stop` method once you have finished using them, otherwise your application will start leaking memory. -The `stop` method accepts an optional error, that will be dispatched every +The `stop` method accepts an optional error, that will be dispatched every subsequent search request. -NOTE: The stop method stops the execution of the msearch processor, but if -you are using a concurrency higher than one, the operations that are already +NOTE: The stop method stops the execution of the msearch processor, but if +you are using a concurrency higher than one, the operations that are already running will not be stopped. [source,js] @@ -507,9 +507,9 @@ setImmediate(() => m.stop()) ~Added~ ~in~ ~`v7.7.0`~ -A simple wrapper around the search API. Instead of returning the entire `result` -object it returns only the search documents source. For improving the -performances, this helper automatically adds `filter_path=hits.hits._source` to +A simple wrapper around the search API. Instead of returning the entire `result` +object it returns only the search documents source. For improving the +performances, this helper automatically adds `filter_path=hits.hits._source` to the query string. [source,js] @@ -535,10 +535,10 @@ for (const doc of documents) { ~Added~ ~in~ ~`v7.7.0`~ -This helpers offers a simple and intuitive way to use the scroll search API. -Once called, it returns an -https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function[async iterator] -which can be used in conjuction with a for-await...of. It handles automatically +This helpers offers a simple and intuitive way to use the scroll search API. +Once called, it returns an +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function[async iterator] +which can be used in conjuction with a for-await...of. It handles automatically the `429` error and uses the `maxRetries` option of the client. [source,js] @@ -576,7 +576,7 @@ for await (const result of scrollSearch) { [discrete] ==== Quickly getting the documents -If you only need the documents from the result of a scroll search, you can +If you only need the documents from the result of a scroll search, you can access them via `result.documents`: [source,js] @@ -593,9 +593,9 @@ for await (const result of scrollSearch) { ~Added~ ~in~ ~`v7.7.0`~ -It works in the same way as the scroll search helper, but it returns only the -documents instead. Note, every loop cycle returns a single document, and you -can't use the `clear` method. For improving the performances, this helper +It works in the same way as the scroll search helper, but it returns only the +documents instead. Note, every loop cycle returns a single document, and you +can't use the `clear` method. For improving the performances, this helper automatically adds `filter_path=hits.hits._source` to the query string. [source,js] @@ -707,3 +707,42 @@ const result = await client.helpers .esql({ query: 'FROM sample_data | LIMIT 2' }) .toRecords() ---- + +[discrete] +===== `toArrowReader` + +~Added~ ~in~ ~`v8.16.0`~ + +ES|QL can return results in multiple binary formats, including https://arrow.apache.org/[Apache Arrow]'s streaming format. Because it is a very efficient format to read, it can be valuable for performing high-performance in-memory analytics. And, because the response is streamed as batches of records, it can be used to produce aggregations and other calculations on larger-than-memory data sets. + +`toArrowReader` returns a https://github.com/apache/arrow/blob/520ae44272d491bbb52eb3c9b84864ed7088f11a/js/src/ipc/reader.ts#L216[`AsyncRecordBatchStreamReader`]. + +[source,ts] +---- +const reader = await client.helpers + .esql({ query: 'FROM sample_data' }) + .toArrowReader() + +// print each record as JSON +for await (const recordBatch of reader) { + for (const record of recordBatch) { + console.log(record.toJSON()) + } +} +---- + +[discrete] +===== `toArrowTable` + +~Added~ ~in~ ~`v8.16.0`~ + +If you would like to pull the entire data set in Arrow format but without streaming, you can use the `toArrowTable` helper to get a https://arrow.apache.org/docs/js/classes/Arrow_dom.Table.html[Table] back instead. + +[source,ts] +---- +const table = await client.helpers + .esql({ query: 'FROM sample_data' }) + .toArrowTable() + +console.log(table.toArray()) +---- diff --git a/docs/index.asciidoc b/docs/index.asciidoc index eda790be4..51206f0b0 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -21,3 +21,4 @@ include::reference.asciidoc[] include::examples/index.asciidoc[] include::helpers.asciidoc[] include::redirects.asciidoc[] +include::timeout-best-practices.asciidoc[] diff --git a/docs/observability.asciidoc b/docs/observability.asciidoc index 9436d457f..387e24717 100644 --- a/docs/observability.asciidoc +++ b/docs/observability.asciidoc @@ -97,7 +97,7 @@ client.diagnostic.on('request', (err, result) => { ---- |`deserialization` -a|Emitted before starting deserialization and decompression. If you want to measure this phase duration, you should measure the time elapsed between this event and `response`. _(This event might not be emitted in certain situations)_. +a|Emitted before starting deserialization and decompression. If you want to measure this phase duration, you should measure the time elapsed between this event and `response`. This event might not be emitted in certain situations, like: when `asStream` is set to true; a response is terminated early due to content length being too large; or a response is terminated early by an `AbortController`. [source,js] ---- client.diagnostic.on('deserialization', (err, result) => { diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 1fdae1564..7b13fa10b 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -28,9 +28,116 @@ [discrete] === bulk Bulk index or delete documents. -Performs multiple indexing or delete operations in a single API call. +Perform multiple `index`, `create`, `delete`, and `update` actions in a single request. This reduces overhead and can greatly increase indexing speed. +If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: + +* To use the `create` action, you must have the `create_doc`, `create`, `index`, or `write` index privilege. Data streams support only the `create` action. +* To use the `index` action, you must have the `create`, `index`, or `write` index privilege. +* To use the `delete` action, you must have the `delete` or `write` index privilege. +* To use the `update` action, you must have the `index` or `write` index privilege. +* To automatically create a data stream or index with a bulk API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. +* To make the result of a bulk operation visible to search using the `refresh` parameter, you must have the `maintenance` or `manage` index privilege. + +Automatic data stream creation requires a matching index template with data stream enabled. + +The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: + +---- +action_and_meta_data\n +optional_source\n +action_and_meta_data\n +optional_source\n +.... +action_and_meta_data\n +optional_source\n +---- + +The `index` and `create` actions expect a source on the next line and have the same semantics as the `op_type` parameter in the standard index API. +A `create` action fails if a document with the same ID already exists in the target +An `index` action adds or replaces a document as necessary. + +NOTE: Data streams support only the `create` action. +To update or delete a document in a data stream, you must target the backing index containing the document. + +An `update` action expects that the partial doc, upsert, and script and its options are specified on the next line. + +A `delete` action does not expect a source on the next line and has the same semantics as the standard delete API. + +NOTE: The final line of data must end with a newline character (`\n`). +Each newline character may be preceded by a carriage return (`\r`). +When sending NDJSON data to the `_bulk` endpoint, use a `Content-Type` header of `application/json` or `application/x-ndjson`. +Because this format uses literal newline characters (`\n`) as delimiters, make sure that the JSON actions and sources are not pretty printed. + +If you provide a target in the request path, it is used for any actions that don't explicitly specify an `_index` argument. + +A note on the format: the idea here is to make processing as fast as possible. +As some of the actions are redirected to other shards on other nodes, only `action_meta_data` is parsed on the receiving node side. + +Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. + +There is no "correct" number of actions to perform in a single bulk request. +Experiment with different settings to find the optimal size for your particular workload. +Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. +It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. +For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. + +**Client suppport for bulk requests** + +Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: + +* Go: Check out `esutil.BulkIndexer` +* Perl: Check out `Search::Elasticsearch::Client::5_0::Bulk` and `Search::Elasticsearch::Client::5_0::Scroll` +* Python: Check out `elasticsearch.helpers.*` +* JavaScript: Check out `client.helpers.*` +* .NET: Check out `BulkAllObservable` +* PHP: Check out bulk indexing. + +**Submitting bulk requests with cURL** + +If you're providing text file input to `curl`, you must use the `--data-binary` flag instead of plain `-d`. +The latter doesn't preserve newlines. For example: + +---- +$ cat requests +{ "index" : { "_index" : "test", "_id" : "1" } } +{ "field1" : "value1" } +$ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo +{"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} +---- + +**Optimistic concurrency control** + +Each `index` and `delete` action within a bulk API call may include the `if_seq_no` and `if_primary_term` parameters in their respective action and meta data lines. +The `if_seq_no` and `if_primary_term` parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. + +**Versioning** + +Each bulk item can include the version value using the `version` field. +It automatically follows the behavior of the index or delete operation based on the `_version` mapping. +It also support the `version_type`. + +**Routing** + +Each bulk item can include the routing value using the `routing` field. +It automatically follows the behavior of the index or delete operation based on the `_routing` mapping. + +NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. + +**Wait for active shards** + +When making bulk calls, you can set the `wait_for_active_shards` parameter to require a minimum number of shard copies to be active before starting to process the bulk request. + +**Refresh** + +Control when the changes made by this request are visible to search. + +NOTE: Only the shards that receive the bulk request will be affected by refresh. +Imagine a `_bulk?refresh=wait_for` request with three documents in it that happen to be routed to different shards in an index with five shards. +The request will only wait for those three shards to refresh. +The other two shards that make up the index do not participate in the `_bulk` request at all. + {ref}/docs-bulk.html[Endpoint documentation] [source,ts] ---- @@ -40,25 +147,25 @@ client.bulk({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string)*: Name of the data stream, index, or index alias to perform bulk actions on. +** *`index` (Optional, string)*: The name of the data stream, index, or index alias to perform bulk actions on. ** *`operations` (Optional, { index, create, update, delete } | { detect_noop, doc, doc_as_upsert, script, scripted_upsert, _source, upsert } | object[])* -** *`pipeline` (Optional, string)*: ID of the pipeline to use to preprocess incoming documents. -If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. -If a final pipeline is configured it will always run, regardless of the value of this parameter. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. -Valid values: `true`, `false`, `wait_for`. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`_source` (Optional, boolean | string | string[])*: `true` or `false` to return the `_source` field or not, or a list of fields to return. -** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. -** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`timeout` (Optional, string | -1 | 0)*: Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). -** *`require_alias` (Optional, boolean)*: If `true`, the request’s actions must target an index alias. +** *`include_source_on_error` (Optional, boolean)*: True or false if to include the document source in the error message in case of parsing errors. +** *`list_executed_pipelines` (Optional, boolean)*: If `true`, the response will include the ingest pipelines that were run for each index or create. +** *`pipeline` (Optional, string)*: The pipeline identifier to use to preprocess incoming documents. If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. If a final pipeline is configured, it will always run regardless of the value of this parameter. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. If `wait_for`, wait for a refresh to make this operation visible to search. If `false`, do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`_source` (Optional, boolean | string | string[])*: Indicates whether to return the `_source` field (`true` or `false`) or contains a list of fields to return. +** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. +** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. +** *`timeout` (Optional, string | -1 | 0)*: The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards. The default is `1m` (one minute), which guarantees Elasticsearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default is `1`, which waits for each primary shard to be active. +** *`require_alias` (Optional, boolean)*: If `true`, the request's actions must target an index alias. +** *`require_data_stream` (Optional, boolean)*: If `true`, the request's actions must target a data stream (existing or to be created). [discrete] === clear_scroll -Clears the search context and results for a scrolling search. +Clear a scrolling search. +Clear the search context and results for a scrolling search. {ref}/clear-scroll-api.html[Endpoint documentation] [source,ts] @@ -69,12 +176,15 @@ client.clearScroll({ ... }) ==== Arguments * *Request (object):* -** *`scroll_id` (Optional, string | string[])*: List of scroll IDs to clear. -To clear all scroll IDs, use `_all`. +** *`scroll_id` (Optional, string | string[])*: A list of scroll IDs to clear. To clear all scroll IDs, use `_all`. IMPORTANT: Scroll IDs can be long. It is recommended to specify scroll IDs in the request body parameter. [discrete] === close_point_in_time -Closes a point-in-time. +Close a point in time. +A point in time must be opened explicitly before being used in search requests. +The `keep_alive` parameter tells Elasticsearch how long it should persist. +A point in time is automatically closed when the `keep_alive` period has elapsed. +However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. {ref}/point-in-time-api.html[Endpoint documentation] [source,ts] @@ -89,7 +199,17 @@ client.closePointInTime({ id }) [discrete] === count -Returns number of documents matching a query. +Count search results. +Get the number of documents matching a query. + +The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. +The query is optional. When no query is provided, the API uses `match_all` to count all the documents. + +The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. + +The operation is broadcast across all shards. +For each shard ID group, a replica is chosen and the search is run against it. +This means that replicas increase the scalability of the count. {ref}/search-count.html[Endpoint documentation] [source,ts] @@ -100,40 +220,97 @@ client.count({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases to search. -Supports wildcards (`*`). -To search all data streams and indices, omit this parameter or use `*` or `_all`. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. -This behavior applies even if the request targets other open indices. -** *`analyzer` (Optional, string)*: Analyzer to use for the query string. -This parameter can only be used when the `q` query string parameter is specified. -** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. -This parameter can only be used when the `q` query string parameter is specified. -** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. -This parameter can only be used when the `q` query string parameter is specified. -** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. -This parameter can only be used when the `q` query string parameter is specified. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. -** *`ignore_throttled` (Optional, boolean)*: If `true`, concrete, expanded or aliased indices are ignored when frozen. +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*` or `_all`. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search query using Query DSL. A request body query cannot be used with the `q` query string parameter. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. +** *`analyzer` (Optional, string)*: The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. This parameter can be used only when the `q` query string parameter is specified. +** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. This parameter can be used only when the `q` query string parameter is specified. +** *`df` (Optional, string)*: The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports a list of values, such as `open,hidden`. +** *`ignore_throttled` (Optional, boolean)*: If `true`, concrete, expanded, or aliased indices are ignored when frozen. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. -** *`min_score` (Optional, number)*: Sets the minimum `_score` value that documents must have to be included in the result. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`terminate_after` (Optional, number)*: Maximum number of documents to collect for each shard. -If a query reaches this limit, Elasticsearch terminates the query early. -Elasticsearch collects documents before sorting. -** *`q` (Optional, string)*: Query in the Lucene query string syntax. +** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the `q` query string parameter is specified. +** *`min_score` (Optional, number)*: The minimum `_score` value that documents must have to be included in the result. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. By default, it is random. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`terminate_after` (Optional, number)*: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. +** *`q` (Optional, string)*: The query in Lucene query string syntax. This parameter cannot be used with a request body. [discrete] === create -Index a document. -Adds a JSON document to the specified data stream or index and makes it searchable. -If the target is an index and the document already exists, the request updates the document and increments its version. +Create a new document in the index. + +You can index a new JSON document with the `//_doc/` or `//_create/<_id>` APIs +Using `_create` guarantees that the document is indexed only if it does not already exist. +It returns a 409 response when a document with a same ID already exists in the index. +To update an existing document, you must use the `//_doc/` API. + +If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: + +* To add a document using the `PUT //_create/<_id>` or `POST //_create/<_id>` request formats, you must have the `create_doc`, `create`, `index`, or `write` index privilege. +* To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. + +Automatic data stream creation requires a matching index template with data stream enabled. + +**Automatically create data streams and indices** + +If the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream. + +If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. + +NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. + +If no mapping exists, the index operation creates a dynamic mapping. +By default, new fields and objects are automatically added to the mapping if needed. + +Automatic index creation is controlled by the `action.auto_create_index` setting. +If it is `true`, any index can be created automatically. +You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely. +Specify a list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. +When a list is specified, the default behaviour is to disallow. + +NOTE: The `action.auto_create_index` setting affects the automatic creation of indices only. +It does not affect the creation of data streams. + +**Routing** + +By default, shard placement — or routing — is controlled by using a hash of the document's ID value. +For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter. + +When setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself. +This does come at the (very minimal) cost of an additional document parsing pass. +If the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. + +NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. + +**Distributed** + +The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. +After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. + +**Active shards** + +To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. +If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. +By default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`). +This default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`. +To alter this behavior per operation, use the `wait_for_active_shards request` parameter. + +Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1). +Specifying a negative value or a number greater than the number of shard copies will throw an error. + +For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). +If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. +This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. +If `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. +This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. +However, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. +The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. + +It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. +After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. +The `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed. {ref}/docs-index_.html[Endpoint documentation] [source,ts] @@ -144,28 +321,64 @@ client.create({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Unique identifier for the document. -** *`index` (string)*: Name of the data stream or index to target. -If the target doesn’t exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. -If the target doesn’t exist and doesn’t match a data stream template, this request creates the index. +** *`id` (string)*: A unique identifier for the document. To automatically generate a document ID, use the `POST //_doc/` request format. +** *`index` (string)*: The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If the target doesn't exist and doesn’t match a data stream template, this request creates the index. ** *`document` (Optional, object)*: A document. -** *`pipeline` (Optional, string)*: ID of the pipeline to use to preprocess incoming documents. -If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. -If a final pipeline is configured it will always run, regardless of the value of this parameter. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. -Valid values: `true`, `false`, `wait_for`. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`timeout` (Optional, string | -1 | 0)*: Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. -** *`version` (Optional, number)*: Explicit version number for concurrency control. -The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +** *`if_primary_term` (Optional, number)*: Only perform the operation if the document has this primary term. +** *`if_seq_no` (Optional, number)*: Only perform the operation if the document has this sequence number. +** *`include_source_on_error` (Optional, boolean)*: True or false if to include the document source in the error message in case of parsing errors. +** *`op_type` (Optional, Enum("index" | "create"))*: Set to `create` to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. The behavior is the same as using the `/_create` endpoint. If a document ID is specified, this paramater defaults to `index`. Otherwise, it defaults to `create`. If the request targets a data stream, an `op_type` of `create` is required. +** *`pipeline` (Optional, string)*: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. If a final pipeline is configured, it will always run regardless of the value of this parameter. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. If `wait_for`, it waits for a refresh to make this operation visible to search. If `false`, it does nothing with refreshes. +** *`require_alias` (Optional, boolean)*: If `true`, the destination must be an index alias. +** *`require_data_stream` (Optional, boolean)*: If `true`, the request's actions must target a data stream (existing or to be created). +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`timeout` (Optional, string | -1 | 0)*: The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. Elasticsearch waits for at least the specified timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur. This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. The actual wait time could be longer, particularly when multiple waits occur. +** *`version` (Optional, number)*: The explicit version number for concurrency control. It must be a non-negative long number. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default value of `1` means it waits for each primary shard to be active. [discrete] === delete Delete a document. -Removes a JSON document from the specified index. + +Remove a JSON document from the specified index. + +NOTE: You cannot send deletion requests directly to a data stream. +To delete a document in a data stream, you must target the backing index containing the document. + +**Optimistic concurrency control** + +Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters. +If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`. + +**Versioning** + +Each document indexed is versioned. +When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. +Every write operation run on a document, deletes included, causes its version to be incremented. +The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. +The length of time for which a deleted document's version remains available is determined by the `index.gc_deletes` index setting. + +**Routing** + +If routing is used during indexing, the routing value also needs to be specified to delete a document. + +If the `_routing` mapping is set to `required` and no routing value is specified, the delete API throws a `RoutingMissingException` and rejects the request. + +For example: + +---- +DELETE /my-index-000001/_doc/1?routing=shard-1 +---- + +This request deletes the document with ID 1, but it is routed based on the user. +The document is not deleted if the correct routing is not specified. + +**Distributed** + +The delete operation gets hashed into a specific shard ID. +It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. {ref}/docs-delete.html[Endpoint documentation] [source,ts] @@ -176,25 +389,100 @@ client.delete({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Unique identifier for the document. -** *`index` (string)*: Name of the target index. +** *`id` (string)*: A unique identifier for the document. +** *`index` (string)*: The name of the target index. ** *`if_primary_term` (Optional, number)*: Only perform the operation if the document has this primary term. ** *`if_seq_no` (Optional, number)*: Only perform the operation if the document has this sequence number. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. -Valid values: `true`, `false`, `wait_for`. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for active shards. -** *`version` (Optional, number)*: Explicit version number for concurrency control. -The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. If `wait_for`, it waits for a refresh to make this operation visible to search. If `false`, it does nothing with refreshes. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for active shards. This parameter is useful for situations where the primary shard assigned to perform the delete operation might not be available when the delete operation runs. Some reasons for this might be that the primary shard is currently recovering from a store or undergoing relocation. By default, the delete operation will wait on the primary shard to become available for up to 1 minute before failing and responding with an error. +** *`version` (Optional, number)*: An explicit version number for concurrency control. It must match the current version of the document for the request to succeed. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The minimum number of shard copies that must be active before proceeding with the operation. You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default value of `1` means it waits for each primary shard to be active. [discrete] === delete_by_query Delete documents. + Deletes documents that match the specified query. +If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: + +* `read` +* `delete` or `write` + +You can specify the query criteria in the request URI or the request body using the same syntax as the search API. +When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. +If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. + +NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. + +While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. +A bulk delete request is performed for each batch of matching documents. +If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. +If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. +Any delete requests that completed successfully still stick, they are not rolled back. + +You can opt to count version conflicts instead of halting and returning by setting `conflicts` to `proceed`. +Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than `max_docs` until it has successfully deleted `max_docs documents`, or it has gone through every document in the source query. + +**Throttling delete requests** + +To control the rate at which delete by query issues batches of delete operations, you can set `requests_per_second` to any positive decimal number. +This pads each batch with a wait time to throttle the rate. +Set `requests_per_second` to `-1` to disable throttling. + +Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. +The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. +By default the batch size is `1000`, so if `requests_per_second` is set to `500`: + +---- +target_time = 1000 / 500 per second = 2 seconds +wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds +---- + +Since the batch is issued as a single `_bulk` request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. +This is "bursty" instead of "smooth". + +**Slicing** + +Delete by query supports sliced scroll to parallelize the delete process. +This can improve efficiency and provide a convenient way to break the request down into smaller parts. + +Setting `slices` to `auto` lets Elasticsearch choose the number of slices to use. +This setting will use one slice per shard, up to a certain limit. +If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. +Adding slices to the delete by query operation creates sub-requests which means it has some quirks: + +* You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. +* Fetching the status of the task for the request with slices only contains the status of completed slices. +* These sub-requests are individually addressable for things like cancellation and rethrottling. +* Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. +* Canceling the request with `slices` will cancel each sub-request. +* Due to the nature of `slices` each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. +* Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being deleted. +* Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. + +If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: + +* Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many `slices` hurts performance. Setting `slices` higher than the number of shards generally does not improve efficiency and adds overhead. +* Delete performance scales linearly across available resources with the number of slices. + +Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. + +**Cancel a delete by query operation** + +Any delete by query can be canceled using the task cancel API. For example: + +---- +POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel +---- + +The task ID can be found by using the get tasks API. + +Cancellation should happen quickly but might take a few seconds. +The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. + {ref}/docs-delete-by-query.html[Endpoint documentation] [source,ts] ---- @@ -204,59 +492,45 @@ client.deleteByQuery({ index }) ==== Arguments * *Request (object):* -** *`index` (string | string[])*: List of data streams, indices, and aliases to search. -Supports wildcards (`*`). -To search all data streams or indices, omit this parameter or use `*` or `_all`. +** *`index` (string | string[])*: A list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams or indices, omit this parameter or use `*` or `_all`. ** *`max_docs` (Optional, number)*: The maximum number of documents to delete. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Specifies the documents to delete using the Query DSL. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The documents to delete specified with Query DSL. ** *`slice` (Optional, { field, id, max })*: Slice the request manually using the provided slice ID and total number of slices. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. -This behavior applies even if the request targets other open indices. -For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. -** *`analyzer` (Optional, string)*: Analyzer to use for the query string. -** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. +** *`analyzer` (Optional, string)*: Analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. This parameter can be used only when the `q` query string parameter is specified. ** *`conflicts` (Optional, Enum("abort" | "proceed"))*: What to do if delete by query hits version conflicts: `abort` or `proceed`. -** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. -** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. -** *`from` (Optional, number)*: Starting offset (default: 0) +** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. This parameter can be used only when the `q` query string parameter is specified. +** *`df` (Optional, string)*: The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports a list of values, such as `open,hidden`. +** *`from` (Optional, number)*: Skips the specified number of documents. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`refresh` (Optional, boolean)*: If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. -** *`request_cache` (Optional, boolean)*: If `true`, the request cache is used for this request. -Defaults to the index-level setting. +** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the `q` query string parameter is specified. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. It is random by default. +** *`refresh` (Optional, boolean)*: If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. This is different than the delete API's `refresh` parameter, which causes just the shard that received the delete request to be refreshed. Unlike the delete API, it does not support `wait_for`. +** *`request_cache` (Optional, boolean)*: If `true`, the request cache is used for this request. Defaults to the index-level setting. ** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`q` (Optional, string)*: Query in the Lucene query string syntax. -** *`scroll` (Optional, string | -1 | 0)*: Period to retain the search context for scrolling. -** *`scroll_size` (Optional, number)*: Size of the scroll request that powers the operation. -** *`search_timeout` (Optional, string | -1 | 0)*: Explicit timeout for each search request. -Defaults to no timeout. -** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: The type of the search operation. -Available options: `query_then_fetch`, `dfs_query_then_fetch`. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`q` (Optional, string)*: A query in the Lucene query string syntax. +** *`scroll` (Optional, string | -1 | 0)*: The period to retain the search context for scrolling. +** *`scroll_size` (Optional, number)*: The size of the scroll request that powers the operation. +** *`search_timeout` (Optional, string | -1 | 0)*: The explicit timeout for each search request. It defaults to no timeout. +** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: The type of the search operation. Available options include `query_then_fetch` and `dfs_query_then_fetch`. ** *`slices` (Optional, number | Enum("auto"))*: The number of slices this task should be divided into. -** *`sort` (Optional, string[])*: A list of : pairs. -** *`stats` (Optional, string[])*: Specific `tag` of the request for logging and statistical purposes. -** *`terminate_after` (Optional, number)*: Maximum number of documents to collect for each shard. -If a query reaches this limit, Elasticsearch terminates the query early. -Elasticsearch collects documents before sorting. -Use with caution. -Elasticsearch applies this parameter to each shard handling the request. -When possible, let Elasticsearch perform early termination automatically. -Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. -** *`timeout` (Optional, string | -1 | 0)*: Period each deletion request waits for active shards. +** *`sort` (Optional, string[])*: A list of `:` pairs. +** *`stats` (Optional, string[])*: The specific `tag` of the request for logging and statistical purposes. +** *`terminate_after` (Optional, number)*: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. +** *`timeout` (Optional, string | -1 | 0)*: The period each deletion request waits for active shards. ** *`version` (Optional, boolean)*: If `true`, returns the document version as part of a hit. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). -** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the operation is complete. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The `timeout` value controls how long each write request waits for unavailable shards to become available. +** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the operation is complete. If `false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. [discrete] === delete_by_query_rethrottle -Changes the number of requests per second for a particular Delete By Query operation. +Throttle a delete by query operation. + +Change the number of requests per second for a particular delete by query operation. +Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. {ref}/docs-delete-by-query.html[Endpoint documentation] [source,ts] @@ -268,14 +542,14 @@ client.deleteByQueryRethrottle({ task_id }) * *Request (object):* ** *`task_id` (string | number)*: The ID for the task. -** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. +** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. To disable throttling, set it to `-1`. [discrete] === delete_script Delete a script or search template. Deletes a stored script or search template. -{ref}/modules-scripting.html[Endpoint documentation] +{ref}/delete-stored-script-api.html[Endpoint documentation] [source,ts] ---- client.deleteScript({ id }) @@ -284,16 +558,31 @@ client.deleteScript({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier for the stored script or search template. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. -If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. -If no response is received before the timeout expires, the request fails and returns an error. +** *`id` (string)*: The identifier for the stored script or search template. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. It can also be set to `-1` to indicate that the request should never timeout. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. It can also be set to `-1` to indicate that the request should never timeout. [discrete] === exists Check a document. -Checks if a specified document exists. + +Verify that a document exists. +For example, check to see if a document with the `_id` 0 exists: + +---- +HEAD my-index-000001/_doc/0 +---- + +If the document exists, the API returns a status code of `200 - OK`. +If the document doesn’t exist, the API returns `404 - Not Found`. + +**Versioning support** + +You can use the `version` parameter to check the document only if its current version is equal to the specified one. + +Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. +The old version of the document doesn't disappear immediately, although you won't be able to access it. +Elasticsearch cleans up deleted documents in the background as you continue to index more data. {ref}/docs-get.html[Endpoint documentation] [source,ts] @@ -304,28 +593,31 @@ client.exists({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier of the document. -** *`index` (string)*: List of data streams, indices, and aliases. -Supports wildcards (`*`). -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. +** *`id` (string)*: A unique document identifier. +** *`index` (string)*: A list of data streams, indices, and aliases. It supports wildcards (`*`). +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. By default, the operation is randomized between the shard replicas. If it is set to `_local`, the operation will prefer to be run on a local allocated shard when possible. If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. This can help with "jumping values" when hitting different shards in different refresh states. A sample value can be something like the web session ID or the user name. ** *`realtime` (Optional, boolean)*: If `true`, the request is real-time as opposed to near-real-time. -** *`refresh` (Optional, boolean)*: If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. -** *`routing` (Optional, string)*: Target the specified primary shard. -** *`_source` (Optional, boolean | string | string[])*: `true` or `false` to return the `_source` field or not, or a list of fields to return. -** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude in the response. -** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`stored_fields` (Optional, string | string[])*: List of stored fields to return as part of a hit. -If no fields are specified, no stored fields are included in the response. -If this field is specified, the `_source` parameter defaults to false. -** *`version` (Optional, number)*: Explicit version number for concurrency control. -The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. +** *`refresh` (Optional, boolean)*: If `true`, the request refreshes the relevant shards before retrieving the document. Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`_source` (Optional, boolean | string | string[])*: Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. +** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. +** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. +** *`stored_fields` (Optional, string | string[])*: A list of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the `_source` parameter defaults to `false`. +** *`version` (Optional, number)*: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. [discrete] === exists_source Check for a document source. -Checks if a document's `_source` is stored. + +Check whether a document source exists in an index. +For example: + +---- +HEAD my-index-000001/_source/1 +---- + +A document's source is not available if it is disabled in the mapping. {ref}/docs-get.html[Endpoint documentation] [source,ts] @@ -336,25 +628,23 @@ client.existsSource({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier of the document. -** *`index` (string)*: List of data streams, indices, and aliases. -Supports wildcards (`*`). -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`realtime` (Optional, boolean)*: If true, the request is real-time as opposed to near-real-time. -** *`refresh` (Optional, boolean)*: If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. -** *`routing` (Optional, string)*: Target the specified primary shard. -** *`_source` (Optional, boolean | string | string[])*: `true` or `false` to return the `_source` field or not, or a list of fields to return. +** *`id` (string)*: A unique identifier for the document. +** *`index` (string)*: A list of data streams, indices, and aliases. It supports wildcards (`*`). +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. By default, the operation is randomized between the shard replicas. +** *`realtime` (Optional, boolean)*: If `true`, the request is real-time as opposed to near-real-time. +** *`refresh` (Optional, boolean)*: If `true`, the request refreshes the relevant shards before retrieving the document. Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`_source` (Optional, boolean | string | string[])*: Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. ** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude in the response. ** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`version` (Optional, number)*: Explicit version number for concurrency control. -The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. +** *`version` (Optional, number)*: The version number for concurrency control. It must match the current version of the document for the request to succeed. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. [discrete] === explain Explain a document match result. -Returns information about why a specific document matches, or doesn’t match, a query. +Get information about why a specific document matches, or doesn't match, a query. +It computes a score explanation for a query and a specific document. {ref}/search-explain.html[Endpoint documentation] [source,ts] @@ -365,30 +655,31 @@ client.explain({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Defines the document ID. -** *`index` (string)*: Index names used to limit the request. -Only a single index name can be provided to this parameter. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. -** *`analyzer` (Optional, string)*: Analyzer to use for the query string. -This parameter can only be used when the `q` query string parameter is specified. -** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. -** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. -** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. -** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`_source` (Optional, boolean | string | string[])*: True or false to return the `_source` field or not, or a list of fields to return. -** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. -** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. +** *`id` (string)*: The document identifier. +** *`index` (string)*: Index names that are used to limit the request. Only a single index name can be provided to this parameter. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. +** *`analyzer` (Optional, string)*: The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. This parameter can be used only when the `q` query string parameter is specified. +** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. This parameter can be used only when the `q` query string parameter is specified. +** *`df` (Optional, string)*: The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the `q` query string parameter is specified. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. It is random by default. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`_source` (Optional, boolean | string | string[])*: `True` or `false` to return the `_source` field or not or a list of fields to return. +** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. +** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. ** *`stored_fields` (Optional, string | string[])*: A list of stored fields to return in the response. -** *`q` (Optional, string)*: Query in the Lucene query string syntax. +** *`q` (Optional, string)*: The query in the Lucene query string syntax. [discrete] === field_caps -The field capabilities API returns the information about the capabilities of fields among multiple indices. -The field capabilities API returns runtime fields like any other field. For example, a runtime field with a type -of keyword is returned as any other field that belongs to the `keyword` family. +Get the field capabilities. + +Get information about the capabilities of fields among multiple indices. + +For data streams, the API returns field capabilities among the stream’s backing indices. +It returns runtime fields like any other field. +For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the `keyword` family. {ref}/search-field-caps.html[Endpoint documentation] [source,ts] @@ -399,25 +690,78 @@ client.fieldCaps({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. -** *`fields` (Optional, string | string[])*: List of fields to retrieve capabilities for. Wildcard (`*`) expressions are supported. -** *`index_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Allows to filter indices if the provided query rewrites to match_none on every shard. -** *`runtime_mappings` (Optional, Record)*: Defines ad-hoc runtime fields in the request similar to the way it is done in search requests. -These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. -** *`allow_no_indices` (Optional, boolean)*: If false, the request returns an error if any wildcard expression, index alias, -or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request -targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports a list of values, such as `open,hidden`. +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. +** *`fields` (Optional, string | string[])*: A list of fields to retrieve capabilities for. Wildcard (`*`) expressions are supported. +** *`index_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Filter indices if the provided query rewrites to `match_none` on every shard. IMPORTANT: The filtering is done on a best-effort basis, it uses index statistics and mappings to rewrite queries to `match_none` instead of fully running the request. For instance a range query over a date field can rewrite to `match_none` if all documents within a shard (including deleted documents) are outside of the provided range. However, not all queries can rewrite to `match_none` so this API may return an index even if the provided filter matches no document. +** *`runtime_mappings` (Optional, Record)*: Define ad-hoc runtime fields in the request similar to the way it is done in search requests. These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. +** *`allow_no_indices` (Optional, boolean)*: If false, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports a list of values, such as `open,hidden`. ** *`ignore_unavailable` (Optional, boolean)*: If `true`, missing or closed indices are not included in the response. ** *`include_unmapped` (Optional, boolean)*: If true, unmapped fields are included in the response. -** *`filters` (Optional, string)*: An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent -** *`types` (Optional, string[])*: Only return results for fields that have one of the types in the list +** *`filters` (Optional, string)*: A list of filters to apply to the response. +** *`types` (Optional, string[])*: A list of field types to include. Any fields that do not match one of these types will be excluded from the results. It defaults to empty, meaning that all field types are returned. ** *`include_empty_fields` (Optional, boolean)*: If false, empty fields are not included in the response. [discrete] === get Get a document by its ID. -Retrieves the document with the specified ID from an index. + +Get a document and its source or stored fields from an index. + +By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). +In the case where stored fields are requested with the `stored_fields` parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. +To turn off realtime behavior, set the `realtime` parameter to false. + +**Source filtering** + +By default, the API returns the contents of the `_source` field unless you have used the `stored_fields` parameter or the `_source` field is turned off. +You can turn off `_source` retrieval by using the `_source` parameter: + +---- +GET my-index-000001/_doc/0?_source=false +---- + +If you only need one or two fields from the `_source`, use the `_source_includes` or `_source_excludes` parameters to include or filter out particular fields. +This can be helpful with large documents where partial retrieval can save on network overhead +Both parameters take a comma separated list of fields or wildcard expressions. +For example: + +---- +GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities +---- + +If you only want to specify includes, you can use a shorter notation: + +---- +GET my-index-000001/_doc/0?_source=*.id +---- + +**Routing** + +If routing is used during indexing, the routing value also needs to be specified to retrieve a document. +For example: + +---- +GET my-index-000001/_doc/2?routing=user1 +---- + +This request gets the document with ID 2, but it is routed based on the user. +The document is not fetched if the correct routing is not specified. + +**Distributed** + +The GET operation is hashed into a specific shard ID. +It is then redirected to one of the replicas within that shard ID and returns the result. +The replicas are the primary shard and its replicas within that shard ID group. +This means that the more replicas you have, the better your GET scaling will be. + +**Versioning support** + +You can use the `version` parameter to retrieve the document only if its current version is equal to the specified one. + +Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. +The old version of the document doesn't disappear immediately, although you won't be able to access it. +Elasticsearch cleans up deleted documents in the background as you continue to index more data. {ref}/docs-get.html[Endpoint documentation] [source,ts] @@ -428,30 +772,26 @@ client.get({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Unique identifier of the document. -** *`index` (string)*: Name of the index that contains the document. -** *`force_synthetic_source` (Optional, boolean)*: Should this request force synthetic _source? -Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. -Fetches with this enabled will be slower the enabling synthetic source natively in the index. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. Random by default. +** *`id` (string)*: A unique document identifier. +** *`index` (string)*: The name of the index that contains the document. +** *`force_synthetic_source` (Optional, boolean)*: Indicates whether the request forces synthetic `_source`. Use this paramater to test if the mapping supports synthetic `_source` and to get a sense of the worst case performance. Fetches with this parameter enabled will be slower than enabling synthetic source natively in the index. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. By default, the operation is randomized between the shard replicas. If it is set to `_local`, the operation will prefer to be run on a local allocated shard when possible. If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. This can help with "jumping values" when hitting different shards in different refresh states. A sample value can be something like the web session ID or the user name. ** *`realtime` (Optional, boolean)*: If `true`, the request is real-time as opposed to near-real-time. -** *`refresh` (Optional, boolean)*: If true, Elasticsearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes. -** *`routing` (Optional, string)*: Target the specified primary shard. -** *`_source` (Optional, boolean | string | string[])*: True or false to return the _source field or not, or a list of fields to return. -** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude in the response. -** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`stored_fields` (Optional, string | string[])*: List of stored fields to return as part of a hit. -If no fields are specified, no stored fields are included in the response. -If this field is specified, the `_source` parameter defaults to false. -** *`version` (Optional, number)*: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: internal, external, external_gte. +** *`refresh` (Optional, boolean)*: If `true`, the request refreshes the relevant shards before retrieving the document. Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`_source` (Optional, boolean | string | string[])*: Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. +** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. +** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. +** *`stored_fields` (Optional, string | string[])*: A list of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the `_source` parameter defaults to `false`. Only leaf fields can be retrieved with the `stored_field` option. Object fields can't be returned;if specified, the request fails. +** *`version` (Optional, number)*: The version number for concurrency control. It must match the current version of the document for the request to succeed. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. [discrete] === get_script Get a script or search template. Retrieves a stored script or search template. -{ref}/modules-scripting.html[Endpoint documentation] +{ref}/get-stored-script-api.html[Endpoint documentation] [source,ts] ---- client.getScript({ id }) @@ -460,14 +800,16 @@ client.getScript({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier for the stored script or search template. -** *`master_timeout` (Optional, string | -1 | 0)*: Specify timeout for connection to master +** *`id` (string)*: The identifier for the stored script or search template. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. It can also be set to `-1` to indicate that the request should never timeout. [discrete] === get_script_context -Returns all script contexts. +Get script contexts. -{painless}/painless-contexts.html[Endpoint documentation] +Get a list of supported script contexts and their methods. + +{ref}/get-script-contexts-api.html[Endpoint documentation] [source,ts] ---- client.getScriptContext() @@ -475,9 +817,11 @@ client.getScriptContext() [discrete] === get_script_languages -Returns available script types, languages and contexts +Get script languages. + +Get a list of available script types, languages, and contexts. -{ref}/modules-scripting.html[Endpoint documentation] +{ref}/get-script-languages-api.html[Endpoint documentation] [source,ts] ---- client.getScriptLanguages() @@ -486,7 +830,19 @@ client.getScriptLanguages() [discrete] === get_source Get a document's source. -Returns the source of a document. + +Get the source of a document. +For example: + +---- +GET my-index-000001/_source/1 +---- + +You can use the source filtering parameters to control which parts of the `_source` are returned: + +---- +GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities +---- {ref}/docs-get.html[Endpoint documentation] [source,ts] @@ -497,22 +853,39 @@ client.getSource({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Unique identifier of the document. -** *`index` (string)*: Name of the index that contains the document. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. Random by default. -** *`realtime` (Optional, boolean)*: Boolean) If true, the request is real-time as opposed to near-real-time. -** *`refresh` (Optional, boolean)*: If true, Elasticsearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes. -** *`routing` (Optional, string)*: Target the specified primary shard. -** *`_source` (Optional, boolean | string | string[])*: True or false to return the _source field or not, or a list of fields to return. +** *`id` (string)*: A unique document identifier. +** *`index` (string)*: The name of the index that contains the document. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. By default, the operation is randomized between the shard replicas. +** *`realtime` (Optional, boolean)*: If `true`, the request is real-time as opposed to near-real-time. +** *`refresh` (Optional, boolean)*: If `true`, the request refreshes the relevant shards before retrieving the document. Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`_source` (Optional, boolean | string | string[])*: Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. ** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude in the response. ** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`stored_fields` (Optional, string | string[])* -** *`version` (Optional, number)*: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: internal, external, external_gte. +** *`stored_fields` (Optional, string | string[])*: A list of stored fields to return as part of a hit. +** *`version` (Optional, number)*: The version number for concurrency control. It must match the current version of the document for the request to succeed. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. [discrete] === health_report -Returns the health of the cluster. +Get the cluster health. +Get a report with the health status of an Elasticsearch cluster. +The report contains a list of indicators that compose Elasticsearch functionality. + +Each indicator has a health status of: green, unknown, yellow or red. +The indicator will provide an explanation and metadata describing the reason for its current health status. + +The cluster’s status is controlled by the worst indicator status. + +In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. +Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. + +Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. +The root cause and remediation steps are encapsulated in a diagnosis. +A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. + +NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. +When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. {ref}/health-api.html[Endpoint documentation] [source,ts] @@ -530,50 +903,158 @@ client.healthReport({ ... }) [discrete] === index -Index a document. -Adds a JSON document to the specified data stream or index and makes it searchable. +Create or update a document in an index. + +Add a JSON document to the specified data stream or index and make it searchable. If the target is an index and the document already exists, the request updates the document and increments its version. -{ref}/docs-index_.html[Endpoint documentation] -[source,ts] ----- -client.index({ index }) ----- -[discrete] -==== Arguments +NOTE: You cannot use this API to send update requests for existing documents in a data stream. + +If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: + +* To add or overwrite a document using the `PUT //_doc/<_id>` request format, you must have the `create`, `index`, or `write` index privilege. +* To add a document using the `POST //_doc/` request format, you must have the `create_doc`, `create`, `index`, or `write` index privilege. +* To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. + +Automatic data stream creation requires a matching index template with data stream enabled. + +NOTE: Replica shards might not all be started when an indexing operation returns successfully. +By default, only the primary is required. Set `wait_for_active_shards` to change this default behavior. + +**Automatically create data streams and indices** + +If the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream. + +If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. + +NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. + +If no mapping exists, the index operation creates a dynamic mapping. +By default, new fields and objects are automatically added to the mapping if needed. + +Automatic index creation is controlled by the `action.auto_create_index` setting. +If it is `true`, any index can be created automatically. +You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely. +Specify a list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. +When a list is specified, the default behaviour is to disallow. + +NOTE: The `action.auto_create_index` setting affects the automatic creation of indices only. +It does not affect the creation of data streams. + +**Optimistic concurrency control** + +Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters. +If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`. + +**Routing** + +By default, shard placement — or routing — is controlled by using a hash of the document's ID value. +For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter. + +When setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself. +This does come at the (very minimal) cost of an additional document parsing pass. +If the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. + +NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. + +**Distributed** + +The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. +After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. + +**Active shards** + +To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. +If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. +By default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`). +This default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`. +To alter this behavior per operation, use the `wait_for_active_shards request` parameter. + +Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1). +Specifying a negative value or a number greater than the number of shard copies will throw an error. + +For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). +If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. +This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. +If `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. +This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. +However, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. +The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. + +It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. +After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. +The `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed. + +**No operation (noop) updates** + +When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. +If this isn't acceptable use the `_update` API with `detect_noop` set to `true`. +The `detect_noop` option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. + +There isn't a definitive rule for when noop updates aren't acceptable. +It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. + +**Versioning** + +Each indexed document is given a version number. +By default, internal versioning is used that starts at 1 and increments with each update, deletes included. +Optionally, the version number can be set to an external value (for example, if maintained in a database). +To enable this functionality, `version_type` should be set to `external`. +The value provided must be a numeric, long value greater than or equal to 0, and less than around `9.2e+18`. + +NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. +If no version is provided, the operation runs without any version checks. + +When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. +If true, the document will be indexed and the new version number used. +If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: + +---- +PUT my-index-000001/_doc/1?version=2&version_type=external +{ + "user": { + "id": "elkbee" + } +} +---- + +In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. +If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). + +A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. +Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. + +{ref}/docs-index_.html[Endpoint documentation] +[source,ts] +---- +client.index({ index }) +---- +[discrete] +==== Arguments * *Request (object):* -** *`index` (string)*: Name of the data stream or index to target. -** *`id` (Optional, string)*: Unique identifier for the document. +** *`index` (string)*: The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If the target doesn't exist and doesn't match a data stream template, this request creates the index. You can check for existing targets with the resolve index API. +** *`id` (Optional, string)*: A unique identifier for the document. To automatically generate a document ID, use the `POST //_doc/` request format and omit this parameter. ** *`document` (Optional, object)*: A document. ** *`if_primary_term` (Optional, number)*: Only perform the operation if the document has this primary term. ** *`if_seq_no` (Optional, number)*: Only perform the operation if the document has this sequence number. -** *`op_type` (Optional, Enum("index" | "create"))*: Set to create to only index the document if it does not already exist (put if absent). -If a document with the specified `_id` already exists, the indexing operation will fail. -Same as using the `/_create` endpoint. -Valid values: `index`, `create`. -If document id is specified, it defaults to `index`. -Otherwise, it defaults to `create`. -** *`pipeline` (Optional, string)*: ID of the pipeline to use to preprocess incoming documents. -If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. -If a final pipeline is configured it will always run, regardless of the value of this parameter. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. -Valid values: `true`, `false`, `wait_for`. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`timeout` (Optional, string | -1 | 0)*: Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. -** *`version` (Optional, number)*: Explicit version number for concurrency control. -The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +** *`include_source_on_error` (Optional, boolean)*: True or false if to include the document source in the error message in case of parsing errors. +** *`op_type` (Optional, Enum("index" | "create"))*: Set to `create` to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. The behavior is the same as using the `/_create` endpoint. If a document ID is specified, this paramater defaults to `index`. Otherwise, it defaults to `create`. If the request targets a data stream, an `op_type` of `create` is required. +** *`pipeline` (Optional, string)*: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. If `wait_for`, it waits for a refresh to make this operation visible to search. If `false`, it does nothing with refreshes. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`timeout` (Optional, string | -1 | 0)*: The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. The actual wait time could be longer, particularly when multiple waits occur. +** *`version` (Optional, number)*: An explicit version number for concurrency control. It must be a non-negative long number. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default value of `1` means it waits for each primary shard to be active. ** *`require_alias` (Optional, boolean)*: If `true`, the destination must be an index alias. [discrete] === info Get cluster info. -Returns basic information about the cluster. +Get basic build, version, and cluster information. -{ref}/index.html[Endpoint documentation] +{ref}/rest-api-root.html[Endpoint documentation] [source,ts] ---- client.info() @@ -581,9 +1062,27 @@ client.info() [discrete] === knn_search -Performs a kNN search. +Run a knn search. -{ref}/search-search.html[Endpoint documentation] +NOTE: The kNN search API has been replaced by the `knn` option in the search API. + +Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. +Given a query vector, the API finds the k closest vectors and returns those documents as search hits. + +Elasticsearch uses the HNSW algorithm to support efficient kNN search. +Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. +This means the results returned are not always the true k closest neighbors. + +The kNN search API supports restricting the search using a filter. +The search will return the top k documents that also match the filter query. + +A kNN search response has the exact same structure as a search API response. +However, certain sections have a meaning specific to kNN search: + +* The document `_score` is determined by the similarity between the query and document vector. +* The `hits.total` object contains the total number of nearest neighbor candidates considered, which is `num_candidates * num_shards`. The `hits.total.relation` will always be `eq`, indicating an exact value. + +{ref}/knn-search-api.html[Endpoint documentation] [source,ts] ---- client.knnSearch({ index, knn }) @@ -592,27 +1091,34 @@ client.knnSearch({ index, knn }) ==== Arguments * *Request (object):* -** *`index` (string | string[])*: A list of index names to search; -use `_all` or to perform the operation on all indices -** *`knn` ({ field, query_vector, k, num_candidates })*: kNN query to execute -** *`_source` (Optional, boolean | { excludes, includes })*: Indicates which source fields are returned for matching documents. These -fields are returned in the hits._source property of the search response. -** *`docvalue_fields` (Optional, { field, format, include_unmapped }[])*: The request returns doc values for field names matching these patterns -in the hits.fields property of the response. Accepts wildcard (*) patterns. -** *`stored_fields` (Optional, string | string[])*: List of stored fields to return as part of a hit. If no fields are specified, -no stored fields are included in the response. If this field is specified, the _source -parameter defaults to false. You can pass _source: true to return both source fields -and stored fields in the search response. -** *`fields` (Optional, string | string[])*: The request returns values for field names matching these patterns -in the hits.fields property of the response. Accepts wildcard (*) patterns. -** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type } | { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type }[])*: Query to filter the documents that can match. The kNN search will return the top -`k` documents that also match this filter. The value can be a single query or a -list of queries. If `filter` isn't provided, all documents are allowed to match. -** *`routing` (Optional, string)*: A list of specific routing values +** *`index` (string | string[])*: A list of index names to search; use `_all` or to perform the operation on all indices. +** *`knn` ({ field, query_vector, k, num_candidates })*: The kNN query to run. +** *`_source` (Optional, boolean | { excludes, includes })*: Indicates which source fields are returned for matching documents. These fields are returned in the `hits._source` property of the search response. +** *`docvalue_fields` (Optional, { field, format, include_unmapped }[])*: The request returns doc values for field names matching these patterns in the `hits.fields` property of the response. It accepts wildcard (`*`) patterns. +** *`stored_fields` (Optional, string | string[])*: A list of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the `_source` parameter defaults to `false`. You can pass `_source: true` to return both source fields and stored fields in the search response. +** *`fields` (Optional, string | string[])*: The request returns values for field names matching these patterns in the `hits.fields` property of the response. It accepts wildcard (`*`) patterns. +** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type } | { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type }[])*: A query to filter the documents that can match. The kNN search will return the top `k` documents that also match this filter. The value can be a single query or a list of queries. If `filter` isn't provided, all documents are allowed to match. +** *`routing` (Optional, string)*: A list of specific routing values. [discrete] === mget -Allows to get multiple documents in one request. +Get multiple documents. + +Get multiple JSON documents by ID from one or more indices. +If you specify an index in the request URI, you only need to specify the document IDs in the request body. +To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. + +**Filter source fields** + +By default, the `_source` field is returned for every document (if stored). +Use the `_source` and `_source_include` or `source_exclude` attributes to filter what fields are returned for a particular document. +You can include the `_source`, `_source_includes`, and `_source_excludes` query parameters in the request URI to specify the defaults to use when there are no per-document instructions. + +**Get stored fields** + +Use the `stored_fields` attribute to specify the set of stored fields you want to retrieve. +Any requested fields that are not stored are ignored. +You can include the `stored_fields` query parameter in the request URI to specify the defaults to use when there are no per-document instructions. {ref}/docs-multi-get.html[Endpoint documentation] [source,ts] @@ -626,24 +1132,35 @@ client.mget({ ... }) ** *`index` (Optional, string)*: Name of the index to retrieve documents from when `ids` are specified, or when a document in the `docs` array does not specify an index. ** *`docs` (Optional, { _id, _index, routing, _source, stored_fields, version, version_type }[])*: The documents you want to retrieve. Required if no index is specified in the request URI. ** *`ids` (Optional, string | string[])*: The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI. -** *`force_synthetic_source` (Optional, boolean)*: Should this request force synthetic _source? -Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. -Fetches with this enabled will be slower the enabling synthetic source natively in the index. +** *`force_synthetic_source` (Optional, boolean)*: Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. ** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. Random by default. ** *`realtime` (Optional, boolean)*: If `true`, the request is real-time as opposed to near-real-time. ** *`refresh` (Optional, boolean)*: If `true`, the request refreshes relevant shards before retrieving documents. ** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. ** *`_source` (Optional, boolean | string | string[])*: True or false to return the `_source` field or not, or a list of fields to return. -** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. -You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. -** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. -If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. -If the `_source` parameter is `false`, this parameter is ignored. +** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. +** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. ** *`stored_fields` (Optional, string | string[])*: If `true`, retrieves the document fields stored in the index rather than the document `_source`. [discrete] === msearch -Allows to execute several search operations in one request. +Run multiple searches. + +The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. +The structure is as follows: + +---- +header\n +body\n +header\n +body\n +---- + +This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. + +IMPORTANT: The final line of data must end with a newline character `\n`. +Each newline character may be preceded by a carriage return `\r`. +When sending requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`. {ref}/search-multi-search.html[Endpoint documentation] [source,ts] @@ -661,12 +1178,7 @@ client.msearch({ ... }) ** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. ** *`ignore_throttled` (Optional, boolean)*: If true, concrete, expanded or aliased indices are ignored when frozen. ** *`ignore_unavailable` (Optional, boolean)*: If true, missing or closed indices are not included in the response. -** *`include_named_queries_score` (Optional, boolean)*: Indicates whether hit.matched_queries should be rendered as a map that includes -the name of the matched query associated with its score (true) -or as an array containing the name of the matched queries (false) -This functionality reruns each named query on every hit in a search response. -Typically, this adds a small overhead to a request. -However, using computationally expensive named queries on a large number of hits may add significant overhead. +** *`include_named_queries_score` (Optional, boolean)*: Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) This functionality reruns each named query on every hit in a search response. Typically, this adds a small overhead to a request. However, using computationally expensive named queries on a large number of hits may add significant overhead. ** *`max_concurrent_searches` (Optional, number)*: Maximum number of concurrent searches the multi search API can execute. ** *`max_concurrent_shard_requests` (Optional, number)*: Maximum number of concurrent shard requests that each sub-search request executes per node. ** *`pre_filter_shard_size` (Optional, number)*: Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. @@ -677,9 +1189,23 @@ However, using computationally expensive named queries on a large number of hits [discrete] === msearch_template -Runs multiple templated searches with a single request. +Run multiple templated searches. -{ref}/search-multi-search.html[Endpoint documentation] +Run multiple templated searches with a single request. +If you are providing a text file or text input to `curl`, use the `--data-binary` flag instead of `-d` to preserve newlines. +For example: + +---- +$ cat requests +{ "index": "my-index" } +{ "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} +{ "index": "my-other-index" } +{ "id": "my-other-search-template", "params": { "query_type": "match_all" }} + +$ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo +---- + +{ref}/multi-search-template.html[Endpoint documentation] [source,ts] ---- client.msearchTemplate({ ... }) @@ -688,21 +1214,28 @@ client.msearchTemplate({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases to search. -Supports wildcards (`*`). -To search all data streams and indices, omit this parameter or use `*`. +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*`. ** *`search_templates` (Optional, { allow_no_indices, expand_wildcards, ignore_unavailable, index, preference, request_cache, routing, search_type, ccs_minimize_roundtrips, allow_partial_search_results, ignore_throttled } | { aggregations, collapse, query, explain, ext, stored_fields, docvalue_fields, knn, from, highlight, indices_boost, min_score, post_filter, profile, rescore, script_fields, search_after, size, sort, _source, fields, terminate_after, stats, timeout, track_scores, track_total_hits, version, runtime_mappings, seq_no_primary_term, pit, suggest }[])* ** *`ccs_minimize_roundtrips` (Optional, boolean)*: If `true`, network round-trips are minimized for cross-cluster search requests. -** *`max_concurrent_searches` (Optional, number)*: Maximum number of concurrent searches the API can run. +** *`max_concurrent_searches` (Optional, number)*: The maximum number of concurrent searches the API can run. ** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: The type of the search operation. -Available options: `query_then_fetch`, `dfs_query_then_fetch`. -** *`rest_total_hits_as_int` (Optional, boolean)*: If `true`, the response returns `hits.total` as an integer. -If `false`, it returns `hits.total` as an object. +** *`rest_total_hits_as_int` (Optional, boolean)*: If `true`, the response returns `hits.total` as an integer. If `false`, it returns `hits.total` as an object. ** *`typed_keys` (Optional, boolean)*: If `true`, the response prefixes aggregation and suggester names with their respective types. [discrete] === mtermvectors -Returns multiple termvectors in one request. +Get multiple term vectors. + +Get multiple term vectors with a single request. +You can specify existing documents by index and ID or provide artificial documents in the body of the request. +You can specify the index in the request body or request URI. +The response contains a `docs` array with all the fetched termvectors. +Each element has the structure provided by the termvectors API. + +**Artificial documents** + +You can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request. +The mapping used is determined by the specified `_index`. {ref}/docs-multi-termvectors.html[Endpoint documentation] [source,ts] @@ -713,32 +1246,61 @@ client.mtermvectors({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string)*: Name of the index that contains the documents. -** *`docs` (Optional, { _id, _index, routing, _source, stored_fields, version, version_type }[])*: Array of existing or artificial documents. -** *`ids` (Optional, string[])*: Simplified syntax to specify documents by their ID if they're in the same index. -** *`fields` (Optional, string | string[])*: List or wildcard expressions of fields to include in the statistics. -Used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. +** *`index` (Optional, string)*: The name of the index that contains the documents. +** *`docs` (Optional, { _id, _index, routing, _source, stored_fields, version, version_type }[])*: An array of existing or artificial documents. +** *`ids` (Optional, string[])*: A simplified syntax to specify documents by their ID if they're in the same index. +** *`fields` (Optional, string | string[])*: A list or wildcard expressions of fields to include in the statistics. It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. ** *`field_statistics` (Optional, boolean)*: If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. ** *`offsets` (Optional, boolean)*: If `true`, the response includes term offsets. ** *`payloads` (Optional, boolean)*: If `true`, the response includes term payloads. ** *`positions` (Optional, boolean)*: If `true`, the response includes term positions. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. It is random by default. ** *`realtime` (Optional, boolean)*: If true, the request is real-time as opposed to near-real-time. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. ** *`term_statistics` (Optional, boolean)*: If true, the response includes term frequency and document frequency. ** *`version` (Optional, number)*: If `true`, returns the document version as part of a hit. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. [discrete] === open_point_in_time -A search request by default executes against the most recent visible data of the target indices, +Open a point in time. + +A search request by default runs against the most recent visible data of the target indices, which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple search requests using the same point in time. For example, if refreshes happen between `search_after` requests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time. +A point in time must be opened explicitly before being used in search requests. + +A subsequent search request with the `pit` parameter must not specify `index`, `routing`, or `preference` values as these parameters are copied from the point in time. + +Just like regular searches, you can use `from` and `size` to page through point in time search results, up to the first 10,000 hits. +If you want to retrieve more hits, use PIT with `search_after`. + +IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. + +When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a `NoShardAvailableActionException` exception. +To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. + +**Keeping point in time alive** + +The `keep_alive` parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. +The value does not need to be long enough to process all data — it just needs to be long enough for the next request. + +Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. +Once the smaller segments are no longer needed they are deleted. +However, open point-in-times prevent the old segments from being deleted since they are still in use. + +TIP: Keeping older segments alive means that more disk space and file handles are needed. +Ensure that you have configured your nodes to have ample free file handles. + +Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. +Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. +Note that a point-in-time doesn't prevent its associated indices from being deleted. +You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. + {ref}/point-in-time-api.html[Endpoint documentation] [source,ts] ---- @@ -749,21 +1311,21 @@ client.openPointInTime({ index, keep_alive }) * *Request (object):* ** *`index` (string | string[])*: A list of index names to open point in time; use `_all` or empty string to perform the operation on all indices -** *`keep_alive` (string | -1 | 0)*: Extends the time to live of the corresponding point in time. +** *`keep_alive` (string | -1 | 0)*: Extend the length of time that the point in time persists. +** *`index_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Filter indices if the provided query rewrites to `match_none` on every shard. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. By default, it is random. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +** *`allow_partial_search_results` (Optional, boolean)*: Indicates whether the point in time tolerates unavailable shards or shard failures when initially creating the PIT. If `false`, creating a point in time request when a shard is missing or unavailable will throw an exception. If `true`, the point in time will contain all the shards that are available at the time of the request. +** *`max_concurrent_shard_requests` (Optional, number)*: Maximum number of concurrent shard requests that each sub-search request executes per node. [discrete] === ping Ping the cluster. -Returns whether the cluster is running. +Get information about whether the cluster is running. -{ref}/index.html[Endpoint documentation] +{ref}/cluster.html[Endpoint documentation] [source,ts] ---- client.ping() @@ -774,7 +1336,7 @@ client.ping() Create or update a script or search template. Creates or updates a stored script or search template. -{ref}/modules-scripting.html[Endpoint documentation] +{ref}/create-stored-script-api.html[Endpoint documentation] [source,ts] ---- client.putScript({ id, script }) @@ -783,19 +1345,17 @@ client.putScript({ id, script }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier for the stored script or search template. -Must be unique within the cluster. -** *`script` ({ lang, options, source })*: Contains the script or search template, its parameters, and its language. -** *`context` (Optional, string)*: Context in which the script or search template should run. -To prevent errors, the API immediately compiles the script or template in this context. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. -If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. -If no response is received before the timeout expires, the request fails and returns an error. +** *`id` (string)*: The identifier for the stored script or search template. It must be unique within the cluster. +** *`script` ({ lang, options, source })*: The script or search template, its parameters, and its language. +** *`context` (Optional, string)*: The context in which the script or search template should run. To prevent errors, the API immediately compiles the script or template in this context. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. It can also be set to `-1` to indicate that the request should never timeout. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. It can also be set to `-1` to indicate that the request should never timeout. [discrete] === rank_eval -Enables you to evaluate the quality of ranked search results over a set of typical search queries. +Evaluate ranked search results. + +Evaluate the quality of ranked search results over a set of typical search queries. {ref}/search-rank-eval.html[Endpoint documentation] [source,ts] @@ -807,8 +1367,7 @@ client.rankEval({ requests }) * *Request (object):* ** *`requests` ({ id, request, ratings, template_id, params }[])*: A set of typical search requests, together with their provided ratings. -** *`index` (Optional, string | string[])*: List of data streams, indices, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. -To target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`. +** *`index` (Optional, string | string[])*: A list of data streams, indices, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. To target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`. ** *`metric` (Optional, { precision, recall, mean_reciprocal_rank, dcg, expected_reciprocal_rank })*: Definition of the evaluation metric to calculate. ** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. ** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Whether to expand wildcard expression to concrete indices that are open, closed or both. @@ -818,7 +1377,187 @@ To target all data streams and indices in a cluster, omit this parameter or use [discrete] === reindex Reindex documents. -Copies documents from a source to a destination. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself. + +Copy documents from a source to a destination. +You can copy all documents to the destination index or reindex a subset of the documents. +The source can be any existing index, alias, or data stream. +The destination must differ from the source. +For example, you cannot reindex a data stream into itself. + +IMPORTANT: Reindex requires `_source` to be enabled for all documents in the source. +The destination should be configured as wanted before calling the reindex API. +Reindex does not copy the settings from the source or its associated template. +Mappings, shard counts, and replicas, for example, must be configured ahead of time. + +If the Elasticsearch security features are enabled, you must have the following security privileges: + +* The `read` index privilege for the source data stream, index, or alias. +* The `write` index privilege for the destination data stream, index, or index alias. +* To automatically create a data stream or index with a reindex API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege for the destination data stream, index, or alias. +* If reindexing from a remote cluster, the `source.remote.user` must have the `monitor` cluster privilege and the `read` index privilege for the source data stream, index, or alias. + +If reindexing from a remote cluster, you must explicitly allow the remote host in the `reindex.remote.whitelist` setting. +Automatic data stream creation requires a matching index template with data stream enabled. + +The `dest` element can be configured like the index API to control optimistic concurrency control. +Omitting `version_type` or setting it to `internal` causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. + +Setting `version_type` to `external` causes Elasticsearch to preserve the `version` from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. + +Setting `op_type` to `create` causes the reindex API to create only missing documents in the destination. +All existing documents will cause a version conflict. + +IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an `op_type` of `create`. +A reindex can only add new documents to a destination data stream. +It cannot update existing documents in a destination data stream. + +By default, version conflicts abort the reindex process. +To continue reindexing if there are conflicts, set the `conflicts` request body property to `proceed`. +In this case, the response includes a count of the version conflicts that were encountered. +Note that the handling of other error types is unaffected by the `conflicts` property. +Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query. + +NOTE: The reindex API makes no effort to handle ID collisions. +The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. +Instead, make sure that IDs are unique by using a script. + +**Running reindex asynchronously** + +If the request contains `wait_for_completion=false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. +Elasticsearch creates a record of this task as a document at `_tasks/`. + +**Reindex from multiple sources** + +If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. +That way you can resume the process if there are any errors by removing the partially completed source and starting over. +It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. + +For example, you can use a bash script like this: + +---- +for index in i1 i2 i3 i4 i5; do + curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ + "source": { + "index": "'$index'" + }, + "dest": { + "index": "'$index'-reindexed" + } + }' +done +---- + +**Throttling** + +Set `requests_per_second` to any positive decimal number (`1.4`, `6`, `1000`, for example) to throttle the rate at which reindex issues batches of index operations. +Requests are throttled by padding each batch with a wait time. +To turn off throttling, set `requests_per_second` to `-1`. + +The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. +The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. +By default the batch size is `1000`, so if `requests_per_second` is set to `500`: + +---- +target_time = 1000 / 500 per second = 2 seconds +wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds +---- + +Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. +This is "bursty" instead of "smooth". + +**Slicing** + +Reindex supports sliced scroll to parallelize the reindexing process. +This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. + +NOTE: Reindexing from remote clusters does not support manual or automatic slicing. + +You can slice a reindex request manually by providing a slice ID and total number of slices to each request. +You can also let reindex automatically parallelize by using sliced scroll to slice on `_id`. +The `slices` parameter specifies the number of slices to use. + +Adding `slices` to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: + +* You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. +* Fetching the status of the task for the request with `slices` only contains the status of completed slices. +* These sub-requests are individually addressable for things like cancellation and rethrottling. +* Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. +* Canceling the request with `slices` will cancel each sub-request. +* Due to the nature of `slices`, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. +* Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being reindexed. +* Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. + +If slicing automatically, setting `slices` to `auto` will choose a reasonable number for most indices. +If slicing manually or otherwise tuning automatic slicing, use the following guidelines. + +Query performance is most efficient when the number of slices is equal to the number of shards in the index. +If that number is large (for example, `500`), choose a lower number as too many slices will hurt performance. +Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. + +Indexing performance scales linearly across available resources with the number of slices. + +Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. + +**Modify documents during reindexing** + +Like `_update_by_query`, reindex operations support a script that modifies the document. +Unlike `_update_by_query`, the script is allowed to modify the document's metadata. + +Just as in `_update_by_query`, you can set `ctx.op` to change the operation that is run on the destination. +For example, set `ctx.op` to `noop` if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the `noop` counter in the response body. +Set `ctx.op` to `delete` if your script decides that the document must be deleted from the destination. +The deletion will be reported in the `deleted` counter in the response body. +Setting `ctx.op` to anything else will return an error, as will setting any other field in `ctx`. + +Think of the possibilities! Just be careful; you are able to change: + +* `_id` +* `_index` +* `_version` +* `_routing` + +Setting `_version` to `null` or clearing it from the `ctx` map is just like not sending the version in an indexing request. +It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. + +**Reindex from remote** + +Reindex supports reindexing from a remote Elasticsearch cluster. +The `host` parameter must contain a scheme, host, port, and optional path. +The `username` and `password` parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. +Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. +There are a range of settings available to configure the behavior of the HTTPS connection. + +When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. +Remote hosts must be explicitly allowed with the `reindex.remote.whitelist` setting. +It can be set to a comma delimited list of allowed remote host and port combinations. +Scheme is ignored; only the host and port are used. +For example: + +---- +reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] +---- + +The list of allowed hosts must be configured on any nodes that will coordinate the reindex. +This feature should work with remote clusters of any version of Elasticsearch. +This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. + +WARNING: Elasticsearch does not support forward compatibility across major versions. +For example, you cannot reindex from a 7.x cluster into a 6.x cluster. + +To enable queries sent to older versions of Elasticsearch, the `query` parameter is sent directly to the remote host without validation or modification. + +NOTE: Reindexing from remote clusters does not support manual or automatic slicing. + +Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. +If the remote index includes very large documents you'll need to use a smaller batch size. +It is also possible to set the socket read timeout on the remote connection with the `socket_timeout` field and the connection timeout with the `connect_timeout` field. +Both default to 30 seconds. + +**Configuring SSL parameters** + +Reindex from remote supports configurable SSL settings. +These must be specified in the `elasticsearch.yml` file, with the exception of the secure settings, which you add in the Elasticsearch keystore. +It is not possible to configure SSL in the body of the reindex request. {ref}/docs-reindex.html[Endpoint documentation] [source,ts] @@ -831,25 +1570,33 @@ client.reindex({ dest, source }) * *Request (object):* ** *`dest` ({ index, op_type, pipeline, routing, version_type })*: The destination you are copying to. ** *`source` ({ index, query, remote, size, slice, sort, _source, runtime_mappings })*: The source you are copying from. -** *`conflicts` (Optional, Enum("abort" | "proceed"))*: Set to proceed to continue reindexing even if there are conflicts. -** *`max_docs` (Optional, number)*: The maximum number of documents to reindex. +** *`conflicts` (Optional, Enum("abort" | "proceed"))*: Indicates whether to continue reindexing even when there are conflicts. +** *`max_docs` (Optional, number)*: The maximum number of documents to reindex. By default, all documents are reindexed. If it is a value less then or equal to `scroll_size`, a scroll will not be used to retrieve the results for the operation. If `conflicts` is set to `proceed`, the reindex operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query. ** *`script` (Optional, { source, id, params, lang, options })*: The script to run to update the document source or metadata when reindexing. ** *`size` (Optional, number)* ** *`refresh` (Optional, boolean)*: If `true`, the request refreshes affected shards to make this operation visible to search. -** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. -Defaults to no throttle. -** *`scroll` (Optional, string | -1 | 0)*: Specifies how long a consistent view of the index should be maintained for scrolled search. -** *`slices` (Optional, number | Enum("auto"))*: The number of slices this task should be divided into. -Defaults to 1 slice, meaning the task isn’t sliced into subtasks. -** *`timeout` (Optional, string | -1 | 0)*: Period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. By default, there is no throttle. +** *`scroll` (Optional, string | -1 | 0)*: The period of time that a consistent view of the index should be maintained for scrolled search. +** *`slices` (Optional, number | Enum("auto"))*: The number of slices this task should be divided into. It defaults to one slice, which means the task isn't sliced into subtasks. Reindex supports sliced scroll to parallelize the reindexing process. This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. NOTE: Reindexing from remote clusters does not support manual or automatic slicing. If set to `auto`, Elasticsearch chooses the number of slices to use. This setting will use one slice per shard, up to a certain limit. If there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards. +** *`timeout` (Optional, string | -1 | 0)*: The period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. By default, Elasticsearch waits for at least one minute before failing. The actual wait time could be longer, particularly when multiple waits occur. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. Set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default value is one, which means it waits for each primary shard to be active. ** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the operation is complete. ** *`require_alias` (Optional, boolean)*: If `true`, the destination must be an index alias. [discrete] === reindex_rethrottle -Copies documents from a source to a destination. +Throttle a reindex operation. + +Change the number of requests per second for a particular reindex operation. +For example: + +---- +POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 +---- + +Rethrottling that speeds up the query takes effect immediately. +Rethrottling that slows down the query will take effect after completing the current batch. +This behavior prevents scroll timeouts. {ref}/docs-reindex.html[Endpoint documentation] [source,ts] @@ -860,12 +1607,14 @@ client.reindexRethrottle({ task_id }) ==== Arguments * *Request (object):* -** *`task_id` (string)*: Identifier for the task. -** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. +** *`task_id` (string)*: The task identifier, which can be found by using the tasks API. +** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. It can be either `-1` to turn off throttling or any decimal number like `1.7` or `12` to throttle to that level. [discrete] === render_search_template -Renders a search template as a search request body. +Render a search template. + +Render a search template as a search request body. {ref}/render-search-template-api.html[Endpoint documentation] [source,ts] @@ -876,21 +1625,22 @@ client.renderSearchTemplate({ ... }) ==== Arguments * *Request (object):* -** *`id` (Optional, string)*: ID of the search template to render. -If no `source` is specified, this or the `id` request body parameter is required. +** *`id` (Optional, string)*: The ID of the search template to render. If no `source` is specified, this or the `id` request body parameter is required. ** *`file` (Optional, string)* -** *`params` (Optional, Record)*: Key-value pairs used to replace Mustache variables in the template. -The key is the variable name. -The value is the variable value. -** *`source` (Optional, string)*: An inline search template. -Supports the same parameters as the search API's request body. -These parameters also support Mustache variables. -If no `id` or `` is specified, this parameter is required. +** *`params` (Optional, Record)*: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. +** *`source` (Optional, string)*: An inline search template. It supports the same parameters as the search API's request body. These parameters also support Mustache variables. If no `id` or `` is specified, this parameter is required. [discrete] === scripts_painless_execute Run a script. + Runs a script and returns a result. +Use this API to build and test scripts, such as when defining a script for a runtime field. +This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster. + +The API uses several _contexts_, which control how scripts are run, what variables are available at runtime, and what the return type is. + +Each context requires a script, but additional parameters depend on the context you're using for that script. {painless}/painless-execute-api.html[Endpoint documentation] [source,ts] @@ -901,15 +1651,28 @@ client.scriptsPainlessExecute({ ... }) ==== Arguments * *Request (object):* -** *`context` (Optional, string)*: The context that the script should run in. -** *`context_setup` (Optional, { document, index, query })*: Additional parameters for the `context`. -** *`script` (Optional, { source, id, params, lang, options })*: The Painless script to execute. +** *`context` (Optional, Enum("painless_test" | "filter" | "score" | "boolean_field" | "date_field" | "double_field" | "geo_point_field" | "ip_field" | "keyword_field" | "long_field" | "composite_field"))*: The context that the script should run in. NOTE: Result ordering in the field contexts is not guaranteed. +** *`context_setup` (Optional, { document, index, query })*: Additional parameters for the `context`. NOTE: This parameter is required for all contexts except `painless_test`, which is the default if no value is provided for `context`. +** *`script` (Optional, { source, id, params, lang, options })*: The Painless script to run. [discrete] === scroll -Allows to retrieve a large numbers of results from a single search request. +Run a scrolling search. + +IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the `search_after` parameter with a point in time (PIT). + +The scroll API gets large sets of results from a single scrolling search request. +To get the necessary scroll ID, submit a search API request that includes an argument for the `scroll` query parameter. +The `scroll` parameter indicates how long Elasticsearch should retain the search context for the request. +The search response returns a scroll ID in the `_scroll_id` response body parameter. +You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. +If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search. + +You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context. -{ref}/search-request-body.html[Endpoint documentation] +IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests. + +{ref}/scroll-api.html[Endpoint documentation] [source,ts] ---- client.scroll({ scroll_id }) @@ -918,16 +1681,33 @@ client.scroll({ scroll_id }) ==== Arguments * *Request (object):* -** *`scroll_id` (string)*: Scroll ID of the search. -** *`scroll` (Optional, string | -1 | 0)*: Period to retain the search context for scrolling. +** *`scroll_id` (string)*: The scroll ID of the search. +** *`scroll` (Optional, string | -1 | 0)*: The period to retain the search context for scrolling. ** *`rest_total_hits_as_int` (Optional, boolean)*: If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. [discrete] === search -Returns search hits that match the query defined in the request. +Run a search. + +Get search hits that match the query defined in the request. You can provide search queries using the `q` query string parameter or the request body. If both are specified, only the query parameter is used. +If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. +To search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices. + +**Search slicing** + +When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties. +By default the splitting is done first on the shards, then locally on each shard. +The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. + +For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. + +IMPORTANT: The same point-in-time ID should be used for all slices. +If different PIT IDs are used, slices can overlap and miss documents. +This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. + {ref}/search-search.html[Endpoint documentation] [source,ts] ---- @@ -937,152 +1717,210 @@ client.search({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases to search. -Supports wildcards (`*`). -To search all data streams and indices, omit this parameter or use `*` or `_all`. -** *`aggregations` (Optional, Record)*: Defines the aggregations that are run as part of the search request. +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*` or `_all`. +** *`aggregations` (Optional, Record)*: Defines the aggregations that are run as part of the search request. ** *`collapse` (Optional, { field, inner_hits, max_concurrent_group_searches, collapse })*: Collapses search results the values of the specified field. -** *`explain` (Optional, boolean)*: If true, returns detailed information about score computation as part of a hit. +** *`explain` (Optional, boolean)*: If `true`, the request returns detailed information about score computation as part of a hit. ** *`ext` (Optional, Record)*: Configuration of search extensions defined by Elasticsearch plugins. -** *`from` (Optional, number)*: Starting document offset. -Needs to be non-negative. -By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. -To page through more hits, use the `search_after` parameter. +** *`from` (Optional, number)*: The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. ** *`highlight` (Optional, { encoder, fields })*: Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. -** *`track_total_hits` (Optional, boolean | number)*: Number of hits matching the query to count accurately. -If `true`, the exact number of hits is returned at the cost of some performance. -If `false`, the response does not include the total number of hits matching the query. -** *`indices_boost` (Optional, Record[])*: Boosts the _score of documents from specified indices. -** *`docvalue_fields` (Optional, { field, format, include_unmapped }[])*: Array of wildcard (`*`) patterns. -The request returns doc values for field names matching these patterns in the `hits.fields` property of the response. -** *`knn` (Optional, { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits } | { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits }[])*: Defines the approximate kNN search to run. -** *`rank` (Optional, { rrf })*: Defines the Reciprocal Rank Fusion (RRF) to use. -** *`min_score` (Optional, number)*: Minimum `_score` for matching documents. -Documents with a lower `_score` are not included in the search results. -** *`post_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Use the `post_filter` parameter to filter search results. -The search hits are filtered after the aggregations are calculated. -A post filter has no impact on the aggregation results. -** *`profile` (Optional, boolean)*: Set to `true` to return detailed timing information about the execution of individual components in a search request. -NOTE: This is a debugging tool and adds significant overhead to search execution. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. +** *`track_total_hits` (Optional, boolean | number)*: Number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. +** *`indices_boost` (Optional, Record[])*: Boost the `_score` of documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than `1.0` increases the score. A boost value between `0` and `1.0` decreases the score. +** *`docvalue_fields` (Optional, { field, format, include_unmapped }[])*: An array of wildcard (`*`) field patterns. The request returns doc values for field names matching these patterns in the `hits.fields` property of the response. +** *`knn` (Optional, { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits, rescore_vector } | { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits, rescore_vector }[])*: The approximate kNN search to run. +** *`rank` (Optional, { rrf })*: The Reciprocal Rank Fusion (RRF) to use. +** *`min_score` (Optional, number)*: The minimum `_score` for matching documents. Documents with a lower `_score` are not included in the search results. +** *`post_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Use the `post_filter` parameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results. +** *`profile` (Optional, boolean)*: Set to `true` to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The search definition using the Query DSL. ** *`rescore` (Optional, { window_size, query, learning_to_rank } | { window_size, query, learning_to_rank }[])*: Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases. -** *`retriever` (Optional, { standard, knn, rrf })*: A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such as query and knn. +** *`retriever` (Optional, { standard, knn, rrf, text_similarity_reranker, rule })*: A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such as `query` and `knn`. ** *`script_fields` (Optional, Record)*: Retrieve a script evaluation (based on different fields) for each hit. ** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Used to retrieve the next page of hits using a set of sort values from the previous page. -** *`size` (Optional, number)*: The number of hits to return. -By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. -To page through more hits, use the `search_after` parameter. -** *`slice` (Optional, { field, id, max })*: Can be used to split a scrolled search into multiple slices that can be consumed independently. +** *`size` (Optional, number)*: The number of hits to return, which must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` property. +** *`slice` (Optional, { field, id, max })*: Split a scrolled search into multiple slices that can be consumed independently. ** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: A list of : pairs. -** *`_source` (Optional, boolean | { excludes, includes })*: Indicates which source fields are returned for matching documents. -These fields are returned in the hits._source property of the search response. -** *`fields` (Optional, { field, format, include_unmapped }[])*: Array of wildcard (`*`) patterns. -The request returns values for field names matching these patterns in the `hits.fields` property of the response. +** *`_source` (Optional, boolean | { excludes, includes })*: The source fields that are returned for matching documents. These fields are returned in the `hits._source` property of the search response. If the `stored_fields` property is specified, the `_source` property defaults to `false`. Otherwise, it defaults to `true`. +** *`fields` (Optional, { field, format, include_unmapped }[])*: An array of wildcard (`*`) field patterns. The request returns values for field names matching these patterns in the `hits.fields` property of the response. ** *`suggest` (Optional, { text })*: Defines a suggester that provides similar looking terms based on a provided text. -** *`terminate_after` (Optional, number)*: Maximum number of documents to collect for each shard. -If a query reaches this limit, Elasticsearch terminates the query early. -Elasticsearch collects documents before sorting. -Use with caution. -Elasticsearch applies this parameter to each shard handling the request. -When possible, let Elasticsearch perform early termination automatically. -Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. -If set to `0` (default), the query does not terminate early. -** *`timeout` (Optional, string)*: Specifies the period of time to wait for a response from each shard. -If no response is received before the timeout expires, the request fails and returns an error. -Defaults to no timeout. -** *`track_scores` (Optional, boolean)*: If true, calculate and return document scores, even if the scores are not used for sorting. -** *`version` (Optional, boolean)*: If true, returns document version as part of a hit. -** *`seq_no_primary_term` (Optional, boolean)*: If `true`, returns sequence number and primary term of the last modification of each hit. -** *`stored_fields` (Optional, string | string[])*: List of stored fields to return as part of a hit. -If no fields are specified, no stored fields are included in the response. -If this field is specified, the `_source` parameter defaults to `false`. -You can pass `_source: true` to return both source fields and stored fields in the search response. -** *`pit` (Optional, { id, keep_alive })*: Limits the search to a point in time (PIT). -If you provide a PIT, you cannot specify an `` in the request path. -** *`runtime_mappings` (Optional, Record)*: Defines one or more runtime fields in the search request. -These fields take precedence over mapped fields with the same name. -** *`stats` (Optional, string[])*: Stats groups to associate with the search. -Each group maintains a statistics aggregation for its associated searches. -You can retrieve these stats using the indices stats API. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. -This behavior applies even if the request targets other open indices. -For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. -** *`allow_partial_search_results` (Optional, boolean)*: If true, returns partial results if there are shard request timeouts or shard failures. If false, returns an error with no partial results. -** *`analyzer` (Optional, string)*: Analyzer to use for the query string. -This parameter can only be used when the q query string parameter is specified. -** *`analyze_wildcard` (Optional, boolean)*: If true, wildcard and prefix queries are analyzed. -This parameter can only be used when the q query string parameter is specified. -** *`batched_reduce_size` (Optional, number)*: The number of shard results that should be reduced at once on the coordinating node. -This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. -** *`ccs_minimize_roundtrips` (Optional, boolean)*: If true, network round-trips between the coordinating node and the remote clusters are minimized when executing cross-cluster search (CCS) requests. -** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: AND or OR. -This parameter can only be used when the `q` query string parameter is specified. -** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. -This parameter can only be used when the q query string parameter is specified. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. +** *`terminate_after` (Optional, number)*: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. Elasticsearch applies this property to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers. If set to `0` (default), the query does not terminate early. +** *`timeout` (Optional, string)*: The period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout. +** *`track_scores` (Optional, boolean)*: If `true`, calculate and return document scores, even if the scores are not used for sorting. +** *`version` (Optional, boolean)*: If `true`, the request returns the document version as part of a hit. +** *`seq_no_primary_term` (Optional, boolean)*: If `true`, the request returns sequence number and primary term of the last modification of each hit. +** *`stored_fields` (Optional, string | string[])*: A list of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the `_source` property defaults to `false`. You can pass `_source: true` to return both source fields and stored fields in the search response. +** *`pit` (Optional, { id, keep_alive })*: Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an `` in the request path. +** *`runtime_mappings` (Optional, Record)*: One or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. +** *`stats` (Optional, string[])*: The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. +** *`allow_partial_search_results` (Optional, boolean)*: If `true` and there are shard request timeouts or shard failures, the request returns partial results. If `false`, it returns an error with no partial results. To override the default behavior, you can set the `search.default_allow_partial_results` cluster setting to `false`. +** *`analyzer` (Optional, string)*: The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. This parameter can be used only when the `q` query string parameter is specified. +** *`batched_reduce_size` (Optional, number)*: The number of shard results that should be reduced at once on the coordinating node. If the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request. +** *`ccs_minimize_roundtrips` (Optional, boolean)*: If `true`, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests. +** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for the query string query: `AND` or `OR`. This parameter can be used only when the `q` query string parameter is specified. +** *`df` (Optional, string)*: The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports a list of values such as `open,hidden`. ** *`ignore_throttled` (Optional, boolean)*: If `true`, concrete, expanded or aliased indices will be ignored when frozen. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`include_named_queries_score` (Optional, boolean)*: Indicates whether hit.matched_queries should be rendered as a map that includes -the name of the matched query associated with its score (true) -or as an array containing the name of the matched queries (false) -This functionality reruns each named query on every hit in a search response. -Typically, this adds a small overhead to a request. -However, using computationally expensive named queries on a large number of hits may add significant overhead. -** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. -This parameter can only be used when the `q` query string parameter is specified. -** *`max_concurrent_shard_requests` (Optional, number)*: Defines the number of concurrent shard requests per node this search executes concurrently. -This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. -** *`min_compatible_shard_node` (Optional, string)*: The minimum version of the node that can handle the request -Any handling node with a lower version will fail the request. -** *`preference` (Optional, string)*: Nodes and shards used for the search. -By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are: -`_only_local` to run the search only on shards on the local node; -`_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method; -`_only_nodes:,` to run the search on only the specified nodes IDs, where, if suitable shards exist on more than one selected node, use shards on those nodes using the default method, or if none of the specified nodes are available, select shards from any available node using the default method; -`_prefer_nodes:,` to if possible, run the search on the specified nodes IDs, or if not, select shards using the default method; -`_shards:,` to run the search only on the specified shards; -`` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order. -** *`pre_filter_shard_size` (Optional, number)*: Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. -This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint). -When unspecified, the pre-filter phase is executed if any of these conditions is met: -the request targets more than 128 shards; -the request targets one or more read-only index; -the primary sort of the query targets an indexed field. -** *`request_cache` (Optional, boolean)*: If `true`, the caching of search results is enabled for requests where `size` is `0`. -Defaults to index level settings. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`scroll` (Optional, string | -1 | 0)*: Period to retain the search context for scrolling. See Scroll search results. -By default, this value cannot exceed `1d` (24 hours). -You can change this limit using the `search.max_keep_alive` cluster-level setting. -** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: How distributed term frequencies are calculated for relevance scoring. -** *`suggest_field` (Optional, string)*: Specifies which field to use for suggestions. -** *`suggest_mode` (Optional, Enum("missing" | "popular" | "always"))*: Specifies the suggest mode. -This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. -** *`suggest_size` (Optional, number)*: Number of suggestions to return. -This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. -** *`suggest_text` (Optional, string)*: The source text for which the suggestions should be returned. -This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. +** *`include_named_queries_score` (Optional, boolean)*: If `true`, the response includes the score contribution from any named queries. This functionality reruns each named query on every hit in a search response. Typically, this adds a small overhead to a request. However, using computationally expensive named queries on a large number of hits may add significant overhead. +** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the `q` query string parameter is specified. +** *`max_concurrent_shard_requests` (Optional, number)*: The number of concurrent shard requests per node that the search runs concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. +** *`min_compatible_shard_node` (Optional, string)*: The minimum version of the node that can handle the request Any handling node with a lower version will fail the request. +** *`preference` (Optional, string)*: The nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are: * `_only_local` to run the search only on shards on the local node; * `_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method; * `_only_nodes:,` to run the search on only the specified nodes IDs, where, if suitable shards exist on more than one selected node, use shards on those nodes using the default method, or if none of the specified nodes are available, select shards from any available node using the default method; * `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs, or if not, select shards using the default method; * `_shards:,` to run the search only on the specified shards; * `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order. +** *`pre_filter_shard_size` (Optional, number)*: A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint). When unspecified, the pre-filter phase is executed if any of these conditions is met: * The request targets more than 128 shards. * The request targets one or more read-only index. * The primary sort of the query targets an indexed field. +** *`request_cache` (Optional, boolean)*: If `true`, the caching of search results is enabled for requests where `size` is `0`. It defaults to index level settings. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`scroll` (Optional, string | -1 | 0)*: The period to retain the search context for scrolling. By default, this value cannot exceed `1d` (24 hours). You can change this limit by using the `search.max_keep_alive` cluster-level setting. +** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: Indicates how distributed term frequencies are calculated for relevance scoring. +** *`suggest_field` (Optional, string)*: The field to use for suggestions. +** *`suggest_mode` (Optional, Enum("missing" | "popular" | "always"))*: The suggest mode. This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. +** *`suggest_size` (Optional, number)*: The number of suggestions to return. This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. +** *`suggest_text` (Optional, string)*: The source text for which the suggestions should be returned. This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. ** *`typed_keys` (Optional, boolean)*: If `true`, aggregation and suggester names are be prefixed by their respective types in the response. ** *`rest_total_hits_as_int` (Optional, boolean)*: Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response. -** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. -You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. -If the `_source` parameter is `false`, this parameter is ignored. -** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. -If this parameter is specified, only these source fields are returned. -You can exclude fields from this subset using the `_source_excludes` query parameter. -If the `_source` parameter is `false`, this parameter is ignored. -** *`q` (Optional, string)*: Query in the Lucene query string syntax using query parameter search. -Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing. -** *`force_synthetic_source` (Optional, boolean)*: Should this request force synthetic _source? -Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. -Fetches with this enabled will be slower the enabling synthetic source natively in the index. +** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. +** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. +** *`q` (Optional, string)*: A query in the Lucene query string syntax. Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing. IMPORTANT: This parameter overrides the query parameter in the request body. If both parameters are specified, documents matching the query request body parameter are not returned. +** *`force_synthetic_source` (Optional, boolean)*: Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. [discrete] === search_mvt Search a vector tile. -Searches a vector tile for geospatial values. + +Search a vector tile for geospatial values. +Before using this API, you should be familiar with the Mapbox vector tile specification. +The API returns results as a binary mapbox vector tile. + +Internally, Elasticsearch translates a vector tile search API request into a search containing: + +* A `geo_bounding_box` query on the ``. The query uses the `//` tile as a bounding box. +* A `geotile_grid` or `geohex_grid` aggregation on the ``. The `grid_agg` parameter determines the aggregation type. The aggregation uses the `//` tile as a bounding box. +* Optionally, a `geo_bounds` aggregation on the ``. The search only includes this aggregation if the `exact_bounds` parameter is `true`. +* If the optional parameter `with_labels` is `true`, the internal search will include a dynamic runtime field that calls the `getLabelPosition` function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. + +For example, Elasticsearch may translate a vector tile search API request with a `grid_agg` argument of `geotile` and an `exact_bounds` argument of `true` into the following search + +---- +GET my-index/_search +{ + "size": 10000, + "query": { + "geo_bounding_box": { + "my-geo-field": { + "top_left": { + "lat": -40.979898069620134, + "lon": -45 + }, + "bottom_right": { + "lat": -66.51326044311186, + "lon": 0 + } + } + } + }, + "aggregations": { + "grid": { + "geotile_grid": { + "field": "my-geo-field", + "precision": 11, + "size": 65536, + "bounds": { + "top_left": { + "lat": -40.979898069620134, + "lon": -45 + }, + "bottom_right": { + "lat": -66.51326044311186, + "lon": 0 + } + } + } + }, + "bounds": { + "geo_bounds": { + "field": "my-geo-field", + "wrap_longitude": false + } + } + } +} +---- + +The API returns results as a binary Mapbox vector tile. +Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: + +* A `hits` layer containing a feature for each `` value matching the `geo_bounding_box` query. +* An `aggs` layer containing a feature for each cell of the `geotile_grid` or `geohex_grid`. The layer only contains features for cells with matching data. +* A meta layer containing: + * A feature containing a bounding box. By default, this is the bounding box of the tile. + * Value ranges for any sub-aggregations on the `geotile_grid` or `geohex_grid`. + * Metadata for the search. + +The API only returns features that can display at its zoom level. +For example, if a polygon feature has no area at its zoom level, the API omits it. +The API returns errors as UTF-8 encoded JSON. + +IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. +If you specify both parameters, the query parameter takes precedence. + +**Grid precision for geotile** + +For a `grid_agg` of `geotile`, you can use cells in the `aggs` layer as tiles for lower zoom levels. +`grid_precision` represents the additional zoom levels available through these cells. The final precision is computed by as follows: ` + grid_precision`. +For example, if `` is 7 and `grid_precision` is 8, then the `geotile_grid` aggregation will use a precision of 15. +The maximum final precision is 29. +The `grid_precision` also determines the number of cells for the grid as follows: `(2^grid_precision) x (2^grid_precision)`. +For example, a value of 8 divides the tile into a grid of 256 x 256 cells. +The `aggs` layer only contains features for cells with matching data. + +**Grid precision for geohex** + +For a `grid_agg` of `geohex`, Elasticsearch uses `` and `grid_precision` to calculate a final precision as follows: ` + grid_precision`. + +This precision determines the H3 resolution of the hexagonal cells produced by the `geohex` aggregation. +The following table maps the H3 resolution for each precision. +For example, if `` is 3 and `grid_precision` is 3, the precision is 6. +At a precision of 6, hexagonal cells have an H3 resolution of 2. +If `` is 3 and `grid_precision` is 4, the precision is 7. +At a precision of 7, hexagonal cells have an H3 resolution of 3. + +| Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | +| --------- | ---------------- | ------------- | ----------------| ----- | +| 1 | 4 | 0 | 122 | 30.5 | +| 2 | 16 | 0 | 122 | 7.625 | +| 3 | 64 | 1 | 842 | 13.15625 | +| 4 | 256 | 1 | 842 | 3.2890625 | +| 5 | 1024 | 2 | 5882 | 5.744140625 | +| 6 | 4096 | 2 | 5882 | 1.436035156 | +| 7 | 16384 | 3 | 41162 | 2.512329102 | +| 8 | 65536 | 3 | 41162 | 0.6280822754 | +| 9 | 262144 | 4 | 288122 | 1.099098206 | +| 10 | 1048576 | 4 | 288122 | 0.2747745514 | +| 11 | 4194304 | 5 | 2016842 | 0.4808526039 | +| 12 | 16777216 | 6 | 14117882 | 0.8414913416 | +| 13 | 67108864 | 6 | 14117882 | 0.2103728354 | +| 14 | 268435456 | 7 | 98825162 | 0.3681524172 | +| 15 | 1073741824 | 8 | 691776122 | 0.644266719 | +| 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | +| 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | +| 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | +| 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | +| 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | +| 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | +| 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | +| 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | +| 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | +| 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | +| 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | +| 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | +| 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | +| 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | + +Hexagonal cells don't align perfectly on a vector tile. +Some cells may intersect more than one vector tile. +To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. +Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. {ref}/search-vector-tile-api.html[Endpoint documentation] [source,ts] @@ -1098,50 +1936,30 @@ client.searchMvt({ index, field, zoom, x, y }) ** *`zoom` (number)*: Zoom level for the vector tile to search ** *`x` (number)*: X coordinate for the vector tile to search ** *`y` (number)*: Y coordinate for the vector tile to search -** *`aggs` (Optional, Record)*: Sub-aggregations for the geotile_grid. - -Supports the following aggregation types: -- avg -- cardinality -- max -- min -- sum -** *`buffer` (Optional, number)*: Size, in pixels, of a clipping buffer outside the tile. This allows renderers -to avoid outline artifacts from geometries that extend past the extent of the tile. -** *`exact_bounds` (Optional, boolean)*: If false, the meta layer’s feature is the bounding box of the tile. -If true, the meta layer’s feature is a bounding box resulting from a -geo_bounds aggregation. The aggregation runs on values that intersect -the // tile with wrap_longitude set to false. The resulting -bounding box may be larger than the vector tile. -** *`extent` (Optional, number)*: Size, in pixels, of a side of the tile. Vector tiles are square with equal sides. -** *`fields` (Optional, string | string[])*: Fields to return in the `hits` layer. Supports wildcards (`*`). -This parameter does not support fields with array values. Fields with array -values may return inconsistent results. -** *`grid_agg` (Optional, Enum("geotile" | "geohex"))*: Aggregation used to create a grid for the `field`. -** *`grid_precision` (Optional, number)*: Additional zoom levels available through the aggs layer. For example, if is 7 -and grid_precision is 8, you can zoom in up to level 15. Accepts 0-8. If 0, results -don’t include the aggs layer. -** *`grid_type` (Optional, Enum("grid" | "point" | "centroid"))*: Determines the geometry type for features in the aggs layer. In the aggs layer, -each feature represents a geotile_grid cell. If 'grid' each feature is a Polygon -of the cells bounding box. If 'point' each feature is a Point that is the centroid -of the cell. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Query DSL used to filter documents for the search. -** *`runtime_mappings` (Optional, Record)*: Defines one or more runtime fields in the search request. These fields take -precedence over mapped fields with the same name. -** *`size` (Optional, number)*: Maximum number of features to return in the hits layer. Accepts 0-10000. -If 0, results don’t include the hits layer. -** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: Sorts features in the hits layer. By default, the API calculates a bounding -box for each feature. It sorts features based on this box’s diagonal length, -from longest to shortest. -** *`track_total_hits` (Optional, boolean | number)*: Number of hits matching the query to count accurately. If `true`, the exact number -of hits is returned at the cost of some performance. If `false`, the response does -not include the total number of hits matching the query. -** *`with_labels` (Optional, boolean)*: If `true`, the hits and aggs layers will contain additional point features representing -suggested label positions for the original features. +** *`aggs` (Optional, Record)*: Sub-aggregations for the geotile_grid. It supports the following aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats` - `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank` - `stats` - `sum` - `value count` The aggregation names can't start with `_mvt_`. The `_mvt_` prefix is reserved for internal aggregations. +** *`buffer` (Optional, number)*: The size, in pixels, of a clipping buffer outside the tile. This allows renderers to avoid outline artifacts from geometries that extend past the extent of the tile. +** *`exact_bounds` (Optional, boolean)*: If `false`, the meta layer's feature is the bounding box of the tile. If `true`, the meta layer's feature is a bounding box resulting from a `geo_bounds` aggregation. The aggregation runs on values that intersect the `//` tile with `wrap_longitude` set to `false`. The resulting bounding box may be larger than the vector tile. +** *`extent` (Optional, number)*: The size, in pixels, of a side of the tile. Vector tiles are square with equal sides. +** *`fields` (Optional, string | string[])*: The fields to return in the `hits` layer. It supports wildcards (`*`). This parameter does not support fields with array values. Fields with array values may return inconsistent results. +** *`grid_agg` (Optional, Enum("geotile" | "geohex"))*: The aggregation used to create a grid for the `field`. +** *`grid_precision` (Optional, number)*: Additional zoom levels available through the aggs layer. For example, if `` is `7` and `grid_precision` is `8`, you can zoom in up to level 15. Accepts 0-8. If 0, results don't include the aggs layer. +** *`grid_type` (Optional, Enum("grid" | "point" | "centroid"))*: Determines the geometry type for features in the aggs layer. In the aggs layer, each feature represents a `geotile_grid` cell. If `grid, each feature is a polygon of the cells bounding box. If `point`, each feature is a Point that is the centroid of the cell. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The query DSL used to filter documents for the search. +** *`runtime_mappings` (Optional, Record)*: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. +** *`size` (Optional, number)*: The maximum number of features to return in the hits layer. Accepts 0-10000. If 0, results don't include the hits layer. +** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: Sort the features in the hits layer. By default, the API calculates a bounding box for each feature. It sorts features based on this box's diagonal length, from longest to shortest. +** *`track_total_hits` (Optional, boolean | number)*: The number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. +** *`with_labels` (Optional, boolean)*: If `true`, the hits and aggs layers will contain additional point features representing suggested label positions for the original features. * `Point` and `MultiPoint` features will have one of the points selected. * `Polygon` and `MultiPolygon` features will have a single point generated, either the centroid, if it is within the polygon, or another point within the polygon selected from the sorted triangle-tree. * `LineString` features will likewise provide a roughly central point selected from the triangle-tree. * The aggregation results will provide one central point for each aggregation bucket. All attributes from the original features will also be copied to the new label features. In addition, the new features will be distinguishable using the tag `_mvt_label_position`. [discrete] === search_shards -Returns information about the indices and shards that a search request would be executed against. +Get the search shards. + +Get the indices and shards that a search request would be run against. +This information can be useful for working out issues or planning optimizations with routing and shard preferences. +When filtered aliases are used, the filter is returned as part of the `indices` section. + +If the Elasticsearch security features are enabled, you must have the `view_index_metadata` or `manage` index privilege for the target data stream, index, or alias. {ref}/search-shards.html[Endpoint documentation] [source,ts] @@ -1152,25 +1970,20 @@ client.searchShards({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: Returns the indices and shards that a search request would be executed against. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. -This behavior applies even if the request targets other open indices. -For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. -Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*` or `_all`. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. ** *`local` (Optional, boolean)*: If `true`, the request retrieves information from the local node only. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. If the master node is not available before the timeout expires, the request fails and returns an error. IT can also be set to `-1` to indicate that the request should never timeout. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. It is random by default. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. [discrete] === search_template -Runs a search with a search template. +Run a search with a search template. -{ref}/search-template.html[Endpoint documentation] +{ref}/search-template-api.html[Endpoint documentation] [source,ts] ---- client.searchTemplate({ ... }) @@ -1179,40 +1992,33 @@ client.searchTemplate({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, -and aliases to search. Supports wildcards (*). -** *`explain` (Optional, boolean)*: If `true`, returns detailed information about score calculation as part of each hit. -** *`id` (Optional, string)*: ID of the search template to use. If no source is specified, -this parameter is required. -** *`params` (Optional, Record)*: Key-value pairs used to replace Mustache variables in the template. -The key is the variable name. -The value is the variable value. +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases to search. It supports wildcards (`*`). +** *`explain` (Optional, boolean)*: If `true`, returns detailed information about score calculation as part of each hit. If you specify both this and the `explain` query parameter, the API uses only the query parameter. +** *`id` (Optional, string)*: The ID of the search template to use. If no `source` is specified, this parameter is required. +** *`params` (Optional, Record)*: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. ** *`profile` (Optional, boolean)*: If `true`, the query execution is profiled. -** *`source` (Optional, string)*: An inline search template. Supports the same parameters as the search API's -request body. Also supports Mustache variables. If no id is specified, this -parameter is required. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. -This behavior applies even if the request targets other open indices. -For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. +** *`source` (Optional, string)*: An inline search template. Supports the same parameters as the search API's request body. It also supports Mustache variables. If no `id` is specified, this parameter is required. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. ** *`ccs_minimize_roundtrips` (Optional, boolean)*: If `true`, network round-trips are minimized for cross-cluster search requests. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. -Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. ** *`ignore_throttled` (Optional, boolean)*: If `true`, specified concrete, expanded, or aliased indices are not included in the response when throttled. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`scroll` (Optional, string | -1 | 0)*: Specifies how long a consistent view of the index -should be maintained for scrolled search. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. It is random by default. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`scroll` (Optional, string | -1 | 0)*: Specifies how long a consistent view of the index should be maintained for scrolled search. ** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: The type of the search operation. -** *`rest_total_hits_as_int` (Optional, boolean)*: If true, hits.total are rendered as an integer in the response. +** *`rest_total_hits_as_int` (Optional, boolean)*: If `true`, `hits.total` is rendered as an integer in the response. If `false`, it is rendered as an object. ** *`typed_keys` (Optional, boolean)*: If `true`, the response prefixes aggregation and suggester names with their respective types. [discrete] === terms_enum -The terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios. +Get terms in an index. + +Discover terms that match a partial string in an index. +This API is designed for low-latency look-ups used in auto-complete scenarios. + +> info +> The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. {ref}/search-terms-enum.html[Endpoint documentation] [source,ts] @@ -1223,19 +2029,58 @@ client.termsEnum({ index, field }) ==== Arguments * *Request (object):* -** *`index` (string)*: List of data streams, indices, and index aliases to search. Wildcard (*) expressions are supported. +** *`index` (string)*: A list of data streams, indices, and index aliases to search. Wildcard (`*`) expressions are supported. To search all data streams or indices, omit this parameter or use `*` or `_all`. ** *`field` (string)*: The string to match at the start of indexed terms. If not provided, all terms in the field are considered. -** *`size` (Optional, number)*: How many matching terms to return. -** *`timeout` (Optional, string | -1 | 0)*: The maximum length of time to spend collecting results. Defaults to "1s" (one second). If the timeout is exceeded the complete flag set to false in the response and the results may be partial or empty. -** *`case_insensitive` (Optional, boolean)*: When true the provided search string is matched against index terms without case sensitivity. -** *`index_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Allows to filter an index shard if the provided query rewrites to match_none. -** *`string` (Optional, string)*: The string after which terms in the index should be returned. Allows for a form of pagination if the last result from one request is passed as the search_after parameter for a subsequent request. -** *`search_after` (Optional, string)* +** *`size` (Optional, number)*: The number of matching terms to return. +** *`timeout` (Optional, string | -1 | 0)*: The maximum length of time to spend collecting results. If the timeout is exceeded the `complete` flag set to `false` in the response and the results may be partial or empty. +** *`case_insensitive` (Optional, boolean)*: When `true`, the provided search string is matched against index terms without case sensitivity. +** *`index_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Filter an index shard if the provided query rewrites to `match_none`. +** *`string` (Optional, string)*: The string to match at the start of indexed terms. If it is not provided, all terms in the field are considered. > info > The prefix string cannot be larger than the largest possible keyword value, which is Lucene's term byte-length limit of 32766. +** *`search_after` (Optional, string)*: The string after which terms in the index should be returned. It allows for a form of pagination if the last result from one request is passed as the `search_after` parameter for a subsequent request. [discrete] === termvectors Get term vector information. -Returns information and statistics about terms in the fields of a particular document. + +Get information and statistics about terms in the fields of a particular document. + +You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. +You can specify the fields you are interested in through the `fields` parameter or by adding the fields to the request body. +For example: + +---- +GET /my-index-000001/_termvectors/1?fields=message +---- + +Fields can be specified using wildcards, similar to the multi match query. + +Term vectors are real-time by default, not near real-time. +This can be changed by setting `realtime` parameter to `false`. + +You can request three types of values: _term information_, _term statistics_, and _field statistics_. +By default, all term information and field statistics are returned for all fields but term statistics are excluded. + +**Term information** + +* term frequency in the field (always returned) +* term positions (`positions: true`) +* start and end offsets (`offsets: true`) +* term payloads (`payloads: true`), as base64 encoded bytes + +If the requested information wasn't stored in the index, it will be computed on the fly if possible. +Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. + +> warn +> Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. + +**Behaviour** + +The term and field statistics are not accurate. +Deleted documents are not taken into account. +The information is only retrieved for the shard the requested document resides in. +The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. +By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. +Use `routing` only to hit a particular shard. {ref}/docs-termvectors.html[Endpoint documentation] [source,ts] @@ -1246,29 +2091,44 @@ client.termvectors({ index }) ==== Arguments * *Request (object):* -** *`index` (string)*: Name of the index that contains the document. -** *`id` (Optional, string)*: Unique identifier of the document. +** *`index` (string)*: The name of the index that contains the document. +** *`id` (Optional, string)*: A unique identifier for the document. ** *`doc` (Optional, object)*: An artificial document (a document not present in the index) for which you want to retrieve term vectors. -** *`filter` (Optional, { max_doc_freq, max_num_terms, max_term_freq, max_word_length, min_doc_freq, min_term_freq, min_word_length })*: Filter terms based on their tf-idf scores. -** *`per_field_analyzer` (Optional, Record)*: Overrides the default per-field analyzer. -** *`fields` (Optional, string | string[])*: List or wildcard expressions of fields to include in the statistics. -Used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. -** *`field_statistics` (Optional, boolean)*: If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. +** *`filter` (Optional, { max_doc_freq, max_num_terms, max_term_freq, max_word_length, min_doc_freq, min_term_freq, min_word_length })*: Filter terms based on their tf-idf scores. This could be useful in order find out a good characteristic vector of a document. This feature works in a similar manner to the second phase of the More Like This Query. +** *`per_field_analyzer` (Optional, Record)*: Override the default per-field analyzer. This is useful in order to generate term vectors in any fashion, especially when using artificial documents. When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated. +** *`fields` (Optional, string | string[])*: A list of fields to include in the statistics. It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. +** *`field_statistics` (Optional, boolean)*: If `true`, the response includes: * The document count (how many documents contain this field). * The sum of document frequencies (the sum of document frequencies for all terms in this field). * The sum of total term frequencies (the sum of total term frequencies of each term in this field). ** *`offsets` (Optional, boolean)*: If `true`, the response includes term offsets. ** *`payloads` (Optional, boolean)*: If `true`, the response includes term payloads. ** *`positions` (Optional, boolean)*: If `true`, the response includes term positions. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`realtime` (Optional, boolean)*: If true, the request is real-time as opposed to near-real-time. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`term_statistics` (Optional, boolean)*: If `true`, the response includes term frequency and document frequency. +** *`term_statistics` (Optional, boolean)*: If `true`, the response includes: * The total term frequency (how often a term occurs in all documents). * The document frequency (the number of documents containing the current term). By default these values are not returned since term statistics can have a serious performance impact. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. ** *`version` (Optional, number)*: If `true`, returns the document version as part of a hit. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. It is random by default. +** *`realtime` (Optional, boolean)*: If true, the request is real-time as opposed to near-real-time. [discrete] === update Update a document. -Updates a document by running a script or passing a partial document. + +Update a document by running a script or passing a partial document. + +If the Elasticsearch security features are enabled, you must have the `index` or `write` index privilege for the target index or index alias. + +The script can update, delete, or skip modifying the document. +The API also supports passing a partial document, which is merged into the existing document. +To fully replace an existing document, use the index API. +This operation: + +* Gets the document (collocated with the shard) from the index. +* Runs the specified script. +* Indexes the result. + +The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. + +The `_source` field must be enabled to use this API. +In addition to `_source`, you can access the following variables through the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing`, and `_now` (the current timestamp). {ref}/docs-update.html[Endpoint documentation] [source,ts] @@ -1279,35 +2139,27 @@ client.update({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Document ID -** *`index` (string)*: The name of the index -** *`detect_noop` (Optional, boolean)*: Set to false to disable setting 'result' in the response -to 'noop' if no change to the document occurred. -** *`doc` (Optional, object)*: A partial update to an existing document. -** *`doc_as_upsert` (Optional, boolean)*: Set to true to use the contents of 'doc' as the value of 'upsert' -** *`script` (Optional, { source, id, params, lang, options })*: Script to execute to update the document. -** *`scripted_upsert` (Optional, boolean)*: Set to true to execute the script whether or not the document exists. -** *`_source` (Optional, boolean | { excludes, includes })*: Set to false to disable source retrieval. You can also specify a comma-separated -list of the fields you want to retrieve. -** *`upsert` (Optional, object)*: If the document does not already exist, the contents of 'upsert' are inserted as a -new document. If the document exists, the 'script' is executed. +** *`id` (string)*: A unique identifier for the document to be updated. +** *`index` (string)*: The name of the target index. By default, the index is created automatically if it doesn't exist. +** *`detect_noop` (Optional, boolean)*: If `true`, the `result` in the response is set to `noop` (no operation) when there are no changes to the document. +** *`doc` (Optional, object)*: A partial update to an existing document. If both `doc` and `script` are specified, `doc` is ignored. +** *`doc_as_upsert` (Optional, boolean)*: If `true`, use the contents of 'doc' as the value of 'upsert'. NOTE: Using ingest pipelines with `doc_as_upsert` is not supported. +** *`script` (Optional, { source, id, params, lang, options })*: The script to run to update the document. +** *`scripted_upsert` (Optional, boolean)*: If `true`, run the script whether or not the document exists. +** *`_source` (Optional, boolean | { excludes, includes })*: If `false`, turn off source retrieval. You can also specify a list of the fields you want to retrieve. +** *`upsert` (Optional, object)*: If the document does not already exist, the contents of 'upsert' are inserted as a new document. If the document exists, the 'script' is run. ** *`if_primary_term` (Optional, number)*: Only perform the operation if the document has this primary term. ** *`if_seq_no` (Optional, number)*: Only perform the operation if the document has this sequence number. +** *`include_source_on_error` (Optional, boolean)*: True or false if to include the document source in the error message in case of parsing errors. ** *`lang` (Optional, string)*: The script language. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation -visible to search, if 'wait_for' then wait for a refresh to make this operation -visible to search, if 'false' do nothing with refreshes. -** *`require_alias` (Optional, boolean)*: If true, the destination must be an index alias. -** *`retry_on_conflict` (Optional, number)*: Specify how many times should the operation be retried when a conflict occurs. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for dynamic mapping updates and active shards. -This guarantees Elasticsearch waits for at least the timeout before failing. -The actual wait time could be longer, particularly when multiple waits occur. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operations. -Set to 'all' or any positive integer up to the total number of shards in the index -(number_of_replicas+1). Defaults to 1 meaning the primary shard. -** *`_source_excludes` (Optional, string | string[])*: Specify the source fields you want to exclude. -** *`_source_includes` (Optional, string | string[])*: Specify the source fields you want to retrieve. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to make this operation visible to search. If 'false', it does nothing with refreshes. +** *`require_alias` (Optional, boolean)*: If `true`, the destination must be an index alias. +** *`retry_on_conflict` (Optional, number)*: The number of times the operation should be retried when a conflict occurs. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for the following operations: dynamic mapping updates and waiting for active shards. Elasticsearch waits for at least the timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of copies of each shard that must be active before proceeding with the operation. Set to 'all' or any positive integer up to the total number of shards in the index (`number_of_replicas`+1). The default value of `1` means it waits for each primary shard to be active. +** *`_source_excludes` (Optional, string | string[])*: The source fields you want to exclude. +** *`_source_includes` (Optional, string | string[])*: The source fields you want to retrieve. [discrete] === update_by_query @@ -1315,6 +2167,87 @@ Update documents. Updates documents that match the specified query. If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. +If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: + +* `read` +* `index` or `write` + +You can specify the query criteria in the request URI or the request body using the same syntax as the search API. + +When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. +When the versions match, the document is updated and the version number is incremented. +If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. +You can opt to count version conflicts instead of halting and returning by setting `conflicts` to `proceed`. +Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than `max_docs` until it has successfully updated `max_docs` documents or it has gone through every document in the source query. + +NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. + +While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. +A bulk update request is performed for each batch of matching documents. +Any query or update failures cause the update by query request to fail and the failures are shown in the response. +Any update requests that completed successfully still stick, they are not rolled back. + +**Throttling update requests** + +To control the rate at which update by query issues batches of update operations, you can set `requests_per_second` to any positive decimal number. +This pads each batch with a wait time to throttle the rate. +Set `requests_per_second` to `-1` to turn off throttling. + +Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. +The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. +By default the batch size is 1000, so if `requests_per_second` is set to `500`: + +---- +target_time = 1000 / 500 per second = 2 seconds +wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds +---- + +Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. +This is "bursty" instead of "smooth". + +**Slicing** + +Update by query supports sliced scroll to parallelize the update process. +This can improve efficiency and provide a convenient way to break the request down into smaller parts. + +Setting `slices` to `auto` chooses a reasonable number for most data streams and indices. +This setting will use one slice per shard, up to a certain limit. +If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. + +Adding `slices` to `_update_by_query` just automates the manual process of creating sub-requests, which means it has some quirks: + +* You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. +* Fetching the status of the task for the request with `slices` only contains the status of completed slices. +* These sub-requests are individually addressable for things like cancellation and rethrottling. +* Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. +* Canceling the request with slices will cancel each sub-request. +* Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. +* Parameters like `requests_per_second` and `max_docs` on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being updated. +* Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. + +If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: + +* Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. +* Update performance scales linearly across available resources with the number of slices. + +Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. + +**Update the document source** + +Update by query supports scripts to update the document source. +As with the update API, you can set `ctx.op` to change the operation that is performed. + +Set `ctx.op = "noop"` if your script decides that it doesn't have to make any changes. +The update by query operation skips updating the document and increments the `noop` counter. + +Set `ctx.op = "delete"` if your script decides that the document should be deleted. +The update by query operation deletes the document and increments the `deleted` counter. + +Update by query supports only `index`, `noop`, and `delete`. +Setting `ctx.op` to anything else is an error. +Setting any other field in `ctx` is an error. +This API enables you to only modify the source of matching documents; you cannot move them. + {ref}/docs-update-by-query.html[Endpoint documentation] [source,ts] ---- @@ -1324,62 +2257,48 @@ client.updateByQuery({ index }) ==== Arguments * *Request (object):* -** *`index` (string | string[])*: List of data streams, indices, and aliases to search. -Supports wildcards (`*`). -To search all data streams or indices, omit this parameter or use `*` or `_all`. +** *`index` (string | string[])*: A list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams or indices, omit this parameter or use `*` or `_all`. ** *`max_docs` (Optional, number)*: The maximum number of documents to update. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Specifies the documents to update using the Query DSL. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The documents to update using the Query DSL. ** *`script` (Optional, { source, id, params, lang, options })*: The script to run to update the document source or metadata when updating. ** *`slice` (Optional, { field, id, max })*: Slice the request manually using the provided slice ID and total number of slices. -** *`conflicts` (Optional, Enum("abort" | "proceed"))*: What to do if update by query hits version conflicts: `abort` or `proceed`. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. -This behavior applies even if the request targets other open indices. -For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. -** *`analyzer` (Optional, string)*: Analyzer to use for the query string. -** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. -** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. -** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. -Valid values are: `all`, `open`, `closed`, `hidden`, `none`. -** *`from` (Optional, number)*: Starting offset (default: 0) +** *`conflicts` (Optional, Enum("abort" | "proceed"))*: The preferred behavior when update by query hits version conflicts: `abort` or `proceed`. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. +** *`analyzer` (Optional, string)*: The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. This parameter can be used only when the `q` query string parameter is specified. +** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. This parameter can be used only when the `q` query string parameter is specified. +** *`df` (Optional, string)*: The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter is specified. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +** *`from` (Optional, number)*: Skips the specified number of documents. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. -** *`pipeline` (Optional, string)*: ID of the pipeline to use to preprocess incoming documents. -If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. -If a final pipeline is configured it will always run, regardless of the value of this parameter. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`q` (Optional, string)*: Query in the Lucene query string syntax. -** *`refresh` (Optional, boolean)*: If `true`, Elasticsearch refreshes affected shards to make the operation visible to search. -** *`request_cache` (Optional, boolean)*: If `true`, the request cache is used for this request. +** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the `q` query string parameter is specified. +** *`pipeline` (Optional, string)*: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. It is random by default. +** *`q` (Optional, string)*: A query in the Lucene query string syntax. +** *`refresh` (Optional, boolean)*: If `true`, Elasticsearch refreshes affected shards to make the operation visible to search after the request completes. This is different than the update API's `refresh` parameter, which causes just the shard that received the request to be refreshed. +** *`request_cache` (Optional, boolean)*: If `true`, the request cache is used for this request. It defaults to the index-level setting. ** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`scroll` (Optional, string | -1 | 0)*: Period to retain the search context for scrolling. -** *`scroll_size` (Optional, number)*: Size of the scroll request that powers the operation. -** *`search_timeout` (Optional, string | -1 | 0)*: Explicit timeout for each search request. -** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`scroll` (Optional, string | -1 | 0)*: The period to retain the search context for scrolling. +** *`scroll_size` (Optional, number)*: The size of the scroll request that powers the operation. +** *`search_timeout` (Optional, string | -1 | 0)*: An explicit timeout for each search request. By default, there is no timeout. +** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: The type of the search operation. Available options include `query_then_fetch` and `dfs_query_then_fetch`. ** *`slices` (Optional, number | Enum("auto"))*: The number of slices this task should be divided into. ** *`sort` (Optional, string[])*: A list of : pairs. -** *`stats` (Optional, string[])*: Specific `tag` of the request for logging and statistical purposes. -** *`terminate_after` (Optional, number)*: Maximum number of documents to collect for each shard. -If a query reaches this limit, Elasticsearch terminates the query early. -Elasticsearch collects documents before sorting. -Use with caution. -Elasticsearch applies this parameter to each shard handling the request. -When possible, let Elasticsearch perform early termination automatically. -Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. -** *`timeout` (Optional, string | -1 | 0)*: Period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. +** *`stats` (Optional, string[])*: The specific `tag` of the request for logging and statistical purposes. +** *`terminate_after` (Optional, number)*: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. +** *`timeout` (Optional, string | -1 | 0)*: The period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. By default, it is one minute. This guarantees Elasticsearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur. ** *`version` (Optional, boolean)*: If `true`, returns the document version as part of a hit. ** *`version_type` (Optional, boolean)*: Should the document increment the version number (internal) on hit or not (reindex) -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). -** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the operation is complete. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The `timeout` parameter controls how long each write request waits for unavailable shards to become available. Both work exactly the way they work in the bulk API. +** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the operation is complete. If `false`, Elasticsearch performs some preflight checks, launches the request, and returns a task ID that you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`. [discrete] === update_by_query_rethrottle -Changes the number of requests per second for a particular Update By Query operation. +Throttle an update by query operation. + +Change the number of requests per second for a particular update by query operation. +Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. {ref}/docs-update-by-query.html[Endpoint documentation] [source,ts] @@ -1391,14 +2310,15 @@ client.updateByQueryRethrottle({ task_id }) * *Request (object):* ** *`task_id` (string)*: The ID for the task. -** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. +** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. To turn off throttling, set it to `-1`. [discrete] === async_search [discrete] ==== delete -Deletes an async search by identifier. -If the search is still running, the search request will be cancelled. +Delete an async search. + +If the asynchronous search is still running, it is cancelled. Otherwise, the saved search results are deleted. If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the `cancel_task` cluster privilege. @@ -1416,7 +2336,9 @@ client.asyncSearch.delete({ id }) [discrete] ==== get -Retrieves the results of a previously submitted async search request given its identifier. +Get async search results. + +Retrieve the results of a previously submitted asynchronous search request. If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. {ref}/async-search.html[Endpoint documentation] @@ -1430,7 +2352,7 @@ client.asyncSearch.get({ id }) * *Request (object):* ** *`id` (string)*: A unique identifier for the async search. -** *`keep_alive` (Optional, string | -1 | 0)*: Specifies how long the async search should be available in the cluster. +** *`keep_alive` (Optional, string | -1 | 0)*: The length of time that the async search should be available in the cluster. When not specified, the `keep_alive` set with the corresponding submit async request will be used. Otherwise, it is possible to override the value and extend the validity of the request. When this period expires, the search, if still running, is cancelled. @@ -1442,9 +2364,13 @@ By default no timeout is set meaning that the currently available results will b [discrete] ==== status -Get async search status -Retrieves the status of a previously submitted async search request given its identifier, without retrieving search results. -If the Elasticsearch security features are enabled, use of this API is restricted to the `monitoring_user` role. +Get the async search status. + +Get the status of a previously submitted async search request given its identifier, without retrieving search results. +If the Elasticsearch security features are enabled, the access to the status of a specific async search is restricted to: + +* The user or API key that submitted the original async search request. +* Users that have the `monitor` cluster privilege or greater privileges. {ref}/async-search.html[Endpoint documentation] [source,ts] @@ -1457,13 +2383,18 @@ client.asyncSearch.status({ id }) * *Request (object):* ** *`id` (string)*: A unique identifier for the async search. +** *`keep_alive` (Optional, string | -1 | 0)*: The length of time that the async search needs to be available. +Ongoing async searches and any saved search results are deleted after this period. [discrete] ==== submit -Runs a search request asynchronously. -When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field, hence partial results become available following the sort criteria that was requested. -Warning: Async search does not support scroll nor search requests that only include the suggest section. -By default, Elasticsearch doesn’t allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. +Run an async search. + +When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. + +Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. + +By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. The maximum allowed size for a stored async search response can be set by changing the `search.max_async_search_response_size` cluster level setting. {ref}/async-search.html[Endpoint documentation] @@ -1477,7 +2408,7 @@ client.asyncSearch.submit({ ... }) * *Request (object):* ** *`index` (Optional, string | string[])*: A list of index names to search; use `_all` or empty string to perform the operation on all indices -** *`aggregations` (Optional, Record)* +** *`aggregations` (Optional, Record)* ** *`collapse` (Optional, { field, inner_hits, max_concurrent_group_searches, collapse })* ** *`explain` (Optional, boolean)*: If true, returns detailed information about score computation as part of a hit. ** *`ext` (Optional, Record)*: Configuration of search extensions defined by Elasticsearch plugins. @@ -1492,12 +2423,12 @@ Defaults to 10,000 hits. ** *`indices_boost` (Optional, Record[])*: Boosts the _score of documents from specified indices. ** *`docvalue_fields` (Optional, { field, format, include_unmapped }[])*: Array of wildcard (*) patterns. The request returns doc values for field names matching these patterns in the hits.fields property of the response. -** *`knn` (Optional, { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits } | { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits }[])*: Defines the approximate kNN search to run. +** *`knn` (Optional, { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits, rescore_vector } | { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits, rescore_vector }[])*: Defines the approximate kNN search to run. ** *`min_score` (Optional, number)*: Minimum _score for matching documents. Documents with a lower _score are not included in the search results. -** *`post_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })* +** *`post_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })* ** *`profile` (Optional, boolean)* -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. ** *`rescore` (Optional, { window_size, query, learning_to_rank } | { window_size, query, learning_to_rank }[])* ** *`script_fields` (Optional, Record)*: Retrieve a script evaluation (based on different fields) for each hit. ** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])* @@ -1527,16 +2458,16 @@ parameter defaults to false. You can pass _source: true to return both source fi and stored fields in the search response. ** *`pit` (Optional, { id, keep_alive })*: Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. -** *`runtime_mappings` (Optional, Record)*: Defines one or more runtime fields in the search request. These fields take +** *`runtime_mappings` (Optional, Record)*: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. ** *`stats` (Optional, string[])*: Stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API. ** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: Blocks and waits until the search is completed up to a certain timeout. When the async search completes within the timeout, the response won’t include the ID as the results are not stored in the cluster. -** *`keep_on_completion` (Optional, boolean)*: If `true`, results are stored for later retrieval when the search completes within the `wait_for_completion_timeout`. ** *`keep_alive` (Optional, string | -1 | 0)*: Specifies how long the async search needs to be available. Ongoing async searches and any saved search results are deleted after this period. +** *`keep_on_completion` (Optional, boolean)*: If `true`, results are stored for later retrieval when the search completes within the `wait_for_completion_timeout`. ** *`allow_no_indices` (Optional, boolean)*: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) ** *`allow_partial_search_results` (Optional, boolean)*: Indicate if an error should be returned if there is a partial search failure or timeout ** *`analyzer` (Optional, string)*: The analyzer to use for the query string @@ -1553,17 +2484,15 @@ A partial reduction is performed every time the coordinating node has received a ** *`max_concurrent_shard_requests` (Optional, number)*: The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests ** *`min_compatible_shard_node` (Optional, string)* ** *`preference` (Optional, string)*: Specify the node or shard the operation should be performed on (default: random) -** *`pre_filter_shard_size` (Optional, number)*: The default value cannot be changed, which enforces the execution of a pre-filter roundtrip to retrieve statistics from each shard so that the ones that surely don’t hold any document matching the query get skipped. ** *`request_cache` (Optional, boolean)*: Specify if request cache should be used for this request or not, defaults to true ** *`routing` (Optional, string)*: A list of specific routing values -** *`scroll` (Optional, string | -1 | 0)* ** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: Search operation type ** *`suggest_field` (Optional, string)*: Specifies which field to use for suggestions. ** *`suggest_mode` (Optional, Enum("missing" | "popular" | "always"))*: Specify suggest mode ** *`suggest_size` (Optional, number)*: How many suggestions to return in response ** *`suggest_text` (Optional, string)*: The source text for which the suggestions should be returned. ** *`typed_keys` (Optional, boolean)*: Specify whether aggregation and suggester names should be prefixed by their respective types in the response -** *`rest_total_hits_as_int` (Optional, boolean)* +** *`rest_total_hits_as_int` (Optional, boolean)*: Indicates whether hits.total should be rendered as an integer or an object in the rest search response ** *`_source_excludes` (Optional, string | string[])*: A list of fields to exclude from the returned _source field ** *`_source_includes` (Optional, string | string[])*: A list of fields to extract and return from the _source field ** *`q` (Optional, string)*: Query in the Lucene query string syntax @@ -1572,7 +2501,9 @@ A partial reduction is performed every time the coordinating node has received a === autoscaling [discrete] ==== delete_autoscaling_policy -Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. +Delete an autoscaling policy. + +NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. {ref}/autoscaling-delete-autoscaling-policy.html[Endpoint documentation] [source,ts] @@ -1585,21 +2516,45 @@ client.autoscaling.deleteAutoscalingPolicy({ name }) * *Request (object):* ** *`name` (string)*: the name of the autoscaling policy +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get_autoscaling_capacity -Gets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. +Get the autoscaling capacity. + +NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. + +This API gets the current autoscaling capacity based on the configured autoscaling policy. +It will return information to size the cluster appropriately to the current workload. + +The `required_capacity` is calculated as the maximum of the `required_capacity` result of all individual deciders that are enabled for the policy. + +The operator should verify that the `current_nodes` match the operator’s knowledge of the cluster to avoid making autoscaling decisions based on stale or incomplete information. + +The response contains decider-specific information you can use to diagnose how and why autoscaling determined a certain capacity was required. +This information is provided for diagnosis only. +Do not use this information to make autoscaling decisions. {ref}/autoscaling-get-autoscaling-capacity.html[Endpoint documentation] [source,ts] ---- -client.autoscaling.getAutoscalingCapacity() +client.autoscaling.getAutoscalingCapacity({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get_autoscaling_policy -Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. +Get an autoscaling policy. + +NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. {ref}/autoscaling-get-autoscaling-capacity.html[Endpoint documentation] [source,ts] @@ -1612,10 +2567,14 @@ client.autoscaling.getAutoscalingPolicy({ name }) * *Request (object):* ** *`name` (string)*: the name of the autoscaling policy +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== put_autoscaling_policy -Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. +Create or update an autoscaling policy. + +NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. {ref}/autoscaling-put-autoscaling-policy.html[Endpoint documentation] [source,ts] @@ -1629,16 +2588,20 @@ client.autoscaling.putAutoscalingPolicy({ name }) * *Request (object):* ** *`name` (string)*: the name of the autoscaling policy ** *`policy` (Optional, { roles, deciders })* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] === cat [discrete] ==== aliases Get aliases. -Retrieves the cluster’s index aliases, including filter and routing information. -The API does not return data stream aliases. -CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API. +Get the cluster's index aliases, including filter and routing information. +This API does not return data stream aliases. + +IMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API. {ref}/cat-alias.html[Endpoint documentation] [source,ts] @@ -1651,12 +2614,28 @@ client.cat.aliases({ ... }) * *Request (object):* ** *`name` (Optional, string | string[])*: A list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Whether to expand wildcard expression to concrete indices that are open, closed or both. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. +If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. +It supports a list of values, such as `open,hidden`. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +To indicated that the request should never timeout, you can set it to `-1`. [discrete] ==== allocation -Provides a snapshot of the number of shards allocated to each data node and their disk space. -IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. +Get shard allocation information. + +Get a snapshot of the number of shards allocated to each data node and their disk space. + +IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. {ref}/cat-allocation.html[Endpoint documentation] [source,ts] @@ -1668,16 +2647,26 @@ client.cat.allocation({ ... }) ==== Arguments * *Request (object):* -** *`node_id` (Optional, string | string[])*: List of node identifiers or names used to limit the returned information. +** *`node_id` (Optional, string | string[])*: A list of node identifiers or names used to limit the returned information. ** *`bytes` (Optional, Enum("b" | "kb" | "mb" | "gb" | "tb" | "pb"))*: The unit used to display byte values. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== component_templates Get component templates. -Returns information about component templates in a cluster. + +Get information about component templates in a cluster. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. -CAT APIs are only intended for human consumption using the command line or Kibana console. +IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get component template API. {ref}/cat-component-templates.html[Endpoint documentation] @@ -1690,15 +2679,27 @@ client.cat.componentTemplates({ ... }) ==== Arguments * *Request (object):* -** *`name` (Optional, string)*: The name of the component template. Accepts wildcard expressions. If omitted, all component templates are returned. +** *`name` (Optional, string)*: The name of the component template. +It accepts wildcard expressions. +If it is omitted, all component templates are returned. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. [discrete] ==== count Get a document count. -Provides quick access to a document count for a data stream, an index, or an entire cluster. + +Get quick access to a document count for a data stream, an index, or an entire cluster. The document count only includes live documents, not deleted documents which have not yet been removed by the merge process. -CAT APIs are only intended for human consumption using the command line or Kibana console. +IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the count API. {ref}/cat-count.html[Endpoint documentation] @@ -1711,12 +2712,20 @@ client.cat.count({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases used to limit the request. -Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases used to limit the request. +It supports wildcards (`*`). +To target all data streams and indices, omit this parameter or use `*` or `_all`. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. [discrete] ==== fielddata -Returns the amount of heap memory currently used by the field data cache on every data node in the cluster. +Get field data cache information. + +Get the amount of heap memory currently used by the field data cache on every data node in the cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes stats API. @@ -1733,11 +2742,16 @@ client.cat.fielddata({ ... }) ** *`fields` (Optional, string | string[])*: List of fields used to limit returned information. To retrieve all fields, omit this parameter. ** *`bytes` (Optional, Enum("b" | "kb" | "mb" | "gb" | "tb" | "pb"))*: The unit used to display byte values. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. [discrete] ==== health -Returns the health status of a cluster, similar to the cluster health API. -IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. +Get the cluster health status. + +IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the cluster health API. This API is often used to check malfunctioning clusters. To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: @@ -1759,11 +2773,16 @@ client.cat.health({ ... }) * *Request (object):* ** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: The unit used to display time values. ** *`ts` (Optional, boolean)*: If true, returns `HH:MM:SS` and Unix epoch timestamps. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. [discrete] ==== help Get CAT help. -Returns help for the CAT APIs. + +Get help for the CAT APIs. {ref}/cat.html[Endpoint documentation] [source,ts] @@ -1775,7 +2794,8 @@ client.cat.help() [discrete] ==== indices Get index information. -Returns high-level information about indices in a cluster, including backing indices for data streams. + +Get high-level information about indices in a cluster, including backing indices for data streams. Use this request to get the following information for each index in a cluster: - shard count @@ -1808,25 +2828,47 @@ Supports wildcards (`*`). To target all data streams and indices, omit this para ** *`include_unloaded_segments` (Optional, boolean)*: If true, the response includes information from segments that are not loaded into memory. ** *`pri` (Optional, boolean)*: If true, the response only includes information from primary shards. ** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: The unit used to display time values. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. [discrete] ==== master -Returns information about the master node, including the ID, bound IP address, and name. +Get master node information. + +Get information about the master node, including the ID, bound IP address, and name. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. {ref}/cat-master.html[Endpoint documentation] [source,ts] ---- -client.cat.master() +client.cat.master({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== ml_data_frame_analytics Get data frame analytics jobs. -Returns configuration and usage information about data frame analytics jobs. -CAT APIs are only intended for human consumption using the Kibana +Get configuration and usage information about data frame analytics jobs. + +IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get data frame analytics jobs statistics API. @@ -1846,17 +2888,18 @@ client.cat.mlDataFrameAnalytics({ ... }) ** *`h` (Optional, Enum("assignment_explanation" | "create_time" | "description" | "dest_index" | "failure_reason" | "id" | "model_memory_limit" | "node.address" | "node.ephemeral_id" | "node.id" | "node.name" | "progress" | "source_index" | "state" | "type" | "version") | Enum("assignment_explanation" | "create_time" | "description" | "dest_index" | "failure_reason" | "id" | "model_memory_limit" | "node.address" | "node.ephemeral_id" | "node.id" | "node.name" | "progress" | "source_index" | "state" | "type" | "version")[])*: List of column names to display. ** *`s` (Optional, Enum("assignment_explanation" | "create_time" | "description" | "dest_index" | "failure_reason" | "id" | "model_memory_limit" | "node.address" | "node.ephemeral_id" | "node.id" | "node.name" | "progress" | "source_index" | "state" | "type" | "version") | Enum("assignment_explanation" | "create_time" | "description" | "dest_index" | "failure_reason" | "id" | "model_memory_limit" | "node.address" | "node.ephemeral_id" | "node.id" | "node.name" | "progress" | "source_index" | "state" | "type" | "version")[])*: List of column names or column aliases used to sort the response. -** *`time` (Optional, string | -1 | 0)*: Unit used to display time values. +** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Unit used to display time values. [discrete] ==== ml_datafeeds Get datafeeds. -Returns configuration and usage information about datafeeds. + +Get configuration and usage information about datafeeds. This API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. -CAT APIs are only intended for human consumption using the Kibana +IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get datafeed statistics API. @@ -1887,12 +2930,13 @@ partial matches. [discrete] ==== ml_jobs Get anomaly detection jobs. -Returns configuration and usage information for anomaly detection jobs. + +Get configuration and usage information for anomaly detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. -CAT APIs are only intended for human consumption using the Kibana +IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get anomaly detection job statistics API. @@ -1924,9 +2968,10 @@ matches. [discrete] ==== ml_trained_models Get trained models. -Returns configuration and usage information about inference trained models. -CAT APIs are only intended for human consumption using the Kibana +Get configuration and usage information about inference trained models. + +IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get trained models statistics API. @@ -1949,22 +2994,40 @@ If `false`, the API returns a 404 status code when there are no matches or only ** *`s` (Optional, Enum("create_time" | "created_by" | "data_frame_analytics_id" | "description" | "heap_size" | "id" | "ingest.count" | "ingest.current" | "ingest.failed" | "ingest.pipelines" | "ingest.time" | "license" | "operations" | "version") | Enum("create_time" | "created_by" | "data_frame_analytics_id" | "description" | "heap_size" | "id" | "ingest.count" | "ingest.current" | "ingest.failed" | "ingest.pipelines" | "ingest.time" | "license" | "operations" | "version")[])*: A list of column names or aliases used to sort the response. ** *`from` (Optional, number)*: Skips the specified number of transforms. ** *`size` (Optional, number)*: The maximum number of transforms to display. +** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Unit used to display time values. [discrete] ==== nodeattrs -Returns information about custom node attributes. +Get node attribute information. + +Get information about custom node attributes. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. {ref}/cat-nodeattrs.html[Endpoint documentation] [source,ts] ---- -client.cat.nodeattrs() +client.cat.nodeattrs({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== nodes -Returns information about the nodes in a cluster. +Get node information. + +Get information about the nodes in a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. {ref}/cat-nodes.html[Endpoint documentation] @@ -1980,34 +3043,74 @@ client.cat.nodes({ ... }) ** *`bytes` (Optional, Enum("b" | "kb" | "mb" | "gb" | "tb" | "pb"))*: The unit used to display byte values. ** *`full_id` (Optional, boolean | string)*: If `true`, return the full node ID. If `false`, return the shortened node ID. ** *`include_unloaded_segments` (Optional, boolean)*: If true, the response includes information from segments that are not loaded into memory. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Unit used to display time values. [discrete] ==== pending_tasks -Returns cluster-level changes that have not yet been executed. +Get pending task information. + +Get information about cluster-level changes that have not yet taken effect. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the pending cluster tasks API. {ref}/cat-pending-tasks.html[Endpoint documentation] [source,ts] ---- -client.cat.pendingTasks() +client.cat.pendingTasks({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Unit used to display time values. [discrete] ==== plugins -Returns a list of plugins running on each node of a cluster. +Get plugin information. + +Get a list of plugins running on each node of a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. {ref}/cat-plugins.html[Endpoint documentation] [source,ts] ---- -client.cat.plugins() +client.cat.plugins({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`include_bootstrap` (Optional, boolean)*: Include bootstrap plugins in the response +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== recovery -Returns information about ongoing and completed shard recoveries. +Get shard recovery information. + +Get information about ongoing and completed shard recoveries. Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or syncing a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing. For data streams, the API returns information about the stream’s backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index recovery API. @@ -2027,22 +3130,44 @@ Supports wildcards (`*`). To target all data streams and indices, omit this para ** *`active_only` (Optional, boolean)*: If `true`, the response only includes ongoing shard recoveries. ** *`bytes` (Optional, Enum("b" | "kb" | "mb" | "gb" | "tb" | "pb"))*: The unit used to display byte values. ** *`detailed` (Optional, boolean)*: If `true`, the response includes detailed information about shard recoveries. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Unit used to display time values. [discrete] ==== repositories -Returns the snapshot repositories for a cluster. +Get snapshot repository information. + +Get a list of snapshot repositories for a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot repository API. {ref}/cat-repositories.html[Endpoint documentation] [source,ts] ---- -client.cat.repositories() +client.cat.repositories({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== segments -Returns low-level information about the Lucene segments in index shards. +Get segment information. + +Get low-level information about the Lucene segments in index shards. For data streams, the API returns information about the backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index segments API. @@ -2060,10 +3185,21 @@ client.cat.segments({ ... }) Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. ** *`bytes` (Optional, Enum("b" | "kb" | "mb" | "gb" | "tb" | "pb"))*: The unit used to display byte values. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== shards -Returns information about the shards in a cluster. +Get shard information. + +Get information about the shards in a cluster. For data streams, the API returns information about the backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. @@ -2081,10 +3217,18 @@ client.cat.shards({ ... }) Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. ** *`bytes` (Optional, Enum("b" | "kb" | "mb" | "gb" | "tb" | "pb"))*: The unit used to display byte values. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Unit used to display time values. [discrete] ==== snapshots -Returns information about the snapshots stored in one or more repositories. +Get snapshot information. + +Get information about the snapshots stored in one or more repositories. A snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API. @@ -2103,13 +3247,21 @@ Accepts wildcard expressions. `_all` returns all repositories. If any repository fails during the request, Elasticsearch returns an error. ** *`ignore_unavailable` (Optional, boolean)*: If `true`, the response does not include information from unavailable snapshots. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Unit used to display time values. [discrete] ==== tasks -Returns information about tasks currently executing in the cluster. +Get task information. + +Get information about tasks currently running in the cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the task management API. -{ref}/tasks.html[Endpoint documentation] +{ref}/cat-tasks.html[Endpoint documentation] [source,ts] ---- client.cat.tasks({ ... }) @@ -2121,12 +3273,22 @@ client.cat.tasks({ ... }) * *Request (object):* ** *`actions` (Optional, string[])*: The task action names, which are used to limit the response. ** *`detailed` (Optional, boolean)*: If `true`, the response includes detailed information about shard recoveries. -** *`node_id` (Optional, string[])*: Unique node identifiers, which are used to limit the response. +** *`nodes` (Optional, string[])*: Unique node identifiers, which are used to limit the response. ** *`parent_task_id` (Optional, string)*: The parent task identifier, which is used to limit the response. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Unit used to display time values. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. +** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the task has completed. [discrete] ==== templates -Returns information about index templates in a cluster. +Get index template information. + +Get information about the index templates in a cluster. You can use index templates to apply index settings and field mappings to new indices at creation. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API. @@ -2142,10 +3304,21 @@ client.cat.templates({ ... }) * *Request (object):* ** *`name` (Optional, string)*: The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== thread_pool -Returns thread pool statistics for each node in a cluster. +Get thread pool statistics. + +Get thread pool statistics for each node in a cluster. Returned information includes all built-in thread pools and custom thread pools. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. @@ -2161,12 +3334,22 @@ client.cat.threadPool({ ... }) * *Request (object):* ** *`thread_pool_patterns` (Optional, string | string[])*: A list of thread pool names used to limit the request. Accepts wildcard expressions. +** *`h` (Optional, string | string[])*: List of columns to appear in the response. Supports simple wildcards. +** *`s` (Optional, string | string[])*: List of columns that determine how the table should be sorted. +Sorting defaults to ascending and can be changed by setting `:asc` +or `:desc` as a suffix to the column name. ** *`time` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: The unit used to display time values. +** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the +local cluster state. If `false` the list of selected nodes are computed +from the cluster state of the master node. In both cases the coordinating +node will send requests for further information to each selected node. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== transforms -Get transforms. -Returns configuration and usage information about transforms. +Get transform information. + +Get configuration and usage information about transforms. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For @@ -2197,7 +3380,9 @@ If `false`, the request returns a 404 status code when there are no matches or o === ccr [discrete] ==== delete_auto_follow_pattern -Deletes auto-follow patterns. +Delete auto-follow patterns. + +Delete a collection of cross-cluster replication auto-follow patterns. {ref}/ccr-delete-auto-follow-pattern.html[Endpoint documentation] [source,ts] @@ -2209,40 +3394,59 @@ client.ccr.deleteAutoFollowPattern({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: The name of the auto follow pattern. +** *`name` (string)*: The auto-follow pattern collection to delete. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +It can also be set to `-1` to indicate that the request should never timeout. [discrete] ==== follow -Creates a new follower index configured to follow the referenced leader index. +Create a follower. +Create a cross-cluster replication follower index that follows a specific leader index. +When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. {ref}/ccr-put-follow.html[Endpoint documentation] [source,ts] ---- -client.ccr.follow({ index }) +client.ccr.follow({ index, leader_index, remote_cluster }) ---- [discrete] ==== Arguments * *Request (object):* -** *`index` (string)*: The name of the follower index -** *`leader_index` (Optional, string)* -** *`max_outstanding_read_requests` (Optional, number)* -** *`max_outstanding_write_requests` (Optional, number)* -** *`max_read_request_operation_count` (Optional, number)* -** *`max_read_request_size` (Optional, string)* -** *`max_retry_delay` (Optional, string | -1 | 0)* -** *`max_write_buffer_count` (Optional, number)* -** *`max_write_buffer_size` (Optional, string)* -** *`max_write_request_operation_count` (Optional, number)* -** *`max_write_request_size` (Optional, string)* -** *`read_poll_timeout` (Optional, string | -1 | 0)* -** *`remote_cluster` (Optional, string)* -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) +** *`index` (string)*: The name of the follower index. +** *`leader_index` (string)*: The name of the index in the leader cluster to follow. +** *`remote_cluster` (string)*: The remote cluster containing the leader index. +** *`data_stream_name` (Optional, string)*: If the leader index is part of a data stream, the name to which the local data stream for the followed index should be renamed. +** *`max_outstanding_read_requests` (Optional, number)*: The maximum number of outstanding reads requests from the remote cluster. +** *`max_outstanding_write_requests` (Optional, number)*: The maximum number of outstanding write requests on the follower. +** *`max_read_request_operation_count` (Optional, number)*: The maximum number of operations to pull per read from the remote cluster. +** *`max_read_request_size` (Optional, number | string)*: The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. +** *`max_retry_delay` (Optional, string | -1 | 0)*: The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when +retrying. +** *`max_write_buffer_count` (Optional, number)*: The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be +deferred until the number of queued operations goes below the limit. +** *`max_write_buffer_size` (Optional, number | string)*: The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will +be deferred until the total bytes of queued operations goes below the limit. +** *`max_write_request_operation_count` (Optional, number)*: The maximum number of operations per bulk write request executed on the follower. +** *`max_write_request_size` (Optional, number | string)*: The maximum total bytes of operations per bulk write request executed on the follower. +** *`read_poll_timeout` (Optional, string | -1 | 0)*: The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. +When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. +Then the follower will immediately attempt to read from the leader again. +** *`settings` (Optional, { index, mode, routing_path, soft_deletes, sort, number_of_shards, number_of_replicas, number_of_routing_shards, check_on_startup, codec, routing_partition_size, load_fixed_bitset_filters_eagerly, hidden, auto_expand_replicas, merge, search, refresh_interval, max_result_window, max_inner_result_window, max_rescore_window, max_docvalue_fields_search, max_script_fields, max_ngram_diff, max_shingle_diff, blocks, max_refresh_listeners, analyze, highlight, max_terms_count, max_regex_length, routing, gc_deletes, default_pipeline, final_pipeline, lifecycle, provided_name, creation_date, creation_date_string, uuid, version, verified_before_close, format, max_slices_per_scroll, translog, query_string, priority, top_metrics_max_size, analysis, settings, time_series, queries, similarity, mapping, indexing.slowlog, indexing_pressure, store })*: Settings to override from the leader index. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: Specifies the number of shards to wait on being active before responding. This defaults to waiting on none of the shards to be +active. +A shard must be restored from the leader index before being active. Restoring a follower shard requires transferring all the +remote Lucene segment files to the follower index. [discrete] ==== follow_info -Retrieves information about all follower indices, including parameters and status for each follower index +Get follower information. + +Get information about all cross-cluster replication follower indices. +For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. {ref}/ccr-get-follow-info.html[Endpoint documentation] [source,ts] @@ -2254,11 +3458,17 @@ client.ccr.followInfo({ index }) ==== Arguments * *Request (object):* -** *`index` (string | string[])*: A list of index patterns; use `_all` to perform the operation on all indices +** *`index` (string | string[])*: A comma-delimited list of follower index patterns. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +It can also be set to `-1` to indicate that the request should never timeout. [discrete] ==== follow_stats -Retrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices. +Get follower stats. + +Get cross-cluster replication follower stats. +The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. {ref}/ccr-get-follow-stats.html[Endpoint documentation] [source,ts] @@ -2270,11 +3480,24 @@ client.ccr.followStats({ index }) ==== Arguments * *Request (object):* -** *`index` (string | string[])*: A list of index patterns; use `_all` to perform the operation on all indices +** *`index` (string | string[])*: A comma-delimited list of index patterns. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== forget_follower -Removes the follower retention leases from the leader. +Forget a follower. +Remove the cross-cluster replication follower retention leases from the leader. + +A following index takes out retention leases on its leader index. +These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. +When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. +However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. +While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. +This API exists to enable manually removing the leases when the unfollow API is unable to do so. + +NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. +The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. {ref}/ccr-post-forget-follower.html[Endpoint documentation] [source,ts] @@ -2291,10 +3514,13 @@ client.ccr.forgetFollower({ index }) ** *`follower_index` (Optional, string)* ** *`follower_index_uuid` (Optional, string)* ** *`leader_remote_cluster` (Optional, string)* +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get_auto_follow_pattern -Gets configured auto-follow patterns. Returns the specified auto-follow pattern collection. +Get auto-follow patterns. + +Get cross-cluster replication auto-follow patterns. {ref}/ccr-get-auto-follow-pattern.html[Endpoint documentation] [source,ts] @@ -2306,11 +3532,23 @@ client.ccr.getAutoFollowPattern({ ... }) ==== Arguments * *Request (object):* -** *`name` (Optional, string)*: Specifies the auto-follow pattern collection that you want to retrieve. If you do not specify a name, the API returns information for all collections. +** *`name` (Optional, string)*: The auto-follow pattern collection that you want to retrieve. +If you do not specify a name, the API returns information for all collections. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +It can also be set to `-1` to indicate that the request should never timeout. [discrete] ==== pause_auto_follow_pattern -Pauses an auto-follow pattern +Pause an auto-follow pattern. + +Pause a cross-cluster replication auto-follow pattern. +When the API returns, the auto-follow pattern is inactive. +New indices that are created on the remote cluster and match the auto-follow patterns are ignored. + +You can resume auto-following with the resume auto-follow pattern API. +When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. +Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. {ref}/ccr-pause-auto-follow-pattern.html[Endpoint documentation] [source,ts] @@ -2322,11 +3560,19 @@ client.ccr.pauseAutoFollowPattern({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: The name of the auto follow pattern that should pause discovering new indices to follow. +** *`name` (string)*: The name of the auto-follow pattern to pause. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +It can also be set to `-1` to indicate that the request should never timeout. [discrete] ==== pause_follow -Pauses a follower index. The follower index will not fetch any additional operations from the leader index. +Pause a follower. + +Pause a cross-cluster replication follower index. +The follower index will not fetch any additional operations from the leader index. +You can resume following with the resume follower API. +You can pause and resume a follower index to change the configuration of the following task. {ref}/ccr-post-pause-follow.html[Endpoint documentation] [source,ts] @@ -2338,11 +3584,20 @@ client.ccr.pauseFollow({ index }) ==== Arguments * *Request (object):* -** *`index` (string)*: The name of the follower index that should pause following its leader index. +** *`index` (string)*: The name of the follower index. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +It can also be set to `-1` to indicate that the request should never timeout. [discrete] ==== put_auto_follow_pattern -Creates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices. +Create or update auto-follow patterns. +Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. +Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. +Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. + +This API can also be used to update auto-follow patterns. +NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. {ref}/ccr-put-auto-follow-pattern.html[Endpoint documentation] [source,ts] @@ -2370,10 +3625,15 @@ client.ccr.putAutoFollowPattern({ name, remote_cluster }) ** *`max_write_buffer_size` (Optional, number | string)*: The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the total bytes of queued operations goes below the limit. ** *`max_write_request_operation_count` (Optional, number)*: The maximum number of operations per bulk write request executed on the follower. ** *`max_write_request_size` (Optional, number | string)*: The maximum total bytes of operations per bulk write request executed on the follower. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== resume_auto_follow_pattern -Resumes an auto-follow pattern that has been paused +Resume an auto-follow pattern. + +Resume a cross-cluster replication auto-follow pattern that was paused. +The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. +Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. {ref}/ccr-resume-auto-follow-pattern.html[Endpoint documentation] [source,ts] @@ -2385,11 +3645,18 @@ client.ccr.resumeAutoFollowPattern({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: The name of the auto follow pattern to resume discovering new indices to follow. +** *`name` (string)*: The name of the auto-follow pattern to resume. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +It can also be set to `-1` to indicate that the request should never timeout. [discrete] ==== resume_follow -Resumes a follower index that has been paused +Resume a follower. +Resume a cross-cluster replication follower index that was paused. +The follower index could have been paused with the pause follower API. +Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. +When this API returns, the follower index will resume fetching operations from the leader index. {ref}/ccr-post-resume-follow.html[Endpoint documentation] [source,ts] @@ -2412,21 +3679,39 @@ client.ccr.resumeFollow({ index }) ** *`max_write_request_operation_count` (Optional, number)* ** *`max_write_request_size` (Optional, string)* ** *`read_poll_timeout` (Optional, string | -1 | 0)* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== stats -Gets all stats related to cross-cluster replication. +Get cross-cluster replication stats. + +This API returns stats about auto-following and the same shard-level stats as the get follower stats API. {ref}/ccr-get-stats.html[Endpoint documentation] [source,ts] ---- -client.ccr.stats() +client.ccr.stats({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +It can also be set to `-1` to indicate that the request should never timeout. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== unfollow -Stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. +Unfollow an index. + +Convert a cross-cluster replication follower index to a regular index. +The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. +The follower index must be paused and closed before you call the unfollow API. + +> info +> Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. {ref}/ccr-post-unfollow.html[Endpoint documentation] [source,ts] @@ -2438,13 +3723,20 @@ client.ccr.unfollow({ index }) ==== Arguments * *Request (object):* -** *`index` (string)*: The name of the follower index that should be turned into a regular index. +** *`index` (string)*: The name of the follower index. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +It can also be set to `-1` to indicate that the request should never timeout. [discrete] === cluster [discrete] ==== allocation_explain -Provides explanations for shard allocations in the cluster. +Explain the shard allocations. +Get explanations for shard allocations in the cluster. +For unassigned shards, it provides an explanation for why the shard is unassigned. +For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. +This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. {ref}/cluster-allocation-explain.html[Endpoint documentation] [source,ts] @@ -2462,11 +3754,11 @@ client.cluster.allocationExplain({ ... }) ** *`shard` (Optional, number)*: Specifies the ID of the shard that you would like an explanation for. ** *`include_disk_info` (Optional, boolean)*: If true, returns information about disk usage and shard sizes. ** *`include_yes_decisions` (Optional, boolean)*: If true, returns YES decisions in explanation. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== delete_component_template Delete component templates. -Deletes component templates. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. {ref}/indices-component-template.html[Endpoint documentation] @@ -2487,9 +3779,10 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== delete_voting_config_exclusions -Clears cluster voting config exclusions. +Clear cluster voting config exclusions. +Remove master-eligible nodes from the voting configuration exclusion list. -{ref}/voting-config-exclusions.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions[Endpoint documentation] [source,ts] ---- client.cluster.deleteVotingConfigExclusions({ ... }) @@ -2499,6 +3792,7 @@ client.cluster.deleteVotingConfigExclusions({ ... }) ==== Arguments * *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. ** *`wait_for_removal` (Optional, boolean)*: Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. Defaults to true, meaning that all excluded nodes must be removed from @@ -2532,7 +3826,7 @@ Defaults to false, which means information is retrieved from the master node. [discrete] ==== get_component_template Get component templates. -Retrieves information about component templates. +Get information about component templates. {ref}/indices-component-template.html[Endpoint documentation] [source,ts] @@ -2555,7 +3849,7 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== get_settings -Returns cluster-wide settings. +Get cluster-wide settings. By default, it returns only settings that have been explicitly defined. {ref}/cluster-get-settings.html[Endpoint documentation] @@ -2577,8 +3871,16 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== health -The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices. -The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status. +Get the cluster health status. +You can also use the API to get the health status of only specified data streams and indices. +For data streams, the API retrieves the health status of the stream’s backing indices. + +The cluster health status is: green, yellow or red. +On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. +The index level status is controlled by the worst shard status. + +One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. +The cluster status is controlled by the worst index status. {ref}/cluster-health.html[Endpoint documentation] [source,ts] @@ -2622,9 +3924,11 @@ client.cluster.info({ target }) [discrete] ==== pending_tasks -Returns cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet been executed. +Get the pending cluster tasks. +Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. + NOTE: This API returns a list of any pending updates to the cluster state. -These are distinct from the tasks reported by the Task Management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. +These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. {ref}/cluster-pending.html[Endpoint documentation] @@ -2644,9 +3948,26 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== post_voting_config_exclusions -Updates the cluster voting config exclusions by node ids or node names. +Update voting configuration exclusions. +Update the cluster voting config exclusions by node IDs or node names. +By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. +If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. +The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. +It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. -{ref}/voting-config-exclusions.html[Endpoint documentation] +Clusters should have no voting configuration exclusions in normal operation. +Once the excluded nodes have stopped, clear the voting configuration exclusions with `DELETE /_cluster/voting_config_exclusions`. +This API waits for the nodes to be fully removed from the cluster before it returns. +If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use `DELETE /_cluster/voting_config_exclusions?wait_for_removal=false` to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. + +A response to `POST /_cluster/voting_config_exclusions` with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling `DELETE /_cluster/voting_config_exclusions`. +If the call to `POST /_cluster/voting_config_exclusions` fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. +In that case, you may safely retry the call. + +NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. +They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions[Endpoint documentation] [source,ts] ---- client.cluster.postVotingConfigExclusions({ ... }) @@ -2660,6 +3981,7 @@ client.cluster.postVotingConfigExclusions({ ... }) voting configuration. If specified, you may not also specify node_ids. ** *`node_ids` (Optional, string | string[])*: A list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify node_names. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. ** *`timeout` (Optional, string | -1 | 0)*: When adding a voting configuration exclusion, the API waits for the specified nodes to be excluded from the voting configuration before returning. If the timeout expires before the appropriate condition @@ -2668,7 +3990,6 @@ is satisfied, the request fails and returns an error. [discrete] ==== put_component_template Create or update a component template. -Creates or updates a component template. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. An index template can be composed of multiple component templates. @@ -2684,6 +4005,11 @@ Changes to component templates do not affect existing indices, including a strea You can use C-style `/* *\/` block comments in component templates. You can include comments anywhere in the request body except before the opening curly bracket. +**Applying component templates** + +You cannot directly apply a component template to a data stream or index. +To be applied, a component template must be included in an index template's `composed_of` list. + {ref}/indices-component-template.html[Endpoint documentation] [source,ts] ---- @@ -2704,7 +4030,7 @@ If you don’t use Elastic Agent and want to disable all built-in component and This number isn't automatically generated or incremented by Elasticsearch. To unset a version, replace the template without specifying a version. ** *`_meta` (Optional, Record)*: Optional user metadata about the component template. -May have any contents. This map is not automatically generated by Elasticsearch. +It may have any contents. This map is not automatically generated by Elasticsearch. This information is stored in the cluster state, so keeping it short is preferable. To unset `_meta`, replace the template without specifying this information. ** *`deprecated` (Optional, boolean)*: Marks this index template as deprecated. When creating or updating a non-deprecated index template @@ -2715,7 +4041,24 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== put_settings -Updates the cluster settings. +Update the cluster settings. +Configure and update dynamic settings on a running cluster. +You can also configure dynamic settings locally on an unstarted or shut down node in `elasticsearch.yml`. + +Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart. +You can also reset transient or persistent settings by assigning them a null value. + +If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) `elasticsearch.yml` setting; 4) Default setting value. +For example, you can apply a transient setting to override a persistent setting or `elasticsearch.yml` setting. +However, a change to an `elasticsearch.yml` setting will not override a defined transient or persistent setting. + +TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster. +If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings. +Only use `elasticsearch.yml` for static cluster settings and node settings. +The API doesn’t require a restart and ensures a setting’s value is the same on all nodes. + +WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead. +If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration. {ref}/cluster-update-settings.html[Endpoint documentation] [source,ts] @@ -2735,9 +4078,16 @@ client.cluster.putSettings({ ... }) [discrete] ==== remote_info -The cluster remote info API allows you to retrieve all of the configured -remote cluster information. It returns connection and endpoint information -keyed by the configured remote cluster alias. +Get remote cluster information. + +Get information about configured remote clusters. +The API returns connection and endpoint information keyed by the configured remote cluster alias. + +> info +> This API returns information that reflects current state on the local cluster. +> The `connected` field does not necessarily reflect whether a remote cluster is down or unavailable, only whether there is currently an open connection to it. +> Elasticsearch does not spontaneously try to reconnect to a disconnected remote cluster. +> To trigger a reconnection, attempt a cross-cluster search, ES|QL cross-cluster search, or try the [resolve cluster endpoint](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-resolve-cluster). {ref}/cluster-remote-info.html[Endpoint documentation] [source,ts] @@ -2748,7 +4098,20 @@ client.cluster.remoteInfo() [discrete] ==== reroute -Allows to manually change the allocation of individual shards in the cluster. +Reroute the cluster. +Manually change the allocation of individual shards in the cluster. +For example, a shard can be moved from one node to another explicitly, an allocation can be canceled, and an unassigned shard can be explicitly allocated to a specific node. + +It is important to note that after processing any reroute commands Elasticsearch will perform rebalancing as normal (respecting the values of settings such as `cluster.routing.rebalance.enable`) in order to remain in a balanced state. +For example, if the requested allocation includes moving a shard from node1 to node2 then this may cause a shard to be moved from node2 back to node1 to even things out. + +The cluster can be set to disable allocations using the `cluster.routing.allocation.enable` setting. +If allocations are disabled then the only allocations that will be performed are explicit ones given using the reroute command, and consequent allocations due to rebalancing. + +The cluster will attempt to allocate a shard a maximum of `index.allocation.max_retries` times in a row (defaults to `5`), before giving up and leaving the shard unallocated. +This scenario can be caused by structural problems such as having an analyzer which refers to a stopwords file which doesn’t exist on all nodes. + +Once the problem has been corrected, allocation can be manually retried by calling the reroute API with the `?retry_failed` URI query parameter, which will attempt a single retry round for these shards. {ref}/cluster-reroute.html[Endpoint documentation] [source,ts] @@ -2761,8 +4124,9 @@ client.cluster.reroute({ ... }) * *Request (object):* ** *`commands` (Optional, { cancel, move, allocate_replica, allocate_stale_primary, allocate_empty_primary }[])*: Defines the commands to perform. -** *`dry_run` (Optional, boolean)*: If true, then the request simulates the operation only and returns the resulting state. -** *`explain` (Optional, boolean)*: If true, then the response contains an explanation of why the commands can or cannot be executed. +** *`dry_run` (Optional, boolean)*: If true, then the request simulates the operation. +It will calculate the result of applying the commands to the current cluster state and return the resulting cluster state after the commands (and rebalancing) have been applied; it will not actually perform the requested changes. +** *`explain` (Optional, boolean)*: If true, then the response contains an explanation of why the commands can or cannot run. ** *`metric` (Optional, string | string[])*: Limits the information returned to the specified metrics. ** *`retry_failed` (Optional, boolean)*: If true, then retries allocation of shards that are blocked due to too many subsequent allocation failures. ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. @@ -2770,7 +4134,25 @@ client.cluster.reroute({ ... }) [discrete] ==== state -Returns a comprehensive information about the state of the cluster. +Get the cluster state. +Get comprehensive information about the state of the cluster. + +The cluster state is an internal data structure which keeps track of a variety of information needed by every node, including the identity and attributes of the other nodes in the cluster; cluster-wide settings; index metadata, including the mapping and settings for each index; the location and status of every shard copy in the cluster. + +The elected master node ensures that every node in the cluster has a copy of the same cluster state. +This API lets you retrieve a representation of this internal state for debugging or diagnostic purposes. +You may need to consult the Elasticsearch source code to determine the precise meaning of the response. + +By default the API will route requests to the elected master node since this node is the authoritative source of cluster states. +You can also retrieve the cluster state held on the node handling the API request by adding the `?local=true` query parameter. + +Elasticsearch may need to expend significant effort to compute a response to this API in larger clusters, and the response may comprise a very large quantity of data. +If you use this API repeatedly, your cluster may become unstable. + +WARNING: The response is a representation of an internal data structure. +Its format is not subject to the same compatibility guarantees as other more stable APIs and may change from version to version. +Do not query this API using external monitoring tools. +Instead, obtain the information you require using other more stable cluster APIs. {ref}/cluster-state.html[Endpoint documentation] [source,ts] @@ -2795,8 +4177,8 @@ client.cluster.state({ ... }) [discrete] ==== stats -Returns cluster statistics. -It returns basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). +Get cluster statistics. +Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). {ref}/cluster-stats.html[Endpoint documentation] [source,ts] @@ -2809,7 +4191,7 @@ client.cluster.stats({ ... }) * *Request (object):* ** *`node_id` (Optional, string | string[])*: List of node filters used to limit returned information. Defaults to all nodes in the cluster. -** *`flat_settings` (Optional, boolean)*: If `true`, returns settings in flat format. +** *`include_remotes` (Optional, boolean)*: Include remote cluster data into the response ** *`timeout` (Optional, string | -1 | 0)*: Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, timed out nodes are included in the response’s `_nodes.failed` property. Defaults to no timeout. @@ -2818,7 +4200,9 @@ However, timed out nodes are included in the response’s `_nodes.failed` proper === connector [discrete] ==== check_in -Updates the last_seen field in the connector, and sets it to current timestamp +Check in a connector. + +Update the `last_seen` field in the connector and set it to the current timestamp. {ref}/check-in-connector-api.html[Endpoint documentation] [source,ts] @@ -2834,7 +4218,12 @@ client.connector.checkIn({ connector_id }) [discrete] ==== delete -Deletes a connector. +Delete a connector. + +Removes a connector and associated sync jobs. +This is a destructive action that is not recoverable. +NOTE: This action doesn’t delete any API keys, ingest pipelines, or data indices associated with the connector. +These need to be removed manually. {ref}/delete-connector-api.html[Endpoint documentation] [source,ts] @@ -2851,7 +4240,9 @@ client.connector.delete({ connector_id }) [discrete] ==== get -Retrieves a connector. +Get a connector. + +Get the details about a connector. {ref}/get-connector-api.html[Endpoint documentation] [source,ts] @@ -2867,7 +4258,9 @@ client.connector.get({ connector_id }) [discrete] ==== list -Returns existing connectors. +Get all connectors. + +Get information about all connectors. {ref}/list-connector-api.html[Endpoint documentation] [source,ts] @@ -2888,7 +4281,11 @@ client.connector.list({ ... }) [discrete] ==== post -Creates a connector. +Create a connector. + +Connectors are Elasticsearch integrations that bring content from third-party data sources, which can be deployed on Elastic Cloud or hosted on your own infrastructure. +Elastic managed connectors (Native connectors) are a managed service on Elastic Cloud. +Self-managed connectors (Connector clients) are self-managed on your infrastructure. {ref}/create-connector-api.html[Endpoint documentation] [source,ts] @@ -2909,7 +4306,7 @@ client.connector.post({ ... }) [discrete] ==== put -Creates or updates a connector. +Create or update a connector. {ref}/create-connector-api.html[Endpoint documentation] [source,ts] @@ -2931,7 +4328,10 @@ client.connector.put({ ... }) [discrete] ==== sync_job_cancel -Cancels a connector sync job. +Cancel a connector sync job. + +Cancel a connector sync job, which sets the status to cancelling and updates `cancellation_requested_at` to the current time. +The connector service is then responsible for setting the status of connector sync jobs to cancelled. {ref}/cancel-connector-sync-job-api.html[Endpoint documentation] [source,ts] @@ -2947,27 +4347,55 @@ client.connector.syncJobCancel({ connector_sync_job_id }) [discrete] ==== sync_job_check_in -Checks in a connector sync job (refreshes 'last_seen'). +Check in a connector sync job. +Check in a connector sync job and set the `last_seen` field to the current time before updating it in the internal index. + +To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. +This service runs automatically on Elastic Cloud for Elastic managed connectors. {ref}/check-in-connector-sync-job-api.html[Endpoint documentation] [source,ts] ---- -client.connector.syncJobCheckIn() +client.connector.syncJobCheckIn({ connector_sync_job_id }) ---- - [discrete] -==== sync_job_claim -Claims a connector sync job. -[source,ts] +==== Arguments + +* *Request (object):* +** *`connector_sync_job_id` (string)*: The unique identifier of the connector sync job to be checked in. + +[discrete] +==== sync_job_claim +Claim a connector sync job. +This action updates the job status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time. +Additionally, it can set the `sync_cursor` property for the sync job. + +This API is not intended for direct connector management by users. +It supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch. + +To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. +This service runs automatically on Elastic Cloud for Elastic managed connectors. +[source,ts] ---- -client.connector.syncJobClaim() +client.connector.syncJobClaim({ connector_sync_job_id, worker_hostname }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`connector_sync_job_id` (string)*: The unique identifier of the connector sync job. +** *`worker_hostname` (string)*: The host name of the current system that will run the job. +** *`sync_cursor` (Optional, User-defined value)*: The cursor object from the last incremental sync job. +This should reference the `sync_cursor` field in the connector state for which the job runs. [discrete] ==== sync_job_delete -Deletes a connector sync job. +Delete a connector sync job. + +Remove a connector sync job and its associated data. +This is a destructive action that is not recoverable. {ref}/delete-connector-sync-job-api.html[Endpoint documentation] [source,ts] @@ -2983,18 +4411,28 @@ client.connector.syncJobDelete({ connector_sync_job_id }) [discrete] ==== sync_job_error -Sets an error for a connector sync job. +Set a connector sync job error. +Set the `error` field for a connector sync job and set its `status` to `error`. + +To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. +This service runs automatically on Elastic Cloud for Elastic managed connectors. {ref}/set-connector-sync-job-error-api.html[Endpoint documentation] [source,ts] ---- -client.connector.syncJobError() +client.connector.syncJobError({ connector_sync_job_id, error }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`connector_sync_job_id` (string)*: The unique identifier for the connector sync job. +** *`error` (string)*: The error for the connector sync job error field. [discrete] ==== sync_job_get -Retrieves a connector sync job. +Get a connector sync job. {ref}/get-connector-sync-job-api.html[Endpoint documentation] [source,ts] @@ -3010,7 +4448,9 @@ client.connector.syncJobGet({ connector_sync_job_id }) [discrete] ==== sync_job_list -Lists connector sync jobs. +Get all connector sync jobs. + +Get information about all stored connector sync jobs listed by their creation date in ascending order. {ref}/list-connector-sync-jobs-api.html[Endpoint documentation] [source,ts] @@ -3030,7 +4470,9 @@ client.connector.syncJobList({ ... }) [discrete] ==== sync_job_post -Creates a connector sync job. +Create a connector sync job. + +Create a connector sync job document in the internal index and initialize its counters and timestamps with default values. {ref}/create-connector-sync-job-api.html[Endpoint documentation] [source,ts] @@ -3048,17 +4490,36 @@ client.connector.syncJobPost({ id }) [discrete] ==== sync_job_update_stats -Updates the stats fields in the connector sync job document. +Set the connector sync job stats. +Stats include: `deleted_document_count`, `indexed_document_count`, `indexed_document_volume`, and `total_document_count`. +You can also update `last_seen`. +This API is mainly used by the connector service for updating sync job information. + +To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. +This service runs automatically on Elastic Cloud for Elastic managed connectors. {ref}/set-connector-sync-job-stats-api.html[Endpoint documentation] [source,ts] ---- -client.connector.syncJobUpdateStats() +client.connector.syncJobUpdateStats({ connector_sync_job_id, deleted_document_count, indexed_document_count, indexed_document_volume }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`connector_sync_job_id` (string)*: The unique identifier of the connector sync job. +** *`deleted_document_count` (number)*: The number of documents the sync job deleted. +** *`indexed_document_count` (number)*: The number of documents the sync job indexed. +** *`indexed_document_volume` (number)*: The total size of the data (in MiB) the sync job indexed. +** *`last_seen` (Optional, string | -1 | 0)*: The timestamp to use in the `last_seen` property for the connector sync job. +** *`metadata` (Optional, Record)*: The connector-specific metadata. +** *`total_document_count` (Optional, number)*: The total number of documents in the target index after the sync job finished. [discrete] ==== update_active_filtering +Activate the connector draft filter. + Activates the valid draft filtering for a connector. {ref}/update-connector-filtering-api.html[Endpoint documentation] @@ -3075,7 +4536,12 @@ client.connector.updateActiveFiltering({ connector_id }) [discrete] ==== update_api_key_id -Updates the API key id in the connector document +Update the connector API key ID. + +Update the `api_key_id` and `api_key_secret_id` fields of a connector. +You can specify the ID of the API key used for authorization and the ID of the connector secret where the API key is stored. +The connector secret ID is required only for Elastic managed (native) connectors. +Self-managed connectors (connector clients) do not use this field. {ref}/update-connector-api-key-id-api.html[Endpoint documentation] [source,ts] @@ -3093,7 +4559,9 @@ client.connector.updateApiKeyId({ connector_id }) [discrete] ==== update_configuration -Updates the configuration field in the connector document +Update the connector configuration. + +Update the configuration field in the connector document. {ref}/update-connector-configuration-api.html[Endpoint documentation] [source,ts] @@ -3111,7 +4579,11 @@ client.connector.updateConfiguration({ connector_id }) [discrete] ==== update_error -Updates the filtering field in the connector document +Update the connector error field. + +Set the error field for the connector. +If the error provided in the request body is non-null, the connector’s status is updated to error. +Otherwise, if the error is reset to null, the connector status is updated to connected. {ref}/update-connector-error-api.html[Endpoint documentation] [source,ts] @@ -3128,18 +4600,41 @@ client.connector.updateError({ connector_id, error }) [discrete] ==== update_features -Updates the connector features in the connector document. +Update the connector features. +Update the connector features in the connector document. +This API can be used to control the following aspects of a connector: + +* document-level security +* incremental syncs +* advanced sync rules +* basic sync rules + +Normally, the running connector service automatically manages these features. +However, you can use this API to override the default behavior. + +To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. +This service runs automatically on Elastic Cloud for Elastic managed connectors. {ref}/update-connector-features-api.html[Endpoint documentation] [source,ts] ---- -client.connector.updateFeatures() +client.connector.updateFeatures({ connector_id, features }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`connector_id` (string)*: The unique identifier of the connector to be updated. +** *`features` ({ document_level_security, incremental_sync, native_connector_api_keys, sync_rules })* [discrete] ==== update_filtering -Updates the filtering field in the connector document +Update the connector filtering. + +Update the draft filtering configuration of a connector and marks the draft validation state as edited. +The filtering draft is activated once validated by the running Elastic connector service. +The filtering property is used to configure sync rules (both basic and advanced) for a connector. {ref}/update-connector-filtering-api.html[Endpoint documentation] [source,ts] @@ -3158,7 +4653,9 @@ client.connector.updateFiltering({ connector_id }) [discrete] ==== update_filtering_validation -Updates the draft filtering validation info for a connector. +Update the connector draft filtering validation. + +Update the draft filtering validation info for a connector. [source,ts] ---- client.connector.updateFilteringValidation({ connector_id, validation }) @@ -3173,7 +4670,9 @@ client.connector.updateFilteringValidation({ connector_id, validation }) [discrete] ==== update_index_name -Updates the index_name in the connector document +Update the connector index name. + +Update the `index_name` field of a connector, specifying the index where the data ingested by the connector is stored. {ref}/update-connector-index-name-api.html[Endpoint documentation] [source,ts] @@ -3190,7 +4689,7 @@ client.connector.updateIndexName({ connector_id, index_name }) [discrete] ==== update_name -Updates the name and description fields in the connector document +Update the connector name and description. {ref}/update-connector-name-description-api.html[Endpoint documentation] [source,ts] @@ -3208,7 +4707,7 @@ client.connector.updateName({ connector_id }) [discrete] ==== update_native -Updates the is_native flag in the connector document +Update the connector is_native flag. [source,ts] ---- client.connector.updateNative({ connector_id, is_native }) @@ -3223,7 +4722,9 @@ client.connector.updateNative({ connector_id, is_native }) [discrete] ==== update_pipeline -Updates the pipeline field in the connector document +Update the connector pipeline. + +When you create a new connector, the configuration of an ingest pipeline is populated with default settings. {ref}/update-connector-pipeline-api.html[Endpoint documentation] [source,ts] @@ -3240,7 +4741,7 @@ client.connector.updatePipeline({ connector_id, pipeline }) [discrete] ==== update_scheduling -Updates the scheduling field in the connector document +Update the connector scheduling. {ref}/update-connector-scheduling-api.html[Endpoint documentation] [source,ts] @@ -3257,7 +4758,7 @@ client.connector.updateScheduling({ connector_id, scheduling }) [discrete] ==== update_service_type -Updates the service type of the connector +Update the connector service type. {ref}/update-connector-service-type-api.html[Endpoint documentation] [source,ts] @@ -3274,7 +4775,7 @@ client.connector.updateServiceType({ connector_id, service_type }) [discrete] ==== update_status -Updates the status of the connector +Update the connector status. {ref}/update-connector-status-api.html[Endpoint documentation] [source,ts] @@ -3293,9 +4794,11 @@ client.connector.updateStatus({ connector_id, status }) === dangling_indices [discrete] ==== delete_dangling_index -Deletes the specified dangling index +Delete a dangling index. +If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. +For example, this can happen if you delete more than `cluster.indices.tombstones.size` indices while an Elasticsearch node is offline. -{ref}/modules-gateway-dangling-indices.html[Endpoint documentation] +{ref}/dangling-index-delete.html[Endpoint documentation] [source,ts] ---- client.danglingIndices.deleteDanglingIndex({ index_uuid, accept_data_loss }) @@ -3305,16 +4808,19 @@ client.danglingIndices.deleteDanglingIndex({ index_uuid, accept_data_loss }) ==== Arguments * *Request (object):* -** *`index_uuid` (string)*: The UUID of the dangling index -** *`accept_data_loss` (boolean)*: Must be set to true in order to delete the dangling index +** *`index_uuid` (string)*: The UUID of the index to delete. Use the get dangling indices API to find the UUID. +** *`accept_data_loss` (boolean)*: This parameter must be set to true to acknowledge that it will no longer be possible to recove data from the dangling index. ** *`master_timeout` (Optional, string | -1 | 0)*: Specify timeout for connection to master ** *`timeout` (Optional, string | -1 | 0)*: Explicit operation timeout [discrete] ==== import_dangling_index -Imports the specified dangling index +Import a dangling index. + +If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. +For example, this can happen if you delete more than `cluster.indices.tombstones.size` indices while an Elasticsearch node is offline. -{ref}/modules-gateway-dangling-indices.html[Endpoint documentation] +{ref}/dangling-index-import.html[Endpoint documentation] [source,ts] ---- client.danglingIndices.importDanglingIndex({ index_uuid, accept_data_loss }) @@ -3324,16 +4830,22 @@ client.danglingIndices.importDanglingIndex({ index_uuid, accept_data_loss }) ==== Arguments * *Request (object):* -** *`index_uuid` (string)*: The UUID of the dangling index -** *`accept_data_loss` (boolean)*: Must be set to true in order to import the dangling index +** *`index_uuid` (string)*: The UUID of the index to import. Use the get dangling indices API to locate the UUID. +** *`accept_data_loss` (boolean)*: This parameter must be set to true to import a dangling index. +Because Elasticsearch cannot know where the dangling index data came from or determine which shard copies are fresh and which are stale, it cannot guarantee that the imported data represents the latest state of the index when it was last in the cluster. ** *`master_timeout` (Optional, string | -1 | 0)*: Specify timeout for connection to master ** *`timeout` (Optional, string | -1 | 0)*: Explicit operation timeout [discrete] ==== list_dangling_indices -Returns all dangling indices. +Get the dangling indices. + +If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. +For example, this can happen if you delete more than `cluster.indices.tombstones.size` indices while an Elasticsearch node is offline. + +Use this API to list dangling indices, which you can then import or delete. -{ref}/modules-gateway-dangling-indices.html[Endpoint documentation] +{ref}/dangling-indices-list.html[Endpoint documentation] [source,ts] ---- client.danglingIndices.listDanglingIndices() @@ -3358,10 +4870,12 @@ client.enrich.deletePolicy({ name }) * *Request (object):* ** *`name` (string)*: Enrich policy to delete. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== execute_policy -Creates the enrich index for an existing enrich policy. +Run an enrich policy. +Create the enrich index for an existing enrich policy. {ref}/execute-enrich-policy-api.html[Endpoint documentation] [source,ts] @@ -3374,6 +4888,7 @@ client.enrich.executePolicy({ name }) * *Request (object):* ** *`name` (string)*: Enrich policy to execute. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. ** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks other enrich policy execution requests until complete. [discrete] @@ -3393,6 +4908,7 @@ client.enrich.getPolicy({ ... }) * *Request (object):* ** *`name` (Optional, string | string[])*: List of enrich policy names used to limit the request. To return information for all enrich policies, omit this parameter. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== put_policy @@ -3413,6 +4929,7 @@ client.enrich.putPolicy({ name }) ** *`geo_match` (Optional, { enrich_fields, indices, match_field, query, name, elasticsearch_version })*: Matches enrich data to incoming documents based on a `geo_shape` query. ** *`match` (Optional, { enrich_fields, indices, match_field, query, name, elasticsearch_version })*: Matches enrich data to incoming documents based on a `term` query. ** *`range` (Optional, { enrich_fields, indices, match_field, query, name, elasticsearch_version })*: Matches a number, date, or IP address in incoming documents to a range in the enrich index based on a `term` query. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== stats @@ -3422,18 +4939,24 @@ Returns enrich coordinator statistics and information about enrich policies that {ref}/enrich-stats-api.html[Endpoint documentation] [source,ts] ---- -client.enrich.stats() +client.enrich.stats({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] === eql [discrete] ==== delete -Deletes an async EQL search or a stored synchronous EQL search. +Delete an async EQL search. +Delete an async EQL search or a stored synchronous EQL search. The API also deletes results for the search. -{ref}/eql-search-api.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-eql-delete[Endpoint documentation] [source,ts] ---- client.eql.delete({ id }) @@ -3449,7 +4972,8 @@ A search ID is also provided if the request’s `keep_on_completion` parameter i [discrete] ==== get -Returns the current status and available results for an async EQL search or a stored synchronous EQL search. +Get async EQL search results. +Get the current status and available results for an async EQL search or a stored synchronous EQL search. {ref}/get-async-eql-search-api.html[Endpoint documentation] [source,ts] @@ -3469,7 +4993,8 @@ Defaults to no timeout, meaning the request waits for complete search results. [discrete] ==== get_status -Returns the current status for an async EQL search or a stored synchronous EQL search without returning results. +Get the async EQL status. +Get the current status for an async EQL search or a stored synchronous EQL search without returning results. {ref}/get-async-eql-status-api.html[Endpoint documentation] [source,ts] @@ -3485,7 +5010,9 @@ client.eql.getStatus({ id }) [discrete] ==== search -Returns results matching a query expressed in Event Query Language (EQL) +Get EQL search results. +Returns search results for an Event Query Language (EQL) query. +EQL assumes each document in a data stream or index corresponds to an event. {ref}/eql-search-api.html[Endpoint documentation] [source,ts] @@ -3504,14 +5031,23 @@ client.eql.search({ index, query }) ** *`tiebreaker_field` (Optional, string)*: Field used to sort hits with the same timestamp in ascending order ** *`timestamp_field` (Optional, string)*: Field containing event timestamp. Default "@timestamp" ** *`fetch_size` (Optional, number)*: Maximum number of events to search at a time for sequence queries. -** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type } | { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type }[])*: Query, written in Query DSL, used to filter the events on which the EQL query runs. +** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type } | { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type }[])*: Query, written in Query DSL, used to filter the events on which the EQL query runs. ** *`keep_alive` (Optional, string | -1 | 0)* ** *`keep_on_completion` (Optional, boolean)* ** *`wait_for_completion_timeout` (Optional, string | -1 | 0)* +** *`allow_partial_search_results` (Optional, boolean)*: Allow query execution also in case of shard failures. +If true, the query will keep running and will return results based on the available shards. +For sequences, the behavior can be further refined using allow_partial_sequence_results +** *`allow_partial_sequence_results` (Optional, boolean)*: This flag applies only to sequences and has effect only if allow_partial_search_results=true. +If true, the sequence query will return results based on the available shards, ignoring the others. +If false, the sequence query will return successfully, but will always have empty results. ** *`size` (Optional, number)*: For basic queries, the maximum number of matching events to return. Defaults to 10 ** *`fields` (Optional, { field, format, include_unmapped } | { field, format, include_unmapped }[])*: Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. ** *`result_position` (Optional, Enum("tail" | "head"))* -** *`runtime_mappings` (Optional, Record)* +** *`runtime_mappings` (Optional, Record)* +** *`max_samples_per_key` (Optional, number)*: By default, the response of a sample query contains up to `10` samples, with one sample per unique set of join keys. Use the `size` +parameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the +`max_samples_per_key` parameter. Pipes are not supported for sample queries. ** *`allow_no_indices` (Optional, boolean)* ** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])* ** *`ignore_unavailable` (Optional, boolean)*: If true, missing or closed indices are not included in the response. @@ -3520,29 +5056,131 @@ client.eql.search({ index, query }) === esql [discrete] ==== async_query -Executes an ESQL request asynchronously +Run an async ES|QL query. +Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. + +The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. {ref}/esql-async-query-api.html[Endpoint documentation] [source,ts] ---- -client.esql.asyncQuery() +client.esql.asyncQuery({ query }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`query` (string)*: The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. +** *`columnar` (Optional, boolean)*: By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. +** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. +** *`locale` (Optional, string)* +** *`params` (Optional, number | number | string | boolean | null | User-defined value[])*: To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. +** *`profile` (Optional, boolean)*: If provided and `true` the response will include an extra `profile` object +with information on how the query was executed. This information is for human debugging +and its format can change at any time but it can give some insight into the performance +of each part of the query. +** *`tables` (Optional, Record>)*: Tables to use with the LOOKUP operation. The top level key is the table +name and the next level key is the column name. +** *`include_ccs_metadata` (Optional, boolean)*: When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` +object with information about the clusters that participated in the search along with info such as shards +count. +** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: The period to wait for the request to finish. +By default, the request waits for 1 second for the query results. +If the query completes during this period, results are returned +Otherwise, a query ID is returned that can later be used to retrieve the results. +** *`delimiter` (Optional, string)*: The character to use between values within a CSV row. +It is valid only for the CSV format. +** *`drop_null_columns` (Optional, boolean)*: Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results. +If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns. +** *`format` (Optional, Enum("csv" | "json" | "tsv" | "txt" | "yaml" | "cbor" | "smile" | "arrow"))*: A short version of the Accept header, for example `json` or `yaml`. +** *`keep_alive` (Optional, string | -1 | 0)*: The period for which the query and its results are stored in the cluster. +The default period is five days. +When this period expires, the query and its results are deleted, even if the query is still ongoing. +If the `keep_on_completion` parameter is false, Elasticsearch only stores async queries that do not complete within the period set by the `wait_for_completion_timeout` parameter, regardless of this value. +** *`keep_on_completion` (Optional, boolean)*: Indicates whether the query and its results are stored in the cluster. +If false, the query and its results are stored in the cluster only if the request does not complete during the period set by the `wait_for_completion_timeout` parameter. + +[discrete] +==== async_query_delete +Delete an async ES|QL query. +If the query is still running, it is cancelled. +Otherwise, the stored results are deleted. + +If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: + +* The authenticated user that submitted the original query request +* Users with the `cancel_task` cluster privilege + +{ref}/esql-async-query-delete-api.html[Endpoint documentation] +[source,ts] +---- +client.esql.asyncQueryDelete({ id }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`id` (string)*: The unique identifier of the query. +A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. +A query ID is also provided when the request was submitted with the `keep_on_completion` parameter set to `true`. [discrete] ==== async_query_get -Retrieves the results of a previously submitted async query request given its ID. +Get async ES|QL query results. +Get the current status and available results or stored results for an ES|QL asynchronous query. +If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. {ref}/esql-async-query-get-api.html[Endpoint documentation] [source,ts] ---- -client.esql.asyncQueryGet() +client.esql.asyncQueryGet({ id }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`id` (string)*: The unique identifier of the query. +A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. +A query ID is also provided when the request was submitted with the `keep_on_completion` parameter set to `true`. +** *`drop_null_columns` (Optional, boolean)*: Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results. +If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns. +** *`keep_alive` (Optional, string | -1 | 0)*: The period for which the query and its results are stored in the cluster. +When this period expires, the query and its results are deleted, even if the query is still ongoing. +** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: The period to wait for the request to finish. +By default, the request waits for complete query results. +If the request completes during the period specified in this parameter, complete query results are returned. +Otherwise, the response returns an `is_running` value of `true` and no results. + +[discrete] +==== async_query_stop +Stop async ES|QL query. + +This API interrupts the query execution and returns the results so far. +If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it. + +{ref}/esql-async-query-stop-api.html[Endpoint documentation] +[source,ts] +---- +client.esql.asyncQueryStop({ id }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`id` (string)*: The unique identifier of the query. +A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. +A query ID is also provided when the request was submitted with the `keep_on_completion` parameter set to `true`. +** *`drop_null_columns` (Optional, boolean)*: Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results. +If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns. [discrete] ==== query -Executes an ES|QL request +Run an ES|QL query. +Get search results for an ES|QL (Elasticsearch query language) query. {ref}/esql-rest.html[Endpoint documentation] [source,ts] @@ -3556,7 +5194,7 @@ client.esql.query({ query }) * *Request (object):* ** *`query` (string)*: The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. ** *`columnar` (Optional, boolean)*: By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. -** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. +** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. ** *`locale` (Optional, string)* ** *`params` (Optional, number | number | string | boolean | null | User-defined value[])*: To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. ** *`profile` (Optional, boolean)*: If provided and `true` the response will include an extra `profile` object @@ -3565,7 +5203,10 @@ and its format can change at any time but it can give some insight into the perf of each part of the query. ** *`tables` (Optional, Record>)*: Tables to use with the LOOKUP operation. The top level key is the table name and the next level key is the column name. -** *`format` (Optional, string)*: A short version of the Accept header, e.g. json, yaml. +** *`include_ccs_metadata` (Optional, boolean)*: When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` +object with information about the clusters that participated in the search along with info such as shards +count. +** *`format` (Optional, Enum("csv" | "json" | "tsv" | "txt" | "yaml" | "cbor" | "smile" | "arrow"))*: A short version of the Accept header, e.g. json, yaml. ** *`delimiter` (Optional, string)*: The character to use between values within a CSV row. Only valid for the CSV format. ** *`drop_null_columns` (Optional, boolean)*: Should columns that are entirely `null` be removed from the `columns` and `values` portion of the results? Defaults to `false`. If `true` then the response will include an extra section under the name `all_columns` which has the name of all columns. @@ -3574,31 +5215,69 @@ Defaults to `false`. If `true` then the response will include an extra section u === features [discrete] ==== get_features -Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot +Get the features. +Get a list of features that can be included in snapshots using the `feature_states` field when creating a snapshot. +You can use this API to determine which feature states to include when taking a snapshot. +By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. + +A feature state includes one or more system indices necessary for a given feature to function. +In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. + +The features listed by this API are a combination of built-in features and features defined by plugins. +In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. {ref}/get-features-api.html[Endpoint documentation] [source,ts] ---- -client.features.getFeatures() +client.features.getFeatures({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== reset_features -Resets the internal state of features, usually by deleting system indices +Reset the features. +Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. -{ref}/modules-snapshots.html[Endpoint documentation] +WARNING: Intended for development and testing use only. Do not reset features on a production cluster. + +Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. +This deletes all state information stored in system indices. + +The response code is HTTP 200 if the state is successfully reset for all features. +It is HTTP 500 if the reset operation failed for any feature. + +Note that select features might provide a way to reset particular system indices. +Using this API resets all features, both those that are built-in and implemented as plugins. + +To list the features that will be affected, use the get features API. + +IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. + +{ref}/reset-features-api.html[Endpoint documentation] [source,ts] ---- -client.features.resetFeatures() +client.features.resetFeatures({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] === fleet [discrete] ==== global_checkpoints -Returns the current global checkpoints for an index. This API is design for internal use by the fleet server project. +Get global checkpoints. + +Get the current global checkpoints for an index. +This API is designed for internal use by the Fleet server project. {ref}/get-global-checkpoints.html[Endpoint documentation] [source,ts] @@ -3625,6 +5304,8 @@ will cause Elasticsearch to immediately return the current global checkpoints. Executes several [fleet searches](https://www.elastic.co/guide/en/elasticsearch/reference/current/fleet-search.html) with a single API request. The API follows the same structure as the [multi search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) API. However, similar to the fleet search API, it supports the wait_for_checkpoints parameter. + +{ref}/fleet-multi-search.html[Endpoint documentation] [source,ts] ---- client.fleet.msearch({ ... }) @@ -3658,6 +5339,8 @@ which is true by default. ==== search The purpose of the fleet search api is to provide a search api where the search will only be executed after provided checkpoint has been processed and is visible for searches inside of Elasticsearch. + +{ref}/fleet-search.html[Endpoint documentation] [source,ts] ---- client.fleet.search({ index }) @@ -3668,7 +5351,7 @@ client.fleet.search({ index }) * *Request (object):* ** *`index` (string | string)*: A single target to search. If the target is an index alias, it must resolve to a single index. -** *`aggregations` (Optional, Record)* +** *`aggregations` (Optional, Record)* ** *`collapse` (Optional, { field, inner_hits, max_concurrent_group_searches, collapse })* ** *`explain` (Optional, boolean)*: If true, returns detailed information about score computation as part of a hit. ** *`ext` (Optional, Record)*: Configuration of search extensions defined by Elasticsearch plugins. @@ -3685,9 +5368,9 @@ Defaults to 10,000 hits. names matching these patterns in the hits.fields property of the response. ** *`min_score` (Optional, number)*: Minimum _score for matching documents. Documents with a lower _score are not included in the search results. -** *`post_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })* +** *`post_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })* ** *`profile` (Optional, boolean)* -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. ** *`rescore` (Optional, { window_size, query, learning_to_rank } | { window_size, query, learning_to_rank }[])* ** *`script_fields` (Optional, Record)*: Retrieve a script evaluation (based on different fields) for each hit. ** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])* @@ -3717,7 +5400,7 @@ parameter defaults to false. You can pass _source: true to return both source fi and stored fields in the search response. ** *`pit` (Optional, { id, keep_alive })*: Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. -** *`runtime_mappings` (Optional, Record)*: Defines one or more runtime fields in the search request. These fields take +** *`runtime_mappings` (Optional, Record)*: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. ** *`stats` (Optional, string[])*: Stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using @@ -3761,7 +5444,12 @@ which is true by default. === graph [discrete] ==== explore -Extracts and summarizes information about the documents and terms in an Elasticsearch data stream or index. +Explore graph analytics. +Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. +The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. +An initial request to the `_explore` API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. +Subsequent requests enable you to spider out from one more vertices of interest. +You can exclude vertices that have already been returned. {ref}/graph-explore-api.html[Endpoint documentation] [source,ts] @@ -3776,7 +5464,7 @@ client.graph.explore({ index }) ** *`index` (string | string[])*: Name of the index. ** *`connections` (Optional, { connections, query, vertices })*: Specifies or more fields from which you want to extract terms that are associated with the specified vertices. ** *`controls` (Optional, { sample_diversity, sample_size, timeout, use_significance })*: Direct the Graph API how to build the graph. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: A seed query that identifies the documents of interest. Can be any valid Elasticsearch query. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: A seed query that identifies the documents of interest. Can be any valid Elasticsearch query. ** *`vertices` (Optional, { exclude, field, include, min_doc_count, shard_min_doc_count, size }[])*: Specifies one or more fields that contain the terms you want to include in the graph as vertices. ** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. ** *`timeout` (Optional, string | -1 | 0)*: Specifies the period of time to wait for a response from each shard. @@ -3787,7 +5475,8 @@ Defaults to no timeout. === ilm [discrete] ==== delete_lifecycle -Deletes the specified lifecycle policy definition. You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. +Delete a lifecycle policy. +You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. {ref}/ilm-delete-lifecycle.html[Endpoint documentation] [source,ts] @@ -3805,7 +5494,11 @@ client.ilm.deleteLifecycle({ policy }) [discrete] ==== explain_lifecycle -Retrieves information about the index’s current lifecycle state, such as the currently executing phase, action, and step. Shows when the index entered each one, the definition of the running phase, and information about any failures. +Explain the lifecycle state. +Get the current lifecycle status for one or more indices. +For data streams, the API retrieves the current lifecycle status for the stream's backing indices. + +The response indicates when the index entered each lifecycle state, provides the definition of the running phase, and information about any failures. {ref}/ilm-explain-lifecycle.html[Endpoint documentation] [source,ts] @@ -3822,11 +5515,10 @@ To target all data streams and indices, use `*` or `_all`. ** *`only_errors` (Optional, boolean)*: Filters the returned indices to only indices that are managed by ILM and are in an error state, either due to an encountering an error while executing the policy, or attempting to use a policy that does not exist. ** *`only_managed` (Optional, boolean)*: Filters the returned indices to only indices that are managed by ILM. ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get_lifecycle -Retrieves a lifecycle policy. +Get lifecycle policies. {ref}/ilm-get-lifecycle.html[Endpoint documentation] [source,ts] @@ -3844,7 +5536,9 @@ client.ilm.getLifecycle({ ... }) [discrete] ==== get_status -Retrieves the current index lifecycle management (ILM) status. +Get the ILM status. + +Get the current index lifecycle management status. {ref}/ilm-get-status.html[Endpoint documentation] [source,ts] @@ -3855,10 +5549,21 @@ client.ilm.getStatus() [discrete] ==== migrate_to_data_tiers -Switches the indices, ILM policies, and legacy, composable and component templates from using custom node attributes and -attribute-based allocation filters to using data tiers, and optionally deletes one legacy index template.+ +Migrate to data tiers routing. +Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. +Optionally, delete one legacy index template. Using node roles enables ILM to automatically move the indices between data tiers. +Migrating away from custom node attributes routing can be manually performed. +This API provides an automated way of performing three out of the four manual steps listed in the migration guide: + +. Stop setting the custom hot attribute on new indices. +. Remove custom allocation settings from existing ILM policies. +. Replace custom allocation settings from existing indices with the corresponding tier preference. + +ILM must be stopped before performing the migration. +Use the stop ILM and get ILM status APIs to wait until the reported operation mode is `STOPPED`. + {ref}/ilm-migrate-to-data-tiers.html[Endpoint documentation] [source,ts] ---- @@ -3876,12 +5581,25 @@ This provides a way to retrieve the indices and ILM policies that need to be mig [discrete] ==== move_to_step -Manually moves an index into the specified step and executes that step. +Move to a lifecycle step. +Manually move an index into a specific step in the lifecycle policy and run that step. + +WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. + +You must specify both the current step and the step to be executed in the body of the request. +The request will fail if the current step does not match the step currently running for the index +This is to prevent the index from being moved from an unexpected step into the next step. + +When specifying the target (`next_step`) to which the index will be moved, either the name or both the action and name fields are optional. +If only the phase is specified, the index will move to the first step of the first action in the target phase. +If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. +Only actions specified in the ILM policy are considered valid. +An index cannot move to a step that is not part of its policy. {ref}/ilm-move-to-step.html[Endpoint documentation] [source,ts] ---- -client.ilm.moveToStep({ index }) +client.ilm.moveToStep({ index, current_step, next_step }) ---- [discrete] @@ -3889,12 +5607,15 @@ client.ilm.moveToStep({ index }) * *Request (object):* ** *`index` (string)*: The name of the index whose lifecycle step is to change -** *`current_step` (Optional, { action, name, phase })* -** *`next_step` (Optional, { action, name, phase })* +** *`current_step` ({ action, name, phase })*: The step that the index is expected to be in. +** *`next_step` ({ action, name, phase })*: The step that you want to run. [discrete] ==== put_lifecycle -Creates a lifecycle policy. If the specified policy exists, the policy is replaced and the policy version is incremented. +Create or update a lifecycle policy. +If the specified policy exists, it is replaced and the policy version is incremented. + +NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. {ref}/ilm-put-lifecycle.html[Endpoint documentation] [source,ts] @@ -3912,7 +5633,9 @@ client.ilm.putLifecycle({ policy }) [discrete] ==== remove_policy -Removes the assigned lifecycle policy and stops managing the specified index +Remove policies from an index. +Remove the assigned lifecycle policies from an index or a data stream's backing indices. +It also stops managing the indices. {ref}/ilm-remove-policy.html[Endpoint documentation] [source,ts] @@ -3928,7 +5651,10 @@ client.ilm.removePolicy({ index }) [discrete] ==== retry -Retries executing the policy for an index that is in the ERROR step. +Retry a policy. +Retry running the lifecycle policy for an index that is in the ERROR step. +The API sets the policy back to the step where the error occurred and runs the step. +Use the explain lifecycle state API to determine whether an index is in the ERROR step. {ref}/ilm-retry-policy.html[Endpoint documentation] [source,ts] @@ -3944,7 +5670,10 @@ client.ilm.retry({ index }) [discrete] ==== start -Start the index lifecycle management (ILM) plugin. +Start the ILM plugin. +Start the index lifecycle management plugin if it is currently stopped. +ILM is started automatically when the cluster is formed. +Restarting ILM is necessary only when it has been stopped using the stop ILM API. {ref}/ilm-start.html[Endpoint documentation] [source,ts] @@ -3956,12 +5685,17 @@ client.ilm.start({ ... }) ==== Arguments * *Request (object):* -** *`master_timeout` (Optional, string | -1 | 0)* -** *`timeout` (Optional, string | -1 | 0)* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== stop -Halts all lifecycle management operations and stops the index lifecycle management (ILM) plugin +Stop the ILM plugin. +Halt all lifecycle management operations and stop the index lifecycle management plugin. +This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. + +The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. +Use the get ILM status API to check whether ILM is running. {ref}/ilm-stop.html[Endpoint documentation] [source,ts] @@ -3973,15 +5707,17 @@ client.ilm.stop({ ... }) ==== Arguments * *Request (object):* -** *`master_timeout` (Optional, string | -1 | 0)* -** *`timeout` (Optional, string | -1 | 0)* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] === indices [discrete] ==== add_block Add an index block. -Limits the operations allowed on an index by blocking specific operation types. + +Add an index block to an index. +Index blocks limit the operations allowed on an index by blocking specific operation types. {ref}/index-modules-blocks.html[Endpoint documentation] [source,ts] @@ -3993,17 +5729,34 @@ client.indices.addBlock({ index, block }) ==== Arguments * *Request (object):* -** *`index` (string)*: A comma separated list of indices to add a block to -** *`block` (Enum("metadata" | "read" | "read_only" | "write"))*: The block to add (one of read, write, read_only or metadata) -** *`allow_no_indices` (Optional, boolean)*: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Whether to expand wildcard expression to concrete indices that are open, closed or both. -** *`ignore_unavailable` (Optional, boolean)*: Whether specified concrete indices should be ignored when unavailable (missing or closed) -** *`master_timeout` (Optional, string | -1 | 0)*: Specify timeout for connection to master -** *`timeout` (Optional, string | -1 | 0)*: Explicit operation timeout +** *`index` (string)*: A list or wildcard expression of index names used to limit the request. +By default, you must explicitly name the indices you are adding blocks to. +To allow the adding of blocks to indices with `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`. +You can update this setting in the `elasticsearch.yml` file or by using the cluster update settings API. +** *`block` (Enum("metadata" | "read" | "read_only" | "write"))*: The block type to add to the index. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. +This behavior applies even if the request targets other open indices. +For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. +If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. +It supports a list of values, such as `open,hidden`. +** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +It can also be set to `-1` to indicate that the request should never timeout. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. +If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. +It can also be set to `-1` to indicate that the request should never timeout. [discrete] ==== analyze -Performs analysis on a text string and returns the resulting tokens. +Get tokens from text analysis. +The analyze API performs analysis on a text string and returns the resulting tokens. + +Generating excessive amount of tokens may cause a node to run out of memory. +The `index.analyze.max_token_count` setting enables you to limit the number of tokens that can be produced. +If more than this limit of tokens gets generated, an error occurs. +The `_analyze` endpoint without a specified index will always use `10000` as its limit. {ref}/indices-analyze.html[Endpoint documentation] [source,ts] @@ -4026,16 +5779,37 @@ This could be a built-in analyzer, or an analyzer that’s been configured in th ** *`field` (Optional, string)*: Field used to derive the analyzer. To use this parameter, you must specify an index. If specified, the `analyzer` parameter overrides this value. -** *`filter` (Optional, string | { type, preserve_original } | { type, common_words, common_words_path, ignore_case, query_mode } | { type, filter, script } | { type, delimiter, encoding } | { type, max_gram, min_gram, side, preserve_original } | { type, articles, articles_path, articles_case } | { type, max_output_size, separator } | { type, dedup, dictionary, locale, longest_only } | { type } | { type, mode, types } | { type, keep_words, keep_words_case, keep_words_path } | { type, ignore_case, keywords, keywords_path, keywords_pattern } | { type } | { type, max, min } | { type, consume_all_tokens, max_token_count } | { type, language } | { type, filters, preserve_original } | { type, max_gram, min_gram, preserve_original } | { type, stoptags } | { type, patterns, preserve_original } | { type, all, flags, pattern, replacement } | { type } | { type, script } | { type } | { type } | { type, filler_token, max_shingle_size, min_shingle_size, output_unigrams, output_unigrams_if_no_shingles, token_separator } | { type, language } | { type, rules, rules_path } | { type, language } | { type, ignore_case, remove_trailing, stopwords, stopwords_path } | { type, expand, format, lenient, synonyms, synonyms_path, synonyms_set, tokenizer, updateable } | { type, expand, format, lenient, synonyms, synonyms_path, synonyms_set, tokenizer, updateable } | { type } | { type, length } | { type, only_on_same_position } | { type } | { type, adjust_offsets, catenate_all, catenate_numbers, catenate_words, generate_number_parts, generate_word_parts, ignore_keywords, preserve_original, protected_words, protected_words_path, split_on_case_change, split_on_numerics, stem_english_possessive, type_table, type_table_path } | { type, catenate_all, catenate_numbers, catenate_words, generate_number_parts, generate_word_parts, preserve_original, protected_words, protected_words_path, split_on_case_change, split_on_numerics, stem_english_possessive, type_table, type_table_path } | { type, minimum_length } | { type, use_romaji } | { type, stoptags } | { type, alternate, case_first, case_level, country, decomposition, hiragana_quaternary_mode, language, numeric, rules, strength, variable_top, variant } | { type, unicode_set_filter } | { type, name } | { type, dir, id } | { type, encoder, languageset, max_code_len, name_type, replace, rule_type } | { type }[])*: Array of token filters used to apply after the tokenizer. +** *`filter` (Optional, string | { type } | { type } | { type, preserve_original } | { type, ignored_scripts, output_unigrams } | { type } | { type } | { type, common_words, common_words_path, ignore_case, query_mode } | { type, filter, script } | { type } | { type, delimiter, encoding } | { type, max_gram, min_gram, side, preserve_original } | { type, articles, articles_path, articles_case } | { type, max_output_size, separator } | { type } | { type } | { type } | { type, dedup, dictionary, locale, longest_only } | { type, hyphenation_patterns_path, no_sub_matches, no_overlapping_matches } | { type } | { type, mode, types } | { type, keep_words, keep_words_case, keep_words_path } | { type, ignore_case, keywords, keywords_path, keywords_pattern } | { type } | { type } | { type, max, min } | { type, consume_all_tokens, max_token_count } | { type, language } | { type, bucket_count, hash_count, hash_set_size, with_rotation } | { type, filters, preserve_original } | { type, max_gram, min_gram, preserve_original } | { type, stoptags } | { type, patterns, preserve_original } | { type, all, pattern, replacement } | { type } | { type } | { type, script } | { type } | { type } | { type } | { type } | { type } | { type, filler_token, max_shingle_size, min_shingle_size, output_unigrams, output_unigrams_if_no_shingles, token_separator } | { type, language } | { type } | { type, rules, rules_path } | { type, language } | { type, ignore_case, remove_trailing, stopwords, stopwords_path } | { type } | { type } | { type } | { type, length } | { type, only_on_same_position } | { type } | { type, adjust_offsets, ignore_keywords } | { type } | { type, stopwords } | { type, minimum_length } | { type, use_romaji } | { type, stoptags } | { type, alternate, case_first, case_level, country, decomposition, hiragana_quaternary_mode, language, numeric, rules, strength, variable_top, variant } | { type, unicode_set_filter } | { type, name } | { type, dir, id } | { type, encoder, languageset, max_code_len, name_type, replace, rule_type } | { type }[])*: Array of token filters used to apply after the tokenizer. ** *`normalizer` (Optional, string)*: Normalizer to use to convert text into a single token. ** *`text` (Optional, string | string[])*: Text to analyze. If an array of strings is provided, it is analyzed as a multi-value field. -** *`tokenizer` (Optional, string | { type, tokenize_on_chars, max_token_length } | { type, custom_token_chars, max_gram, min_gram, token_chars } | { type, buffer_size } | { type } | { type } | { type, custom_token_chars, max_gram, min_gram, token_chars } | { type, decompound_mode, discard_punctuation, user_dictionary, user_dictionary_rules } | { type, buffer_size, delimiter, replacement, reverse, skip } | { type, max_token_length } | { type, max_token_length } | { type, max_token_length } | { type, discard_punctuation, mode, nbest_cost, nbest_examples, user_dictionary, user_dictionary_rules, discard_compound_token } | { type, flags, group, pattern } | { type, rule_files })*: Tokenizer to use to convert text into tokens. +** *`tokenizer` (Optional, string | { type, tokenize_on_chars, max_token_length } | { type, max_token_length } | { type, custom_token_chars, max_gram, min_gram, token_chars } | { type, buffer_size } | { type } | { type } | { type, custom_token_chars, max_gram, min_gram, token_chars } | { type, buffer_size, delimiter, replacement, reverse, skip } | { type, flags, group, pattern } | { type, pattern } | { type, pattern } | { type, max_token_length } | { type } | { type, max_token_length } | { type, max_token_length } | { type, rule_files } | { type, discard_punctuation, mode, nbest_cost, nbest_examples, user_dictionary, user_dictionary_rules, discard_compound_token } | { type, decompound_mode, discard_punctuation, user_dictionary, user_dictionary_rules })*: Tokenizer to use to convert text into tokens. + +[discrete] +==== cancel_migrate_reindex +Cancel a migration reindex operation. + +Cancel a migration reindex attempt for a data stream or index. +[source,ts] +---- +client.indices.cancelMigrateReindex({ index }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`index` (string | string[])*: The index or data stream name [discrete] ==== clear_cache -Clears the caches of one or more indices. -For data streams, the API clears the caches of the stream’s backing indices. +Clear the cache. +Clear the cache of one or more indices. +For data streams, the API clears the caches of the stream's backing indices. + +By default, the clear cache API clears all caches. +To clear only specific caches, use the `fielddata`, `query`, or `request` parameters. +To clear the cache only of specific fields, use the `fields` parameter. {ref}/indices-clearcache.html[Endpoint documentation] [source,ts] @@ -4065,7 +5839,51 @@ Use the `fields` parameter to clear the cache of specific fields only. [discrete] ==== clone -Clones an existing index. +Clone an index. +Clone an existing index into a new index. +Each original primary shard is cloned into a new primary shard in the new index. + +IMPORTANT: Elasticsearch does not apply index templates to the resulting index. +The API also does not copy index metadata from the original index. +Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. +For example, if you clone a CCR follower index, the resulting clone will not be a follower index. + +The clone API copies most index settings from the source index to the resulting index, with the exception of `index.number_of_replicas` and `index.auto_expand_replicas`. +To set the number of replicas in the resulting index, configure these settings in the clone request. + +Cloning works as follows: + +* First, it creates a new target index with the same definition as the source index. +* Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. +* Finally, it recovers the target index as though it were a closed index which had just been re-opened. + +IMPORTANT: Indices can only be cloned if they meet the following requirements: + +* The index must be marked as read-only and have a cluster health status of green. +* The target index must not exist. +* The source index must have the same number of primary shards as the target index. +* The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. + +The current write index on a data stream cannot be cloned. +In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. + +NOTE: Mappings cannot be specified in the `_clone` request. The mappings of the source index will be used for the target index. + +**Monitor the cloning process** + +The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the `wait_for_status` parameter to `yellow`. + +The `_clone` API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. +At this point, all shards are in the state unassigned. +If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. + +Once the primary shard is allocated, it moves to state initializing, and the clone process begins. +When the clone operation completes, the shard will become active. +At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. + +**Wait for active shards** + +Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. {ref}/indices-clone-index.html[Endpoint documentation] [source,ts] @@ -4090,7 +5908,24 @@ Set to `all` or any positive integer up to the total number of shards in the ind [discrete] ==== close -Closes an index. +Close an index. +A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. +It is not possible to index documents or to search for documents in a closed index. +Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. + +When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. +The shards will then go through the normal recovery process. +The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. + +You can open and close multiple indices. +An error is thrown if the request explicitly refers to a missing index. +This behaviour can be turned off using the `ignore_unavailable=true` parameter. + +By default, you must explicitly name the indices you are opening or closing. +To open or close indices with `_all`, `*`, or other wildcard expressions, change the` action.destructive_requires_name` setting to `false`. This setting can also be changed with the cluster update settings API. + +Closed indices consume a significant amount of disk-space which can cause problems in managed environments. +Closing indices can be turned off with the cluster settings API by setting `cluster.indices.close.enable` to `false`. {ref}/indices-close.html[Endpoint documentation] [source,ts] @@ -4120,7 +5955,25 @@ Set to `all` or any positive integer up to the total number of shards in the ind [discrete] ==== create Create an index. -Creates a new index. +You can use the create index API to add a new index to an Elasticsearch cluster. +When creating an index, you can specify the following: + +* Settings for the index. +* Mappings for fields in the index. +* Index aliases + +**Wait for active shards** + +By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. +The index creation response will indicate what happened. +For example, `acknowledged` indicates whether the index was successfully created in the cluster, `while shards_acknowledged` indicates whether the requisite number of shard copies were started for each shard in the index before timing out. +Note that it is still possible for either `acknowledged` or `shards_acknowledged` to be `false`, but for the index creation to be successful. +These values simply indicate whether the operation completed before the timeout. +If `acknowledged` is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. +If `shards_acknowledged` is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, `acknowledged` is `true`). + +You can change the default of only waiting for the primary shards to start through the index setting `index.write.wait_for_active_shards`. +Note that changing this setting will also affect the `wait_for_active_shards` value on all subsequent write operations. {ref}/indices-create-index.html[Endpoint documentation] [source,ts] @@ -4149,10 +6002,10 @@ Set to `all` or any positive integer up to the total number of shards in the ind [discrete] ==== create_data_stream Create a data stream. -Creates a data stream. + You must have a matching index template with data stream enabled. -{ref}/data-streams.html[Endpoint documentation] +{ref}/indices-create-data-stream.html[Endpoint documentation] [source,ts] ---- client.indices.createDataStream({ name }) @@ -4171,12 +6024,31 @@ Cannot be longer than 255 bytes. Multi-byte characters count towards this limit ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. ** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. +[discrete] +==== create_from +Create an index from a source index. + +Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values. +[source,ts] +---- +client.indices.createFrom({ source, dest }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`source` (string)*: The source index or data stream name +** *`dest` (string)*: The destination index or data stream name +** *`create_from` (Optional, { mappings_override, settings_override, remove_index_blocks })* + [discrete] ==== data_streams_stats Get data stream stats. -Retrieves statistics for one or more data streams. -{ref}/data-streams.html[Endpoint documentation] +Get statistics for one or more data streams. + +{ref}/data-stream-stats-api.html[Endpoint documentation] [source,ts] ---- client.indices.dataStreamsStats({ ... }) @@ -4195,7 +6067,12 @@ Supports a list of values, such as `open,hidden`. [discrete] ==== delete Delete indices. -Deletes one or more indices. +Deleting an index deletes its documents, shards, and metadata. +It does not delete related Kibana components, such as data views, visualizations, or dashboards. + +You cannot delete the current write index of a data stream. +To delete the index, you must roll over the data stream so a new write index is created. +You can then use the delete index API to delete the previous write index. {ref}/indices-delete-index.html[Endpoint documentation] [source,ts] @@ -4228,7 +6105,7 @@ If no response is received before the timeout expires, the request fails and ret Delete an alias. Removes a data stream or index from an alias. -{ref}/indices-aliases.html[Endpoint documentation] +{ref}/indices-delete-alias.html[Endpoint documentation] [source,ts] ---- client.indices.deleteAlias({ index, name }) @@ -4272,7 +6149,7 @@ client.indices.deleteDataLifecycle({ name }) Delete data streams. Deletes one or more data streams and their backing indices. -{ref}/data-streams.html[Endpoint documentation] +{ref}/indices-delete-data-stream.html[Endpoint documentation] [source,ts] ---- client.indices.deleteDataStream({ name }) @@ -4309,7 +6186,7 @@ client.indices.deleteIndexTemplate({ name }) [discrete] ==== delete_template -Deletes a legacy index template. +Delete a legacy index template. {ref}/indices-delete-template-v1.html[Endpoint documentation] [source,ts] @@ -4330,7 +6207,14 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== disk_usage -Analyzes the disk usage of each field of an index or data stream. +Analyze the index disk usage. +Analyze the disk usage of each field of an index or data stream. +This API might not support indices created in previous Elasticsearch versions. +The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. + +NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index `store_size` value because some small metadata files are ignored and some parts of data files might not be scanned by the API. +Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. +The stored size of the `_id` field is likely underestimated while the `_source` field is overestimated. {ref}/indices-disk-usage.html[Endpoint documentation] [source,ts] @@ -4358,7 +6242,14 @@ To use the API, this parameter must be set to `true`. [discrete] ==== downsample -Aggregates a time series (TSDS) index and stores pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval. +Downsample an index. +Aggregate a time series (TSDS) index and store pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval. +For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. +All documents within an hour interval are summarized and stored as a single document in the downsample index. + +NOTE: Only indices in a time series data stream are supported. +Neither field nor document level security can be defined on the source index. +The source index must be read only (`index.blocks.write: true`). {ref}/indices-downsample-data-stream.html[Endpoint documentation] [source,ts] @@ -4377,7 +6268,7 @@ client.indices.downsample({ index, target_index }) [discrete] ==== exists Check indices. -Checks if one or more indices, index aliases, or data streams exist. +Check if one or more indices, index aliases, or data streams exist. {ref}/indices-exists.html[Endpoint documentation] [source,ts] @@ -4404,9 +6295,10 @@ Valid values are: `all`, `open`, `closed`, `hidden`, `none`. [discrete] ==== exists_alias Check aliases. -Checks if one or more data stream or index aliases exist. -{ref}/indices-aliases.html[Endpoint documentation] +Check if one or more data stream or index aliases exist. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-exists-alias[Endpoint documentation] [source,ts] ---- client.indices.existsAlias({ name }) @@ -4430,9 +6322,11 @@ Valid values are: `all`, `open`, `closed`, `hidden`, `none`. [discrete] ==== exists_index_template -Returns information about whether a particular index template exists. +Check index templates. + +Check whether index templates exist. -{ref}/index-templates.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-exists-index-template[Endpoint documentation] [source,ts] ---- client.indices.existsIndexTemplate({ name }) @@ -4443,12 +6337,17 @@ client.indices.existsIndexTemplate({ name }) * *Request (object):* ** *`name` (string)*: List of index template names used to limit the request. Wildcard (*) expressions are supported. +** *`local` (Optional, boolean)*: If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. +** *`flat_settings` (Optional, boolean)*: If true, returns settings in flat format. ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== exists_template Check existence of index templates. -Returns information about whether a particular index template exists. +Get information about whether index templates exist. +Index templates define settings, mappings, and aliases that can be applied automatically to new indices. + +IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. {ref}/indices-template-exists-v1.html[Endpoint documentation] [source,ts] @@ -4460,15 +6359,18 @@ client.indices.existsTemplate({ name }) ==== Arguments * *Request (object):* -** *`name` (string | string[])*: The comma separated names of the index templates -** *`flat_settings` (Optional, boolean)*: Return settings in flat format (default: false) -** *`local` (Optional, boolean)*: Return local information, do not retrieve the state from master node (default: false) -** *`master_timeout` (Optional, string | -1 | 0)*: Explicit operation timeout for connection to master node +** *`name` (string | string[])*: A list of index template names used to limit the request. +Wildcard (`*`) expressions are supported. +** *`flat_settings` (Optional, boolean)*: Indicates whether to use a flat format for the response. +** *`local` (Optional, boolean)*: Indicates whether to get information from the local node only. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. [discrete] ==== explain_data_lifecycle Get the status for a data stream lifecycle. -Retrieves information about an index or data stream’s current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. +Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. {ref}/data-streams-explain-lifecycle.html[Endpoint documentation] [source,ts] @@ -4486,7 +6388,13 @@ client.indices.explainDataLifecycle({ index }) [discrete] ==== field_usage_stats -Returns field usage information for each shard and field of an index. +Get field usage stats. +Get field usage information for each shard and field of an index. +Field usage statistics are automatically captured when queries are running on a cluster. +A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. + +The response body reports the per-shard usage count of the data structures that back the fields in the index. +A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. {ref}/field-usage-stats.html[Endpoint documentation] [source,ts] @@ -4507,16 +6415,20 @@ If the request can target data streams, this argument determines whether wildcar Supports a list of values, such as `open,hidden`. ** *`ignore_unavailable` (Optional, boolean)*: If `true`, missing or closed indices are not included in the response. ** *`fields` (Optional, string | string[])*: List or wildcard expressions of fields to include in the statistics. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. -If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. -If no response is received before the timeout expires, the request fails and returns an error. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). [discrete] ==== flush -Flushes one or more data streams or indices. +Flush data streams or indices. +Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. +When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. +Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. + +After each operation has been flushed it is permanently stored in the Lucene index. +This may mean that there is no need to maintain an additional copy of it in the transaction log. +The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. + +It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. +If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. {ref}/indices-flush.html[Endpoint documentation] [source,ts] @@ -4544,7 +6456,59 @@ If `false`, Elasticsearch returns an error if you request a flush when another f [discrete] ==== forcemerge -Performs the force merge operation on one or more indices. +Force a merge. +Perform the force merge operation on the shards of one or more indices. +For data streams, the API forces a merge on the shards of the stream's backing indices. + +Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. +Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. + +WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). +When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". +These soft-deleted documents are automatically cleaned up during regular segment merges. +But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. +So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. +If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. + +**Blocks during a force merge** + +Calls to this API block until the merge is complete (unless request contains `wait_for_completion=false`). +If the client connection is lost before completion then the force merge process will continue in the background. +Any new requests to force merge the same indices will also block until the ongoing force merge is complete. + +**Running force merge asynchronously** + +If the request contains `wait_for_completion=false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. +However, you can not cancel this task as the force merge task is not cancelable. +Elasticsearch creates a record of this task as a document at `_tasks/`. +When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. + +**Force merging multiple indices** + +You can force merge multiple indices with a single request by targeting: + +* One or more data streams that contain multiple backing indices +* Multiple indices +* One or more aliases +* All data streams and indices in a cluster + +Each targeted shard is force-merged separately using the force_merge threadpool. +By default each node only has a single `force_merge` thread which means that the shards on that node are force-merged one at a time. +If you expand the `force_merge` threadpool on a node then it will force merge its shards in parallel + +Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case `max_num_segments parameter` is set to `1`, to rewrite all segments into a new one. + +**Data streams and time-based indices** + +Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. +In these cases, each index only receives indexing traffic for a certain period of time. +Once an index receive no more writes, its shards can be force-merged to a single segment. +This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. +For example: + +---- +POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 +---- {ref}/indices-forcemerge.html[Endpoint documentation] [source,ts] @@ -4568,7 +6532,7 @@ client.indices.forcemerge({ ... }) [discrete] ==== get Get index information. -Returns information about one or more indices. For data streams, the API returns information about the +Get information about one or more indices. For data streams, the API returns information about the stream’s backing indices. {ref}/indices-get-index.html[Endpoint documentation] @@ -4601,7 +6565,7 @@ such as open,hidden. Get aliases. Retrieves information for one or more data stream or index aliases. -{ref}/indices-aliases.html[Endpoint documentation] +{ref}/indices-get-alias.html[Endpoint documentation] [source,ts] ---- client.indices.getAlias({ ... }) @@ -4629,7 +6593,8 @@ Valid values are: `all`, `open`, `closed`, `hidden`, `none`. [discrete] ==== get_data_lifecycle Get data stream lifecycles. -Retrieves the data stream lifecycle configuration of one or more data streams. + +Get the data stream lifecycle configuration of one or more data streams. {ref}/data-streams-get-lifecycle.html[Endpoint documentation] [source,ts] @@ -4650,12 +6615,25 @@ Valid values are: `all`, `open`, `closed`, `hidden`, `none`. ** *`include_defaults` (Optional, boolean)*: If `true`, return all default settings in the response. ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. +[discrete] +==== get_data_lifecycle_stats +Get data stream lifecycle stats. +Get statistics about the data streams that are managed by a data stream lifecycle. + +{ref}/data-streams-get-lifecycle-stats.html[Endpoint documentation] +[source,ts] +---- +client.indices.getDataLifecycleStats() +---- + + [discrete] ==== get_data_stream Get data streams. -Retrieves information about one or more data streams. -{ref}/data-streams.html[Endpoint documentation] +Get information about one or more data streams. + +{ref}/indices-get-data-stream.html[Endpoint documentation] [source,ts] ---- client.indices.getDataStream({ ... }) @@ -4671,6 +6649,7 @@ Wildcard (`*`) expressions are supported. If omitted, all data streams are retur Supports a list of values, such as `open,hidden`. ** *`include_defaults` (Optional, boolean)*: If true, returns all relevant default configurations for the index template. ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. +** *`verbose` (Optional, boolean)*: Whether the maximum timestamp for each data stream should be calculated and returned. [discrete] ==== get_field_mapping @@ -4678,6 +6657,8 @@ Get mapping definitions. Retrieves mapping definitions for one or more fields. For data streams, the API retrieves field mappings for the stream’s backing indices. +This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. + {ref}/indices-get-field-mapping.html[Endpoint documentation] [source,ts] ---- @@ -4689,6 +6670,7 @@ client.indices.getFieldMapping({ fields }) * *Request (object):* ** *`fields` (string | string[])*: List or wildcard expression of fields used to limit returned information. +Supports wildcards (`*`). ** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. @@ -4705,7 +6687,7 @@ Valid values are: `all`, `open`, `closed`, `hidden`, `none`. [discrete] ==== get_index_template Get index templates. -Returns information about one or more index templates. +Get information about one or more index templates. {ref}/indices-get-template.html[Endpoint documentation] [source,ts] @@ -4726,7 +6708,6 @@ client.indices.getIndexTemplate({ ... }) [discrete] ==== get_mapping Get mapping definitions. -Retrieves mapping definitions for one or more indices. For data streams, the API retrieves mappings for the stream’s backing indices. {ref}/indices-get-mapping.html[Endpoint documentation] @@ -4754,27 +6735,43 @@ Valid values are: `all`, `open`, `closed`, `hidden`, `none`. If no response is received before the timeout expires, the request fails and returns an error. [discrete] -==== get_settings -Get index settings. -Returns setting information for one or more indices. For data streams, -returns setting information for the stream’s backing indices. +==== get_migrate_reindex_status +Get the migration reindexing status. -{ref}/indices-get-settings.html[Endpoint documentation] +Get the status of a migration reindex attempt for a data stream or index. [source,ts] ---- -client.indices.getSettings({ ... }) +client.indices.getMigrateReindexStatus({ index }) ---- [discrete] ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases used to limit -the request. Supports wildcards (`*`). To target all data streams and -indices, omit this parameter or use `*` or `_all`. -** *`name` (Optional, string | string[])*: List or wildcard expression of settings to retrieve. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index -alias, or `_all` value targets only missing or closed indices. This +** *`index` (string | string[])*: The index or data stream name. + +[discrete] +==== get_settings +Get index settings. +Get setting information for one or more indices. +For data streams, it returns setting information for the stream's backing indices. + +{ref}/indices-get-settings.html[Endpoint documentation] +[source,ts] +---- +client.indices.getSettings({ ... }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases used to limit +the request. Supports wildcards (`*`). To target all data streams and +indices, omit this parameter or use `*` or `_all`. +** *`name` (Optional, string | string[])*: List or wildcard expression of settings to retrieve. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index +alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with `bar`. @@ -4793,7 +6790,9 @@ error. [discrete] ==== get_template Get index templates. -Retrieves information about one or more index templates. +Get information about one or more index templates. + +IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. {ref}/indices-get-template-v1.html[Endpoint documentation] [source,ts] @@ -4813,6 +6812,24 @@ To return all index templates, omit this parameter or use a value of `_all` or ` ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. +[discrete] +==== migrate_reindex +Reindex legacy backing indices. + +Reindex all legacy backing indices for a data stream. +This operation occurs in a persistent task. +The persistent task ID is returned immediately and the reindexing work is completed in that task. +[source,ts] +---- +client.indices.migrateReindex({ ... }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`reindex` (Optional, { mode, source })* + [discrete] ==== migrate_to_data_stream Convert an index alias to a data stream. @@ -4827,7 +6844,7 @@ If successful, the request removes the alias and creates a data stream with the The indices for the alias become hidden backing indices for the stream. The write index for the alias becomes the write index for the stream. -{ref}/data-streams.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-migrate-to-data-stream[Endpoint documentation] [source,ts] ---- client.indices.migrateToDataStream({ name }) @@ -4846,7 +6863,7 @@ client.indices.migrateToDataStream({ name }) Update data streams. Performs one or more data stream modification actions in a single atomic operation. -{ref}/data-streams.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-modify-data-stream[Endpoint documentation] [source,ts] ---- client.indices.modifyDataStream({ actions }) @@ -4860,9 +6877,30 @@ client.indices.modifyDataStream({ actions }) [discrete] ==== open -Opens a closed index. +Open a closed index. For data streams, the API opens any closed backing indices. +A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. +It is not possible to index documents or to search for documents in a closed index. +This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. + +When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. +The shards will then go through the normal recovery process. +The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. + +You can open and close multiple indices. +An error is thrown if the request explicitly refers to a missing index. +This behavior can be turned off by using the `ignore_unavailable=true` parameter. + +By default, you must explicitly name the indices you are opening or closing. +To open or close indices with `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`. +This setting can also be changed with the cluster update settings API. + +Closed indices consume a significant amount of disk-space which can cause problems in managed environments. +Closing indices can be turned off with the cluster settings API by setting `cluster.indices.close.enable` to `false`. + +Because opening or closing an index allocates its shards, the `wait_for_active_shards` setting on index creation applies to the `_open` and `_close` index actions as well. + {ref}/indices-open-close.html[Endpoint documentation] [source,ts] ---- @@ -4894,9 +6932,19 @@ Set to `all` or any positive integer up to the total number of shards in the ind [discrete] ==== promote_data_stream -Promotes a data stream from a replicated data stream managed by CCR to a regular data stream +Promote a data stream. +Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. + +With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. +These data streams can't be rolled over in the local cluster. +These replicated data streams roll over only if the upstream data stream rolls over. +In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. -{ref}/data-streams.html[Endpoint documentation] +NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. +If this is missing, the data stream will not be able to roll over until a matching index template is created. +This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-promote-data-stream[Endpoint documentation] [source,ts] ---- client.indices.promoteDataStream({ name }) @@ -4914,7 +6962,7 @@ client.indices.promoteDataStream({ name }) Create or update an alias. Adds a data stream or index to an alias. -{ref}/indices-aliases.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-put-alias[Endpoint documentation] [source,ts] ---- client.indices.putAlias({ index, name }) @@ -4930,7 +6978,7 @@ Wildcard patterns that match both data streams and indices return an error. ** *`name` (string)*: Alias to update. If the alias doesn’t exist, the request creates it. Index alias names support date math. -** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Query used to limit documents the alias can access. +** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Query used to limit documents the alias can access. ** *`index_routing` (Optional, string)*: Value used to route indexing operations to a specific shard. If specified, this overwrites the `routing` value for indexing operations. Data stream aliases don’t support this parameter. @@ -4953,7 +7001,7 @@ If no response is received before the timeout expires, the request fails and ret Update data stream lifecycles. Update the data stream lifecycle of the specified data streams. -{ref}/data-streams-put-lifecycle.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-put-data-lifecycle[Endpoint documentation] [source,ts] ---- client.indices.putDataLifecycle({ name }) @@ -4969,8 +7017,9 @@ To target all data streams use `*` or `_all`. ** *`data_retention` (Optional, string | -1 | 0)*: If defined, every document added to this data stream will be stored at least for this time frame. Any time after this duration the document could be deleted. When empty, every document in this data stream will be stored indefinitely. -** *`downsampling` (Optional, { rounds })*: If defined, every backing index will execute the configured downsampling configuration after the backing -index is not the data stream write index anymore. +** *`downsampling` (Optional, { rounds })*: The downsampling configuration to execute for the managed backing index after rollover. +** *`enabled` (Optional, boolean)*: If defined, it turns data stream lifecycle on/off (`true`/`false`) for this data stream. A data stream lifecycle +that's disabled (enabled: `false`) will have no effect on the data stream. ** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of data stream that wildcard patterns can match. Supports a list of values, such as `open,hidden`. Valid values are: `all`, `hidden`, `open`, `closed`, `none`. @@ -4985,7 +7034,33 @@ If no response is received before the timeout expires, the request fails and ret Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices. -{ref}/indices-put-template.html[Endpoint documentation] +Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. +Index templates are applied during data stream or index creation. +For data streams, these settings and mappings are applied when the stream's backing indices are created. +Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. +Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. + +You can use C-style `/* *\/` block comments in index templates. +You can include comments anywhere in the request body, except before the opening curly bracket. + +**Multiple matching templates** + +If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. + +Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. + +**Composing aliases, mappings, and settings** + +When multiple component templates are specified in the `composed_of` field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. +Any mappings, settings, or aliases from the parent index template are merged in next. +Finally, any configuration on the index request itself is merged. +Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. +If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. +This recursive merging strategy applies not only to field mappings, but also root options like `dynamic_templates` and `meta`. +If an earlier component contains a `dynamic_templates` block, then by default new `dynamic_templates` entries are appended onto the end. +If an entry already exists with the same key, then it is overwritten by the new definition. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-put-index-template[Endpoint documentation] [source,ts] ---- client.indices.putIndexTemplate({ name }) @@ -5001,7 +7076,7 @@ client.indices.putIndexTemplate({ name }) Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. ** *`template` (Optional, { aliases, mappings, settings, lifecycle })*: Template to be applied. It may optionally include an `aliases`, `mappings`, or `settings` configuration. -** *`data_stream` (Optional, { hidden })*: If this object is included, the template is used to create data streams and their backing indices. +** *`data_stream` (Optional, { hidden, allow_custom_routing })*: If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. Data streams require a matching index template with a `data_stream` object. ** *`priority` (Optional, number)*: Priority to determine index template precedence when a new data stream or index is created. @@ -5010,9 +7085,13 @@ If no priority is specified the template is treated as though it is of priority This number is not automatically generated by Elasticsearch. ** *`version` (Optional, number)*: Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. +External systems can use these version numbers to simplify template management. +To unset a version, replace the template without specifying one. ** *`_meta` (Optional, Record)*: Optional user metadata about the index template. -May have any contents. -This map is not automatically generated by Elasticsearch. +It may have any contents. +It is not automatically generated or used by Elasticsearch. +This user-defined object is stored in the cluster state, so keeping it short is preferable +To unset the metadata, replace the template without specifying it. ** *`allow_auto_create` (Optional, boolean)*: This setting overrides the value of the `action.auto_create_index` cluster setting. If set to `true` in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled via `actions.auto_create_index`. If set to `false`, then indices or data streams matching the template must always be explicitly created, and may never be automatically created. @@ -5028,10 +7107,35 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== put_mapping Update field mappings. -Adds new fields to an existing data stream or index. -You can also use this API to change the search settings of existing fields. +Add new fields to an existing data stream or index. +You can also use this API to change the search settings of existing fields and add new properties to existing object fields. For data streams, these changes are applied to all backing indices by default. +**Add multi-fields to an existing field** + +Multi-fields let you index the same field in different ways. +You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. +WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. +You can populate the new multi-field with the update by query API. + +**Change supported mapping parameters for an existing field** + +The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. +For example, you can use the update mapping API to update the `ignore_above` parameter. + +**Change the mapping of an existing field** + +Except for supported mapping parameters, you can't change the mapping or field type of an existing field. +Changing an existing field could invalidate data that's already indexed. + +If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. +If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. + +**Rename a field** + +Renaming a field would invalidate data already indexed under the old field name. +Instead, add an alias field to create an alternate field name. + {ref}/indices-put-mapping.html[Endpoint documentation] [source,ts] ---- @@ -5048,20 +7152,20 @@ client.indices.putMapping({ index }) ** *`dynamic_date_formats` (Optional, string[])*: If date detection is enabled then new string fields are checked against 'dynamic_date_formats' and if the value matches then a new date field is added instead of string. -** *`dynamic_templates` (Optional, Record | Record[])*: Specify dynamic templates for the mapping. +** *`dynamic_templates` (Optional, Record[])*: Specify dynamic templates for the mapping. ** *`_field_names` (Optional, { enabled })*: Control whether field names are enabled for the index. ** *`_meta` (Optional, Record)*: A mapping type can have custom meta data associated with it. These are not used at all by Elasticsearch, but can be used to store application-specific metadata. ** *`numeric_detection` (Optional, boolean)*: Automatically map strings into numeric data types for all fields. -** *`properties` (Optional, Record)*: Mapping for a field. For new fields, this mapping can include: +** *`properties` (Optional, Record)*: Mapping for a field. For new fields, this mapping can include: - Field name - Field data type - Mapping parameters ** *`_routing` (Optional, { required })*: Enable making a routing value required on indexed documents. ** *`_source` (Optional, { compress, compress_threshold, enabled, excludes, includes, mode })*: Control whether the _source field is enabled on the index. -** *`runtime` (Optional, Record)*: Mapping of runtime fields for the index. +** *`runtime` (Optional, Record)*: Mapping of runtime fields for the index. ** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. ** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. @@ -5078,8 +7182,21 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== put_settings Update index settings. -Changes dynamic index settings in real time. For data streams, index setting -changes are applied to all backing indices by default. +Changes dynamic index settings in real time. +For data streams, index setting changes are applied to all backing indices by default. + +To revert a setting to the default value, use a null value. +The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. +To preserve existing settings from being updated, set the `preserve_existing` parameter to `true`. + +NOTE: You can only define new analyzers on closed indices. +To add an analyzer, you must close the index, define the analyzer, and reopen the index. +You cannot close the write index of a data stream. +To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. +Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. +This affects searches and any new data added to the stream after the rollover. +However, it does not affect the data stream's backing indices or their existing data. +To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. {ref}/indices-update-settings.html[Endpoint documentation] [source,ts] @@ -5110,6 +7227,9 @@ hidden data streams. Supports a list of values, such as received before the timeout expires, the request fails and returns an error. ** *`preserve_existing` (Optional, boolean)*: If `true`, existing index settings remain unchanged. +** *`reopen` (Optional, boolean)*: Whether to close and reopen the index to apply non-dynamic settings. +If set to `true` the indices to which the settings are being applied +will be closed temporarily and then reopened in order to apply the changes. ** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. @@ -5117,6 +7237,25 @@ error. ==== put_template Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices. +Elasticsearch applies templates to new indices based on an index pattern that matches the index name. + +IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. + +Composable templates always take precedence over legacy templates. +If no composable template matches a new index, matching legacy templates are applied according to their order. + +Index templates are only applied during index creation. +Changes to index templates do not affect existing indices. +Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. + +You can use C-style `/* *\/` block comments in index templates. +You can include comments anywhere in the request body, except before the opening curly bracket. + +**Indices matching multiple templates** + +Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. +The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. +NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. {ref}/indices-templates-v1.html[Endpoint documentation] [source,ts] @@ -5141,15 +7280,37 @@ Templates with lower 'order' values are merged first. Templates with higher ** *`settings` (Optional, { index, mode, routing_path, soft_deletes, sort, number_of_shards, number_of_replicas, number_of_routing_shards, check_on_startup, codec, routing_partition_size, load_fixed_bitset_filters_eagerly, hidden, auto_expand_replicas, merge, search, refresh_interval, max_result_window, max_inner_result_window, max_rescore_window, max_docvalue_fields_search, max_script_fields, max_ngram_diff, max_shingle_diff, blocks, max_refresh_listeners, analyze, highlight, max_terms_count, max_regex_length, routing, gc_deletes, default_pipeline, final_pipeline, lifecycle, provided_name, creation_date, creation_date_string, uuid, version, verified_before_close, format, max_slices_per_scroll, translog, query_string, priority, top_metrics_max_size, analysis, settings, time_series, queries, similarity, mapping, indexing.slowlog, indexing_pressure, store })*: Configuration options for the index. ** *`version` (Optional, number)*: Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. +To unset a version, replace the template without specifying one. ** *`create` (Optional, boolean)*: If true, this request cannot replace or update existing index templates. ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. -** *`cause` (Optional, string)* +** *`cause` (Optional, string)*: User defined reason for creating/updating the index template [discrete] ==== recovery -Returns information about ongoing and completed shard recoveries for one or more indices. -For data streams, the API returns information for the stream’s backing indices. +Get index recovery information. +Get information about ongoing and completed shard recoveries for one or more indices. +For data streams, the API returns information for the stream's backing indices. + +All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. + +Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. +When a shard recovery completes, the recovered shard is available for search and indexing. + +Recovery automatically occurs during the following processes: + +* When creating an index for the first time. +* When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. +* Creation of new replica shard copies from the primary. +* Relocation of a shard copy to a different node in the same cluster. +* A snapshot restore operation. +* A clone, shrink, or split operation. + +You can determine the cause of a shard recovery using the recovery or cat recovery APIs. + +The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. +It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. +This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. {ref}/indices-recovery.html[Endpoint documentation] [source,ts] @@ -5173,6 +7334,17 @@ Refresh an index. A refresh makes recent operations performed on one or more indices available for search. For data streams, the API runs the refresh operation on the stream’s backing indices. +By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. +You can change this default interval with the `index.refresh_interval` setting. + +Refresh requests are synchronous and do not return a response until the refresh operation completes. + +Refreshes are resource-intensive. +To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. + +If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's `refresh=wait_for` query parameter option. +This option ensures the indexing operation waits for a periodic refresh before running the search. + {ref}/indices-refresh.html[Endpoint documentation] [source,ts] ---- @@ -5196,7 +7368,20 @@ Valid values are: `all`, `open`, `closed`, `hidden`, `none`. [discrete] ==== reload_search_analyzers -Reloads an index's search analyzers and their resources. +Reload search analyzers. +Reload an index's search analyzers and their resources. +For data streams, the API reloads search analyzers and resources for the stream's backing indices. + +IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. + +You can use the reload search analyzers API to pick up changes to synonym files used in the `synonym_graph` or `synonym` token filter of a search analyzer. +To be eligible, the token filter must have an `updateable` flag of `true` and only be used in search analyzers. + +NOTE: This API does not perform a reload for each shard of an index. +Instead, it performs a reload for each node containing index shards. +As a result, the total shard count returned by the API can differ from the number of index shards. +Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. +This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. {ref}/indices-reload-analyzers.html[Endpoint documentation] [source,ts] @@ -5212,38 +7397,102 @@ client.indices.reloadSearchAnalyzers({ index }) ** *`allow_no_indices` (Optional, boolean)*: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) ** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Whether to expand wildcard expression to concrete indices that are open, closed or both. ** *`ignore_unavailable` (Optional, boolean)*: Whether specified concrete indices should be ignored when unavailable (missing or closed) +** *`resource` (Optional, string)*: Changed resource to reload analyzers from if applicable [discrete] ==== resolve_cluster -Resolves the specified index expressions to return information about each cluster, including -the local cluster, if included. -Multiple patterns and remote clusters are supported. +Resolve the cluster. + +Resolve the specified index expressions to return information about each cluster, including the local "querying" cluster, if included. +If no index expression is provided, the API will return information about all the remote clusters that are configured on the querying cluster. + +This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. + +You use the same index expression with this endpoint as you would for cross-cluster search. +Index and cluster exclusions are also supported with this endpoint. + +For each cluster in the index expression, information is returned about: + +* Whether the querying ("local") cluster is currently connected to each remote cluster specified in the index expression. Note that this endpoint actively attempts to contact the remote clusters, unlike the `remote/info` endpoint. +* Whether each remote cluster is configured with `skip_unavailable` as `true` or `false`. +* Whether there are any indices, aliases, or data streams on that cluster that match the index expression. +* Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). +* Cluster version information, including the Elasticsearch server version. + +For example, `GET /_resolve/cluster/my-index-*,cluster*:my-index-*` returns information about the local cluster and all remotely configured clusters that start with the alias `cluster*`. +Each cluster returns information about whether it has any indices, aliases or data streams that match `my-index-*`. + +## Note on backwards compatibility +The ability to query without an index expression was added in version 8.18, so when +querying remote clusters older than that, the local cluster will send the index +expression `dummy*` to those remote clusters. Thus, if an errors occur, you may see a reference +to that index expression even though you didn't request it. If it causes a problem, you can +instead include an index expression like `*:*` to bypass the issue. + +## Advantages of using this endpoint before a cross-cluster search + +You may want to exclude a cluster or index from a search when: + +* A remote cluster is not currently connected and is configured with `skip_unavailable=false`. Running a cross-cluster search under those conditions will cause the entire search to fail. +* A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is `logs*,remote1:logs*` and the remote1 cluster has no indices, aliases or data streams that match `logs*`. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. +* The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the `_resolve/cluster` response will be present. (This is also where security/permission errors will be shown.) +* A remote cluster is an older version that does not support the feature you want to use in your search. + +## Test availability of remote clusters + +The `remote/info` endpoint is commonly used to test whether the "local" cluster (the cluster being queried) is connected to its remote clusters, but it does not necessarily reflect whether the remote cluster is available or not. +The remote cluster may be available, while the local cluster is not currently connected to it. + +You can use the `_resolve/cluster` API to attempt to reconnect to remote clusters. +For example with `GET _resolve/cluster` or `GET _resolve/cluster/*:*`. +The `connected` field in the response will indicate whether it was successful. +If a connection was (re-)established, this will also cause the `remote/info` endpoint to now indicate a connected status. {ref}/indices-resolve-cluster-api.html[Endpoint documentation] [source,ts] ---- -client.indices.resolveCluster({ name }) +client.indices.resolveCluster({ ... }) ---- [discrete] ==== Arguments * *Request (object):* -** *`name` (string | string[])*: Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. +** *`name` (Optional, string | string[])*: A list of names or index patterns for the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified using the ``:`` syntax. -** *`allow_no_indices` (Optional, boolean)*: If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing +Index and cluster exclusions (e.g., `-cluster1:*`) are also supported. +If no index expression is specified, information about all remote clusters configured on the local cluster +is returned without doing any index matching +** *`allow_no_indices` (Optional, boolean)*: If false, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request -targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. +targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. +NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index +options to the `_resolve/cluster` API endpoint that takes no index expression. ** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. -** *`ignore_throttled` (Optional, boolean)*: If true, concrete, expanded or aliased indices are ignored when frozen. Defaults to false. -** *`ignore_unavailable` (Optional, boolean)*: If false, the request returns an error if it targets a missing or closed index. Defaults to false. +NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index +options to the `_resolve/cluster` API endpoint that takes no index expression. +** *`ignore_throttled` (Optional, boolean)*: If true, concrete, expanded, or aliased indices are ignored when frozen. +NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index +options to the `_resolve/cluster` API endpoint that takes no index expression. +** *`ignore_unavailable` (Optional, boolean)*: If false, the request returns an error if it targets a missing or closed index. +NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index +options to the `_resolve/cluster` API endpoint that takes no index expression. +** *`timeout` (Optional, string | -1 | 0)*: The maximum time to wait for remote clusters to respond. +If a remote cluster does not respond within this timeout period, the API response +will show the cluster as not connected and include an error message that the +request timed out. + +The default timeout is unset and the query can take +as long as the networking layer is configured to wait for remote clusters that are +not responding (typically 30 seconds). [discrete] ==== resolve_index -Resolves the specified name(s) and/or index patterns for indices, aliases, and data streams. +Resolve indices. +Resolve the names and/or index patterns for indices, aliases, and data streams. Multiple patterns and remote clusters are supported. {ref}/indices-resolve-index-api.html[Endpoint documentation] @@ -5262,11 +7511,51 @@ Resources on remote clusters can be specified using the ``:`` syn If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. +This behavior applies even if the request targets other open indices. +For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. [discrete] ==== rollover Roll over to a new index. -Creates a new index for a data stream or index alias. +TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. + +The rollover API creates a new index for a data stream or index alias. +The API behavior depends on the rollover target. + +**Roll over a data stream** + +If you roll over a data stream, the API creates a new write index for the stream. +The stream's previous write index becomes a regular backing index. +A rollover also increments the data stream's generation. + +**Roll over an index alias with a write index** + +TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. +Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. + +If an index alias points to multiple indices, one of the indices must be a write index. +The rollover API creates a new write index for the alias with `is_write_index` set to `true`. +The API also `sets is_write_index` to `false` for the previous write index. + +**Roll over an index alias with one index** + +If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. + +NOTE: A rollover creates a new index and is subject to the `wait_for_active_shards` setting. + +**Increment index names for an alias** + +When you roll over an index alias, you can specify a name for the new index. +If you don't specify a name and the current index ends with `-` and a number, such as `my-index-000001` or `my-index-3`, the new index name increments that number. +For example, if you roll over an alias with a current index of `my-index-000001`, the rollover creates a new index named `my-index-000002`. +This number is always six characters and zero-padded, regardless of the previous index's name. + +If you use an index alias for time series data, you can use date math in the index name to track the rollover date. +For example, you can create an alias that points to an index named ``. +If you create the index on May 6, 2099, the index's name is `my-index-2099.05.06-000001`. +If you roll over the alias on May 7, 2099, the new index's name is `my-index-2099.05.07-000002`. {ref}/indices-rollover-index.html[Endpoint documentation] [source,ts] @@ -5300,11 +7589,14 @@ If no response is received before the timeout expires, the request fails and ret If no response is received before the timeout expires, the request fails and returns an error. ** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +** *`lazy` (Optional, boolean)*: If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. +Only allowed on data streams. [discrete] ==== segments -Returns low-level information about the Lucene segments in index shards. -For data streams, the API returns information about the stream’s backing indices. +Get index segments. +Get low-level information about the Lucene segments in index shards. +For data streams, the API returns information about the stream's backing indices. {ref}/indices-segments.html[Endpoint documentation] [source,ts] @@ -5330,8 +7622,18 @@ Valid values are: `all`, `open`, `closed`, `hidden`, `none`. [discrete] ==== shard_stores -Retrieves store information about replica shards in one or more indices. -For data streams, the API retrieves store information for the stream’s backing indices. +Get index shard stores. +Get store information about replica shards in one or more indices. +For data streams, the API retrieves store information for the stream's backing indices. + +The index shard stores API returns the following information: + +* The node on which each replica shard exists. +* The allocation ID for each replica shard. +* A unique ID for each replica shard. +* Any errors encountered while opening the shard index or from an earlier failure. + +By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. {ref}/indices-shards-stores.html[Endpoint documentation] [source,ts] @@ -5354,7 +7656,38 @@ this argument determines whether wildcard expressions match hidden data streams. [discrete] ==== shrink -Shrinks an existing index into a new index with fewer primary shards. +Shrink an index. +Shrink an index into a new index with fewer primary shards. + +Before you can shrink an index: + +* The index must be read-only. +* A copy of every shard in the index must reside on the same node. +* The index must have a green health status. + +To make shard allocation easier, we recommend you also remove the index's replica shards. +You can later re-add replica shards as part of the shrink operation. + +The requested number of primary shards in the target index must be a factor of the number of shards in the source index. +For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. +If the number of shards in the index is a prime number it can only be shrunk into a single primary shard + Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. + +The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. + +A shrink operation: + +* Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. +* Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. +* Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the `.routing.allocation.initial_recovery._id` index setting. + +IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: + +* The target index must not exist. +* The source index must have more primary shards than the target index. +* The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. +* The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. +* The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. {ref}/indices-shrink-index.html[Endpoint documentation] [source,ts] @@ -5381,7 +7714,7 @@ Set to `all` or any positive integer up to the total number of shards in the ind [discrete] ==== simulate_index_template Simulate an index. -Returns the index configuration that would be applied to the specified index from an existing index template. +Get the index configuration that would be applied to the specified index from an existing index template. {ref}/indices-simulate-index.html[Endpoint documentation] [source,ts] @@ -5394,13 +7727,15 @@ client.indices.simulateIndexTemplate({ name }) * *Request (object):* ** *`name` (string)*: Name of the index to simulate +** *`create` (Optional, boolean)*: Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one +** *`cause` (Optional, string)*: User defined reason for dry-run creating the new template for simulation purposes ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. ** *`include_defaults` (Optional, boolean)*: If true, returns all relevant default configurations for the index template. [discrete] ==== simulate_template Simulate an index template. -Returns the index configuration that would be applied by a particular index template. +Get the index configuration that would be applied by a particular index template. {ref}/indices-simulate-template.html[Endpoint documentation] [source,ts] @@ -5422,7 +7757,7 @@ If set to `false`, then indices or data streams matching the template must alway Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. ** *`template` (Optional, { aliases, mappings, settings, lifecycle })*: Template to be applied. It may optionally include an `aliases`, `mappings`, or `settings` configuration. -** *`data_stream` (Optional, { hidden })*: If this object is included, the template is used to create data streams and their backing indices. +** *`data_stream` (Optional, { hidden, allow_custom_routing })*: If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. Data streams require a matching index template with a `data_stream` object. ** *`priority` (Optional, number)*: Priority to determine index template precedence when a new data stream or index is created. @@ -5439,12 +7774,45 @@ references a component template that might not exist ** *`deprecated` (Optional, boolean)*: Marks this index template as deprecated. When creating or updating a non-deprecated index template that uses deprecated components, Elasticsearch will emit a deprecation warning. ** *`create` (Optional, boolean)*: If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. +** *`cause` (Optional, string)*: User defined reason for dry-run creating the new template for simulation purposes ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. ** *`include_defaults` (Optional, boolean)*: If true, returns all relevant default configurations for the index template. [discrete] ==== split -Splits an existing index into a new index with more primary shards. +Split an index. +Split an index into a new index with more primary shards. +* Before you can split an index: + +* The index must be read-only. +* The cluster health status must be green. + +You can do make an index read-only with the following request using the add index block API: + +---- +PUT /my_source_index/_block/write +---- + +The current write index on a data stream cannot be split. +In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. + +The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the `index.number_of_routing_shards` setting. +The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. +For instance, a 5 shard index with `number_of_routing_shards` set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. + +A split operation: + +* Creates a new target index with the same definition as the source index, but with a larger number of primary shards. +* Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. +* Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. +* Recovers the target index as though it were a closed index which had just been re-opened. + +IMPORTANT: Indices can only be split if they satisfy the following requirements: + +* The target index must not exist. +* The source index must have fewer primary shards than the target index. +* The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. +* The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. {ref}/indices-split-index.html[Endpoint documentation] [source,ts] @@ -5468,132 +7836,818 @@ If no response is received before the timeout expires, the request fails and ret Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). [discrete] -==== stats -Returns statistics for one or more indices. -For data streams, the API retrieves statistics for the stream’s backing indices. +==== stats +Get index statistics. +For data streams, the API retrieves statistics for the stream's backing indices. + +By default, the returned statistics are index-level with `primaries` and `total` aggregations. +`primaries` are the values for only the primary shards. +`total` are the accumulated values for both primary and replica shards. + +To get shard-level statistics, set the `level` parameter to `shards`. + +NOTE: When moving to another node, the shard-level statistics for a shard are cleared. +Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. + +{ref}/indices-stats.html[Endpoint documentation] +[source,ts] +---- +client.indices.stats({ ... }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`metric` (Optional, string | string[])*: Limit the information returned the specific metrics. +** *`index` (Optional, string | string[])*: A list of index names; use `_all` or empty string to perform the operation on all indices +** *`completion_fields` (Optional, string | string[])*: List or wildcard expressions of fields to include in fielddata and suggest statistics. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. If the request can target data streams, this argument +determines whether wildcard expressions match hidden data streams. Supports a list of values, +such as `open,hidden`. +** *`fielddata_fields` (Optional, string | string[])*: List or wildcard expressions of fields to include in fielddata statistics. +** *`fields` (Optional, string | string[])*: List or wildcard expressions of fields to include in the statistics. +** *`forbid_closed_indices` (Optional, boolean)*: If true, statistics are not collected from closed indices. +** *`groups` (Optional, string | string[])*: List of search groups to include in the search statistics. +** *`include_segment_file_sizes` (Optional, boolean)*: If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). +** *`include_unloaded_segments` (Optional, boolean)*: If true, the response includes information from segments that are not loaded into memory. +** *`level` (Optional, Enum("cluster" | "indices" | "shards"))*: Indicates whether statistics are aggregated at the cluster, index, or shard level. + +[discrete] +==== unfreeze +Unfreeze an index. +When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again. + +{ref}/unfreeze-index-api.html[Endpoint documentation] +[source,ts] +---- +client.indices.unfreeze({ index }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`index` (string)*: Identifier for the index. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. +This behavior applies even if the request targets other open indices. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. +If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. +Supports a list of values, such as `open,hidden`. +Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. +** *`wait_for_active_shards` (Optional, string)*: The number of shard copies that must be active before proceeding with the operation. +Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + +[discrete] +==== update_aliases +Create or update an alias. +Adds a data stream or index to an alias. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-update-aliases[Endpoint documentation] +[source,ts] +---- +client.indices.updateAliases({ ... }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`actions` (Optional, { add_backing_index, remove_backing_index }[])*: Actions to perform. +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. + +[discrete] +==== validate_query +Validate a query. +Validates a query without running it. + +{ref}/search-validate.html[Endpoint documentation] +[source,ts] +---- +client.indices.validateQuery({ ... }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases to search. +Supports wildcards (`*`). +To search all data streams or indices, omit this parameter or use `*` or `_all`. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Query in the Lucene query string syntax. +** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. +This behavior applies even if the request targets other open indices. +** *`all_shards` (Optional, boolean)*: If `true`, the validation is executed on all shards instead of one random shard per index. +** *`analyzer` (Optional, string)*: Analyzer to use for the query string. +This parameter can only be used when the `q` query string parameter is specified. +** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. +** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. +** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. +This parameter can only be used when the `q` query string parameter is specified. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. +If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. +Supports a list of values, such as `open,hidden`. +Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +** *`explain` (Optional, boolean)*: If `true`, the response returns detailed information if an error has occurred. +** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. +** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. +** *`rewrite` (Optional, boolean)*: If `true`, returns a more detailed explanation showing the actual Lucene query that will be executed. +** *`q` (Optional, string)*: Query in the Lucene query string syntax. + +[discrete] +=== inference +[discrete] +==== chat_completion_unified +Perform chat completion inference + +{ref}/chat-completion-inference-api.html[Endpoint documentation] +[source,ts] +---- +client.inference.chatCompletionUnified({ inference_id }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`inference_id` (string)*: The inference Id +** *`chat_completion_request` (Optional, { messages, model, max_completion_tokens, stop, temperature, tool_choice, tools, top_p })* +** *`timeout` (Optional, string | -1 | 0)*: Specifies the amount of time to wait for the inference request to complete. + +[discrete] +==== completion +Perform completion inference on the service + +{ref}/post-inference-api.html[Endpoint documentation] +[source,ts] +---- +client.inference.completion({ inference_id, input }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`inference_id` (string)*: The inference Id +** *`input` (string | string[])*: Inference input. +Either a string or an array of strings. +** *`task_settings` (Optional, User-defined value)*: Optional task settings +** *`timeout` (Optional, string | -1 | 0)*: Specifies the amount of time to wait for the inference request to complete. + +[discrete] +==== delete +Delete an inference endpoint + +{ref}/delete-inference-api.html[Endpoint documentation] +[source,ts] +---- +client.inference.delete({ inference_id }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`inference_id` (string)*: The inference identifier. +** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion" | "chat_completion"))*: The task type +** *`dry_run` (Optional, boolean)*: When true, the endpoint is not deleted and a list of ingest processors which reference this endpoint is returned. +** *`force` (Optional, boolean)*: When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields. + +[discrete] +==== get +Get an inference endpoint + +{ref}/get-inference-api.html[Endpoint documentation] +[source,ts] +---- +client.inference.get({ ... }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion" | "chat_completion"))*: The task type +** *`inference_id` (Optional, string)*: The inference Id + +[discrete] +==== inference +Perform inference on the service. + +This API enables you to use machine learning models to perform specific tasks on data that you provide as an input. +It returns a response with the results of the tasks. +The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API. + +For details about using this API with a service, such as Amazon Bedrock, Anthropic, or HuggingFace, refer to the service-specific documentation. + +> info +> The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. + +{ref}/post-inference-api.html[Endpoint documentation] +[source,ts] +---- +client.inference.inference({ inference_id, input }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`inference_id` (string)*: The unique identifier for the inference endpoint. +** *`input` (string | string[])*: The text on which you want to perform the inference task. +It can be a single string or an array. + +> info +> Inference endpoints for the `completion` task type currently only support a single string as input. +** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion" | "chat_completion"))*: The type of inference task that the model performs. +** *`query` (Optional, string)*: The query input, which is required only for the `rerank` task. +It is not required for other tasks. +** *`task_settings` (Optional, User-defined value)*: Task settings for the individual inference request. +These settings are specific to the task type you specified and override the task settings specified when initializing the service. +** *`timeout` (Optional, string | -1 | 0)*: The amount of time to wait for the inference request to complete. + +[discrete] +==== put +Create an inference endpoint. +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. +For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. +However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. + +{ref}/put-inference-api.html[Endpoint documentation] +[source,ts] +---- +client.inference.put({ inference_id }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`inference_id` (string)*: The inference Id +** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion" | "chat_completion"))*: The task type +** *`inference_config` (Optional, { chunking_settings, service, service_settings, task_settings })* + +[discrete] +==== put_alibabacloud +Create an AlibabaCloud AI Search inference endpoint. + +Create an inference endpoint to perform an inference task with the `alibabacloud-ai-search` service. + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-alibabacloud-ai-search.html[Endpoint documentation] +[source,ts] +---- +client.inference.putAlibabacloud({ task_type, alibabacloud_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("completion" | "rerank" | "space_embedding" | "text_embedding"))*: The type of the inference task that the model will perform. +** *`alibabacloud_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("alibabacloud-ai-search"))*: The type of service supported for the specified task type. In this case, `alibabacloud-ai-search`. +** *`service_settings` ({ api_key, host, rate_limit, service_id, workspace })*: Settings used to install the inference model. These settings are specific to the `alibabacloud-ai-search` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { input_type, return_token })*: Settings to configure the inference task. +These settings are specific to the task type you specified. + +[discrete] +==== put_amazonbedrock +Create an Amazon Bedrock inference endpoint. + +Creates an inference endpoint to perform an inference task with the `amazonbedrock` service. + +>info +> You need to provide the access and secret keys only once, during the inference model creation. The get inference API does not retrieve your access or secret keys. After creating the inference model, you cannot change the associated key pairs. If you want to use a different access and secret key pair, delete the inference model and recreate it with the same name and the updated keys. + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-amazon-bedrock.html[Endpoint documentation] +[source,ts] +---- +client.inference.putAmazonbedrock({ task_type, amazonbedrock_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("completion" | "text_embedding"))*: The type of the inference task that the model will perform. +** *`amazonbedrock_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("amazonbedrock"))*: The type of service supported for the specified task type. In this case, `amazonbedrock`. +** *`service_settings` ({ access_key, model, provider, region, rate_limit, secret_key })*: Settings used to install the inference model. These settings are specific to the `amazonbedrock` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { max_new_tokens, temperature, top_k, top_p })*: Settings to configure the inference task. +These settings are specific to the task type you specified. + +[discrete] +==== put_anthropic +Create an Anthropic inference endpoint. + +Create an inference endpoint to perform an inference task with the `anthropic` service. + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-anthropic.html[Endpoint documentation] +[source,ts] +---- +client.inference.putAnthropic({ task_type, anthropic_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("completion"))*: The task type. +The only valid task type for the model to perform is `completion`. +** *`anthropic_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("anthropic"))*: The type of service supported for the specified task type. In this case, `anthropic`. +** *`service_settings` ({ api_key, model_id, rate_limit })*: Settings used to install the inference model. These settings are specific to the `watsonxai` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { max_tokens, temperature, top_k, top_p })*: Settings to configure the inference task. +These settings are specific to the task type you specified. + +[discrete] +==== put_azureaistudio +Create an Azure AI studio inference endpoint. + +Create an inference endpoint to perform an inference task with the `azureaistudio` service. + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-azure-ai-studio.html[Endpoint documentation] +[source,ts] +---- +client.inference.putAzureaistudio({ task_type, azureaistudio_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("completion" | "text_embedding"))*: The type of the inference task that the model will perform. +** *`azureaistudio_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("azureaistudio"))*: The type of service supported for the specified task type. In this case, `azureaistudio`. +** *`service_settings` ({ api_key, endpoint_type, target, provider, rate_limit })*: Settings used to install the inference model. These settings are specific to the `openai` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { do_sample, max_new_tokens, temperature, top_p, user })*: Settings to configure the inference task. +These settings are specific to the task type you specified. + +[discrete] +==== put_azureopenai +Create an Azure OpenAI inference endpoint. + +Create an inference endpoint to perform an inference task with the `azureopenai` service. + +The list of chat completion models that you can choose from in your Azure OpenAI deployment include: + +* [GPT-4 and GPT-4 Turbo models](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#gpt-4-and-gpt-4-turbo-models) +* [GPT-3.5](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#gpt-35) + +The list of embeddings models that you can choose from in your deployment can be found in the [Azure models documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#embeddings). + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-azure-openai.html[Endpoint documentation] +[source,ts] +---- +client.inference.putAzureopenai({ task_type, azureopenai_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("completion" | "text_embedding"))*: The type of the inference task that the model will perform. +NOTE: The `chat_completion` task type only supports streaming and only through the _stream API. +** *`azureopenai_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("azureopenai"))*: The type of service supported for the specified task type. In this case, `azureopenai`. +** *`service_settings` ({ api_key, api_version, deployment_id, entra_id, rate_limit, resource_name })*: Settings used to install the inference model. These settings are specific to the `azureopenai` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { user })*: Settings to configure the inference task. +These settings are specific to the task type you specified. + +[discrete] +==== put_cohere +Create a Cohere inference endpoint. + +Create an inference endpoint to perform an inference task with the `cohere` service. + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-cohere.html[Endpoint documentation] +[source,ts] +---- +client.inference.putCohere({ task_type, cohere_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("completion" | "rerank" | "text_embedding"))*: The type of the inference task that the model will perform. +** *`cohere_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("cohere"))*: The type of service supported for the specified task type. In this case, `cohere`. +** *`service_settings` ({ api_key, embedding_type, model_id, rate_limit, similarity })*: Settings used to install the inference model. +These settings are specific to the `cohere` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { input_type, return_documents, top_n, truncate })*: Settings to configure the inference task. +These settings are specific to the task type you specified. + +[discrete] +==== put_elasticsearch +Create an Elasticsearch inference endpoint. + +Create an inference endpoint to perform an inference task with the `elasticsearch` service. + +> info +> Your Elasticsearch deployment contains preconfigured ELSER and E5 inference endpoints, you only need to create the enpoints using the API if you want to customize the settings. + +If you use the ELSER or the E5 model through the `elasticsearch` service, the API request will automatically download and deploy the model if it isn't downloaded yet. + +> info +> You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value. + +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-elasticsearch.html[Endpoint documentation] +[source,ts] +---- +client.inference.putElasticsearch({ task_type, elasticsearch_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("rerank" | "sparse_embedding" | "text_embedding"))*: The type of the inference task that the model will perform. +** *`elasticsearch_inference_id` (string)*: The unique identifier of the inference endpoint. +The must not match the `model_id`. +** *`service` (Enum("elasticsearch"))*: The type of service supported for the specified task type. In this case, `elasticsearch`. +** *`service_settings` ({ adaptive_allocations, deployment_id, model_id, num_allocations, num_threads })*: Settings used to install the inference model. These settings are specific to the `elasticsearch` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { return_documents })*: Settings to configure the inference task. +These settings are specific to the task type you specified. + +[discrete] +==== put_elser +Create an ELSER inference endpoint. + +Create an inference endpoint to perform an inference task with the `elser` service. +You can also deploy ELSER by using the Elasticsearch inference integration. + +> info +> Your Elasticsearch deployment contains a preconfigured ELSER inference endpoint, you only need to create the enpoint using the API if you want to customize the settings. + +The API request will automatically download and deploy the ELSER model if it isn't already downloaded. + +> info +> You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value. + +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-elser.html[Endpoint documentation] +[source,ts] +---- +client.inference.putElser({ task_type, elser_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("sparse_embedding"))*: The type of the inference task that the model will perform. +** *`elser_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("elser"))*: The type of service supported for the specified task type. In this case, `elser`. +** *`service_settings` ({ adaptive_allocations, num_allocations, num_threads })*: Settings used to install the inference model. These settings are specific to the `elser` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. + +[discrete] +==== put_googleaistudio +Create an Google AI Studio inference endpoint. + +Create an inference endpoint to perform an inference task with the `googleaistudio` service. + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-google-ai-studio.html[Endpoint documentation] +[source,ts] +---- +client.inference.putGoogleaistudio({ task_type, googleaistudio_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("completion" | "text_embedding"))*: The type of the inference task that the model will perform. +** *`googleaistudio_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("googleaistudio"))*: The type of service supported for the specified task type. In this case, `googleaistudio`. +** *`service_settings` ({ api_key, model_id, rate_limit })*: Settings used to install the inference model. These settings are specific to the `googleaistudio` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. + +[discrete] +==== put_googlevertexai +Create a Google Vertex AI inference endpoint. + +Create an inference endpoint to perform an inference task with the `googlevertexai` service. + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-google-vertex-ai.html[Endpoint documentation] +[source,ts] +---- +client.inference.putGooglevertexai({ task_type, googlevertexai_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("rerank" | "text_embedding"))*: The type of the inference task that the model will perform. +** *`googlevertexai_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("googlevertexai"))*: The type of service supported for the specified task type. In this case, `googlevertexai`. +** *`service_settings` ({ location, model_id, project_id, rate_limit, service_account_json })*: Settings used to install the inference model. These settings are specific to the `googlevertexai` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { auto_truncate, top_n })*: Settings to configure the inference task. +These settings are specific to the task type you specified. + +[discrete] +==== put_hugging_face +Create a Hugging Face inference endpoint. + +Create an inference endpoint to perform an inference task with the `hugging_face` service. + +You must first create an inference endpoint on the Hugging Face endpoint page to get an endpoint URL. +Select the model you want to use on the new endpoint creation page (for example `intfloat/e5-small-v2`), then select the sentence embeddings task under the advanced configuration section. +Create the endpoint and copy the URL after the endpoint initialization has been finished. + +The following models are recommended for the Hugging Face service: + +* `all-MiniLM-L6-v2` +* `all-MiniLM-L12-v2` +* `all-mpnet-base-v2` +* `e5-base-v2` +* `e5-small-v2` +* `multilingual-e5-base` +* `multilingual-e5-small` + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-hugging-face.html[Endpoint documentation] +[source,ts] +---- +client.inference.putHuggingFace({ task_type, huggingface_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("text_embedding"))*: The type of the inference task that the model will perform. +** *`huggingface_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("hugging_face"))*: The type of service supported for the specified task type. In this case, `hugging_face`. +** *`service_settings` ({ api_key, rate_limit, url })*: Settings used to install the inference model. These settings are specific to the `hugging_face` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. + +[discrete] +==== put_jinaai +Create an JinaAI inference endpoint. + +Create an inference endpoint to perform an inference task with the `jinaai` service. + +To review the available `rerank` models, refer to . +To review the available `text_embedding` models, refer to the . + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-jinaai.html[Endpoint documentation] +[source,ts] +---- +client.inference.putJinaai({ task_type, jinaai_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("rerank" | "text_embedding"))*: The type of the inference task that the model will perform. +** *`jinaai_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("jinaai"))*: The type of service supported for the specified task type. In this case, `jinaai`. +** *`service_settings` ({ api_key, model_id, rate_limit, similarity })*: Settings used to install the inference model. These settings are specific to the `jinaai` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { return_documents, task, top_n })*: Settings to configure the inference task. +These settings are specific to the task type you specified. + +[discrete] +==== put_mistral +Create a Mistral inference endpoint. + +Creates an inference endpoint to perform an inference task with the `mistral` service. + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +[source,ts] +---- +client.inference.putMistral({ task_type, mistral_inference_id, service, service_settings }) +---- + +[discrete] +==== Arguments -{ref}/indices-stats.html[Endpoint documentation] +* *Request (object):* +** *`task_type` (Enum("text_embedding"))*: The task type. +The only valid task type for the model to perform is `text_embedding`. +** *`mistral_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("mistral"))*: The type of service supported for the specified task type. In this case, `mistral`. +** *`service_settings` ({ api_key, max_input_tokens, model, rate_limit })*: Settings used to install the inference model. These settings are specific to the `mistral` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. + +[discrete] +==== put_openai +Create an OpenAI inference endpoint. + +Create an inference endpoint to perform an inference task with the `openai` service or `openai` compatible APIs. + +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-openai.html[Endpoint documentation] [source,ts] ---- -client.indices.stats({ ... }) +client.inference.putOpenai({ task_type, openai_inference_id, service, service_settings }) ---- [discrete] ==== Arguments * *Request (object):* -** *`metric` (Optional, string | string[])*: Limit the information returned the specific metrics. -** *`index` (Optional, string | string[])*: A list of index names; use `_all` or empty string to perform the operation on all indices -** *`completion_fields` (Optional, string | string[])*: List or wildcard expressions of fields to include in fielddata and suggest statistics. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. If the request can target data streams, this argument -determines whether wildcard expressions match hidden data streams. Supports a list of values, -such as `open,hidden`. -** *`fielddata_fields` (Optional, string | string[])*: List or wildcard expressions of fields to include in fielddata statistics. -** *`fields` (Optional, string | string[])*: List or wildcard expressions of fields to include in the statistics. -** *`forbid_closed_indices` (Optional, boolean)*: If true, statistics are not collected from closed indices. -** *`groups` (Optional, string | string[])*: List of search groups to include in the search statistics. -** *`include_segment_file_sizes` (Optional, boolean)*: If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). -** *`include_unloaded_segments` (Optional, boolean)*: If true, the response includes information from segments that are not loaded into memory. -** *`level` (Optional, Enum("cluster" | "indices" | "shards"))*: Indicates whether statistics are aggregated at the cluster, index, or shard level. +** *`task_type` (Enum("chat_completion" | "completion" | "text_embedding"))*: The type of the inference task that the model will perform. +NOTE: The `chat_completion` task type only supports streaming and only through the _stream API. +** *`openai_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("openai"))*: The type of service supported for the specified task type. In this case, `openai`. +** *`service_settings` ({ api_key, dimensions, model_id, organization_id, rate_limit, url })*: Settings used to install the inference model. These settings are specific to the `openai` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { user })*: Settings to configure the inference task. +These settings are specific to the task type you specified. [discrete] -==== unfreeze -Unfreezes an index. +==== put_voyageai +Create a VoyageAI inference endpoint. -{ref}/unfreeze-index-api.html[Endpoint documentation] +Create an inference endpoint to perform an inference task with the `voyageai` service. + +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-voyageai.html[Endpoint documentation] [source,ts] ---- -client.indices.unfreeze({ index }) +client.inference.putVoyageai({ task_type, voyageai_inference_id, service, service_settings }) ---- [discrete] ==== Arguments * *Request (object):* -** *`index` (string)*: Identifier for the index. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. -This behavior applies even if the request targets other open indices. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. -Valid values are: `all`, `open`, `closed`, `hidden`, `none`. -** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. -If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. -If no response is received before the timeout expires, the request fails and returns an error. -** *`wait_for_active_shards` (Optional, string)*: The number of shard copies that must be active before proceeding with the operation. -Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +** *`task_type` (Enum("text_embedding" | "rerank"))*: The type of the inference task that the model will perform. +** *`voyageai_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("voyageai"))*: The type of service supported for the specified task type. In this case, `voyageai`. +** *`service_settings` ({ dimensions, model_id, rate_limit, embedding_type })*: Settings used to install the inference model. These settings are specific to the `voyageai` service. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { input_type, return_documents, top_k, truncation })*: Settings to configure the inference task. +These settings are specific to the task type you specified. [discrete] -==== update_aliases -Create or update an alias. -Adds a data stream or index to an alias. +==== put_watsonx +Create a Watsonx inference endpoint. + +Create an inference endpoint to perform an inference task with the `watsonxai` service. +You need an IBM Cloud Databases for Elasticsearch deployment to use the `watsonxai` inference service. +You can provision one through the IBM catalog, the Cloud Databases CLI plug-in, the Cloud Databases API, or Terraform. -{ref}/indices-aliases.html[Endpoint documentation] +When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +After creating the endpoint, wait for the model deployment to complete before using it. +To verify the deployment status, use the get trained model statistics API. +Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. +Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + +{ref}/infer-service-watsonx-ai.html[Endpoint documentation] [source,ts] ---- -client.indices.updateAliases({ ... }) +client.inference.putWatsonx({ task_type, watsonx_inference_id, service, service_settings }) ---- [discrete] ==== Arguments * *Request (object):* -** *`actions` (Optional, { add_backing_index, remove_backing_index }[])*: Actions to perform. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. -If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. -If no response is received before the timeout expires, the request fails and returns an error. +** *`task_type` (Enum("text_embedding"))*: The task type. +The only valid task type for the model to perform is `text_embedding`. +** *`watsonx_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("watsonxai"))*: The type of service supported for the specified task type. In this case, `watsonxai`. +** *`service_settings` ({ api_key, api_version, model_id, project_id, rate_limit, url })*: Settings used to install the inference model. These settings are specific to the `watsonxai` service. [discrete] -==== validate_query -Validate a query. -Validates a query without running it. +==== rerank +Perform rereanking inference on the service -{ref}/search-validate.html[Endpoint documentation] +{ref}/post-inference-api.html[Endpoint documentation] [source,ts] ---- -client.indices.validateQuery({ ... }) +client.inference.rerank({ inference_id, query, input }) ---- [discrete] ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases to search. -Supports wildcards (`*`). -To search all data streams or indices, omit this parameter or use `*` or `_all`. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Query in the Lucene query string syntax. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. -This behavior applies even if the request targets other open indices. -** *`all_shards` (Optional, boolean)*: If `true`, the validation is executed on all shards instead of one random shard per index. -** *`analyzer` (Optional, string)*: Analyzer to use for the query string. -This parameter can only be used when the `q` query string parameter is specified. -** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. -** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. -** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. -This parameter can only be used when the `q` query string parameter is specified. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. -Valid values are: `all`, `open`, `closed`, `hidden`, `none`. -** *`explain` (Optional, boolean)*: If `true`, the response returns detailed information if an error has occurred. -** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. -** *`rewrite` (Optional, boolean)*: If `true`, returns a more detailed explanation showing the actual Lucene query that will be executed. -** *`q` (Optional, string)*: Query in the Lucene query string syntax. +** *`inference_id` (string)*: The unique identifier for the inference endpoint. +** *`query` (string)*: Query input. +** *`input` (string | string[])*: The text on which you want to perform the inference task. +It can be a single string or an array. + +> info +> Inference endpoints for the `completion` task type currently only support a single string as input. +** *`task_settings` (Optional, User-defined value)*: Task settings for the individual inference request. +These settings are specific to the task type you specified and override the task settings specified when initializing the service. +** *`timeout` (Optional, string | -1 | 0)*: The amount of time to wait for the inference request to complete. [discrete] -=== inference -[discrete] -==== delete -Delete an inference endpoint +==== sparse_embedding +Perform sparse embedding inference on the service -{ref}/delete-inference-api.html[Endpoint documentation] +{ref}/post-inference-api.html[Endpoint documentation] [source,ts] ---- -client.inference.delete({ inference_id }) +client.inference.sparseEmbedding({ inference_id, input }) ---- [discrete] @@ -5601,35 +8655,46 @@ client.inference.delete({ inference_id }) * *Request (object):* ** *`inference_id` (string)*: The inference Id -** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion"))*: The task type -** *`dry_run` (Optional, boolean)*: When true, the endpoint is not deleted, and a list of ingest processors which reference this endpoint is returned -** *`force` (Optional, boolean)*: When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields +** *`input` (string | string[])*: Inference input. +Either a string or an array of strings. +** *`task_settings` (Optional, User-defined value)*: Optional task settings +** *`timeout` (Optional, string | -1 | 0)*: Specifies the amount of time to wait for the inference request to complete. [discrete] -==== get -Get an inference endpoint +==== stream_completion +Perform streaming inference. +Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. +This API works only with the completion task type. -{ref}/get-inference-api.html[Endpoint documentation] +IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. + +This API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege). You must use a client that supports streaming. + +{ref}/stream-inference-api.html[Endpoint documentation] [source,ts] ---- -client.inference.get({ ... }) +client.inference.streamCompletion({ inference_id, input }) ---- [discrete] ==== Arguments * *Request (object):* -** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion"))*: The task type -** *`inference_id` (Optional, string)*: The inference Id +** *`inference_id` (string)*: The unique identifier for the inference endpoint. +** *`input` (string | string[])*: The text on which you want to perform the inference task. +It can be a single string or an array. + +NOTE: Inference endpoints for the completion task type currently only support a single string as input. +** *`task_settings` (Optional, User-defined value)*: Optional task settings [discrete] -==== inference -Perform inference on the service +==== text_embedding +Perform text embedding inference on the service {ref}/post-inference-api.html[Endpoint documentation] [source,ts] ---- -client.inference.inference({ inference_id, input }) +client.inference.textEmbedding({ inference_id, input }) ---- [discrete] @@ -5639,35 +8704,42 @@ client.inference.inference({ inference_id, input }) ** *`inference_id` (string)*: The inference Id ** *`input` (string | string[])*: Inference input. Either a string or an array of strings. -** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion"))*: The task type -** *`query` (Optional, string)*: Query input, required for rerank task. -Not required for other tasks. ** *`task_settings` (Optional, User-defined value)*: Optional task settings ** *`timeout` (Optional, string | -1 | 0)*: Specifies the amount of time to wait for the inference request to complete. [discrete] -==== put -Create an inference endpoint +==== update +Update an inference endpoint. -{ref}/put-inference-api.html[Endpoint documentation] +Modify `task_settings`, secrets (within `service_settings`), or `num_allocations` for an inference endpoint, depending on the specific endpoint service and `task_type`. + +IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. +For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. +However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. + +{ref}/update-inference-api.html[Endpoint documentation] [source,ts] ---- -client.inference.put({ inference_id }) +client.inference.update({ inference_id }) ---- [discrete] ==== Arguments * *Request (object):* -** *`inference_id` (string)*: The inference Id -** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion"))*: The task type -** *`inference_config` (Optional, { service, service_settings, task_settings })* +** *`inference_id` (string)*: The unique identifier of the inference endpoint. +** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion" | "chat_completion"))*: The type of inference task that the model performs. +** *`inference_config` (Optional, { chunking_settings, service, service_settings, task_settings })* [discrete] === ingest [discrete] ==== delete_geoip_database -Deletes a geoip database configuration. +Delete GeoIP database configurations. + +Delete one or more IP geolocation database configurations. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ingest-delete-geoip-database[Endpoint documentation] [source,ts] ---- client.ingest.deleteGeoipDatabase({ id }) @@ -5678,13 +8750,36 @@ client.ingest.deleteGeoipDatabase({ id }) * *Request (object):* ** *`id` (string | string[])*: A list of geoip database configurations to delete -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + +[discrete] +==== delete_ip_location_database +Delete IP geolocation database configurations. + +{ref}/delete-ip-location-database-api.html[Endpoint documentation] +[source,ts] +---- +client.ingest.deleteIpLocationDatabase({ id }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`id` (string | string[])*: A list of IP location database configurations. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +A value of `-1` indicates that the request should never time out. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. +A value of `-1` indicates that the request should never time out. [discrete] ==== delete_pipeline -Deletes one or more existing ingest pipeline. +Delete pipelines. +Delete one or more ingest pipelines. {ref}/delete-pipeline-api.html[Endpoint documentation] [source,ts] @@ -5705,7 +8800,8 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== geo_ip_stats -Gets download statistics for GeoIP2 databases used with the geoip processor. +Get GeoIP statistics. +Get download statistics for GeoIP2 databases that are used with the GeoIP processor. {ref}/geoip-processor.html[Endpoint documentation] [source,ts] @@ -5716,7 +8812,11 @@ client.ingest.geoIpStats() [discrete] ==== get_geoip_database -Returns information about one or more geoip database configurations. +Get GeoIP database configurations. + +Get information about one or more IP geolocation database configurations. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ingest-get-geoip-database[Endpoint documentation] [source,ts] ---- client.ingest.getGeoipDatabase({ ... }) @@ -5725,16 +8825,37 @@ client.ingest.getGeoipDatabase({ ... }) [discrete] ==== Arguments +* *Request (object):* +** *`id` (Optional, string | string[])*: A list of database configuration IDs to retrieve. +Wildcard (`*`) expressions are supported. +To get all database configurations, omit this parameter or use `*`. + +[discrete] +==== get_ip_location_database +Get IP geolocation database configurations. + +{ref}/get-ip-location-database-api.html[Endpoint documentation] +[source,ts] +---- +client.ingest.getIpLocationDatabase({ ... }) +---- + +[discrete] +==== Arguments + * *Request (object):* ** *`id` (Optional, string | string[])*: List of database configuration IDs to retrieve. Wildcard (`*`) expressions are supported. To get all database configurations, omit this parameter or use `*`. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. +A value of `-1` indicates that the request should never time out. [discrete] ==== get_pipeline -Returns information about one or more ingest pipelines. +Get pipelines. + +Get information about one or more ingest pipelines. This API returns a local reference of the pipeline. {ref}/get-pipeline-api.html[Endpoint documentation] @@ -5756,8 +8877,9 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== processor_grok -Extracts structured fields out of a single text field within a document. -You choose which field to extract matched fields from, as well as the grok pattern you expect will match. +Run a grok processor. +Extract structured fields out of a single text field within a document. +You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. A grok pattern is like a regular expression that supports aliased expressions that can be reused. {ref}/grok-processor.html[Endpoint documentation] @@ -5769,7 +8891,11 @@ client.ingest.processorGrok() [discrete] ==== put_geoip_database -Returns information about one or more geoip database configurations. +Create or update a GeoIP database configuration. + +Refer to the create or update IP geolocation database configuration API. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ingest-put-geoip-database[Endpoint documentation] [source,ts] ---- client.ingest.putGeoipDatabase({ id, name, maxmind }) @@ -5787,9 +8913,32 @@ At present, the only supported provider is maxmind, and the maxmind provider req If no response is received before the timeout expires, the request fails and returns an error. ** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. +[discrete] +==== put_ip_location_database +Create or update an IP geolocation database configuration. + +{ref}/put-ip-location-database-api.html[Endpoint documentation] +[source,ts] +---- +client.ingest.putIpLocationDatabase({ id }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`id` (string)*: The database configuration identifier. +** *`configuration` (Optional, { name, maxmind, ipinfo })* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +A value of `-1` indicates that the request should never time out. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. +If no response is received before the timeout expires, the cluster metadata update still applies but the response indicates that it was not completely acknowledged. +A value of `-1` indicates that the request should never time out. + [discrete] ==== put_pipeline -Creates or updates an ingest pipeline. +Create or update a pipeline. Changes made using this API take effect immediately. {ref}/ingest.html[Endpoint documentation] @@ -5805,16 +8954,21 @@ client.ingest.putPipeline({ id }) ** *`id` (string)*: ID of the ingest pipeline to create or update. ** *`_meta` (Optional, Record)*: Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch. ** *`description` (Optional, string)*: Description of the ingest pipeline. -** *`on_failure` (Optional, { append, attachment, bytes, circle, convert, csv, date, date_index_name, dissect, dot_expander, drop, enrich, fail, foreach, geoip, grok, gsub, html_strip, inference, join, json, kv, lowercase, pipeline, remove, rename, reroute, script, set, set_security_user, sort, split, trim, uppercase, urldecode, uri_parts, user_agent }[])*: Processors to run immediately after a processor failure. Each processor supports a processor-level `on_failure` value. If a processor without an `on_failure` value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. -** *`processors` (Optional, { append, attachment, bytes, circle, convert, csv, date, date_index_name, dissect, dot_expander, drop, enrich, fail, foreach, geoip, grok, gsub, html_strip, inference, join, json, kv, lowercase, pipeline, remove, rename, reroute, script, set, set_security_user, sort, split, trim, uppercase, urldecode, uri_parts, user_agent }[])*: Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. +** *`on_failure` (Optional, { append, attachment, bytes, circle, community_id, convert, csv, date, date_index_name, dissect, dot_expander, drop, enrich, fail, fingerprint, foreach, ip_location, geo_grid, geoip, grok, gsub, html_strip, inference, join, json, kv, lowercase, network_direction, pipeline, redact, registered_domain, remove, rename, reroute, script, set, set_security_user, sort, split, terminate, trim, uppercase, urldecode, uri_parts, user_agent }[])*: Processors to run immediately after a processor failure. Each processor supports a processor-level `on_failure` value. If a processor without an `on_failure` value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. +** *`processors` (Optional, { append, attachment, bytes, circle, community_id, convert, csv, date, date_index_name, dissect, dot_expander, drop, enrich, fail, fingerprint, foreach, ip_location, geo_grid, geoip, grok, gsub, html_strip, inference, join, json, kv, lowercase, network_direction, pipeline, redact, registered_domain, remove, rename, reroute, script, set, set_security_user, sort, split, terminate, trim, uppercase, urldecode, uri_parts, user_agent }[])*: Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. ** *`version` (Optional, number)*: Version number used by external systems to track ingest pipelines. This parameter is intended for external systems only. Elasticsearch does not use or validate pipeline version numbers. +** *`deprecated` (Optional, boolean)*: Marks this ingest pipeline as deprecated. +When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. ** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. ** *`if_version` (Optional, number)*: Required version for optimistic concurrency control for pipeline updates [discrete] ==== simulate -Executes an ingest pipeline against a set of provided documents. +Simulate a pipeline. + +Run an ingest pipeline against a set of provided documents. +You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. {ref}/simulate-pipeline-api.html[Endpoint documentation] [source,ts] @@ -5827,10 +8981,10 @@ client.ingest.simulate({ docs }) * *Request (object):* ** *`docs` ({ _id, _index, _source }[])*: Sample documents to test in the pipeline. -** *`id` (Optional, string)*: Pipeline to test. -If you don’t specify a `pipeline` in the request body, this parameter is required. -** *`pipeline` (Optional, { description, on_failure, processors, version, _meta })*: Pipeline to test. -If you don’t specify the `pipeline` request path parameter, this parameter is required. +** *`id` (Optional, string)*: The pipeline to test. +If you don't specify a `pipeline` in the request body, this parameter is required. +** *`pipeline` (Optional, { description, on_failure, processors, version, deprecated, _meta })*: The pipeline to test. +If you don't specify the `pipeline` request path parameter, this parameter is required. If you specify both this and the request path parameter, the API only uses the request path parameter. ** *`verbose` (Optional, boolean)*: If `true`, the response includes output data for each processor in the executed pipeline. @@ -5838,20 +8992,34 @@ If you specify both this and the request path parameter, the API only uses the r === license [discrete] ==== delete -Deletes licensing information for the cluster +Delete the license. + +When the license expires, your subscription level reverts to Basic. + +If the operator privileges feature is enabled, only operator users can use this API. {ref}/delete-license.html[Endpoint documentation] [source,ts] ---- -client.license.delete() +client.license.delete({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get Get license information. -Returns information about your Elastic license, including its type, its status, when it was issued, and when it expires. -For more information about the different types of licenses, refer to [Elastic Stack subscriptions](https://www.elastic.co/subscriptions). + +Get information about your Elastic license including its type, its status, when it was issued, and when it expires. + +>info +> If the master node is generating a new cluster state, the get license API may return a `404 Not Found` response. +> If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. {ref}/get-license.html[Endpoint documentation] [source,ts] @@ -5869,7 +9037,7 @@ This parameter is deprecated and will always be set to true in 8.x. [discrete] ==== get_basic_status -Retrieves information about the status of the basic license. +Get the basic license status. {ref}/get-basic-status.html[Endpoint documentation] [source,ts] @@ -5880,7 +9048,7 @@ client.license.getBasicStatus() [discrete] ==== get_trial_status -Retrieves information about the status of the trial license. +Get the trial status. {ref}/get-trial-status.html[Endpoint documentation] [source,ts] @@ -5891,9 +9059,17 @@ client.license.getTrialStatus() [discrete] ==== post -Updates the license for the cluster. +Update the license. + +You can update your license at runtime without shutting down your nodes. +License updates take effect immediately. +If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. +You must then re-submit the API request with the acknowledge parameter set to true. -{ref}/update-license.html[Endpoint documentation] +NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. +If the operator privileges feature is enabled, only operator users can use this API. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-license-post[Endpoint documentation] [source,ts] ---- client.license.post({ ... }) @@ -5906,11 +9082,21 @@ client.license.post({ ... }) ** *`license` (Optional, { expiry_date_in_millis, issue_date_in_millis, start_date_in_millis, issued_to, issuer, max_nodes, max_resource_units, signature, type, uid })* ** *`licenses` (Optional, { expiry_date_in_millis, issue_date_in_millis, start_date_in_millis, issued_to, issuer, max_nodes, max_resource_units, signature, type, uid }[])*: A sequence of one or more JSON documents containing the license information. ** *`acknowledge` (Optional, boolean)*: Specifies whether you acknowledge the license changes. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== post_start_basic -The start basic API enables you to initiate an indefinite basic license, which gives access to all the basic features. If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. You must then re-submit the API request with the acknowledge parameter set to true. -To check the status of your basic license, use the following API: [Get basic status](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-basic-status.html). +Start a basic license. + +Start an indefinite basic license, which gives access to all the basic features. + +NOTE: In order to start a basic license, you must not currently have a basic license. + +If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. +You must then re-submit the API request with the `acknowledge` parameter set to `true`. + +To check the status of your basic license, use the get basic license API. {ref}/start-basic.html[Endpoint documentation] [source,ts] @@ -5923,10 +9109,18 @@ client.license.postStartBasic({ ... }) * *Request (object):* ** *`acknowledge` (Optional, boolean)*: whether the user has acknowledged acknowledge messages (default: false) +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== post_start_trial -The start trial API enables you to start a 30-day trial, which gives access to all subscription features. +Start a trial. +Start a 30-day trial, which gives access to all subscription features. + +NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. +For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. + +To check the status of your trial, use the get trial status API. {ref}/start-trial.html[Endpoint documentation] [source,ts] @@ -5940,12 +9134,15 @@ client.license.postStartTrial({ ... }) * *Request (object):* ** *`acknowledge` (Optional, boolean)*: whether the user has acknowledged acknowledge messages (default: false) ** *`type_query_string` (Optional, string)* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] === logstash [discrete] ==== delete_pipeline -Deletes a pipeline used for Logstash Central Management. +Delete a Logstash pipeline. +Delete a pipeline that is used for Logstash Central Management. +If the request succeeds, you receive an empty response with an appropriate status code. {ref}/logstash-api-delete-pipeline.html[Endpoint documentation] [source,ts] @@ -5957,11 +9154,12 @@ client.logstash.deletePipeline({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier for the pipeline. +** *`id` (string)*: An identifier for the pipeline. [discrete] ==== get_pipeline -Retrieves pipelines used for Logstash Central Management. +Get Logstash pipelines. +Get pipelines that are used for Logstash Central Management. {ref}/logstash-api-get-pipeline.html[Endpoint documentation] [source,ts] @@ -5973,11 +9171,14 @@ client.logstash.getPipeline({ ... }) ==== Arguments * *Request (object):* -** *`id` (Optional, string | string[])*: List of pipeline identifiers. +** *`id` (Optional, string | string[])*: A list of pipeline identifiers. [discrete] ==== put_pipeline -Creates or updates a pipeline used for Logstash Central Management. +Create or update a Logstash pipeline. + +Create a pipeline that is used for Logstash Central Management. +If the specified pipeline exists, it is replaced. {ref}/logstash-api-put-pipeline.html[Endpoint documentation] [source,ts] @@ -5989,14 +9190,18 @@ client.logstash.putPipeline({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier for the pipeline. -** *`pipeline` (Optional, { description, on_failure, processors, version, _meta })* +** *`id` (string)*: An identifier for the pipeline. +** *`pipeline` (Optional, { description, on_failure, processors, version, deprecated, _meta })* [discrete] === migration [discrete] ==== deprecations -Retrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version. +Get deprecation information. +Get information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version. + +TIP: This APIs is designed for indirect use by the Upgrade Assistant. +You are strongly recommended to use the Upgrade Assistant. {ref}/migration-api-deprecation.html[Endpoint documentation] [source,ts] @@ -6012,9 +9217,14 @@ client.migration.deprecations({ ... }) [discrete] ==== get_feature_upgrade_status -Find out whether system features need to be upgraded or not +Get feature migration information. +Version upgrades sometimes require changes to how features store configuration information and data in system indices. +Check which features need to be migrated and the status of any migrations that are in progress. -{ref}/migration-api-feature-upgrade.html[Endpoint documentation] +TIP: This API is designed for indirect use by the Upgrade Assistant. +You are strongly recommended to use the Upgrade Assistant. + +{ref}/feature-migration-api.html[Endpoint documentation] [source,ts] ---- client.migration.getFeatureUpgradeStatus() @@ -6023,9 +9233,15 @@ client.migration.getFeatureUpgradeStatus() [discrete] ==== post_feature_upgrade -Begin upgrades for system features +Start the feature migration. +Version upgrades sometimes require changes to how features store configuration information and data in system indices. +This API starts the automatic migration process. + +Some functionality might be temporarily unavailable during the migration process. -{ref}/migration-api-feature-upgrade.html[Endpoint documentation] +TIP: The API is designed for indirect use by the Upgrade Assistant. We strongly recommend you use the Upgrade Assistant. + +{ref}/feature-migration-api.html[Endpoint documentation] [source,ts] ---- client.migration.postFeatureUpgrade() @@ -6037,6 +9253,7 @@ client.migration.postFeatureUpgrade() [discrete] ==== clear_trained_model_deployment_cache Clear trained model deployment cache. + Cache will be cleared on all nodes where the trained model is assigned. A trained model deployment may have an inference cache enabled. As requests are handled by each allocated node, their responses may be cached on that individual node. @@ -6057,6 +9274,7 @@ client.ml.clearTrainedModelDeploymentCache({ model_id }) [discrete] ==== close_job Close anomaly detection jobs. + A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. @@ -6080,7 +9298,8 @@ client.ml.closeJob({ job_id }) [discrete] ==== delete_calendar Delete a calendar. -Removes all scheduled events from a calendar, then deletes it. + +Remove all scheduled events from a calendar, then delete it. {ref}/ml-delete-calendar.html[Endpoint documentation] [source,ts] @@ -6172,14 +9391,15 @@ stopping and deleting the datafeed. [discrete] ==== delete_expired_data Delete expired ML data. -Deletes all job results, model snapshots and forecast data that have exceeded + +Delete all job results, model snapshots and forecast data that have exceeded their retention days period. Machine learning state documents that are not associated with any job are also deleted. You can limit the request to a single or set of anomaly detection jobs by -using a job identifier, a group name, a comma-separated list of jobs, or a +using a job identifier, a group name, a list of jobs, or a wildcard expression. You can delete expired data for all anomaly detection -jobs by using _all, by specifying * as the , or by omitting the -. +jobs by using `_all`, by specifying `*` as the ``, or by omitting the +``. {ref}/ml-delete-expired-data.html[Endpoint documentation] [source,ts] @@ -6200,6 +9420,7 @@ behavior is no throttling. [discrete] ==== delete_filter Delete a filter. + If an anomaly detection job references the filter, you cannot delete the filter. You must update or delete the job before you can delete the filter. @@ -6218,6 +9439,7 @@ client.ml.deleteFilter({ filter_id }) [discrete] ==== delete_forecast Delete forecasts from a job. + By default, forecasts are retained for 14 days. You can specify a different retention period with the `expires_in` parameter in the forecast jobs API. The delete forecast API enables you to delete one or more @@ -6248,6 +9470,7 @@ error. [discrete] ==== delete_job Delete an anomaly detection job. + All job configuration, model state and results are deleted. It is not currently possible to delete multiple jobs using wildcards or a comma separated list. If you delete a job that has a datafeed, the request @@ -6277,6 +9500,7 @@ job deletion completes. [discrete] ==== delete_model_snapshot Delete a model snapshot. + You cannot delete the active model snapshot. To delete that snapshot, first revert to a different one. To identify the active model snapshot, refer to the `model_snapshot_id` in the results from the get jobs API. @@ -6297,6 +9521,7 @@ client.ml.deleteModelSnapshot({ job_id, snapshot_id }) [discrete] ==== delete_trained_model Delete an unreferenced trained model. + The request deletes a trained inference model that is not referenced by an ingest pipeline. {ref}/delete-trained-models.html[Endpoint documentation] @@ -6311,10 +9536,12 @@ client.ml.deleteTrainedModel({ model_id }) * *Request (object):* ** *`model_id` (string)*: The unique identifier of the trained model. ** *`force` (Optional, boolean)*: Forcefully deletes a trained model that is referenced by ingest pipelines or has a started deployment. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== delete_trained_model_alias Delete a trained model alias. + This API deletes an existing model alias that refers to a trained model. If the model alias is missing or refers to a model other than the one identified by the `model_id`, this API returns an error. @@ -6335,11 +9562,12 @@ client.ml.deleteTrainedModelAlias({ model_alias, model_id }) [discrete] ==== estimate_model_memory Estimate job model memory usage. -Makes an estimation of the memory usage for an anomaly detection job model. -It is based on analysis configuration details for the job and cardinality + +Make an estimation of the memory usage for an anomaly detection job model. +The estimate is based on analysis configuration details for the job and cardinality estimates for the fields it references. -{ref}/ml-apis.html[Endpoint documentation] +{ref}/ml-estimate-model-memory.html[Endpoint documentation] [source,ts] ---- client.ml.estimateModelMemory({ ... }) @@ -6367,6 +9595,7 @@ omitted from the request if no detectors have a `by_field_name`, [discrete] ==== evaluate_data_frame Evaluate data frame analytics. + The API packages together commonly used evaluation metrics for various types of machine learning features. This has been designed for use on indexes created by data frame analytics. Evaluation requires both a ground truth @@ -6384,11 +9613,12 @@ client.ml.evaluateDataFrame({ evaluation, index }) * *Request (object):* ** *`evaluation` ({ classification, outlier_detection, regression })*: Defines the type of evaluation you want to perform. ** *`index` (string)*: Defines the `index` in which the evaluation will be performed. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: A query clause that retrieves a subset of data from the source index. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: A query clause that retrieves a subset of data from the source index. [discrete] ==== explain_data_frame_analytics Explain data frame analytics config. + This API provides explanations for a data frame analytics config that either exists already or one that has not been created yet. The following explanations are provided: @@ -6587,7 +9817,7 @@ This parameter has the `from` and `size` properties. ==== get_data_frame_analytics Get data frame analytics job configuration info. You can get information for multiple data frame analytics jobs in a single -API request by using a comma-separated list of data frame analytics jobs or a +API request by using a list of data frame analytics jobs or a wildcard expression. {ref}/get-dfanalytics.html[Endpoint documentation] @@ -6605,10 +9835,10 @@ option, the API returns information for the first hundred data frame analytics jobs. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no data frame analytics +. Contains wildcard expressions and there are no data frame analytics jobs that match. -2. Contains the `_all` string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains the `_all` string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. @@ -6622,7 +9852,7 @@ be retrieved and then added to another cluster. [discrete] ==== get_data_frame_analytics_stats -Get data frame analytics jobs usage info. +Get data frame analytics job stats. {ref}/get-dfanalytics-stats.html[Endpoint documentation] [source,ts] @@ -6639,10 +9869,10 @@ option, the API returns information for the first hundred data frame analytics jobs. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no data frame analytics +. Contains wildcard expressions and there are no data frame analytics jobs that match. -2. Contains the `_all` string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains the `_all` string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. @@ -6654,9 +9884,9 @@ there are no matches or only partial matches. [discrete] ==== get_datafeed_stats -Get datafeeds usage info. +Get datafeed stats. You can get statistics for multiple datafeeds in a single API request by -using a comma-separated list of datafeeds or a wildcard expression. You can +using a list of datafeeds or a wildcard expression. You can get statistics for all datafeeds by using `_all`, by specifying `*` as the ``, or by omitting the ``. If the datafeed is stopped, the only information you receive is the `datafeed_id` and the `state`. @@ -6677,9 +9907,9 @@ wildcard expression. If you do not specify one of these options, the API returns information about all datafeeds. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no datafeeds that match. -2. Contains the `_all` string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no datafeeds that match. +. Contains the `_all` string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value is `true`, which returns an empty `datafeeds` array when there are no matches and the subset of results when there are @@ -6690,7 +9920,7 @@ partial matches. If this parameter is `false`, the request returns a ==== get_datafeeds Get datafeeds configuration info. You can get information for multiple datafeeds in a single API request by -using a comma-separated list of datafeeds or a wildcard expression. You can +using a list of datafeeds or a wildcard expression. You can get information for all datafeeds by using `_all`, by specifying `*` as the ``, or by omitting the ``. This API returns a maximum of 10,000 datafeeds. @@ -6710,9 +9940,9 @@ wildcard expression. If you do not specify one of these options, the API returns information about all datafeeds. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no datafeeds that match. -2. Contains the `_all` string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no datafeeds that match. +. Contains the `_all` string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value is `true`, which returns an empty `datafeeds` array when there are no matches and the subset of results when there are @@ -6778,7 +10008,7 @@ means it is unset and results are not limited to specific timestamps. [discrete] ==== get_job_stats -Get anomaly detection jobs usage info. +Get anomaly detection job stats. {ref}/ml-get-job-stats.html[Endpoint documentation] [source,ts] @@ -6796,9 +10026,9 @@ you do not specify one of these options, the API returns information for all anomaly detection jobs. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no jobs that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no jobs that match. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. If `true`, the API returns an empty `jobs` array when there are no matches and the subset of results when there are partial @@ -6809,7 +10039,7 @@ code when there are no matches or only partial matches. ==== get_jobs Get anomaly detection jobs configuration info. You can get information for multiple anomaly detection jobs in a single API -request by using a group name, a comma-separated list of jobs, or a wildcard +request by using a group name, a list of jobs, or a wildcard expression. You can get information for all anomaly detection jobs by using `_all`, by specifying `*` as the ``, or by omitting the ``. @@ -6828,9 +10058,9 @@ group name, or a wildcard expression. If you do not specify one of these options, the API returns information for all anomaly detection jobs. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no jobs that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no jobs that match. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value is `true`, which returns an empty `jobs` array when there are no matches and the subset of results when there are partial @@ -6858,8 +10088,6 @@ client.ml.getMemoryStats({ ... }) * *Request (object):* ** *`node_id` (Optional, string)*: The names of particular nodes in the cluster to target. For example, `nodeId1,nodeId2` or `ml:true` -** *`human` (Optional, boolean)*: Specify this query parameter to include the fields with units in the response. Otherwise only -the `_in_bytes` sizes are returned in the response. ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. ** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request @@ -7035,6 +10263,7 @@ be retrieved and then added to another cluster. ** *`from` (Optional, number)*: Skips the specified number of models. ** *`include` (Optional, Enum("definition" | "feature_importance_baseline" | "hyperparameters" | "total_feature_importance" | "definition_status"))*: A comma delimited string of optional fields to include in the response body. +** *`include_model_definition` (Optional, boolean)*: parameter is deprecated! Use [include=definition] instead ** *`size` (Optional, number)*: Specifies the maximum number of models to obtain. ** *`tags` (Optional, string | string[])*: A comma delimited string of tags. A trained model can have many tags, or none. When supplied, only trained models that contain all the supplied @@ -7044,7 +10273,7 @@ tags are returned. ==== get_trained_models_stats Get trained models usage info. You can get usage information for multiple trained -models in a single API request by using a comma-separated list of model IDs or a wildcard expression. +models in a single API request by using a list of model IDs or a wildcard expression. {ref}/get-trained-models-stats.html[Endpoint documentation] [source,ts] @@ -7092,8 +10321,8 @@ Currently, for NLP models, only a single value is allowed. [discrete] ==== info -Return ML defaults and limits. -Returns defaults and limits used by machine learning. +Get machine learning information. +Get defaults and limits used by machine learning. This endpoint is designed to be used by a user interface that needs to fully understand machine learning configurations where some options are not specified, meaning that the defaults should be used. This endpoint may be @@ -7111,6 +10340,7 @@ client.ml.info() [discrete] ==== open_job Open anomaly detection jobs. + An anomaly detection job must be opened to be ready to receive and analyze data. It can be opened and closed multiple times throughout its lifecycle. When you open a new job, it starts with an empty model. @@ -7153,7 +10383,7 @@ client.ml.postCalendarEvents({ calendar_id, events }) Send data to an anomaly detection job for analysis. IMPORTANT: For each job, data can be accepted from only a single connection at a time. -It is not currently possible to post data to multiple jobs using wildcards or a comma-separated list. +It is not currently possible to post data to multiple jobs using wildcards or a list. {ref}/ml-post-data.html[Endpoint documentation] [source,ts] @@ -7173,7 +10403,7 @@ client.ml.postData({ job_id }) [discrete] ==== preview_data_frame_analytics Preview features used by data frame analytics. -Previews the extracted features used by a data frame analytics config. +Preview the extracted features used by a data frame analytics config. {ref}/preview-dfanalytics.html[Endpoint documentation] [source,ts] @@ -7264,6 +10494,11 @@ client.ml.putCalendarJob({ calendar_id, job_id }) Create a data frame analytics job. This API creates a data frame analytics job that performs an analysis on the source indices and stores the outcome in a destination index. +By default, the query used in the source configuration is `{"match_all": {}}`. + +If the destination index does not exist, it is created automatically when you start the job. + +If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. {ref}/put-dfanalytics.html[Endpoint documentation] [source,ts] @@ -7324,6 +10559,7 @@ model the values as `0-14 = 0`, `15-24 = 1`, `25-34 = 2`, and so on. threads may decrease the time necessary to complete the analysis at the cost of using more CPU. Note that the process may use additional threads for operational functionality other than the analysis itself. +** *`_meta` (Optional, Record)* ** *`model_memory_limit` (Optional, string)*: The approximate maximum amount of memory resources that are permitted for analytical processing. If your `elasticsearch.yml` file contains an `xpack.ml.max_model_memory_limit` setting, an error occurs when you try @@ -7339,6 +10575,8 @@ Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection You can associate only one datafeed with each anomaly detection job. The datafeed contains a query that runs at a defined interval (`frequency`). If you are concerned about delayed data, you can add a delay (`query_delay') at each interval. +By default, the datafeed uses the following query: `{"match_all": {"boost": 1}}`. + When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. @@ -7358,7 +10596,7 @@ client.ml.putDatafeed({ datafeed_id }) ** *`datafeed_id` (string)*: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. -** *`aggregations` (Optional, Record)*: If set, the datafeed performs aggregation searches. +** *`aggregations` (Optional, Record)*: If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. ** *`chunking_config` (Optional, { mode, time_span })*: Datafeeds might be required to search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. @@ -7382,14 +10620,14 @@ learning nodes must have the `remote_cluster_client` role. stops and closes the associated job after this many real-time searches return no documents. In other words, it stops after `frequency` times `max_empty_searches` of real-time operation. If not set, a datafeed with no end time that sees no data remains started until it is explicitly stopped. By default, it is not set. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. ** *`query_delay` (Optional, string | -1 | 0)*: The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default value is randomly selected between `60s` and `120s`. This randomness improves the query performance when there are multiple jobs running on the same node. -** *`runtime_mappings` (Optional, Record)*: Specifies runtime fields for the datafeed search. +** *`runtime_mappings` (Optional, Record)*: Specifies runtime fields for the datafeed search. ** *`script_fields` (Optional, Record)*: Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. ** *`scroll_size` (Optional, number)*: The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. @@ -7426,7 +10664,9 @@ Up to 10000 items are allowed in each filter. [discrete] ==== put_job Create an anomaly detection job. + If you include a `datafeed_config`, you must have read index privileges on the source index. +If you include a `datafeed_config` but do not provide a query, the datafeed uses `{"match_all": {"boost": 1}}`. {ref}/ml-put-job.html[Endpoint documentation] [source,ts] @@ -7454,6 +10694,18 @@ client.ml.putJob({ job_id, analysis_config, data_description }) ** *`renormalization_window_days` (Optional, number)*: Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen. The default value is the longer of 30 days or 100 bucket spans. ** *`results_index_name` (Optional, string)*: A text string that affects the name of the machine learning results index. By default, the job generates an index named `.ml-anomalies-shared`. ** *`results_retention_days` (Optional, number)*: Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. Annotations generated by the system also count as results for retention purposes; they are deleted after the same number of days as results. Annotations added by users are retained forever. +** *`allow_no_indices` (Optional, boolean)*: If `true`, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the +`_all` string or when no indices are specified. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines +whether wildcard expressions match hidden data streams. Supports a list of values. Valid values are: + +* `all`: Match any data stream or index, including hidden ones. +* `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. +* `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or both. +* `none`: Wildcard patterns are not accepted. +* `open`: Match open, non-hidden indices. Also matches any non-hidden data stream. +** *`ignore_throttled` (Optional, boolean)*: If `true`, concrete, expanded or aliased indices are ignored when frozen. +** *`ignore_unavailable` (Optional, boolean)*: If `true`, unavailable indices (missing or closed) are ignored. [discrete] ==== put_trained_model @@ -7477,7 +10729,7 @@ specified. ** *`definition` (Optional, { preprocessors, trained_model })*: The inference definition for the model. If definition is specified, then compressed_definition cannot be specified. ** *`description` (Optional, string)*: A human-readable description of the inference trained model. -** *`inference_config` (Optional, { regression, classification, text_classification, zero_shot_classification, fill_mask, ner, pass_through, text_embedding, text_expansion, question_answering })*: The default configuration for inference. This can be either a regression +** *`inference_config` (Optional, { regression, classification, text_classification, zero_shot_classification, fill_mask, learning_to_rank, ner, pass_through, text_embedding, text_expansion, question_answering })*: The default configuration for inference. This can be either a regression or classification configuration. It must match the underlying definition.trained_model's target_type. For pre-packaged models such as ELSER the config is not required. @@ -7743,6 +10995,9 @@ client.ml.startTrainedModelDeployment({ model_id }) * *Request (object):* ** *`model_id` (string)*: The unique identifier of the trained model. Currently, only PyTorch models are supported. +** *`adaptive_allocations` (Optional, { enabled, min_number_of_allocations, max_number_of_allocations })*: Adaptive allocations configuration. When enabled, the number of allocations +is set based on the current load. +If adaptive_allocations is enabled, do not set the number of allocations manually. ** *`cache_size` (Optional, number | string)*: The inference cache size (in memory outside the JVM heap) per node for the model. The default value is the same size as the `model_size_bytes`. To disable the cache, `0b` can be provided. @@ -7753,6 +11008,7 @@ a separate set of threads to evaluate the model. Increasing this value generally increases the throughput. If this setting is greater than the number of hardware threads it will automatically be changed to a value less than the number of hardware threads. +If adaptive_allocations is enabled, do not set this value, because it’s automatically set. ** *`priority` (Optional, Enum("normal" | "low"))*: The deployment priority. ** *`queue_capacity` (Optional, number)*: Specifies the number of inference requests that are allowed in the queue. After the number of requests exceeds this value, new requests are rejected with a 429 error. @@ -7785,10 +11041,10 @@ lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no data frame analytics +. Contains wildcard expressions and there are no data frame analytics jobs that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value is true, which returns an empty data_frame_analytics array when there are no matches and the subset of results when there are @@ -7847,7 +11103,7 @@ restart the model deployment. ==== update_data_frame_analytics Update a data frame analytics job. -{ref}/update-dfanalytics.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-data-frame-analytics[Endpoint documentation] [source,ts] ---- client.ml.updateDataFrameAnalytics({ id }) @@ -7894,7 +11150,7 @@ client.ml.updateDatafeed({ datafeed_id }) ** *`datafeed_id` (string)*: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. -** *`aggregations` (Optional, Record)*: If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only +** *`aggregations` (Optional, Record)*: If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. ** *`chunking_config` (Optional, { mode, time_span })*: Datafeeds might search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of @@ -7917,7 +11173,7 @@ learning nodes must have the `remote_cluster_client` role. stops and closes the associated job after this many real-time searches return no documents. In other words, it stops after `frequency` times `max_empty_searches` of real-time operation. If not set, a datafeed with no end time that sees no data remains started until it is explicitly stopped. By default, it is not set. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. Note that if you change the query, the analyzed data is also changed. Therefore, the time required to learn might be long and the understandability of the results is @@ -7928,7 +11184,7 @@ when you are satisfied with the results of the job. not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default value is randomly selected between `60s` and `120s`. This randomness improves the query performance when there are multiple jobs running on the same node. -** *`runtime_mappings` (Optional, Record)*: Specifies runtime fields for the datafeed search. +** *`runtime_mappings` (Optional, Record)*: Specifies runtime fields for the datafeed search. ** *`script_fields` (Optional, Record)*: Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. ** *`scroll_size` (Optional, number)*: The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. @@ -8029,7 +11285,7 @@ bucket result. If this property has a non-null value, once per day at than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. ** *`groups` (Optional, string[])*: A list of job groups. A job can belong to no groups or many. -** *`detectors` (Optional, { by_field_name, custom_rules, detector_description, detector_index, exclude_frequent, field_name, function, over_field_name, partition_field_name, use_null }[])*: An array of detector update objects. +** *`detectors` (Optional, { detector_index, description, custom_rules }[])*: An array of detector update objects. ** *`per_partition_categorization` (Optional, { enabled, stop_on_warn })*: Settings related to how categorization interacts with partition fields. [discrete] @@ -8058,7 +11314,7 @@ snapshot will be deleted when the job is deleted. ==== update_trained_model_deployment Update a trained model deployment. -{ref}/update-trained-model-deployment.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-trained-model-deployment[Endpoint documentation] [source,ts] ---- client.ml.updateTrainedModelDeployment({ model_id }) @@ -8075,11 +11331,15 @@ a separate set of threads to evaluate the model. Increasing this value generally increases the throughput. If this setting is greater than the number of hardware threads it will automatically be changed to a value less than the number of hardware threads. +If adaptive_allocations is enabled, do not set this value, because it’s automatically set. +** *`adaptive_allocations` (Optional, { enabled, min_number_of_allocations, max_number_of_allocations })*: Adaptive allocations configuration. When enabled, the number of allocations +is set based on the current load. +If adaptive_allocations is enabled, do not set the number of allocations manually. [discrete] ==== upgrade_job_snapshot Upgrade a snapshot. -Upgrades an anomaly detection model snapshot to the latest major version. +Upgrade an anomaly detection model snapshot to the latest major version. Over time, older snapshot formats are deprecated and removed. Anomaly detection jobs support only snapshots that are from the current or previous major version. @@ -8105,33 +11365,12 @@ client.ml.upgradeJobSnapshot({ job_id, snapshot_id }) Otherwise, it responds as soon as the upgrade task is assigned to a node. ** *`timeout` (Optional, string | -1 | 0)*: Controls the time to wait for the request to complete. -[discrete] -=== monitoring -[discrete] -==== bulk -Used by the monitoring features to send monitoring data. - -{ref}/monitor-elasticsearch-cluster.html[Endpoint documentation] -[source,ts] ----- -client.monitoring.bulk({ system_id, system_api_version, interval }) ----- - -[discrete] -==== Arguments - -* *Request (object):* -** *`system_id` (string)*: Identifier of the monitored system -** *`system_api_version` (string)* -** *`interval` (string | -1 | 0)*: Collection interval (e.g., '10s' or '10000ms') of the payload -** *`type` (Optional, string)*: Default document type for items which don't provide one -** *`operations` (Optional, { index, create, update, delete } | { detect_noop, doc, doc_as_upsert, script, scripted_upsert, _source, upsert } | object[])* - [discrete] === nodes [discrete] ==== clear_repositories_metering_archive -You can use this API to clear the archived repositories metering information in the cluster. +Clear the archived repositories metering. +Clear the archived repositories metering information in the cluster. {ref}/clear-repositories-metering-archive-api.html[Endpoint documentation] [source,ts] @@ -8144,15 +11383,14 @@ client.nodes.clearRepositoriesMeteringArchive({ node_id, max_archive_version }) * *Request (object):* ** *`node_id` (string | string[])*: List of node IDs or names used to limit returned information. -All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes). -** *`max_archive_version` (number)*: Specifies the maximum [archive_version](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-repositories-metering-api.html#get-repositories-metering-api-response-body) to be cleared from the archive. +** *`max_archive_version` (number)*: Specifies the maximum `archive_version` to be cleared from the archive. [discrete] ==== get_repositories_metering_info -You can use the cluster repositories metering API to retrieve repositories metering information in a cluster. -This API exposes monotonically non-decreasing counters and it’s expected that clients would durably store the -information needed to compute aggregations over a period of time. Additionally, the information exposed by this -API is volatile, meaning that it won’t be present after node restarts. +Get cluster repositories metering. +Get repositories metering information for a cluster. +This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. +Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. {ref}/get-repositories-metering-api.html[Endpoint documentation] [source,ts] @@ -8169,8 +11407,9 @@ All the nodes selective options are explained [here](https://www.elastic.co/guid [discrete] ==== hot_threads -This API yields a breakdown of the hot threads on each selected node in the cluster. -The output is plain text with a breakdown of each node’s top hot threads. +Get the hot threads for nodes. +Get a breakdown of the hot threads on each selected node in the cluster. +The output is plain text with a breakdown of the top hot threads for each node. {ref}/cluster-nodes-hot-threads.html[Endpoint documentation] [source,ts] @@ -8187,9 +11426,6 @@ client.nodes.hotThreads({ ... }) a task from an empty queue) are filtered out. ** *`interval` (Optional, string | -1 | 0)*: The interval to do the second sampling of threads. ** *`snapshots` (Optional, number)*: Number of samples of thread stacktrace. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response -is received before the timeout expires, the request fails and -returns an error. ** *`threads` (Optional, number)*: Specifies the number of hot threads to provide information for. ** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. @@ -8198,7 +11434,9 @@ before the timeout expires, the request fails and returns an error. [discrete] ==== info -Returns cluster nodes information. +Get node information. + +By default, the API returns all attributes and core settings for cluster nodes. {ref}/cluster-nodes-info.html[Endpoint documentation] [source,ts] @@ -8213,14 +11451,21 @@ client.nodes.info({ ... }) ** *`node_id` (Optional, string | string[])*: List of node IDs or names used to limit returned information. ** *`metric` (Optional, string | string[])*: Limits the information returned to the specific metrics. Supports a list, such as http,ingest. ** *`flat_settings` (Optional, boolean)*: If true, returns settings in flat format. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. ** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== reload_secure_settings -Reloads the keystore on nodes in the cluster. +Reload the keystore on nodes in the cluster. + +Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. +That is, you can change them on disk and reload them without restarting any nodes in the cluster. +When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. -{ref}/secure-settings.html[Endpoint documentation] +When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. +Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. +Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. + +{ref}/cluster-nodes-reload-secure-settings.html[Endpoint documentation] [source,ts] ---- client.nodes.reloadSecureSettings({ ... }) @@ -8237,7 +11482,9 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== stats -Returns cluster nodes statistics. +Get node statistics. +Get statistics for nodes in a cluster. +By default, all stats are returned. You can limit the returned information by using metrics. {ref}/cluster-nodes-stats.html[Endpoint documentation] [source,ts] @@ -8258,14 +11505,13 @@ client.nodes.stats({ ... }) ** *`groups` (Optional, boolean)*: List of search groups to include in the search statistics. ** *`include_segment_file_sizes` (Optional, boolean)*: If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). ** *`level` (Optional, Enum("cluster" | "indices" | "shards"))*: Indicates whether statistics are aggregated at the cluster, index, or shard level. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. ** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. ** *`types` (Optional, string[])*: A list of document types for the indexing index metric. ** *`include_unloaded_segments` (Optional, boolean)*: If `true`, the response includes information from segments that are not loaded into memory. [discrete] ==== usage -Returns information on the usage of features. +Get feature usage information. {ref}/cluster-nodes-usage.html[Endpoint documentation] [source,ts] @@ -8287,7 +11533,9 @@ If no response is received before the timeout expires, the request fails and ret === query_rules [discrete] ==== delete_rule -Deletes a query rule within a query ruleset. +Delete a query rule. +Delete a query rule within a query ruleset. +This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. {ref}/delete-query-rule.html[Endpoint documentation] [source,ts] @@ -8304,7 +11552,9 @@ client.queryRules.deleteRule({ ruleset_id, rule_id }) [discrete] ==== delete_ruleset -Deletes a query ruleset. +Delete a query ruleset. +Remove a query ruleset and its associated data. +This is a destructive action that is not recoverable. {ref}/delete-query-ruleset.html[Endpoint documentation] [source,ts] @@ -8320,7 +11570,8 @@ client.queryRules.deleteRuleset({ ruleset_id }) [discrete] ==== get_rule -Returns the details about a query rule within a query ruleset +Get a query rule. +Get details about a query rule within a query ruleset. {ref}/get-query-rule.html[Endpoint documentation] [source,ts] @@ -8337,7 +11588,8 @@ client.queryRules.getRule({ ruleset_id, rule_id }) [discrete] ==== get_ruleset -Returns the details about a query ruleset +Get a query ruleset. +Get details about a query ruleset. {ref}/get-query-ruleset.html[Endpoint documentation] [source,ts] @@ -8353,7 +11605,8 @@ client.queryRules.getRuleset({ ruleset_id }) [discrete] ==== list_rulesets -Returns summarized information about existing query rulesets. +Get all query rulesets. +Get summarized information about the query rulesets. {ref}/list-query-rulesets.html[Endpoint documentation] [source,ts] @@ -8365,38 +11618,71 @@ client.queryRules.listRulesets({ ... }) ==== Arguments * *Request (object):* -** *`from` (Optional, number)*: Starting offset (default: 0) -** *`size` (Optional, number)*: specifies a max number of results to get +** *`from` (Optional, number)*: The offset from the first result to fetch. +** *`size` (Optional, number)*: The maximum number of results to retrieve. + +[discrete] +==== put_rule +Create or update a query rule. +Create or update a query rule within a query ruleset. + +IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. +It is advised to use one or the other in query rulesets, to avoid errors. +Additionally, pinned queries have a maximum limit of 100 pinned hits. +If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. + +{ref}/put-query-rule.html[Endpoint documentation] +[source,ts] +---- +client.queryRules.putRule({ ruleset_id, rule_id, type, criteria, actions }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`ruleset_id` (string)*: The unique identifier of the query ruleset containing the rule to be created or updated. +** *`rule_id` (string)*: The unique identifier of the query rule within the specified ruleset to be created or updated. +** *`type` (Enum("pinned" | "exclude"))*: The type of rule. +** *`criteria` ({ type, metadata, values } | { type, metadata, values }[])*: The criteria that must be met for the rule to be applied. +If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied. +** *`actions` ({ ids, docs })*: The actions to take when the rule is matched. +The format of this action depends on the rule type. +** *`priority` (Optional, number)* + +[discrete] +==== put_ruleset +Create or update a query ruleset. +There is a limit of 100 rules per ruleset. +This limit can be increased by using the `xpack.applications.rules.max_rules_per_ruleset` cluster setting. -[discrete] -==== put_rule -Creates or updates a query rule within a query ruleset. +IMPORTANT: Due to limitations within pinned queries, you can only select documents using `ids` or `docs`, but cannot use both in single rule. +It is advised to use one or the other in query rulesets, to avoid errors. +Additionally, pinned queries have a maximum limit of 100 pinned hits. +If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. -{ref}/put-query-rule.html[Endpoint documentation] +{ref}/put-query-ruleset.html[Endpoint documentation] [source,ts] ---- -client.queryRules.putRule({ ruleset_id, rule_id, type, criteria, actions }) +client.queryRules.putRuleset({ ruleset_id, rules }) ---- [discrete] ==== Arguments * *Request (object):* -** *`ruleset_id` (string)*: The unique identifier of the query ruleset containing the rule to be created or updated -** *`rule_id` (string)*: The unique identifier of the query rule within the specified ruleset to be created or updated -** *`type` (Enum("pinned" | "exclude"))* -** *`criteria` ({ type, metadata, values } | { type, metadata, values }[])* -** *`actions` ({ ids, docs })* -** *`priority` (Optional, number)* +** *`ruleset_id` (string)*: The unique identifier of the query ruleset to be created or updated. +** *`rules` ({ rule_id, type, criteria, actions, priority } | { rule_id, type, criteria, actions, priority }[])* [discrete] -==== put_ruleset -Creates or updates a query ruleset. +==== test +Test a query ruleset. +Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. -{ref}/put-query-ruleset.html[Endpoint documentation] +{ref}/test-query-ruleset.html[Endpoint documentation] [source,ts] ---- -client.queryRules.putRuleset({ ruleset_id, rules }) +client.queryRules.test({ ruleset_id, match_criteria }) ---- [discrete] @@ -8404,13 +11690,37 @@ client.queryRules.putRuleset({ ruleset_id, rules }) * *Request (object):* ** *`ruleset_id` (string)*: The unique identifier of the query ruleset to be created or updated -** *`rules` ({ rule_id, type, criteria, actions, priority } | { rule_id, type, criteria, actions, priority }[])* +** *`match_criteria` (Record)*: The match criteria to apply to rules in the given query ruleset. +Match criteria should match the keys defined in the `criteria.metadata` field of the rule. [discrete] === rollup [discrete] ==== delete_job -Deletes an existing rollup job. +Delete a rollup job. + +A job must be stopped before it can be deleted. +If you attempt to delete a started job, an error occurs. +Similarly, if you attempt to delete a nonexistent job, an exception occurs. + +IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. +The API does not delete any previously rolled up data. +This is by design; a user may wish to roll up a static data set. +Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). +Thus the job can be deleted, leaving behind the rolled up data for analysis. +If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. +If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: + +---- +POST my_rollup_index/_delete_by_query +{ + "query": { + "term": { + "_rollup.id": "the_rollup_job_id" + } + } +} +---- {ref}/rollup-delete-job.html[Endpoint documentation] [source,ts] @@ -8426,7 +11736,12 @@ client.rollup.deleteJob({ id }) [discrete] ==== get_jobs -Retrieves the configuration, stats, and status of rollup jobs. +Get rollup job information. +Get the configuration, stats, and status of rollup jobs. + +NOTE: This API returns only active (both `STARTED` and `STOPPED`) jobs. +If a job was created, ran for a while, then was deleted, the API does not return any details about it. +For details about a historical rollup job, the rollup capabilities API may be more useful. {ref}/rollup-get-job.html[Endpoint documentation] [source,ts] @@ -8443,7 +11758,15 @@ If it is `_all` or omitted, the API returns all rollup jobs. [discrete] ==== get_rollup_caps -Returns the capabilities of any rollup jobs that have been configured for a specific index or index pattern. +Get the rollup job capabilities. +Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. + +This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. +Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. +This API enables you to inspect an index and determine: + +. Does this index have associated rollup data somewhere in the cluster? +. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? {ref}/rollup-get-rollup-caps.html[Endpoint documentation] [source,ts] @@ -8460,7 +11783,12 @@ client.rollup.getRollupCaps({ ... }) [discrete] ==== get_rollup_index_caps -Returns the rollup capabilities of all jobs inside of a rollup index (for example, the index where rollup data is stored). +Get the rollup index capabilities. +Get the rollup capabilities of all jobs inside of a rollup index. +A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: + +* What jobs are stored in an index (or indices specified via a pattern)? +* What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? {ref}/rollup-get-rollup-index-caps.html[Endpoint documentation] [source,ts] @@ -8477,7 +11805,15 @@ Wildcard (`*`) expressions are supported. [discrete] ==== put_job -Creates a rollup job. +Create a rollup job. + +WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. + +The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. + +There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. + +Jobs are created in a `STOPPED` state. You can start them with the start rollup jobs API. {ref}/rollup-put-job.html[Endpoint documentation] [source,ts] @@ -8518,7 +11854,42 @@ on a per-field basis and for each field you configure which metric should be col [discrete] ==== rollup_search -Enables searching rolled-up data using the standard Query DSL. +Search rolled-up data. +The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. +It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. + +The request body supports a subset of features from the regular search API. +The following functionality is not available: + +`size`: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. +`highlighter`, `suggestors`, `post_filter`, `profile`, `explain`: These are similarly disallowed. + +**Searching both historical rollup and non-rollup data** + +The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. +This is done by simply adding the live indices to the URI. For example: + +---- +GET sensor-1,sensor_rollup/_rollup_search +{ + "size": 0, + "aggregations": { + "max_temperature": { + "max": { + "field": "temperature" + } + } + } +} +---- + +The rollup search endpoint does two things when the search runs: + +* The original request is sent to the non-rollup index unaltered. +* A rewritten version of the original request is sent to the rollup index. + +When the two responses are received, the endpoint rewrites the rollup response and merges the two together. +During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. {ref}/rollup-search.html[Endpoint documentation] [source,ts] @@ -8530,16 +11901,24 @@ client.rollup.rollupSearch({ index }) ==== Arguments * *Request (object):* -** *`index` (string | string[])*: Enables searching rolled-up data using the standard Query DSL. -** *`aggregations` (Optional, Record)*: Specifies aggregations. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Specifies a DSL query. +** *`index` (string | string[])*: A list of data streams and indices used to limit the request. +This parameter has the following rules: + +* At least one data stream, index, or wildcard expression must be specified. This target can include a rollup or non-rollup index. For data streams, the stream's backing indices can only serve as non-rollup indices. Omitting the parameter or using `_all` are not permitted. +* Multiple non-rollup indices may be specified. +* Only one rollup index may be specified. If more than one are supplied, an exception occurs. +* Wildcard expressions (`*`) may be used. If they match more than one rollup index, an exception occurs. However, you can use an expression to match multiple non-rollup indices or data streams. +** *`aggregations` (Optional, Record)*: Specifies aggregations. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Specifies a DSL query that is subject to some limitations. ** *`size` (Optional, number)*: Must be zero if set, as rollups work on pre-aggregated data. ** *`rest_total_hits_as_int` (Optional, boolean)*: Indicates whether hits.total should be rendered as an integer or an object in the rest search response ** *`typed_keys` (Optional, boolean)*: Specify whether aggregation and suggester names should be prefixed by their respective types in the response [discrete] ==== start_job -Starts an existing, stopped rollup job. +Start rollup jobs. +If you try to start a job that does not exist, an exception occurs. +If you try to start a job that is already started, nothing happens. {ref}/rollup-start-job.html[Endpoint documentation] [source,ts] @@ -8555,7 +11934,18 @@ client.rollup.startJob({ id }) [discrete] ==== stop_job -Stops an existing, started rollup job. +Stop rollup jobs. +If you try to stop a job that does not exist, an exception occurs. +If you try to stop a job that is already stopped, nothing happens. + +Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. +This is accomplished with the `wait_for_completion` query parameter, and optionally a timeout. For example: + +---- +POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s +---- +The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. +If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. {ref}/rollup-stop-job.html[Endpoint documentation] [source,ts] @@ -8570,6 +11960,8 @@ client.rollup.stopJob({ id }) ** *`id` (string)*: Identifier for the rollup job. ** *`timeout` (Optional, string | -1 | 0)*: If `wait_for_completion` is `true`, the API blocks for (at maximum) the specified duration while waiting for the job to stop. If more than `timeout` time has passed, the API throws a timeout exception. +NOTE: Even if a timeout occurs, the stop request is still processing and eventually moves the job to STOPPED. +The timeout simply means the API call itself timed out while waiting for the status change. ** *`wait_for_completion` (Optional, boolean)*: If set to `true`, causes the API to block until the indexer state completely stops. If set to `false`, the API returns immediately and the indexer is stopped asynchronously in the background. @@ -8577,7 +11969,9 @@ If set to `false`, the API returns immediately and the indexer is stopped asynch === search_application [discrete] ==== delete -Deletes a search application. +Delete a search application. + +Remove a search application and its associated alias. Indices attached to the search application are not removed. {ref}/delete-search-application.html[Endpoint documentation] [source,ts] @@ -8589,11 +11983,12 @@ client.searchApplication.delete({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: The name of the search application to delete +** *`name` (string)*: The name of the search application to delete. [discrete] ==== delete_behavioral_analytics Delete a behavioral analytics collection. +The associated data stream is also deleted. {ref}/delete-analytics-collection.html[Endpoint documentation] [source,ts] @@ -8609,7 +12004,7 @@ client.searchApplication.deleteBehavioralAnalytics({ name }) [discrete] ==== get -Returns the details about a search application +Get search application details. {ref}/get-search-application.html[Endpoint documentation] [source,ts] @@ -8625,7 +12020,7 @@ client.searchApplication.get({ name }) [discrete] ==== get_behavioral_analytics -Returns the existing behavioral analytics collections. +Get behavioral analytics collections. {ref}/list-analytics-collection.html[Endpoint documentation] [source,ts] @@ -8641,9 +12036,10 @@ client.searchApplication.getBehavioralAnalytics({ ... }) [discrete] ==== list -Returns the existing search applications. +Get search applications. +Get information about search applications. -{ref}/list-search-applications.html[Endpoint documentation] +{ref}/list-analytics-collection.html[Endpoint documentation] [source,ts] ---- client.searchApplication.list({ ... }) @@ -8659,18 +12055,26 @@ client.searchApplication.list({ ... }) [discrete] ==== post_behavioral_analytics_event -Creates a behavioral analytics event for existing collection. +Create a behavioral analytics collection event. -http://todo.com/tbd[Endpoint documentation] +{ref}/post-analytics-collection-event.html[Endpoint documentation] [source,ts] ---- -client.searchApplication.postBehavioralAnalyticsEvent() +client.searchApplication.postBehavioralAnalyticsEvent({ collection_name, event_type }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`collection_name` (string)*: The name of the behavioral analytics collection. +** *`event_type` (Enum("page_view" | "search" | "search_click"))*: The analytics event type. +** *`payload` (Optional, User-defined value)* +** *`debug` (Optional, boolean)*: Whether the response type has to include more details [discrete] ==== put -Creates or updates a search application. +Create or update a search application. {ref}/put-search-application.html[Endpoint documentation] [source,ts] @@ -8683,12 +12087,12 @@ client.searchApplication.put({ name }) * *Request (object):* ** *`name` (string)*: The name of the search application to be created or updated. -** *`search_application` (Optional, { name, indices, updated_at_millis, analytics_collection_name, template })* +** *`search_application` (Optional, { indices, analytics_collection_name, template })* ** *`create` (Optional, boolean)*: If `true`, this request cannot replace or update existing Search Applications. [discrete] ==== put_behavioral_analytics -Creates a behavioral analytics collection. +Create a behavioral analytics collection. {ref}/put-analytics-collection.html[Endpoint documentation] [source,ts] @@ -8704,18 +12108,31 @@ client.searchApplication.putBehavioralAnalytics({ name }) [discrete] ==== render_query -Renders a query for given search application search parameters +Render a search application query. +Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. +If a parameter used in the search template is not specified in `params`, the parameter's default value will be used. +The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. + +You must have `read` privileges on the backing alias of the search application. {ref}/search-application-render-query.html[Endpoint documentation] [source,ts] ---- -client.searchApplication.renderQuery() +client.searchApplication.renderQuery({ name }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`name` (string)*: The name of the search application to render teh query for. +** *`params` (Optional, Record)* [discrete] ==== search -Perform a search against a search application. +Run a search application search. +Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. +Unspecified template parameters are assigned their default values if applicable. {ref}/search-application-search.html[Endpoint documentation] [source,ts] @@ -8735,9 +12152,10 @@ client.searchApplication.search({ name }) === searchable_snapshots [discrete] ==== cache_stats -Retrieve node-level cache statistics about searchable snapshots. +Get cache statistics. +Get statistics about the shared cache for partially mounted indices. -{ref}/searchable-snapshots-apis.html[Endpoint documentation] +{ref}/searchable-snapshots-api-cache-stats.html[Endpoint documentation] [source,ts] ---- client.searchableSnapshots.cacheStats({ ... }) @@ -8747,14 +12165,15 @@ client.searchableSnapshots.cacheStats({ ... }) ==== Arguments * *Request (object):* -** *`node_id` (Optional, string | string[])*: A list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes +** *`node_id` (Optional, string | string[])*: The names of the nodes in the cluster to target. ** *`master_timeout` (Optional, string | -1 | 0)* [discrete] ==== clear_cache -Clear the cache of searchable snapshots. +Clear the cache. +Clear indices and data streams from the shared cache for partially mounted indices. -{ref}/searchable-snapshots-apis.html[Endpoint documentation] +{ref}/searchable-snapshots-api-clear-cache.html[Endpoint documentation] [source,ts] ---- client.searchableSnapshots.clearCache({ ... }) @@ -8764,16 +12183,18 @@ client.searchableSnapshots.clearCache({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: A list of index names +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases to clear from the cache. +It supports wildcards (`*`). ** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Whether to expand wildcard expression to concrete indices that are open, closed or both. ** *`allow_no_indices` (Optional, boolean)*: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) ** *`ignore_unavailable` (Optional, boolean)*: Whether specified concrete indices should be ignored when unavailable (missing or closed) -** *`pretty` (Optional, boolean)* -** *`human` (Optional, boolean)* [discrete] ==== mount -Mount a snapshot as a searchable index. +Mount a snapshot. +Mount a snapshot as a searchable snapshot index. +Do not use this API for snapshots managed by index lifecycle management (ILM). +Manually mounting ILM-managed snapshots can interfere with ILM processes. {ref}/searchable-snapshots-api-mount-snapshot.html[Endpoint documentation] [source,ts] @@ -8785,21 +12206,24 @@ client.searchableSnapshots.mount({ repository, snapshot, index }) ==== Arguments * *Request (object):* -** *`repository` (string)*: The name of the repository containing the snapshot of the index to mount -** *`snapshot` (string)*: The name of the snapshot of the index to mount -** *`index` (string)* -** *`renamed_index` (Optional, string)* -** *`index_settings` (Optional, Record)* -** *`ignore_index_settings` (Optional, string[])* -** *`master_timeout` (Optional, string | -1 | 0)*: Explicit operation timeout for connection to master node -** *`wait_for_completion` (Optional, boolean)*: Should this request wait until the operation has completed before returning -** *`storage` (Optional, string)*: Selects the kind of local storage used to accelerate searches. Experimental, and defaults to `full_copy` +** *`repository` (string)*: The name of the repository containing the snapshot of the index to mount. +** *`snapshot` (string)*: The name of the snapshot of the index to mount. +** *`index` (string)*: The name of the index contained in the snapshot whose data is to be mounted. +If no `renamed_index` is specified, this name will also be used to create the new index. +** *`renamed_index` (Optional, string)*: The name of the index that will be created. +** *`index_settings` (Optional, Record)*: The settings that should be added to the index when it is mounted. +** *`ignore_index_settings` (Optional, string[])*: The names of settings that should be removed from the index when it is mounted. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. +** *`wait_for_completion` (Optional, boolean)*: If true, the request blocks until the operation is complete. +** *`storage` (Optional, string)*: The mount option for the searchable snapshot index. [discrete] ==== stats -Retrieve shard-level statistics about searchable snapshots. +Get searchable snapshot statistics. -{ref}/searchable-snapshots-apis.html[Endpoint documentation] +{ref}/searchable-snapshots-api-stats.html[Endpoint documentation] [source,ts] ---- client.searchableSnapshots.stats({ ... }) @@ -8809,14 +12233,27 @@ client.searchableSnapshots.stats({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: A list of index names +** *`index` (Optional, string | string[])*: A list of data streams and indices to retrieve statistics for. ** *`level` (Optional, Enum("cluster" | "indices" | "shards"))*: Return stats aggregated at cluster, index or shard level [discrete] === security [discrete] ==== activate_user_profile -Creates or updates a user profile on behalf of another user. +Activate a user profile. + +Create or update a user profile on behalf of another user. + +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +The calling application must have either an `access_token` or a combination of `username` and `password` for the user that the profile document is intended for. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + +This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including `username`, `full_name,` `roles`, and the authentication realm. +For example, in the JWT `access_token` case, the profile user's `username` is extracted from the JWT token claim pointed to by the `claims.principal` setting of the JWT realm that authenticated the token. + +When updating a profile document, the API enables the document if it was disabled. +Any updates do not change existing content for either the `labels` or `data` fields. {ref}/security-api-activate-user-profile.html[Endpoint documentation] [source,ts] @@ -8828,14 +12265,22 @@ client.security.activateUserProfile({ grant_type }) ==== Arguments * *Request (object):* -** *`grant_type` (Enum("password" | "access_token"))* -** *`access_token` (Optional, string)* -** *`password` (Optional, string)* -** *`username` (Optional, string)* +** *`grant_type` (Enum("password" | "access_token"))*: The type of grant. +** *`access_token` (Optional, string)*: The user's Elasticsearch access token or JWT. +Both `access` and `id` JWT token types are supported and they depend on the underlying JWT realm configuration. +If you specify the `access_token` grant type, this parameter is required. +It is not valid with other grant types. +** *`password` (Optional, string)*: The user's password. +If you specify the `password` grant type, this parameter is required. +It is not valid with other grant types. +** *`username` (Optional, string)*: The username that identifies the user. +If you specify the `password` grant type, this parameter is required. +It is not valid with other grant types. [discrete] ==== authenticate Authenticate a user. + Authenticates a user and returns information about the authenticated user. Include the user information in a [basic auth header](https://en.wikipedia.org/wiki/Basic_access_authentication). A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. @@ -8850,6 +12295,8 @@ client.security.authenticate() [discrete] ==== bulk_delete_role +Bulk delete roles. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The bulk delete roles API cannot delete roles that are defined in roles files. @@ -8868,6 +12315,8 @@ client.security.bulkDeleteRole({ names }) [discrete] ==== bulk_put_role +Bulk create or update roles. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The bulk create or update roles API cannot update roles that are defined in roles files. @@ -8881,23 +12330,58 @@ client.security.bulkPutRole({ roles }) ==== Arguments * *Request (object):* -** *`roles` (Record)*: A dictionary of role name to RoleDescriptor objects to add or update +** *`roles` (Record)*: A dictionary of role name to RoleDescriptor objects to add or update ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== bulk_update_api_keys -Updates the attributes of multiple existing API keys. +Bulk update API keys. +Update the attributes for multiple API keys. + +IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. + +This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. + +It is not possible to update expired or invalidated API keys. + +This API supports updates to API key access scope, metadata and expiration. +The access scope of each API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request. +The snapshot of the owner's permissions is updated automatically on every call. + +IMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. + +A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. {ref}/security-api-bulk-update-api-keys.html[Endpoint documentation] [source,ts] ---- -client.security.bulkUpdateApiKeys() +client.security.bulkUpdateApiKeys({ ids }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`ids` (string | string[])*: The API key identifiers. +** *`expiration` (Optional, string | -1 | 0)*: Expiration time for the API keys. +By default, API keys never expire. +This property can be omitted to leave the value unchanged. +** *`metadata` (Optional, Record)*: Arbitrary nested metadata to associate with the API keys. +Within the `metadata` object, top-level keys beginning with an underscore (`_`) are reserved for system usage. +Any information specified with this parameter fully replaces metadata previously associated with the API key. +** *`role_descriptors` (Optional, Record)*: The role descriptors to assign to the API keys. +An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. +You can assign new privileges by specifying them in this parameter. +To remove assigned privileges, supply the `role_descriptors` parameter as an empty object `{}`. +If an API key has no assigned privileges, it inherits the owner user's full permissions. +The snapshot of the owner's permissions is always updated, whether you supply the `role_descriptors` parameter. +The structure of a role descriptor is the same as the request for the create API keys API. [discrete] ==== change_password -Changes the passwords of users in the native realm and built-in users. +Change passwords. + +Change the passwords of users in the native realm and built-in users. {ref}/security-api-change-password.html[Endpoint documentation] [source,ts] @@ -8920,7 +12404,9 @@ setting. [discrete] ==== clear_api_key_cache -Evicts a subset of all entries from the API key cache. +Clear the API key cache. + +Evict a subset of all entries from the API key cache. The cache is also automatically cleared on state changes of the security index. {ref}/security-api-clear-api-key-cache.html[Endpoint documentation] @@ -8939,7 +12425,10 @@ Does not support other wildcard patterns. [discrete] ==== clear_cached_privileges -Evicts application privileges from the native application privileges cache. +Clear the privileges cache. + +Evict privileges from the native application privilege cache. +The cache is also automatically cleared for applications that have their privileges updated. {ref}/security-api-clear-privilege-cache.html[Endpoint documentation] [source,ts] @@ -8951,11 +12440,20 @@ client.security.clearCachedPrivileges({ application }) ==== Arguments * *Request (object):* -** *`application` (string)*: A list of application names +** *`application` (string)*: A list of applications. +To clear all applications, use an asterism (`*`). +It does not support other wildcard patterns. [discrete] ==== clear_cached_realms -Evicts users from the user cache. Can completely clear the cache or evict specific users. +Clear the user cache. + +Evict users from the user cache. +You can completely clear the cache or evict specific users. + +User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. +There are realm settings that you can use to configure the user cache. +For more information, refer to the documentation about controlling the user cache. {ref}/security-api-clear-cache.html[Endpoint documentation] [source,ts] @@ -8967,12 +12465,17 @@ client.security.clearCachedRealms({ realms }) ==== Arguments * *Request (object):* -** *`realms` (string | string[])*: List of realms to clear -** *`usernames` (Optional, string[])*: List of usernames to clear from the cache +** *`realms` (string | string[])*: A list of realms. +To clear all realms, use an asterisk (`*`). +It does not support other wildcard patterns. +** *`usernames` (Optional, string[])*: A list of the users to clear from the cache. +If you do not specify this parameter, the API evicts all users from the user cache. [discrete] ==== clear_cached_roles -Evicts roles from the native role cache. +Clear the roles cache. + +Evict roles from the native role cache. {ref}/security-api-clear-role-cache.html[Endpoint documentation] [source,ts] @@ -8984,11 +12487,20 @@ client.security.clearCachedRoles({ name }) ==== Arguments * *Request (object):* -** *`name` (string | string[])*: Role name +** *`name` (string | string[])*: A list of roles to evict from the role cache. +To evict all roles, use an asterisk (`*`). +It does not support other wildcard patterns. [discrete] ==== clear_cached_service_tokens -Evicts tokens from the service account token caches. +Clear service account token caches. + +Evict a subset of all entries from the service account token caches. +Two separate caches exist for service account tokens: one cache for tokens backed by the `service_tokens` file, and another for tokens backed by the `.security` index. +This API clears matching entries from both caches. + +The cache for service account tokens backed by the `.security` index is cleared automatically on state changes of the security index. +The cache for tokens backed by the `service_tokens` file is cleared automatically on file changes. {ref}/security-api-clear-service-token-caches.html[Endpoint documentation] [source,ts] @@ -9000,18 +12512,29 @@ client.security.clearCachedServiceTokens({ namespace, service, name }) ==== Arguments * *Request (object):* -** *`namespace` (string)*: An identifier for the namespace -** *`service` (string)*: An identifier for the service name -** *`name` (string | string[])*: A list of service token names +** *`namespace` (string)*: The namespace, which is a top-level grouping of service accounts. +** *`service` (string)*: The name of the service, which must be unique within its namespace. +** *`name` (string | string[])*: A list of token names to evict from the service account token caches. +Use a wildcard (`*`) to evict all tokens that belong to a service account. +It does not support other wildcard patterns. [discrete] ==== create_api_key Create an API key. -Creates an API key for access without requiring basic authentication. + +Create an API key for access without requiring basic authentication. + +IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. +If you specify privileges, the API returns an error. + A successful request returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. + NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. +The API keys are created by the Elasticsearch API key service, which is automatically enabled. +To configure or turn off the API key service, refer to API key service setting documentation. + {ref}/security-api-create-api-key.html[Endpoint documentation] [source,ts] ---- @@ -9022,26 +12545,72 @@ client.security.createApiKey({ ... }) ==== Arguments * *Request (object):* -** *`expiration` (Optional, string | -1 | 0)*: Expiration time for the API key. By default, API keys never expire. -** *`name` (Optional, string)*: Specifies the name for this API key. -** *`role_descriptors` (Optional, Record)*: An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. +** *`expiration` (Optional, string | -1 | 0)*: The expiration time for the API key. +By default, API keys never expire. +** *`name` (Optional, string)*: A name for the API key. +** *`role_descriptors` (Optional, Record)*: An array of role descriptors for this API key. +When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. +If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. +The structure of role descriptor is the same as the request for the create role API. +For more details, refer to the create or update roles API. + +NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. +In this case, you must explicitly specify a role descriptor with no privileges. +The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. ** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== create_cross_cluster_api_key -Creates a cross-cluster API key for API key based remote cluster access. +Create a cross-cluster API key. + +Create an API key of the `cross_cluster` type for the API key based remote cluster access. +A `cross_cluster` API key cannot be used to authenticate through the REST interface. + +IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. + +Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. + +NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the `access` property. + +A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. + +By default, API keys never expire. You can specify expiration information when you create the API keys. + +Cross-cluster API keys can only be updated with the update cross-cluster API key API. +Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. {ref}/security-api-create-cross-cluster-api-key.html[Endpoint documentation] [source,ts] ---- -client.security.createCrossClusterApiKey() +client.security.createCrossClusterApiKey({ access, name }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`access` ({ replication, search })*: The access to be granted to this API key. +The access is composed of permissions for cross-cluster search and cross-cluster replication. +At least one of them must be specified. + +NOTE: No explicit privileges should be specified for either search or replication access. +The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. +** *`name` (string)*: Specifies the name for this API key. +** *`expiration` (Optional, string | -1 | 0)*: Expiration time for the API key. +By default, API keys never expire. +** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the API key. +It supports nested data structure. +Within the metadata object, keys beginning with `_` are reserved for system usage. [discrete] ==== create_service_token -Creates a service accounts token for access without requiring basic authentication. +Create a service account token. + +Create a service accounts token for access without requiring basic authentication. + +NOTE: Service account tokens never expire. +You must actively delete them if they are no longer needed. {ref}/security-api-create-service-token.html[Endpoint documentation] [source,ts] @@ -9053,14 +12622,56 @@ client.security.createServiceToken({ namespace, service }) ==== Arguments * *Request (object):* -** *`namespace` (string)*: An identifier for the namespace -** *`service` (string)*: An identifier for the service name -** *`name` (Optional, string)*: An identifier for the token name +** *`namespace` (string)*: The name of the namespace, which is a top-level grouping of service accounts. +** *`service` (string)*: The name of the service. +** *`name` (Optional, string)*: The name for the service account token. +If omitted, a random name will be generated. + +Token names must be at least one and no more than 256 characters. +They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes (`-`), and underscores (`_`), but cannot begin with an underscore. + +NOTE: Token names must be unique in the context of the associated service account. +They must also be globally unique with their fully qualified names, which are comprised of the service account principal and token name, such as `//`. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +[discrete] +==== delegate_pki +Delegate PKI authentication. + +This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. +The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has `delegation.enabled` set to `true`. +A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw `username_pattern` of the respective realm. + +This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch. + +IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. +This is part of the TLS authentication process and it is delegated to the proxy that calls this API. +The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. + +{ref}/security-api-delegate-pki-authentication.html[Endpoint documentation] +[source,ts] +---- +client.security.delegatePki({ x509_certificate_chain }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`x509_certificate_chain` (string[])*: The X509Certificate chain, which is represented as an ordered string array. +Each string in the array is a base64-encoded (Section 4 of RFC4648 - not base64url-encoded) of the certificate's DER encoding. + +The first element is the target certificate that contains the subject distinguished name that is requesting access. +This may be followed by additional certificates; each subsequent certificate is used to certify the previous one. + [discrete] ==== delete_privileges -Removes application privileges. +Delete application privileges. + +To use this API, you must have one of the following privileges: + +* The `manage_security` cluster privilege (or a greater privilege such as `all`). +* The "Manage Application Privileges" global privilege for the application being referenced in the request. {ref}/security-api-delete-privilege.html[Endpoint documentation] [source,ts] @@ -9072,13 +12683,18 @@ client.security.deletePrivileges({ application, name }) ==== Arguments * *Request (object):* -** *`application` (string)*: Application name -** *`name` (string | string[])*: Privilege name +** *`application` (string)*: The name of the application. +Application privileges are always associated with exactly one application. +** *`name` (string | string[])*: The name of the privilege. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== delete_role -Removes roles in the native realm. +Delete roles. + +Delete roles in the native realm. +The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +The delete roles API cannot remove roles that are defined in roles files. {ref}/security-api-delete-role.html[Endpoint documentation] [source,ts] @@ -9090,12 +12706,16 @@ client.security.deleteRole({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: Role name +** *`name` (string)*: The name of the role. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== delete_role_mapping -Removes role mappings. +Delete role mappings. + +Role mappings define which roles are assigned to each user. +The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. +The delete role mappings API cannot remove role mappings that are defined in role mapping files. {ref}/security-api-delete-role-mapping.html[Endpoint documentation] [source,ts] @@ -9107,12 +12727,15 @@ client.security.deleteRoleMapping({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: Role-mapping name +** *`name` (string)*: The distinct name that identifies the role mapping. +The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== delete_service_token -Deletes a service account token. +Delete service account tokens. + +Delete service account tokens for a service in a specified namespace. {ref}/security-api-delete-service-token.html[Endpoint documentation] [source,ts] @@ -9124,14 +12747,16 @@ client.security.deleteServiceToken({ namespace, service, name }) ==== Arguments * *Request (object):* -** *`namespace` (string)*: An identifier for the namespace -** *`service` (string)*: An identifier for the service name -** *`name` (string)*: An identifier for the token name +** *`namespace` (string)*: The namespace, which is a top-level grouping of service accounts. +** *`service` (string)*: The service name. +** *`name` (string)*: The name of the service account token. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== delete_user -Deletes users from the native realm. +Delete users. + +Delete users from the native realm. {ref}/security-api-delete-user.html[Endpoint documentation] [source,ts] @@ -9143,12 +12768,16 @@ client.security.deleteUser({ username }) ==== Arguments * *Request (object):* -** *`username` (string)*: username +** *`username` (string)*: An identifier for the user. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== disable_user -Disables users in the native realm. +Disable users. + +Disable users in the native realm. +By default, when you create users, they are enabled. +You can use this API to revoke a user's access to Elasticsearch. {ref}/security-api-disable-user.html[Endpoint documentation] [source,ts] @@ -9160,12 +12789,21 @@ client.security.disableUser({ username }) ==== Arguments * *Request (object):* -** *`username` (string)*: The username of the user to disable +** *`username` (string)*: An identifier for the user. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== disable_user_profile -Disables a user profile so it's not visible in user profile searches. +Disable a user profile. + +Disable user profiles so that they are not visible in user profile searches. + +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + +When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. +To re-enable a disabled user profile, use the enable user profile API . {ref}/security-api-disable-user-profile.html[Endpoint documentation] [source,ts] @@ -9178,13 +12816,16 @@ client.security.disableUserProfile({ uid }) * *Request (object):* ** *`uid` (string)*: Unique identifier for the user profile. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation -visible to search, if 'wait_for' then wait for a refresh to make this operation -visible to search, if 'false' do nothing with refreshes. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. +If 'wait_for', it waits for a refresh to make this operation visible to search. +If 'false', it does nothing with refreshes. [discrete] ==== enable_user -Enables users in the native realm. +Enable users. + +Enable users in the native realm. +By default, when you create users, they are enabled. {ref}/security-api-enable-user.html[Endpoint documentation] [source,ts] @@ -9196,12 +12837,21 @@ client.security.enableUser({ username }) ==== Arguments * *Request (object):* -** *`username` (string)*: The username of the user to enable +** *`username` (string)*: An identifier for the user. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== enable_user_profile -Enables a user profile so it's visible in user profile searches. +Enable a user profile. + +Enable user profiles to make them visible in user profile searches. + +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + +When you activate a user profile, it's automatically enabled and visible in user profile searches. +If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. {ref}/security-api-enable-user-profile.html[Endpoint documentation] [source,ts] @@ -9213,14 +12863,20 @@ client.security.enableUserProfile({ uid }) ==== Arguments * *Request (object):* -** *`uid` (string)*: Unique identifier for the user profile. +** *`uid` (string)*: A unique identifier for the user profile. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation -visible to search, if 'wait_for' then wait for a refresh to make this operation -visible to search, if 'false' do nothing with refreshes. +visible to search. +If 'wait_for', it waits for a refresh to make this operation visible to search. +If 'false', nothing is done with refreshes. [discrete] ==== enroll_kibana -Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. +Enroll Kibana. + +Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + +NOTE: This API is currently intended for internal use only by Kibana. +Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. {ref}/security-api-kibana-enrollment.html[Endpoint documentation] [source,ts] @@ -9231,7 +12887,12 @@ client.security.enrollKibana() [discrete] ==== enroll_node -Allows a new node to join an existing cluster with security features enabled. +Enroll a node. + +Enroll a new node to allow it to join an existing cluster with security features enabled. + +The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. +The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. {ref}/security-api-node-enrollment.html[Endpoint documentation] [source,ts] @@ -9243,6 +12904,7 @@ client.security.enrollNode() [discrete] ==== get_api_key Get API key information. + Retrieves information for one or more API keys. NOTE: If you have only the `manage_own_api_key` privilege, this API returns only the API keys that you own. If you have `read_security`, `manage_api_key` or greater privileges (including `manage_security`), this API returns all API keys regardless of ownership. @@ -9277,7 +12939,9 @@ descriptors and the owner user's role descriptors. [discrete] ==== get_builtin_privileges -Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. +Get builtin privileges. + +Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. {ref}/security-api-get-builtin-privileges.html[Endpoint documentation] [source,ts] @@ -9288,7 +12952,12 @@ client.security.getBuiltinPrivileges() [discrete] ==== get_privileges -Retrieves application privileges. +Get application privileges. + +To use this API, you must have one of the following privileges: + +* The `read_security` cluster privilege (or a greater privilege such as `manage_security` or `all`). +* The "Manage Application Privileges" global privilege for the application being referenced in the request. {ref}/security-api-get-privileges.html[Endpoint documentation] [source,ts] @@ -9300,11 +12969,17 @@ client.security.getPrivileges({ ... }) ==== Arguments * *Request (object):* -** *`application` (Optional, string)*: Application name -** *`name` (Optional, string | string[])*: Privilege name +** *`application` (Optional, string)*: The name of the application. +Application privileges are always associated with exactly one application. +If you do not specify this parameter, the API returns information about all privileges for all applications. +** *`name` (Optional, string | string[])*: The name of the privilege. +If you do not specify this parameter, the API returns information about all privileges for the requested application. [discrete] ==== get_role +Get roles. + +Get roles in the native realm. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The get roles API cannot retrieve roles that are defined in roles files. @@ -9318,11 +12993,17 @@ client.security.getRole({ ... }) ==== Arguments * *Request (object):* -** *`name` (Optional, string | string[])*: The name of the role. You can specify multiple roles as a list. If you do not specify this parameter, the API returns information about all roles. +** *`name` (Optional, string | string[])*: The name of the role. +You can specify multiple roles as a list. +If you do not specify this parameter, the API returns information about all roles. [discrete] ==== get_role_mapping -Retrieves role mappings. +Get role mappings. + +Role mappings define which roles are assigned to each user. +The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. +The get role mappings API cannot retrieve role mappings that are defined in role mapping files. {ref}/security-api-get-role-mapping.html[Endpoint documentation] [source,ts] @@ -9338,7 +13019,11 @@ client.security.getRoleMapping({ ... }) [discrete] ==== get_service_accounts -This API returns a list of service accounts that match the provided path parameter(s). +Get service accounts. + +Get a list of service accounts that match the provided path parameters. + +NOTE: Currently, only the `elastic/fleet-server` service account is available. {ref}/security-api-get-service-accounts.html[Endpoint documentation] [source,ts] @@ -9350,12 +13035,22 @@ client.security.getServiceAccounts({ ... }) ==== Arguments * *Request (object):* -** *`namespace` (Optional, string)*: Name of the namespace. Omit this parameter to retrieve information about all service accounts. If you omit this parameter, you must also omit the `service` parameter. -** *`service` (Optional, string)*: Name of the service name. Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. +** *`namespace` (Optional, string)*: The name of the namespace. +Omit this parameter to retrieve information about all service accounts. +If you omit this parameter, you must also omit the `service` parameter. +** *`service` (Optional, string)*: The service name. +Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. [discrete] ==== get_service_credentials -Retrieves information of all service credentials for a service account. +Get service account credentials. + +To use this API, you must have at least the `read_security` cluster privilege (or a greater privilege such as `manage_service_account` or `manage_security`). + +The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. + +NOTE: For tokens backed by the `service_tokens` file, the API collects them from all nodes of the cluster. +Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. {ref}/security-api-get-service-credentials.html[Endpoint documentation] [source,ts] @@ -9367,23 +13062,49 @@ client.security.getServiceCredentials({ namespace, service }) ==== Arguments * *Request (object):* -** *`namespace` (string)*: Name of the namespace. -** *`service` (string)*: Name of the service name. +** *`namespace` (string)*: The name of the namespace. +** *`service` (string)*: The service name. [discrete] ==== get_settings -Retrieve settings for the security system indices +Get security index settings. + +Get the user-configurable settings for the security internal index (`.security` and associated indices). +Only a subset of the index settings — those that are user-configurable—will be shown. +This includes: + +* `index.auto_expand_replicas` +* `index.number_of_replicas` {ref}/security-api-get-settings.html[Endpoint documentation] [source,ts] ---- -client.security.getSettings() +client.security.getSettings({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get_token -Creates a bearer token for access without requiring basic authentication. +Get a token. + +Create a bearer token for access without requiring basic authentication. +The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. +Alternatively, you can explicitly enable the `xpack.security.authc.token.enabled` setting. +When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. + +The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. + +A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. + +The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. +That time period is defined by the `xpack.security.authc.token.timeout` setting. +If you want to invalidate a token immediately, you can do so by using the invalidate token API. {ref}/security-api-get-token.html[Endpoint documentation] [source,ts] @@ -9395,16 +13116,28 @@ client.security.getToken({ ... }) ==== Arguments * *Request (object):* -** *`grant_type` (Optional, Enum("password" | "client_credentials" | "_kerberos" | "refresh_token"))* -** *`scope` (Optional, string)* -** *`password` (Optional, string)* -** *`kerberos_ticket` (Optional, string)* -** *`refresh_token` (Optional, string)* -** *`username` (Optional, string)* +** *`grant_type` (Optional, Enum("password" | "client_credentials" | "_kerberos" | "refresh_token"))*: The type of grant. +Supported grant types are: `password`, `_kerberos`, `client_credentials`, and `refresh_token`. +** *`scope` (Optional, string)*: The scope of the token. +Currently tokens are only issued for a scope of FULL regardless of the value sent with the request. +** *`password` (Optional, string)*: The user's password. +If you specify the `password` grant type, this parameter is required. +This parameter is not valid with any other supported grant type. +** *`kerberos_ticket` (Optional, string)*: The base64 encoded kerberos ticket. +If you specify the `_kerberos` grant type, this parameter is required. +This parameter is not valid with any other supported grant type. +** *`refresh_token` (Optional, string)*: The string that was returned when you created the token, which enables you to extend its life. +If you specify the `refresh_token` grant type, this parameter is required. +This parameter is not valid with any other supported grant type. +** *`username` (Optional, string)*: The username that identifies the user. +If you specify the `password` grant type, this parameter is required. +This parameter is not valid with any other supported grant type. [discrete] ==== get_user -Retrieves information about users in the native realm and built-in users. +Get users. + +Get information about users in the native realm and built-in users. {ref}/security-api-get-user.html[Endpoint documentation] [source,ts] @@ -9417,11 +13150,16 @@ client.security.getUser({ ... }) * *Request (object):* ** *`username` (Optional, string | string[])*: An identifier for the user. You can specify multiple usernames as a list. If you omit this parameter, the API retrieves information about all users. -** *`with_profile_uid` (Optional, boolean)*: If true will return the User Profile ID for a user, if any. +** *`with_profile_uid` (Optional, boolean)*: Determines whether to retrieve the user profile UID, if it exists, for the users. [discrete] ==== get_user_privileges -Retrieves security privileges for the logged in user. +Get user privileges. + +Get the security privileges for the logged in user. +All users can use this API, but only to determine their own privileges. +To check the privileges of other users, you must use the run as feature. +To check whether a user has a specific list of privileges, use the has privileges API. {ref}/security-api-get-user-privileges.html[Endpoint documentation] [source,ts] @@ -9439,7 +13177,13 @@ client.security.getUserPrivileges({ ... }) [discrete] ==== get_user_profile -Retrieves a user's profile using the unique profile ID. +Get a user profile. + +Get a user's profile using the unique profile ID. + +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. {ref}/security-api-get-user-profile.html[Endpoint documentation] [source,ts] @@ -9452,21 +13196,30 @@ client.security.getUserProfile({ uid }) * *Request (object):* ** *`uid` (string | string[])*: A unique identifier for the user profile. -** *`data` (Optional, string | string[])*: List of filters for the `data` field of the profile document. -To return all content use `data=*`. To return a subset of content -use `data=` to retrieve content nested under the specified ``. +** *`data` (Optional, string | string[])*: A list of filters for the `data` field of the profile document. +To return all content use `data=*`. +To return a subset of content use `data=` to retrieve content nested under the specified ``. By default returns no `data` content. [discrete] ==== grant_api_key -Creates an API key on behalf of another user. -This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. -The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. -It is not possible to use this API to create an API key without that user’s credentials. +Grant an API key. + +Create an API key on behalf of another user. +This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. +The caller must have authentication credentials for the user on whose behalf the API key will be created. +It is not possible to use this API to create an API key without that user's credentials. +The supported user authentication credential types are: + +* username and password +* Elasticsearch access tokens +* JWTs + The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. In this case, the API key will be created on behalf of the impersonated user. This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. +The API keys are created by the Elasticsearch API key service, which is automatically enabled. A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. @@ -9483,22 +13236,26 @@ client.security.grantApiKey({ api_key, grant_type }) ==== Arguments * *Request (object):* -** *`api_key` ({ name, expiration, role_descriptors, metadata })*: Defines the API key. +** *`api_key` ({ name, expiration, role_descriptors, metadata })*: The API key. ** *`grant_type` (Enum("access_token" | "password"))*: The type of grant. Supported grant types are: `access_token`, `password`. -** *`access_token` (Optional, string)*: The user’s access token. +** *`access_token` (Optional, string)*: The user's access token. If you specify the `access_token` grant type, this parameter is required. It is not valid with other grant types. ** *`username` (Optional, string)*: The user name that identifies the user. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. -** *`password` (Optional, string)*: The user’s password. If you specify the `password` grant type, this parameter is required. +** *`password` (Optional, string)*: The user's password. +If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. ** *`run_as` (Optional, string)*: The name of the user to be impersonated. [discrete] ==== has_privileges Check user privileges. -Determines whether the specified user has a specified list of privileges. + +Determine whether the specified user has a specified list of privileges. +All users can use this API, but only to determine their own privileges. +To check the privileges of other users, you must use the run as feature. {ref}/security-api-has-privileges.html[Endpoint documentation] [source,ts] @@ -9512,12 +13269,17 @@ client.security.hasPrivileges({ ... }) * *Request (object):* ** *`user` (Optional, string)*: Username ** *`application` (Optional, { application, privileges, resources }[])* -** *`cluster` (Optional, Enum("all" | "cancel_task" | "create_snapshot" | "cross_cluster_replication" | "cross_cluster_search" | "delegate_pki" | "grant_api_key" | "manage" | "manage_api_key" | "manage_autoscaling" | "manage_behavioral_analytics" | "manage_ccr" | "manage_data_frame_transforms" | "manage_data_stream_global_retention" | "manage_enrich" | "manage_ilm" | "manage_index_templates" | "manage_inference" | "manage_ingest_pipelines" | "manage_logstash_pipelines" | "manage_ml" | "manage_oidc" | "manage_own_api_key" | "manage_pipeline" | "manage_rollup" | "manage_saml" | "manage_search_application" | "manage_search_query_rules" | "manage_search_synonyms" | "manage_security" | "manage_service_account" | "manage_slm" | "manage_token" | "manage_transform" | "manage_user_profile" | "manage_watcher" | "monitor" | "monitor_data_frame_transforms" | "monitor_data_stream_global_retention" | "monitor_enrich" | "monitor_inference" | "monitor_ml" | "monitor_rollup" | "monitor_snapshot" | "monitor_text_structure" | "monitor_transform" | "monitor_watcher" | "none" | "post_behavioral_analytics_event" | "read_ccr" | "read_fleet_secrets" | "read_ilm" | "read_pipeline" | "read_security" | "read_slm" | "transport_client" | "write_connector_secrets" | "write_fleet_secrets")[])*: A list of the cluster privileges that you want to check. +** *`cluster` (Optional, Enum("all" | "cancel_task" | "create_snapshot" | "cross_cluster_replication" | "cross_cluster_search" | "delegate_pki" | "grant_api_key" | "manage" | "manage_api_key" | "manage_autoscaling" | "manage_behavioral_analytics" | "manage_ccr" | "manage_data_frame_transforms" | "manage_data_stream_global_retention" | "manage_enrich" | "manage_ilm" | "manage_index_templates" | "manage_inference" | "manage_ingest_pipelines" | "manage_logstash_pipelines" | "manage_ml" | "manage_oidc" | "manage_own_api_key" | "manage_pipeline" | "manage_rollup" | "manage_saml" | "manage_search_application" | "manage_search_query_rules" | "manage_search_synonyms" | "manage_security" | "manage_service_account" | "manage_slm" | "manage_token" | "manage_transform" | "manage_user_profile" | "manage_watcher" | "monitor" | "monitor_data_frame_transforms" | "monitor_data_stream_global_retention" | "monitor_enrich" | "monitor_inference" | "monitor_ml" | "monitor_rollup" | "monitor_snapshot" | "monitor_stats" | "monitor_text_structure" | "monitor_transform" | "monitor_watcher" | "none" | "post_behavioral_analytics_event" | "read_ccr" | "read_fleet_secrets" | "read_ilm" | "read_pipeline" | "read_security" | "read_slm" | "transport_client" | "write_connector_secrets" | "write_fleet_secrets")[])*: A list of the cluster privileges that you want to check. ** *`index` (Optional, { names, privileges, allow_restricted_indices }[])* [discrete] ==== has_privileges_user_profile -Determines whether the users associated with the specified profile IDs have all the requested privileges. +Check user profile privileges. + +Determine whether the users associated with the specified user profile IDs have all the requested privileges. + +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. {ref}/security-api-has-privileges-user-profile.html[Endpoint documentation] [source,ts] @@ -9530,18 +13292,24 @@ client.security.hasPrivilegesUserProfile({ uids, privileges }) * *Request (object):* ** *`uids` (string[])*: A list of profile IDs. The privileges are checked for associated users of the profiles. -** *`privileges` ({ application, cluster, index })* +** *`privileges` ({ application, cluster, index })*: An object containing all the privileges to be checked. [discrete] ==== invalidate_api_key Invalidate API keys. -Invalidates one or more API keys. -The `manage_api_key` privilege allows deleting any API keys. -The `manage_own_api_key` only allows deleting API keys that are owned by the user. + +This API invalidates API keys created by the create API key or grant API key APIs. +Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. + +To use this API, you must have at least the `manage_security`, `manage_api_key`, or `manage_own_api_key` cluster privileges. +The `manage_security` privilege allows deleting any API key, including both REST and cross cluster API keys. +The `manage_api_key` privilege allows deleting any REST API key, but not cross cluster API keys. +The `manage_own_api_key` only allows deleting REST API keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, an invalidation request must be issued in one of the three formats: + - Set the parameter `owner=true`. -- Or, set both `username` and `realm_name` to match the user’s identity. -- Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the `ids` field. +- Or, set both `username` and `realm_name` to match the user's identity. +- Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the `ids` field. {ref}/security-api-invalidate-api-key.html[Endpoint documentation] [source,ts] @@ -9558,16 +13326,30 @@ client.security.invalidateApiKey({ ... }) This parameter cannot be used with any of `name`, `realm_name`, or `username`. ** *`name` (Optional, string)*: An API key name. This parameter cannot be used with any of `ids`, `realm_name` or `username`. -** *`owner` (Optional, boolean)*: Can be used to query API keys owned by the currently authenticated user. +** *`owner` (Optional, boolean)*: Query API keys owned by the currently authenticated user. The `realm_name` or `username` parameters cannot be specified when this parameter is set to `true` as they are assumed to be the currently authenticated ones. + +NOTE: At least one of `ids`, `name`, `username`, and `realm_name` must be specified if `owner` is `false`. ** *`realm_name` (Optional, string)*: The name of an authentication realm. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. ** *`username` (Optional, string)*: The username of a user. -This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. +This parameter cannot be used with either `ids` or `name` or when `owner` flag is set to `true`. [discrete] ==== invalidate_token -Invalidates one or more access tokens or refresh tokens. +Invalidate a token. + +The access tokens returned by the get token API have a finite period of time for which they are valid. +After that time period, they can no longer be used. +The time period is defined by the `xpack.security.authc.token.timeout` setting. + +The refresh tokens returned by the get token API are only valid for 24 hours. +They can also be used exactly once. +If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. + +NOTE: While all parameters are optional, at least one of them is required. +More specifically, either one of `token` or `refresh_token` parameters is required. +If none of these two are specified, then `realm_name` and/or `username` need to be specified. {ref}/security-api-invalidate-token.html[Endpoint documentation] [source,ts] @@ -9579,47 +13361,122 @@ client.security.invalidateToken({ ... }) ==== Arguments * *Request (object):* -** *`token` (Optional, string)* -** *`refresh_token` (Optional, string)* -** *`realm_name` (Optional, string)* -** *`username` (Optional, string)* +** *`token` (Optional, string)*: An access token. +This parameter cannot be used if any of `refresh_token`, `realm_name`, or `username` are used. +** *`refresh_token` (Optional, string)*: A refresh token. +This parameter cannot be used if any of `refresh_token`, `realm_name`, or `username` are used. +** *`realm_name` (Optional, string)*: The name of an authentication realm. +This parameter cannot be used with either `refresh_token` or `token`. +** *`username` (Optional, string)*: The username of a user. +This parameter cannot be used with either `refresh_token` or `token`. [discrete] ==== oidc_authenticate -Exchanges an OpenID Connection authentication response message for an Elasticsearch access token and refresh token pair +Authenticate OpenID Connect. + +Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. + +Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. +These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. {ref}/security-api-oidc-authenticate.html[Endpoint documentation] [source,ts] ---- -client.security.oidcAuthenticate() +client.security.oidcAuthenticate({ nonce, redirect_uri, state }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`nonce` (string)*: Associate a client session with an ID token and mitigate replay attacks. +This value needs to be the same as the one that was provided to the `/_security/oidc/prepare` API or the one that was generated by Elasticsearch and included in the response to that call. +** *`redirect_uri` (string)*: The URL to which the OpenID Connect Provider redirected the User Agent in response to an authentication request after a successful authentication. +This URL must be provided as-is (URL encoded), taken from the body of the response or as the value of a location header in the response from the OpenID Connect Provider. +** *`state` (string)*: Maintain state between the authentication request and the response. +This value needs to be the same as the one that was provided to the `/_security/oidc/prepare` API or the one that was generated by Elasticsearch and included in the response to that call. +** *`realm` (Optional, string)*: The name of the OpenID Connect realm. +This property is useful in cases where multiple realms are defined. [discrete] ==== oidc_logout -Invalidates a refresh token and access token that was generated from the OpenID Connect Authenticate API +Logout of OpenID Connect. + +Invalidate an access token and a refresh token that were generated as a response to the `/_security/oidc/authenticate` API. + +If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. + +Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. +These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. {ref}/security-api-oidc-logout.html[Endpoint documentation] [source,ts] ---- -client.security.oidcLogout() +client.security.oidcLogout({ token }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`token` (string)*: The access token to be invalidated. +** *`refresh_token` (Optional, string)*: The refresh token to be invalidated. [discrete] ==== oidc_prepare_authentication -Creates an OAuth 2.0 authentication request as a URL string +Prepare OpenID connect authentication. + +Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. + +The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. + +Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. +These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. {ref}/security-api-oidc-prepare-authentication.html[Endpoint documentation] [source,ts] ---- -client.security.oidcPrepareAuthentication() +client.security.oidcPrepareAuthentication({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`iss` (Optional, string)*: In the case of a third party initiated single sign on, this is the issuer identifier for the OP that the RP is to send the authentication request to. +It cannot be specified when *realm* is specified. +One of *realm* or *iss* is required. +** *`login_hint` (Optional, string)*: In the case of a third party initiated single sign on, it is a string value that is included in the authentication request as the *login_hint* parameter. +This parameter is not valid when *realm* is specified. +** *`nonce` (Optional, string)*: The value used to associate a client session with an ID token and to mitigate replay attacks. +If the caller of the API does not provide a value, Elasticsearch will generate one with sufficient entropy and return it in the response. +** *`realm` (Optional, string)*: The name of the OpenID Connect realm in Elasticsearch the configuration of which should be used in order to generate the authentication request. +It cannot be specified when *iss* is specified. +One of *realm* or *iss* is required. +** *`state` (Optional, string)*: The value used to maintain state between the authentication request and the response, typically used as a Cross-Site Request Forgery mitigation. +If the caller of the API does not provide a value, Elasticsearch will generate one with sufficient entropy and return it in the response. [discrete] ==== put_privileges -Adds or updates application privileges. +Create or update application privileges. + +To use this API, you must have one of the following privileges: + +* The `manage_security` cluster privilege (or a greater privilege such as `all`). +* The "Manage Application Privileges" global privilege for the application being referenced in the request. + +Application names are formed from a prefix, with an optional suffix that conform to the following rules: + +* The prefix must begin with a lowercase ASCII letter. +* The prefix must contain only ASCII letters or digits. +* The prefix must be at least 3 characters long. +* If the suffix exists, it must begin with either a dash `-` or `_`. +* The suffix cannot contain any of the following characters: `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, `*`. +* No part of the name can contain whitespace. + +Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters `_`, `-`, and `.`. + +Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: `/`, `*`, `:`. {ref}/security-api-put-privileges.html[Endpoint documentation] [source,ts] @@ -9636,8 +13493,11 @@ client.security.putPrivileges({ ... }) [discrete] ==== put_role -The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +Create or update roles. + +The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. The create or update roles API cannot update roles that are defined in roles files. +File-based role management is not available in Elastic Serverless. {ref}/security-api-put-role.html[Endpoint documentation] [source,ts] @@ -9651,9 +13511,14 @@ client.security.putRole({ name }) * *Request (object):* ** *`name` (string)*: The name of the role. ** *`applications` (Optional, { application, privileges, resources }[])*: A list of application privilege entries. -** *`cluster` (Optional, Enum("all" | "cancel_task" | "create_snapshot" | "cross_cluster_replication" | "cross_cluster_search" | "delegate_pki" | "grant_api_key" | "manage" | "manage_api_key" | "manage_autoscaling" | "manage_behavioral_analytics" | "manage_ccr" | "manage_data_frame_transforms" | "manage_data_stream_global_retention" | "manage_enrich" | "manage_ilm" | "manage_index_templates" | "manage_inference" | "manage_ingest_pipelines" | "manage_logstash_pipelines" | "manage_ml" | "manage_oidc" | "manage_own_api_key" | "manage_pipeline" | "manage_rollup" | "manage_saml" | "manage_search_application" | "manage_search_query_rules" | "manage_search_synonyms" | "manage_security" | "manage_service_account" | "manage_slm" | "manage_token" | "manage_transform" | "manage_user_profile" | "manage_watcher" | "monitor" | "monitor_data_frame_transforms" | "monitor_data_stream_global_retention" | "monitor_enrich" | "monitor_inference" | "monitor_ml" | "monitor_rollup" | "monitor_snapshot" | "monitor_text_structure" | "monitor_transform" | "monitor_watcher" | "none" | "post_behavioral_analytics_event" | "read_ccr" | "read_fleet_secrets" | "read_ilm" | "read_pipeline" | "read_security" | "read_slm" | "transport_client" | "write_connector_secrets" | "write_fleet_secrets")[])*: A list of cluster privileges. These privileges define the cluster-level actions for users with this role. +** *`cluster` (Optional, Enum("all" | "cancel_task" | "create_snapshot" | "cross_cluster_replication" | "cross_cluster_search" | "delegate_pki" | "grant_api_key" | "manage" | "manage_api_key" | "manage_autoscaling" | "manage_behavioral_analytics" | "manage_ccr" | "manage_data_frame_transforms" | "manage_data_stream_global_retention" | "manage_enrich" | "manage_ilm" | "manage_index_templates" | "manage_inference" | "manage_ingest_pipelines" | "manage_logstash_pipelines" | "manage_ml" | "manage_oidc" | "manage_own_api_key" | "manage_pipeline" | "manage_rollup" | "manage_saml" | "manage_search_application" | "manage_search_query_rules" | "manage_search_synonyms" | "manage_security" | "manage_service_account" | "manage_slm" | "manage_token" | "manage_transform" | "manage_user_profile" | "manage_watcher" | "monitor" | "monitor_data_frame_transforms" | "monitor_data_stream_global_retention" | "monitor_enrich" | "monitor_inference" | "monitor_ml" | "monitor_rollup" | "monitor_snapshot" | "monitor_stats" | "monitor_text_structure" | "monitor_transform" | "monitor_watcher" | "none" | "post_behavioral_analytics_event" | "read_ccr" | "read_fleet_secrets" | "read_ilm" | "read_pipeline" | "read_security" | "read_slm" | "transport_client" | "write_connector_secrets" | "write_fleet_secrets")[])*: A list of cluster privileges. These privileges define the cluster-level actions for users with this role. ** *`global` (Optional, Record)*: An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. ** *`indices` (Optional, { field_security, names, privileges, query, allow_restricted_indices }[])*: A list of indices permissions entries. +** *`remote_indices` (Optional, { clusters, field_security, names, privileges, query, allow_restricted_indices }[])*: A list of remote indices permissions entries. + +NOTE: Remote indices are effective for remote clusters configured with the API key based model. +They have no effect for remote clusters configured with the certificate based model. +** *`remote_cluster` (Optional, { clusters, privileges }[])*: A list of remote cluster permissions entries. ** *`metadata` (Optional, Record)*: Optional metadata. Within the metadata object, keys that begin with an underscore (`_`) are reserved for system use. ** *`run_as` (Optional, string[])*: A list of users that the owners of this role can impersonate. *Note*: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will be rejected. ** *`description` (Optional, string)*: Optional description of the role descriptor @@ -9662,7 +13527,32 @@ client.security.putRole({ name }) [discrete] ==== put_role_mapping -Creates and updates role mappings. +Create or update role mappings. + +Role mappings define which roles are assigned to each user. +Each mapping has rules that identify users and a list of roles that are granted to those users. +The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. + +NOTE: This API does not create roles. Rather, it maps users to existing roles. +Roles can be created by using the create or update roles API or roles files. + +**Role templates** + +The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. +For example, all users in the `cn=admin,dc=example,dc=com` LDAP group should be given the superuser role in Elasticsearch. +The `roles` field is used for this purpose. + +For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. +The `role_templates` field is used for this purpose. + +NOTE: To use role templates successfully, the relevant scripting feature must be enabled. +Otherwise, all attempts to create a role mapping with role templates fail. + +All of the user fields that are available in the role mapping rules are also available in the role templates. +Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. + +By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. +If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. {ref}/security-api-put-role-mapping.html[Endpoint documentation] [source,ts] @@ -9674,18 +13564,27 @@ client.security.putRoleMapping({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: Role-mapping name -** *`enabled` (Optional, boolean)* -** *`metadata` (Optional, Record)* -** *`roles` (Optional, string[])* -** *`role_templates` (Optional, { format, template }[])* -** *`rules` (Optional, { any, all, field, except })* +** *`name` (string)*: The distinct name that identifies the role mapping. +The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. +** *`enabled` (Optional, boolean)*: Mappings that have `enabled` set to `false` are ignored when role mapping is performed. +** *`metadata` (Optional, Record)*: Additional metadata that helps define which roles are assigned to each user. +Within the metadata object, keys beginning with `_` are reserved for system usage. +** *`roles` (Optional, string[])*: A list of role names that are granted to the users that match the role mapping rules. +Exactly one of `roles` or `role_templates` must be specified. +** *`role_templates` (Optional, { format, template }[])*: A list of Mustache templates that will be evaluated to determine the roles names that should granted to the users that match the role mapping rules. +Exactly one of `roles` or `role_templates` must be specified. +** *`rules` (Optional, { any, all, field, except })*: The rules that determine which users should be matched by the mapping. +A rule is a logical condition that is expressed by using a JSON DSL. ** *`run_as` (Optional, string[])* ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== put_user -Adds and updates users in the native realm. These users are commonly referred to as native users. +Create or update users. + +Add and update users in the native realm. +A password is required for adding a new user but is optional when updating an existing user. +To change a user's password without updating any other fields, use the change password API. {ref}/security-api-put-user.html[Endpoint documentation] [source,ts] @@ -9697,20 +13596,40 @@ client.security.putUser({ username }) ==== Arguments * *Request (object):* -** *`username` (string)*: The username of the User -** *`email` (Optional, string | null)* -** *`full_name` (Optional, string | null)* -** *`metadata` (Optional, Record)* -** *`password` (Optional, string)* -** *`password_hash` (Optional, string)* -** *`roles` (Optional, string[])* -** *`enabled` (Optional, boolean)* -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +** *`username` (string)*: An identifier for the user. + +NOTE: Usernames must be at least 1 and no more than 507 characters. +They can contain alphanumeric characters (a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic Latin (ASCII) block. +Leading or trailing whitespace is not allowed. +** *`email` (Optional, string | null)*: The email of the user. +** *`full_name` (Optional, string | null)*: The full name of the user. +** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the user. +** *`password` (Optional, string)*: The user's password. +Passwords must be at least 6 characters long. +When adding a user, one of `password` or `password_hash` is required. +When updating an existing user, the password is optional, so that other fields on the user (such as their roles) may be updated without modifying the user's password +** *`password_hash` (Optional, string)*: A hash of the user's password. +This must be produced using the same hashing algorithm as has been configured for password storage. +For more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm` setting in the user cache and password hash algorithm documentation. +Using this parameter allows the client to pre-hash the password for performance and/or confidentiality reasons. +The `password` parameter and the `password_hash` parameter cannot be used in the same request. +** *`roles` (Optional, string[])*: A set of roles the user has. +The roles determine the user's access permissions. +To create a user without any roles, specify an empty list (`[]`). +** *`enabled` (Optional, boolean)*: Specifies whether the user is enabled. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: Valid values are `true`, `false`, and `wait_for`. +These values have the same meaning as in the index API, but the default value for this API is true. [discrete] ==== query_api_keys -Query API keys. -Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. +Find API keys with a query. + +Get a paginated list of API keys and their information. +You can optionally filter the results with a query. + +To use this API, you must have at least the `manage_own_api_key` or the `read_security` cluster privileges. +If you have only the `manage_own_api_key` privilege, this API returns only the API keys that you own. +If you have the `read_security`, `manage_api_key`, or greater privileges (including `manage_security`), this API returns all API keys regardless of ownership. {ref}/security-api-query-api-key.html[Endpoint documentation] [source,ts] @@ -9733,23 +13652,39 @@ The query supports a subset of query types, including `match_all`, `bool`, `term `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following public information associated with an API key: `id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`, `username`, `realm`, and `metadata`. -** *`from` (Optional, number)*: Starting document offset. -By default, you cannot page through more than 10,000 hits using the from and size parameters. + +NOTE: The queryable string values associated with API keys are internally mapped as keywords. +Consequently, if no `analyzer` parameter is specified for a `match` query, then the provided match query string is interpreted as a single keyword value. +Such a match query is hence equivalent to a `term` query. +** *`from` (Optional, number)*: The starting document offset. +It must not be negative. +By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: Other than `id`, all public fields of an API key are eligible for sorting. +** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: The sort definition. +Other than `id`, all public fields of an API key are eligible for sorting. In addition, sort can also be applied to the `_doc` field to sort by index order. ** *`size` (Optional, number)*: The number of hits to return. +It must not be negative. +The `size` parameter can be set to `0`, in which case no API key matches are returned, only the aggregation results. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Search after definition +** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: The search after definition. ** *`with_limited_by` (Optional, boolean)*: Return the snapshot of the owner user's role descriptors associated with the API key. -An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. -** *`with_profile_uid` (Optional, boolean)*: Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. +An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors (effectively limited by it). +An API key cannot retrieve any API key’s limited-by role descriptors (including itself) unless it has `manage_api_key` or higher privileges. +** *`with_profile_uid` (Optional, boolean)*: Determines whether to also retrieve the profile UID for the API key owner principal. +If it exists, the profile UID is returned under the `profile_uid` response field for each API key. ** *`typed_keys` (Optional, boolean)*: Determines whether aggregation names are prefixed by their respective types in the response. [discrete] ==== query_role -Retrieves roles in a paginated manner. You can optionally filter the results with a query. +Find roles with a query. + +Get roles in a paginated manner. +The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. +You can optionally filter the results with a query. +Also, the results can be paginated and sorted. {ref}/security-api-query-role.html[Endpoint documentation] [source,ts] @@ -9766,20 +13701,29 @@ If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with roles: `name`, `description`, `metadata`, -`applications.application`, `applications.privileges`, `applications.resources`. -** *`from` (Optional, number)*: Starting document offset. -By default, you cannot page through more than 10,000 hits using the from and size parameters. +`applications.application`, `applications.privileges`, and `applications.resources`. +** *`from` (Optional, number)*: The starting document offset. +It must not be negative. +By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: All public fields of a role are eligible for sorting. +** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: The sort definition. +You can sort on `username`, `roles`, or `enabled`. In addition, sort can also be applied to the `_doc` field to sort by index order. ** *`size` (Optional, number)*: The number of hits to return. +It must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Search after definition +** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: The search after definition. [discrete] ==== query_user -Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. +Find users with a query. + +Get information for users in a paginated manner. +You can optionally filter the results with a query. + +NOTE: As opposed to the get user API, built-in users are excluded from the result. +This API is only for native users. {ref}/security-api-query-user.html[Endpoint documentation] [source,ts] @@ -9795,21 +13739,39 @@ client.security.queryUser({ ... }) If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. -You can query the following information associated with user: `username`, `roles`, `enabled` -** *`from` (Optional, number)*: Starting document offset. -By default, you cannot page through more than 10,000 hits using the from and size parameters. +You can query the following information associated with user: `username`, `roles`, `enabled`, `full_name`, and `email`. +** *`from` (Optional, number)*: The starting document offset. +It must not be negative. +By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: Fields eligible for sorting are: username, roles, enabled +** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: The sort definition. +Fields eligible for sorting are: `username`, `roles`, `enabled`. In addition, sort can also be applied to the `_doc` field to sort by index order. ** *`size` (Optional, number)*: The number of hits to return. +It must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Search after definition -** *`with_profile_uid` (Optional, boolean)*: If true will return the User Profile ID for the users in the query result, if any. +** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: The search after definition +** *`with_profile_uid` (Optional, boolean)*: Determines whether to retrieve the user profile UID, if it exists, for the users. [discrete] ==== saml_authenticate -Submits a SAML Response message to Elasticsearch for consumption. +Authenticate SAML. + +Submit a SAML response message to Elasticsearch for consumption. + +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +The SAML message that is submitted can be: + +* A response to a SAML authentication request that was previously created using the SAML prepare authentication API. +* An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. + +In either case, the SAML message needs to be a base64 encoded XML document with a root element of ``. + +After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. +This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. {ref}/security-api-saml-authenticate.html[Endpoint documentation] [source,ts] @@ -9821,14 +13783,25 @@ client.security.samlAuthenticate({ content, ids }) ==== Arguments * *Request (object):* -** *`content` (string)*: The SAML response as it was sent by the user’s browser, usually a Base64 encoded XML document. -** *`ids` (string | string[])*: A json array with all the valid SAML Request Ids that the caller of the API has for the current user. +** *`content` (string)*: The SAML response as it was sent by the user's browser, usually a Base64 encoded XML document. +** *`ids` (string | string[])*: A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. ** *`realm` (Optional, string)*: The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. [discrete] ==== saml_complete_logout +Logout of SAML completely. + Verifies the logout response sent from the SAML IdP. +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. +This API verifies the response by ensuring the content is relevant and validating its signature. +An empty response is returned if the verification process is successful. +The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. +The caller of this API must prepare the request accordingly so that this API can handle either of them. + {ref}/security-api-saml-complete-logout.html[Endpoint documentation] [source,ts] ---- @@ -9840,13 +13813,23 @@ client.security.samlCompleteLogout({ realm, ids }) * *Request (object):* ** *`realm` (string)*: The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. -** *`ids` (string | string[])*: A json array with all the valid SAML Request Ids that the caller of the API has for the current user. +** *`ids` (string | string[])*: A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. ** *`query_string` (Optional, string)*: If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI. ** *`content` (Optional, string)*: If the SAML IdP sends the logout response with the HTTP-Post binding, this field must be set to the value of the SAMLResponse form parameter from the logout response. [discrete] ==== saml_invalidate -Submits a SAML LogoutRequest message to Elasticsearch for consumption. +Invalidate SAML. + +Submit a SAML LogoutRequest message to Elasticsearch for consumption. + +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +The logout request comes from the SAML IdP during an IdP initiated Single Logout. +The custom web application can use this API to have Elasticsearch process the `LogoutRequest`. +After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. +Thus the user can be redirected back to their IdP. {ref}/security-api-saml-invalidate.html[Endpoint documentation] [source,ts] @@ -9859,17 +13842,25 @@ client.security.samlInvalidate({ query_string }) * *Request (object):* ** *`query_string` (string)*: The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. -This query should include a single parameter named SAMLRequest that contains a SAML logout request that is deflated and Base64 encoded. -If the SAML IdP has signed the logout request, the URL should include two extra parameters named SigAlg and Signature that contain the algorithm used for the signature and the signature value itself. -In order for Elasticsearch to be able to verify the IdP’s signature, the value of the query_string field must be an exact match to the string provided by the browser. +This query should include a single parameter named `SAMLRequest` that contains a SAML logout request that is deflated and Base64 encoded. +If the SAML IdP has signed the logout request, the URL should include two extra parameters named `SigAlg` and `Signature` that contain the algorithm used for the signature and the signature value itself. +In order for Elasticsearch to be able to verify the IdP's signature, the value of the `query_string` field must be an exact match to the string provided by the browser. The client application must not attempt to parse or process the string in any way. -** *`acs` (Optional, string)*: The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the realm parameter. -** *`realm` (Optional, string)*: The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the acs parameter. +** *`acs` (Optional, string)*: The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the `realm` parameter. +** *`realm` (Optional, string)*: The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the `acs` parameter. [discrete] ==== saml_logout +Logout of SAML. + Submits a request to invalidate an access token and refresh token. +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +This API invalidates the tokens that were generated for a user by the SAML authenticate API. +If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). + {ref}/security-api-saml-logout.html[Endpoint documentation] [source,ts] ---- @@ -9881,13 +13872,26 @@ client.security.samlLogout({ token }) * *Request (object):* ** *`token` (string)*: The access token that was returned as a response to calling the SAML authenticate API. -Alternatively, the most recent token that was received after refreshing the original one by using a refresh_token. +Alternatively, the most recent token that was received after refreshing the original one by using a `refresh_token`. ** *`refresh_token` (Optional, string)*: The refresh token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent refresh token that was received after refreshing the original access token. [discrete] ==== saml_prepare_authentication -Creates a SAML authentication request () as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. +Prepare SAML authentication. + +Create a SAML authentication request (``) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. + +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +This API returns a URL pointing to the SAML Identity Provider. +You can use the URL to redirect the browser of the user in order to continue the authentication process. +The URL includes a single parameter named `SAMLRequest`, which contains a SAML Authentication request that is deflated and Base64 encoded. +If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named `SigAlg` and `Signature`. +These parameters contain the algorithm used for the signature and the signature value itself. +It also returns a random string that uniquely identifies this SAML Authentication request. +The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. {ref}/security-api-saml-prepare-authentication.html[Endpoint documentation] [source,ts] @@ -9900,16 +13904,21 @@ client.security.samlPrepareAuthentication({ ... }) * *Request (object):* ** *`acs` (Optional, string)*: The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. -The realm is used to generate the authentication request. You must specify either this parameter or the realm parameter. +The realm is used to generate the authentication request. You must specify either this parameter or the `realm` parameter. ** *`realm` (Optional, string)*: The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. -You must specify either this parameter or the acs parameter. -** *`relay_state` (Optional, string)*: A string that will be included in the redirect URL that this API returns as the RelayState query parameter. +You must specify either this parameter or the `acs` parameter. +** *`relay_state` (Optional, string)*: A string that will be included in the redirect URL that this API returns as the `RelayState` query parameter. If the Authentication Request is signed, this value is used as part of the signature computation. [discrete] ==== saml_service_provider_metadata +Create SAML service provider metadata. + Generate SAML metadata for a SAML 2.0 Service Provider. +The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. +This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. + {ref}/security-api-saml-sp-metadata.html[Endpoint documentation] [source,ts] ---- @@ -9924,8 +13933,14 @@ client.security.samlServiceProviderMetadata({ realm_name }) [discrete] ==== suggest_user_profiles +Suggest a user profile. + Get suggestions for user profiles that match specified search criteria. +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + {ref}/security-api-suggest-user-profile.html[Endpoint documentation] [source,ts] ---- @@ -9936,34 +13951,40 @@ client.security.suggestUserProfiles({ ... }) ==== Arguments * *Request (object):* -** *`name` (Optional, string)*: Query string used to match name-related fields in user profile documents. +** *`name` (Optional, string)*: A query string used to match name-related fields in user profile documents. Name-related fields are the user's `username`, `full_name`, and `email`. -** *`size` (Optional, number)*: Number of profiles to return. -** *`data` (Optional, string | string[])*: List of filters for the `data` field of the profile document. -To return all content use `data=*`. To return a subset of content -use `data=` to retrieve content nested under the specified ``. -By default returns no `data` content. +** *`size` (Optional, number)*: The number of profiles to return. +** *`data` (Optional, string | string[])*: A list of filters for the `data` field of the profile document. +To return all content use `data=*`. +To return a subset of content, use `data=` to retrieve content nested under the specified ``. +By default, the API returns no `data` content. +It is an error to specify `data` as both the query parameter and the request body field. ** *`hint` (Optional, { uids, labels })*: Extra search criteria to improve relevance of the suggestion result. Profiles matching the spcified hint are ranked higher in the response. -Profiles not matching the hint don't exclude the profile from the response -as long as the profile matches the `name` field query. +Profiles not matching the hint aren't excluded from the response as long as the profile matches the `name` field query. [discrete] ==== update_api_key Update an API key. -Updates attributes of an existing API key. + +Update attributes of an existing API key. +This API supports updates to an API key's access scope, expiration, and metadata. + +To use this API, you must have at least the `manage_own_api_key` cluster privilege. Users can only update API keys that they created or that were granted to them. -Use this API to update API keys created by the create API Key or grant API Key APIs. -If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. -It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. -This API supports updates to an API key’s access scope and metadata. -The access scope of an API key is derived from the `role_descriptors` you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. -The snapshot of the owner’s permissions is updated automatically on every call. -If you don’t specify `role_descriptors` in the request, a call to this API might still change the API key’s access scope. -This change can occur if the owner user’s permissions have changed since the API key was created or last modified. To update another user’s API key, use the `run_as` feature to submit a request on behalf of another user. -IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. -To update an API key, the owner user’s credentials are required. + +IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. + +Use this API to update API keys created by the create API key or grant API Key APIs. +If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. +It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. + +The access scope of an API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request. +The snapshot of the owner's permissions is updated automatically on every call. + +IMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change the API key's access scope. +This change can occur if the owner user's permissions have changed since the API key was created or last modified. {ref}/security-api-update-api-key.html[Endpoint documentation] [source,ts] @@ -9976,35 +13997,112 @@ client.security.updateApiKey({ id }) * *Request (object):* ** *`id` (string)*: The ID of the API key to update. -** *`role_descriptors` (Optional, Record)*: An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. -** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. -** *`expiration` (Optional, string | -1 | 0)*: Expiration time for the API key. +** *`role_descriptors` (Optional, Record)*: The role descriptors to assign to this API key. +The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. +You can assign new privileges by specifying them in this parameter. +To remove assigned privileges, you can supply an empty `role_descriptors` parameter, that is to say, an empty object `{}`. +If an API key has no assigned privileges, it inherits the owner user's full permissions. +The snapshot of the owner's permissions is always updated, whether you supply the `role_descriptors` parameter or not. +The structure of a role descriptor is the same as the request for the create API keys API. +** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the API key. +It supports a nested data structure. +Within the metadata object, keys beginning with `_` are reserved for system usage. +When specified, this value fully replaces the metadata previously associated with the API key. +** *`expiration` (Optional, string | -1 | 0)*: The expiration time for the API key. +By default, API keys never expire. +This property can be omitted to leave the expiration unchanged. [discrete] ==== update_cross_cluster_api_key -Updates attributes of an existing cross-cluster API key. +Update a cross-cluster API key. + +Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. + +To use this API, you must have at least the `manage_security` cluster privilege. +Users can only update API keys that they created. +To update another user's API key, use the `run_as` feature to submit a request on behalf of another user. + +IMPORTANT: It's not possible to use an API key as the authentication credential for this API. +To update an API key, the owner user's credentials are required. + +It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. + +This API supports updates to an API key's access scope, metadata, and expiration. +The owner user's information, such as the `username` and `realm`, is also updated automatically on every call. + +NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. {ref}/security-api-update-cross-cluster-api-key.html[Endpoint documentation] [source,ts] ---- -client.security.updateCrossClusterApiKey() +client.security.updateCrossClusterApiKey({ id, access }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`id` (string)*: The ID of the cross-cluster API key to update. +** *`access` ({ replication, search })*: The access to be granted to this API key. +The access is composed of permissions for cross cluster search and cross cluster replication. +At least one of them must be specified. +When specified, the new access assignment fully replaces the previously assigned access. +** *`expiration` (Optional, string | -1 | 0)*: The expiration time for the API key. +By default, API keys never expire. This property can be omitted to leave the value unchanged. +** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the API key. +It supports nested data structure. +Within the metadata object, keys beginning with `_` are reserved for system usage. +When specified, this information fully replaces metadata previously associated with the API key. [discrete] ==== update_settings -Update settings for the security system index +Update security index settings. + +Update the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified. This includes `index.auto_expand_replicas` and `index.number_of_replicas`. + +NOTE: If `index.auto_expand_replicas` is set, `index.number_of_replicas` will be ignored during updates. + +If a specific index is not in use on the system and settings are provided for it, the request will be rejected. +This API does not yet support configuring the settings for indices before they are in use. {ref}/security-api-update-settings.html[Endpoint documentation] [source,ts] ---- -client.security.updateSettings() +client.security.updateSettings({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`security` (Optional, { index })*: Settings for the index used for most security configuration, including native realm users and roles configured with the API. +** *`security-profile` (Optional, { index })*: Settings for the index used to store profile information. +** *`security-tokens` (Optional, { index })*: Settings for the index used to store tokens. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== update_user_profile_data -Updates specific data for the user profile that's associated with the specified unique ID. +Update user profile data. + +Update specific data for the user profile that is associated with a unique ID. + +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + +To use this API, you must have one of the following privileges: + +* The `manage_user_profile` cluster privilege. +* The `update_profile_data` global privilege for the namespaces that are referenced in the request. + +This API updates the `labels` and `data` fields of an existing user profile document with JSON objects. +New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. + +For both labels and data, content is namespaced by the top-level fields. +The `update_profile_data` global privilege grants privileges for updating only the allowed namespaces. {ref}/security-api-update-user-profile-data.html[Endpoint documentation] [source,ts] @@ -10017,23 +14115,35 @@ client.security.updateUserProfileData({ uid }) * *Request (object):* ** *`uid` (string)*: A unique identifier for the user profile. -** *`labels` (Optional, Record)*: Searchable data that you want to associate with the user profile. This -field supports a nested data structure. +** *`labels` (Optional, Record)*: Searchable data that you want to associate with the user profile. +This field supports a nested data structure. +Within the labels object, top-level keys cannot begin with an underscore (`_`) or contain a period (`.`). ** *`data` (Optional, Record)*: Non-searchable data that you want to associate with the user profile. This field supports a nested data structure. +Within the `data` object, top-level keys cannot begin with an underscore (`_`) or contain a period (`.`). +The data object is not searchable, but can be retrieved with the get user profile API. ** *`if_seq_no` (Optional, number)*: Only perform the operation if the document has this sequence number. ** *`if_primary_term` (Optional, number)*: Only perform the operation if the document has this primary term. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation -visible to search, if 'wait_for' then wait for a refresh to make this operation -visible to search, if 'false' do nothing with refreshes. +visible to search. +If 'wait_for', it waits for a refresh to make this operation visible to search. +If 'false', nothing is done with refreshes. [discrete] === shutdown [discrete] ==== delete_node -Removes a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. +Cancel node shutdown preparations. +Remove a node from the shutdown list so it can resume normal operations. +You must explicitly clear the shutdown request when a node rejoins the cluster or when a node has permanently left the cluster. +Shutdown requests are never removed automatically by Elasticsearch. + +NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. +Direct use is not supported. -https://www.elastic.co/guide/en/elasticsearch/reference/current[Endpoint documentation] +If the operator privileges feature is enabled, you must be an operator to use this API. + +{ref}/delete-shutdown.html[Endpoint documentation] [source,ts] ---- client.shutdown.deleteNode({ node_id }) @@ -10049,9 +14159,16 @@ client.shutdown.deleteNode({ node_id }) [discrete] ==== get_node -Retrieve status of a node or nodes that are currently marked as shutting down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. +Get the shutdown status. + +Get information about nodes that are ready to be shut down, have shut down preparations still in progress, or have stalled. +The API returns status information for each part of the shut down process. -https://www.elastic.co/guide/en/elasticsearch/reference/current[Endpoint documentation] +NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. + +If the operator privileges feature is enabled, you must be an operator to use this API. + +{ref}/get-shutdown.html[Endpoint documentation] [source,ts] ---- client.shutdown.getNode({ ... }) @@ -10063,13 +14180,27 @@ client.shutdown.getNode({ ... }) * *Request (object):* ** *`node_id` (Optional, string | string[])*: Which node for which to retrieve the shutdown status ** *`master_timeout` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== put_node -Adds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. +Prepare a node to be shut down. + +NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. + +If you specify a node that is offline, it will be prepared for shut down when it rejoins the cluster. + +If the operator privileges feature is enabled, you must be an operator to use this API. + +The API migrates ongoing tasks and index shards to other nodes as needed to prepare a node to be restarted or shut down and removed from the cluster. +This ensures that Elasticsearch can be stopped safely with minimal disruption to the cluster. + +You must specify the type of shutdown: `restart`, `remove`, or `replace`. +If a node is already being prepared for shutdown, you can use this API to change the shutdown type. -https://www.elastic.co/guide/en/elasticsearch/reference/current[Endpoint documentation] +IMPORTANT: This API does NOT terminate the Elasticsearch process. +Monitor the node shutdown status to determine when it is safe to stop Elasticsearch. + +{ref}/put-shutdown.html[Endpoint documentation] [source,ts] ---- client.shutdown.putNode({ node_id, type, reason }) @@ -10079,7 +14210,10 @@ client.shutdown.putNode({ node_id, type, reason }) ==== Arguments * *Request (object):* -** *`node_id` (string)*: The node id of node to be shut down +** *`node_id` (string)*: The node identifier. +This parameter is not validated against the cluster's active nodes. +This enables you to register a node for shut down while it is offline. +No error is thrown if you specify an invalid node ID. ** *`type` (Enum("restart" | "remove" | "replace"))*: Valid values are restart, remove, or replace. Use restart when you need to temporarily shut down a node to perform an upgrade, make configuration changes, or perform other maintenance. Because the node is expected to rejoin the cluster, data is not migrated off of the node. @@ -10097,27 +14231,63 @@ If you specify both a restart allocation delay and an index-level allocation del Specifies the name of the node that is replacing the node being shut down. Shards from the shut down node are only allowed to be allocated to the target node, and no other data will be allocated to the target node. During relocation of data certain allocation rules are ignored, such as disk watermarks or user attribute filtering rules. -** *`master_timeout` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. +** *`master_timeout` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, Enum("nanos" | "micros" | "ms" | "s" | "m" | "h" | "d"))*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] === simulate [discrete] ==== ingest -Simulates running ingest with example documents. +Simulate data ingestion. +Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. + +This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. + +The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. +If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. +No data is indexed into Elasticsearch. +Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. +The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. + +This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. +The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. + +By default, the pipeline definitions that are currently in the system are used. +However, you can supply substitute pipeline definitions in the body of the request. +These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. {ref}/simulate-ingest-api.html[Endpoint documentation] [source,ts] ---- -client.simulate.ingest() +client.simulate.ingest({ docs }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`docs` ({ _id, _index, _source }[])*: Sample documents to test in the pipeline. +** *`index` (Optional, string)*: The index to simulate ingesting into. +This value can be overridden by specifying an index on each document. +If you specify this parameter in the request path, it is used for any documents that do not explicitly specify an index argument. +** *`component_template_substitutions` (Optional, Record)*: A map of component template names to substitute component template definition objects. +** *`index_template_substitutions` (Optional, Record)*: A map of index template names to substitute index template definition objects. +** *`mapping_addition` (Optional, { all_field, date_detection, dynamic, dynamic_date_formats, dynamic_templates, _field_names, index_field, _meta, numeric_detection, properties, _routing, _size, _source, runtime, enabled, subobjects, _data_stream_timestamp })* +** *`pipeline_substitutions` (Optional, Record)*: Pipelines to test. +If you don’t specify the `pipeline` request path parameter, this parameter is required. +If you specify both this and the request path parameter, the API only uses the request path parameter. +** *`pipeline` (Optional, string)*: The pipeline to use as the default pipeline. +This value can be used to override the default pipeline of the index. [discrete] === slm [discrete] ==== delete_lifecycle -Deletes an existing snapshot lifecycle policy. +Delete a policy. +Delete a snapshot lifecycle policy definition. +This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. {ref}/slm-api-delete-policy.html[Endpoint documentation] [source,ts] @@ -10130,10 +14300,16 @@ client.slm.deleteLifecycle({ policy_id }) * *Request (object):* ** *`policy_id` (string)*: The id of the snapshot lifecycle policy to remove +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== execute_lifecycle -Immediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time. +Run a policy. +Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. +The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. {ref}/slm-api-execute-lifecycle.html[Endpoint documentation] [source,ts] @@ -10146,21 +14322,36 @@ client.slm.executeLifecycle({ policy_id }) * *Request (object):* ** *`policy_id` (string)*: The id of the snapshot lifecycle policy to be executed +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== execute_retention -Deletes any snapshots that are expired according to the policy's retention rules. +Run a retention policy. +Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. +The retention policy is normally applied according to its schedule. {ref}/slm-api-execute-retention.html[Endpoint documentation] [source,ts] ---- -client.slm.executeRetention() +client.slm.executeRetention({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get_lifecycle -Retrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts. +Get policy information. +Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. {ref}/slm-api-get-policy.html[Endpoint documentation] [source,ts] @@ -10173,32 +14364,56 @@ client.slm.getLifecycle({ ... }) * *Request (object):* ** *`policy_id` (Optional, string | string[])*: List of snapshot lifecycle policies to retrieve +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get_stats -Returns global and policy-level statistics about actions taken by snapshot lifecycle management. +Get snapshot lifecycle management statistics. +Get global and policy-level statistics about actions taken by snapshot lifecycle management. {ref}/slm-api-get-stats.html[Endpoint documentation] [source,ts] ---- -client.slm.getStats() +client.slm.getStats({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get_status -Retrieves the status of snapshot lifecycle management (SLM). +Get the snapshot lifecycle management status. {ref}/slm-api-get-status.html[Endpoint documentation] [source,ts] ---- -client.slm.getStatus() +client.slm.getStatus({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. [discrete] ==== put_lifecycle -Creates or updates a snapshot lifecycle policy. +Create or update a policy. +Create or update a snapshot lifecycle policy. +If the policy already exists, this request increments the policy version. +Only the latest version of a policy is stored. {ref}/slm-api-put-policy.html[Endpoint documentation] [source,ts] @@ -10210,42 +14425,76 @@ client.slm.putLifecycle({ policy_id }) ==== Arguments * *Request (object):* -** *`policy_id` (string)*: ID for the snapshot lifecycle policy you want to create or update. +** *`policy_id` (string)*: The identifier for the snapshot lifecycle policy you want to create or update. ** *`config` (Optional, { ignore_unavailable, indices, include_global_state, feature_states, metadata, partial })*: Configuration for each snapshot created by the policy. ** *`name` (Optional, string)*: Name automatically assigned to each snapshot created by the policy. Date math is supported. To prevent conflicting snapshot names, a UUID is automatically appended to each snapshot name. ** *`repository` (Optional, string)*: Repository used to store snapshots created by this policy. This repository must exist prior to the policy’s creation. You can create a repository using the snapshot repository API. ** *`retention` (Optional, { expire_after, max_count, min_count })*: Retention rules used to retain and delete snapshots created by the policy. ** *`schedule` (Optional, string)*: Periodic or absolute schedule at which the policy creates snapshots. SLM applies schedule changes immediately. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. [discrete] ==== start -Turns on snapshot lifecycle management (SLM). +Start snapshot lifecycle management. +Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. +Manually starting SLM is necessary only if it has been stopped using the stop SLM API. {ref}/slm-api-start.html[Endpoint documentation] [source,ts] ---- -client.slm.start() +client.slm.start({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. [discrete] ==== stop -Turns off snapshot lifecycle management (SLM). +Stop snapshot lifecycle management. +Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. +This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. +Stopping SLM does not stop any snapshots that are in progress. +You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. + +The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. +Use the get snapshot lifecycle management status API to see if SLM is running. {ref}/slm-api-stop.html[Endpoint documentation] [source,ts] ---- -client.slm.stop() +client.slm.stop({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. [discrete] === snapshot [discrete] ==== cleanup_repository -Triggers the review of a snapshot repository’s contents and deletes any stale data not referenced by existing snapshots. +Clean up the snapshot repository. +Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. {ref}/clean-up-snapshot-repo-api.html[Endpoint documentation] [source,ts] @@ -10263,9 +14512,10 @@ client.snapshot.cleanupRepository({ repository }) [discrete] ==== clone -Clones indices from one snapshot into another snapshot in the same repository. +Clone a snapshot. +Clone part of all of a snapshot into another snapshot in the same repository. -{ref}/modules-snapshots.html[Endpoint documentation] +{ref}/clone-snapshot-api.html[Endpoint documentation] [source,ts] ---- client.snapshot.clone({ repository, snapshot, target_snapshot, indices }) @@ -10280,13 +14530,13 @@ client.snapshot.clone({ repository, snapshot, target_snapshot, indices }) ** *`target_snapshot` (string)*: The name of the cloned snapshot to create ** *`indices` (string)* ** *`master_timeout` (Optional, string | -1 | 0)*: Explicit operation timeout for connection to master node -** *`timeout` (Optional, string | -1 | 0)* [discrete] ==== create -Creates a snapshot in a repository. +Create a snapshot. +Take a snapshot of a cluster or of data streams and indices. -{ref}/modules-snapshots.html[Endpoint documentation] +{ref}/create-snapshot-api.html[Endpoint documentation] [source,ts] ---- client.snapshot.create({ repository, snapshot }) @@ -10309,7 +14559,10 @@ client.snapshot.create({ repository, snapshot }) [discrete] ==== create_repository -Creates a repository. +Create or update a snapshot repository. +IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. +To register a snapshot repository, the cluster's global metadata must be writeable. +Ensure there are no cluster blocks (for example, `cluster.blocks.read_only` and `clsuter.blocks.read_only_allow_delete` settings) that prevent write access. {ref}/modules-snapshots.html[Endpoint documentation] [source,ts] @@ -10328,9 +14581,9 @@ client.snapshot.createRepository({ repository }) [discrete] ==== delete -Deletes one or more snapshots. +Delete snapshots. -{ref}/modules-snapshots.html[Endpoint documentation] +{ref}/delete-snapshot-api.html[Endpoint documentation] [source,ts] ---- client.snapshot.delete({ repository, snapshot }) @@ -10346,9 +14599,11 @@ client.snapshot.delete({ repository, snapshot }) [discrete] ==== delete_repository -Deletes a repository. +Delete snapshot repositories. +When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. +The snapshots themselves are left untouched and in place. -{ref}/modules-snapshots.html[Endpoint documentation] +{ref}/delete-snapshot-repo-api.html[Endpoint documentation] [source,ts] ---- client.snapshot.deleteRepository({ repository }) @@ -10364,9 +14619,9 @@ client.snapshot.deleteRepository({ repository }) [discrete] ==== get -Returns information about a snapshot. +Get snapshot information. -{ref}/modules-snapshots.html[Endpoint documentation] +{ref}/get-snapshot-api.html[Endpoint documentation] [source,ts] ---- client.snapshot.get({ repository, snapshot }) @@ -10396,9 +14651,9 @@ client.snapshot.get({ repository, snapshot }) [discrete] ==== get_repository -Returns information about a repository. +Get snapshot repository information. -{ref}/modules-snapshots.html[Endpoint documentation] +{ref}/get-snapshot-repo-api.html[Endpoint documentation] [source,ts] ---- client.snapshot.getRepository({ ... }) @@ -10414,20 +14669,155 @@ client.snapshot.getRepository({ ... }) [discrete] ==== repository_analyze -Analyzes a repository for correctness and performance +Analyze a snapshot repository. +Analyze the performance characteristics and any incorrect behaviour found in a repository. -{ref}/modules-snapshots.html[Endpoint documentation] +The response exposes implementation details of the analysis which may change from version to version. +The response body format is therefore not considered stable and may be different in newer versions. + +There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. +Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. + +The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. +Run your first analysis with the default parameter values to check for simple problems. +If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a `blob_count` of at least `2000`, a `max_blob_size` of at least `2gb`, a `max_total_data_size` of at least `1tb`, and a `register_operation_count` of at least `100`. +Always specify a generous timeout, possibly `1h` or longer, to allow time for each analysis to run to completion. +Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. + +If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. +This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. +If so, this storage system is not suitable for use as a snapshot repository. +You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. + +If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. +You can use this information to determine the performance of your storage system. +If any operation fails or returns an incorrect result, the API returns an error. +If the API returns an error, it may not have removed all the data it wrote to the repository. +The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. +You should verify that this location has been cleaned up correctly. +If there is still leftover data at the specified location, you should manually remove it. + +If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. +Some clients are configured to close their connection if no response is received within a certain timeout. +An analysis takes a long time to complete so you might need to relax any such client-side timeouts. +On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. +The path to the leftover data is recorded in the Elasticsearch logs. +You should verify that this location has been cleaned up correctly. +If there is still leftover data at the specified location, you should manually remove it. + +If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. +The analysis attempts to detect common bugs but it does not offer 100% coverage. +Additionally, it does not test the following: + +* Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. +* Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. +* Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. + +IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. +This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. +You must ensure this load does not affect other users of these systems. +Analyses respect the repository settings `max_snapshot_bytes_per_sec` and `max_restore_bytes_per_sec` if available and the cluster setting `indices.recovery.max_bytes_per_sec` which you can use to limit the bandwidth they consume. + +NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. + +NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. +A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. +This indicates it behaves incorrectly in ways that the former version did not detect. +You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. + +NOTE: This API may not work correctly in a mixed-version cluster. + +*Implementation details* + +NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. + +The analysis comprises a number of blob-level tasks, as set by the `blob_count` parameter and a number of compare-and-exchange operations on linearizable registers, as set by the `register_operation_count` parameter. +These tasks are distributed over the data and master-eligible nodes in the cluster for execution. + +For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. +The size of the blob is chosen randomly, according to the `max_blob_size` and `max_total_data_size` parameters. +If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. + +For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. +These reads are permitted to fail, but must not return partial data. +If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. + +For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. +In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. +If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. + +The executing node will use a variety of different methods to write the blob. +For instance, where applicable, it will use both single-part and multi-part uploads. +Similarly, the reading nodes will use a variety of different methods to read the data back again. +For instance they may read the entire blob from start to end or may read only a subset of the data. + +For some blob-level tasks, the executing node will cancel the write before it is complete. +In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. + +Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. +This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. +The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. +Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. +Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. +If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. +Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. +Some operations also verify the behavior on small blobs with sizes other than 8 bytes. + +{ref}/repo-analysis-api.html[Endpoint documentation] [source,ts] ---- -client.snapshot.repositoryAnalyze() +client.snapshot.repositoryAnalyze({ repository }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`repository` (string)*: The name of the repository. +** *`blob_count` (Optional, number)*: The total number of blobs to write to the repository during the test. +For realistic experiments, you should set it to at least `2000`. +** *`concurrency` (Optional, number)*: The number of operations to run concurrently during the test. +** *`detailed` (Optional, boolean)*: Indicates whether to return detailed results, including timing information for every operation performed during the analysis. +If false, it returns only a summary of the analysis. +** *`early_read_node_count` (Optional, number)*: The number of nodes on which to perform an early read operation while writing each blob. +Early read operations are only rarely performed. +** *`max_blob_size` (Optional, number | string)*: The maximum size of a blob to be written during the test. +For realistic experiments, you should set it to at least `2gb`. +** *`max_total_data_size` (Optional, number | string)*: An upper limit on the total size of all the blobs written during the test. +For realistic experiments, you should set it to at least `1tb`. +** *`rare_action_probability` (Optional, number)*: The probability of performing a rare action such as an early read, an overwrite, or an aborted write on each blob. +** *`rarely_abort_writes` (Optional, boolean)*: Indicates whether to rarely cancel writes before they complete. +** *`read_node_count` (Optional, number)*: The number of nodes on which to read a blob after writing. +** *`register_operation_count` (Optional, number)*: The minimum number of linearizable register operations to perform in total. +For realistic experiments, you should set it to at least `100`. +** *`seed` (Optional, number)*: The seed for the pseudo-random number generator used to generate the list of operations performed during the test. +To repeat the same set of operations in multiple experiments, use the same seed in each experiment. +Note that the operations are performed concurrently so might not always happen in the same order on each run. +** *`timeout` (Optional, string | -1 | 0)*: The period of time to wait for the test to complete. +If no response is received before the timeout expires, the test is cancelled and returns an error. [discrete] ==== restore -Restores a snapshot. +Restore a snapshot. +Restore a snapshot of a cluster or data streams and indices. -{ref}/modules-snapshots.html[Endpoint documentation] +You can restore a snapshot only to a running cluster with an elected master node. +The snapshot repository must be registered and available to the cluster. +The snapshot and cluster versions must be compatible. + +To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. + +Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: + +---- +GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream +---- + +If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. + +If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. + +{ref}/restore-snapshot-api.html[Endpoint documentation] [source,ts] ---- client.snapshot.restore({ repository, snapshot }) @@ -10454,9 +14844,19 @@ client.snapshot.restore({ repository, snapshot }) [discrete] ==== status -Returns information about the status of a snapshot. +Get the snapshot status. +Get a detailed description of the current state for each shard participating in the snapshot. +Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. +If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. -{ref}/modules-snapshots.html[Endpoint documentation] +WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. +The API requires a read from the repository for each shard in each snapshot. +For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). + +Depending on the latency of your storage, such requests can take an extremely long time to return results. +These requests can also tax machine resources and, when using cloud storage, incur high processing costs. + +{ref}/get-snapshot-status-api.html[Endpoint documentation] [source,ts] ---- client.snapshot.status({ ... }) @@ -10473,9 +14873,10 @@ client.snapshot.status({ ... }) [discrete] ==== verify_repository -Verifies a repository. +Verify a snapshot repository. +Check for common misconfigurations in a snapshot repository. -{ref}/modules-snapshots.html[Endpoint documentation] +{ref}/verify-snapshot-repo-api.html[Endpoint documentation] [source,ts] ---- client.snapshot.verifyRepository({ repository }) @@ -10493,7 +14894,7 @@ client.snapshot.verifyRepository({ repository }) === sql [discrete] ==== clear_cursor -Clears the SQL cursor +Clear an SQL search cursor. {ref}/clear-sql-cursor-api.html[Endpoint documentation] [source,ts] @@ -10509,7 +14910,14 @@ client.sql.clearCursor({ cursor }) [discrete] ==== delete_async -Deletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it. +Delete an async SQL search. +Delete an async SQL search or a stored synchronous SQL search. +If the search is still running, the API cancels it. + +If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: + +* Users with the `cancel_task` cluster privilege. +* The user who first submitted the search. {ref}/delete-async-sql-search-api.html[Endpoint documentation] [source,ts] @@ -10521,11 +14929,14 @@ client.sql.deleteAsync({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier for the search. +** *`id` (string)*: The identifier for the search. [discrete] ==== get_async -Returns the current status and available results for an async SQL search or stored synchronous SQL search +Get async SQL search results. +Get the current status and available results for an async SQL search or stored synchronous SQL search. + +If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. {ref}/get-async-sql-search-api.html[Endpoint documentation] [source,ts] @@ -10537,18 +14948,21 @@ client.sql.getAsync({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier for the search. -** *`delimiter` (Optional, string)*: Separator for CSV results. The API only supports this parameter for CSV responses. -** *`format` (Optional, string)*: Format for the response. You must specify a format using this parameter or the -Accept HTTP header. If you specify both, the API uses this parameter. -** *`keep_alive` (Optional, string | -1 | 0)*: Retention period for the search and its results. Defaults -to the `keep_alive` period for the original SQL search. -** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: Period to wait for complete results. Defaults to no timeout, -meaning the request waits for complete search results. +** *`id` (string)*: The identifier for the search. +** *`delimiter` (Optional, string)*: The separator for CSV results. +The API supports this parameter only for CSV responses. +** *`format` (Optional, string)*: The format for the response. +You must specify a format using this parameter or the `Accept` HTTP header. +If you specify both, the API uses this parameter. +** *`keep_alive` (Optional, string | -1 | 0)*: The retention period for the search and its results. +It defaults to the `keep_alive` period for the original SQL search. +** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: The period to wait for complete results. +It defaults to no timeout, meaning the request waits for complete search results. [discrete] ==== get_async_status -Returns the current status of an async SQL search or a stored synchronous SQL search +Get the async SQL search status. +Get the current status of an async SQL search or a stored synchronous SQL search. {ref}/get-async-sql-search-status-api.html[Endpoint documentation] [source,ts] @@ -10560,11 +14974,12 @@ client.sql.getAsyncStatus({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier for the search. +** *`id` (string)*: The identifier for the search. [discrete] ==== query -Executes a SQL request +Get SQL search results. +Run an SQL request. {ref}/sql-search-api.html[Endpoint documentation] [source,ts] @@ -10576,30 +14991,46 @@ client.sql.query({ ... }) ==== Arguments * *Request (object):* -** *`catalog` (Optional, string)*: Default catalog (cluster) for queries. If unspecified, the queries execute on the data in the local cluster only. -** *`columnar` (Optional, boolean)*: If true, the results in a columnar fashion: one row represents all the values of a certain column from the current page of results. -** *`cursor` (Optional, string)*: Cursor used to retrieve a set of paginated results. +** *`allow_partial_search_results` (Optional, boolean)*: If `true`, the response has partial results when there are shard request timeouts or shard failures. +If `false`, the API returns an error with no partial results. +** *`catalog` (Optional, string)*: The default catalog (cluster) for queries. +If unspecified, the queries execute on the data in the local cluster only. +** *`columnar` (Optional, boolean)*: If `true`, the results are in a columnar fashion: one row represents all the values of a certain column from the current page of results. +The API supports this parameter only for CBOR, JSON, SMILE, and YAML responses. +** *`cursor` (Optional, string)*: The cursor used to retrieve a set of paginated results. If you specify a cursor, the API only uses the `columnar` and `time_zone` request body parameters. It ignores other request body parameters. -** *`fetch_size` (Optional, number)*: The maximum number of rows (or entries) to return in one response -** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Elasticsearch query DSL for additional filtering. -** *`query` (Optional, string)*: SQL query to run. +** *`fetch_size` (Optional, number)*: The maximum number of rows (or entries) to return in one response. +** *`field_multi_value_leniency` (Optional, boolean)*: If `false`, the API returns an exception when encountering multiple values for a field. +If `true`, the API is lenient and returns the first value from the array with no guarantee of consistent results. +** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The Elasticsearch query DSL for additional filtering. +** *`index_using_frozen` (Optional, boolean)*: If `true`, the search can run on frozen indices. +** *`keep_alive` (Optional, string | -1 | 0)*: The retention period for an async or saved synchronous search. +** *`keep_on_completion` (Optional, boolean)*: If `true`, Elasticsearch stores synchronous searches if you also specify the `wait_for_completion_timeout` parameter. +If `false`, Elasticsearch only stores async searches that don't finish before the `wait_for_completion_timeout`. +** *`page_timeout` (Optional, string | -1 | 0)*: The minimum retention period for the scroll cursor. +After this time period, a pagination request might fail because the scroll cursor is no longer available. +Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of `page_timeout` in the scroll request. +** *`params` (Optional, Record)*: The values for parameters in the query. +** *`query` (Optional, string)*: The SQL query to run. ** *`request_timeout` (Optional, string | -1 | 0)*: The timeout before the request fails. -** *`page_timeout` (Optional, string | -1 | 0)*: The timeout before a pagination request fails. -** *`time_zone` (Optional, string)*: ISO-8601 time zone ID for the search. -** *`field_multi_value_leniency` (Optional, boolean)*: Throw an exception when encountering multiple values for a field (default) or be lenient and return the first value from the list (without any guarantees of what that will be - typically the first in natural ascending order). -** *`runtime_mappings` (Optional, Record)*: Defines one or more runtime fields in the search request. These fields take -precedence over mapped fields with the same name. -** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: Period to wait for complete results. Defaults to no timeout, meaning the request waits for complete search results. If the search doesn’t finish within this period, the search becomes async. -** *`params` (Optional, Record)*: Values for parameters in the query. -** *`keep_alive` (Optional, string | -1 | 0)*: Retention period for an async or saved synchronous search. -** *`keep_on_completion` (Optional, boolean)*: If true, Elasticsearch stores synchronous searches if you also specify the wait_for_completion_timeout parameter. If false, Elasticsearch only stores async searches that don’t finish before the wait_for_completion_timeout. -** *`index_using_frozen` (Optional, boolean)*: If true, the search can run on frozen indices. Defaults to false. -** *`format` (Optional, string)*: Format for the response. +** *`runtime_mappings` (Optional, Record)*: One or more runtime fields for the search request. +These fields take precedence over mapped fields with the same name. +** *`time_zone` (Optional, string)*: The ISO-8601 time zone ID for the search. +** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: The period to wait for complete results. +It defaults to no timeout, meaning the request waits for complete search results. +If the search doesn't finish within this period, the search becomes async. + +To save a synchronous search, you must specify this parameter and the `keep_on_completion` parameter. +** *`format` (Optional, Enum("csv" | "json" | "tsv" | "txt" | "yaml" | "cbor" | "smile"))*: The format for the response. +You can also specify a format using the `Accept` HTTP header. +If you specify both this parameter and the `Accept` HTTP header, this parameter takes precedence. [discrete] ==== translate -Translates SQL into Elasticsearch queries +Translate SQL into Elasticsearch queries. +Translate an SQL search into a search API request containing Query DSL. +It accepts the same request body parameters as the SQL search API, excluding `cursor`. {ref}/sql-translate-api.html[Endpoint documentation] [source,ts] @@ -10611,16 +15042,32 @@ client.sql.translate({ query }) ==== Arguments * *Request (object):* -** *`query` (string)*: SQL query to run. +** *`query` (string)*: The SQL query to run. ** *`fetch_size` (Optional, number)*: The maximum number of rows (or entries) to return in one response. -** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Elasticsearch query DSL for additional filtering. -** *`time_zone` (Optional, string)*: ISO-8601 time zone ID for the search. +** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The Elasticsearch query DSL for additional filtering. +** *`time_zone` (Optional, string)*: The ISO-8601 time zone ID for the search. [discrete] === ssl [discrete] ==== certificates -Retrieves information about the X.509 certificates used to encrypt communications in the cluster. +Get SSL certificates. + +Get information about the X.509 certificates that are used to encrypt communications in the cluster. +The API returns a list that includes certificates from all TLS contexts including: + +- Settings for transport and HTTP interfaces +- TLS settings that are used within authentication realms +- TLS settings for remote monitoring exporters + +The list includes certificates that are used for configuring trust, such as those configured in the `xpack.security.transport.ssl.truststore` and `xpack.security.transport.ssl.certificate_authorities` settings. +It also includes certificates that are used for configuring server identity, such as `xpack.security.http.ssl.keystore` and `xpack.security.http.ssl.certificate settings`. + +The list does not include certificates that are sourced from the default SSL context of the Java Runtime Environment (JRE), even if those certificates are in use within Elasticsearch. + +NOTE: When a PKCS#11 token is configured as the truststore of the JRE, the API returns all the certificates that are included in the PKCS#11 token irrespective of whether these are used in the Elasticsearch TLS configuration. + +If Elasticsearch is configured to use a keystore or truststore, the API output includes all certificates in that store, even though some of the certificates might not be in active use within the cluster. {ref}/security-api-ssl.html[Endpoint documentation] [source,ts] @@ -10633,7 +15080,24 @@ client.ssl.certificates() === synonyms [discrete] ==== delete_synonym -Deletes a synonym set +Delete a synonym set. + +You can only delete a synonyms set that is not in use by any index analyzer. + +Synonyms sets can be used in synonym graph token filters and synonym token filters. +These synonym filters can be used as part of search analyzers. + +Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). +Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. + +If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. +To prevent that, synonyms sets that are used in analyzers can't be deleted. +A delete request in this case will return a 400 response code. + +To remove a synonyms set, you must first remove all indices that contain analyzers using it. +You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. +Once finished, you can delete the index. +When the synonyms set is not used in analyzers, you will be able to delete it. {ref}/delete-synonyms-set.html[Endpoint documentation] [source,ts] @@ -10645,11 +15109,12 @@ client.synonyms.deleteSynonym({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: The id of the synonyms set to be deleted +** *`id` (string)*: The synonyms set identifier to delete. [discrete] ==== delete_synonym_rule -Deletes a synonym rule in a synonym set +Delete a synonym rule. +Delete a synonym rule from a synonym set. {ref}/delete-synonym-rule.html[Endpoint documentation] [source,ts] @@ -10661,12 +15126,12 @@ client.synonyms.deleteSynonymRule({ set_id, rule_id }) ==== Arguments * *Request (object):* -** *`set_id` (string)*: The id of the synonym set to be updated -** *`rule_id` (string)*: The id of the synonym rule to be deleted +** *`set_id` (string)*: The ID of the synonym set to update. +** *`rule_id` (string)*: The ID of the synonym rule to delete. [discrete] ==== get_synonym -Retrieves a synonym set +Get a synonym set. {ref}/get-synonyms-set.html[Endpoint documentation] [source,ts] @@ -10678,13 +15143,14 @@ client.synonyms.getSynonym({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: "The id of the synonyms set to be retrieved -** *`from` (Optional, number)*: Starting offset for query rules to be retrieved -** *`size` (Optional, number)*: specifies a max number of query rules to retrieve +** *`id` (string)*: The synonyms set identifier to retrieve. +** *`from` (Optional, number)*: The starting offset for query rules to retrieve. +** *`size` (Optional, number)*: The max number of query rules to retrieve. [discrete] ==== get_synonym_rule -Retrieves a synonym rule from a synonym set +Get a synonym rule. +Get a synonym rule from a synonym set. {ref}/get-synonym-rule.html[Endpoint documentation] [source,ts] @@ -10696,14 +15162,15 @@ client.synonyms.getSynonymRule({ set_id, rule_id }) ==== Arguments * *Request (object):* -** *`set_id` (string)*: The id of the synonym set to retrieve the synonym rule from -** *`rule_id` (string)*: The id of the synonym rule to retrieve +** *`set_id` (string)*: The ID of the synonym set to retrieve the synonym rule from. +** *`rule_id` (string)*: The ID of the synonym rule to retrieve. [discrete] ==== get_synonyms_sets -Retrieves a summary of all defined synonym sets +Get all synonym sets. +Get a summary of all defined synonym sets. -{ref}/list-synonyms-sets.html[Endpoint documentation] +{ref}/get-synonyms-set.html[Endpoint documentation] [source,ts] ---- client.synonyms.getSynonymsSets({ ... }) @@ -10713,12 +15180,17 @@ client.synonyms.getSynonymsSets({ ... }) ==== Arguments * *Request (object):* -** *`from` (Optional, number)*: Starting offset -** *`size` (Optional, number)*: specifies a max number of results to get +** *`from` (Optional, number)*: The starting offset for synonyms sets to retrieve. +** *`size` (Optional, number)*: The maximum number of synonyms sets to retrieve. [discrete] ==== put_synonym -Creates or updates a synonym set. +Create or update a synonym set. +Synonyms sets are limited to a maximum of 10,000 synonym rules per set. +If you need to manage more synonym rules, you can create multiple synonym sets. + +When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. +This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. {ref}/put-synonyms-set.html[Endpoint documentation] [source,ts] @@ -10730,12 +15202,17 @@ client.synonyms.putSynonym({ id, synonyms_set }) ==== Arguments * *Request (object):* -** *`id` (string)*: The id of the synonyms set to be created or updated -** *`synonyms_set` ({ id, synonyms } | { id, synonyms }[])*: The synonym set information to update +** *`id` (string)*: The ID of the synonyms set to be created or updated. +** *`synonyms_set` ({ id, synonyms } | { id, synonyms }[])*: The synonym rules definitions for the synonyms set. [discrete] ==== put_synonym_rule -Creates or updates a synonym rule in a synonym set +Create or update a synonym rule. +Create or update a synonym rule in a synonym set. + +If any of the synonym rules included is invalid, the API returns an error. + +When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. {ref}/put-synonym-rule.html[Endpoint documentation] [source,ts] @@ -10747,15 +15224,26 @@ client.synonyms.putSynonymRule({ set_id, rule_id, synonyms }) ==== Arguments * *Request (object):* -** *`set_id` (string)*: The id of the synonym set to be updated with the synonym rule -** *`rule_id` (string)*: The id of the synonym rule to be updated or created -** *`synonyms` (string)* +** *`set_id` (string)*: The ID of the synonym set. +** *`rule_id` (string)*: The ID of the synonym rule to be updated or created. +** *`synonyms` (string)*: The synonym rule information definition, which must be in Solr format. [discrete] === tasks [discrete] ==== cancel -Cancels a task, if it can be cancelled through an API. +Cancel a task. + +WARNING: The task management API is new and should still be considered a beta feature. +The API may change in ways that are not backwards compatible. + +A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. +It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. +The get task information API will continue to list these cancelled tasks until they complete. +The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. + +To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the `?detailed` parameter to identify the other tasks the system is running. +You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. {ref}/tasks.html[Endpoint documentation] [source,ts] @@ -10767,16 +15255,21 @@ client.tasks.cancel({ ... }) ==== Arguments * *Request (object):* -** *`task_id` (Optional, string | number)*: ID of the task. -** *`actions` (Optional, string | string[])*: List or wildcard expression of actions used to limit the request. -** *`nodes` (Optional, string[])*: List of node IDs or names used to limit the request. -** *`parent_task_id` (Optional, string)*: Parent task ID used to limit the tasks. -** *`wait_for_completion` (Optional, boolean)*: Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false +** *`task_id` (Optional, string | number)*: The task identifier. +** *`actions` (Optional, string | string[])*: A list or wildcard expression of actions that is used to limit the request. +** *`nodes` (Optional, string[])*: A list of node IDs or names that is used to limit the request. +** *`parent_task_id` (Optional, string)*: A parent task ID that is used to limit the tasks. +** *`wait_for_completion` (Optional, boolean)*: If true, the request blocks until all found tasks are complete. [discrete] ==== get Get task information. -Returns information about the tasks currently executing in the cluster. +Get information about a task currently running in the cluster. + +WARNING: The task management API is new and should still be considered a beta feature. +The API may change in ways that are not backwards compatible. + +If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. {ref}/tasks.html[Endpoint documentation] [source,ts] @@ -10788,14 +15281,72 @@ client.tasks.get({ task_id }) ==== Arguments * *Request (object):* -** *`task_id` (string)*: ID of the task. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. +** *`task_id` (string)*: The task identifier. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. ** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the task has completed. [discrete] ==== list -The task management API returns information about tasks currently executing on one or more nodes in the cluster. +Get all tasks. +Get information about the tasks currently running on one or more nodes in the cluster. + +WARNING: The task management API is new and should still be considered a beta feature. +The API may change in ways that are not backwards compatible. + +**Identifying running tasks** + +The `X-Opaque-Id header`, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. +This enables you to track certain calls or associate certain tasks with the client that started them. +For example: + +---- +curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" +---- + +The API returns the following result: + +---- +HTTP/1.1 200 OK +X-Opaque-Id: 123456 +content-type: application/json; charset=UTF-8 +content-length: 831 + +{ + "tasks" : { + "u5lcZHqcQhu-rUoFaqDphA:45" : { + "node" : "u5lcZHqcQhu-rUoFaqDphA", + "id" : 45, + "type" : "transport", + "action" : "cluster:monitor/tasks/lists", + "start_time_in_millis" : 1513823752749, + "running_time_in_nanos" : 293139, + "cancellable" : false, + "headers" : { + "X-Opaque-Id" : "123456" + }, + "children" : [ + { + "node" : "u5lcZHqcQhu-rUoFaqDphA", + "id" : 46, + "type" : "direct", + "action" : "cluster:monitor/tasks/lists[n]", + "start_time_in_millis" : 1513823752750, + "running_time_in_nanos" : 92133, + "cancellable" : false, + "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", + "headers" : { + "X-Opaque-Id" : "123456" + } + } + ] + } + } + } +---- +In this example, `X-Opaque-Id: 123456` is the ID as a part of the response header. +The `X-Opaque-Id` in the task `headers` is the ID for the task that was initiated by the REST request. +The `X-Opaque-Id` in the children `headers` is the child task of the task that was initiated by the REST request. {ref}/tasks.html[Endpoint documentation] [source,ts] @@ -10807,42 +15358,261 @@ client.tasks.list({ ... }) ==== Arguments * *Request (object):* -** *`actions` (Optional, string | string[])*: List or wildcard expression of actions used to limit the request. -** *`detailed` (Optional, boolean)*: If `true`, the response includes detailed information about shard recoveries. -** *`group_by` (Optional, Enum("nodes" | "parents" | "none"))*: Key used to group tasks in the response. -** *`node_id` (Optional, string[])*: List of node IDs or names used to limit returned information. -** *`parent_task_id` (Optional, string)*: Parent task ID used to limit returned information. To return all tasks, omit this parameter or use a value of `-1`. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. +** *`actions` (Optional, string | string[])*: A list or wildcard expression of actions used to limit the request. +For example, you can use `cluser:*` to retrieve all cluster-related tasks. +** *`detailed` (Optional, boolean)*: If `true`, the response includes detailed information about the running tasks. +This information is useful to distinguish tasks from each other but is more costly to run. +** *`group_by` (Optional, Enum("nodes" | "parents" | "none"))*: A key that is used to group tasks in the response. +The task lists can be grouped either by nodes or by parent tasks. +** *`nodes` (Optional, string | string[])*: A list of node IDs or names that is used to limit the returned information. +** *`parent_task_id` (Optional, string)*: A parent task identifier that is used to limit returned information. +To return all tasks, omit this parameter or use a value of `-1`. +If the parent task is not found, the API does not return a 404 response code. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for each node to respond. +If a node does not respond before its timeout expires, the response does not include its information. +However, timed out nodes are included in the `node_failures` property. ** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the operation is complete. [discrete] === text_structure [discrete] ==== find_field_structure -Finds the structure of a text field in an index. +Find the structure of a text field. +Find the structure of a text field in an Elasticsearch index. + +This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. +For example, if you have ingested data into a very simple index that has just `@timestamp` and message fields, you can use this API to see what common structure exists in the message field. + +The response from the API contains: + +* Sample messages. +* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. +* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. +* Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. + +All this information can be calculated by the structure finder with no guidance. +However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. + +If the structure finder produces unexpected results, specify the `explain` query parameter and an explanation will appear in the response. +It helps determine why the returned structure was chosen. {ref}/find-field-structure.html[Endpoint documentation] [source,ts] ---- -client.textStructure.findFieldStructure() ----- - +client.textStructure.findFieldStructure({ field, index }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`field` (string)*: The field that should be analyzed. +** *`index` (string)*: The name of the index that contains the analyzed field. +** *`column_names` (Optional, string)*: If `format` is set to `delimited`, you can specify the column names in a list. +If this parameter is not specified, the structure finder uses the column names from the header row of the text. +If the text does not have a header row, columns are named "column1", "column2", "column3", for example. +** *`delimiter` (Optional, string)*: If you have set `format` to `delimited`, you can specify the character used to delimit the values in each row. +Only a single character is supported; the delimiter cannot have multiple characters. +By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`). +In this default scenario, all rows must have the same number of fields for the delimited format to be detected. +If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. +** *`documents_to_sample` (Optional, number)*: The number of documents to include in the structural analysis. +The minimum value is 2. +** *`ecs_compatibility` (Optional, Enum("disabled" | "v1"))*: The mode of compatibility with ECS compliant Grok patterns. +Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. +This setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input. +If the structure finder identifies a common structure but has no idea of the meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output. +The intention in that situation is that a user who knows the meanings will rename the fields before using them. +** *`explain` (Optional, boolean)*: If `true`, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result. +** *`format` (Optional, Enum("delimited" | "ndjson" | "semi_structured_text" | "xml"))*: The high level structure of the text. +By default, the API chooses the format. +In this default scenario, all rows must have the same number of fields for a delimited format to be detected. +If the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. +** *`grok_pattern` (Optional, string)*: If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text. +The name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter. +If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". +If `grok_pattern` is not specified, the structure finder creates a Grok pattern. +** *`quote` (Optional, string)*: If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. +Only a single character is supported. +If this parameter is not specified, the default value is a double quote (`"`). +If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. +** *`should_trim_fields` (Optional, boolean)*: If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. +If this parameter is not specified and the delimiter is pipe (`|`), the default value is true. +Otherwise, the default value is `false`. +** *`timeout` (Optional, string | -1 | 0)*: The maximum amount of time that the structure analysis can take. +If the analysis is still running when the timeout expires, it will be stopped. +** *`timestamp_field` (Optional, string)*: The name of the field that contains the primary timestamp of each record in the text. +In particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field. + +If the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`. +Therefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified. + +For structured text, if you specify this parameter, the field must exist within the text. + +If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. +For structured text, it is not compulsory to have a timestamp in the text. +** *`timestamp_format` (Optional, string)*: The Java time format of the timestamp field in the text. +Only a subset of Java time format letter groups are supported: + +* `a` +* `d` +* `dd` +* `EEE` +* `EEEE` +* `H` +* `HH` +* `h` +* `M` +* `MM` +* `MMM` +* `MMMM` +* `mm` +* `ss` +* `XX` +* `XXX` +* `yy` +* `yyyy` +* `zzz` + +Additionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`). +Spacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes. +For example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. + +One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`. +Another is when the timestamp format is one that the structure finder does not consider by default. + +If this parameter is not specified, the structure finder chooses the best format from a built-in set. + +If the special value `null` is specified, the structure finder will not look for a primary timestamp in the text. +When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. [discrete] ==== find_message_structure -Finds the structure of a list of messages. The messages must contain data that is suitable to be ingested into Elasticsearch. +Find the structure of text messages. +Find the structure of a list of text messages. +The messages must contain data that is suitable to be ingested into Elasticsearch. + +This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. +Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. + +The response from the API contains: + +* Sample messages. +* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. +* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. +Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. + +All this information can be calculated by the structure finder with no guidance. +However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. + +If the structure finder produces unexpected results, specify the `explain` query parameter and an explanation will appear in the response. +It helps determine why the returned structure was chosen. {ref}/find-message-structure.html[Endpoint documentation] [source,ts] ---- -client.textStructure.findMessageStructure() ----- - +client.textStructure.findMessageStructure({ messages }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`messages` (string[])*: The list of messages you want to analyze. +** *`column_names` (Optional, string)*: If the format is `delimited`, you can specify the column names in a list. +If this parameter is not specified, the structure finder uses the column names from the header row of the text. +If the text does not have a header role, columns are named "column1", "column2", "column3", for example. +** *`delimiter` (Optional, string)*: If you the format is `delimited`, you can specify the character used to delimit the values in each row. +Only a single character is supported; the delimiter cannot have multiple characters. +By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`). +In this default scenario, all rows must have the same number of fields for the delimited format to be detected. +If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. +** *`ecs_compatibility` (Optional, Enum("disabled" | "v1"))*: The mode of compatibility with ECS compliant Grok patterns. +Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. +This setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input. +If the structure finder identifies a common structure but has no idea of meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output, with the intention that a user who knows the meanings rename these fields before using it. +** *`explain` (Optional, boolean)*: If this parameter is set to true, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result. +** *`format` (Optional, Enum("delimited" | "ndjson" | "semi_structured_text" | "xml"))*: The high level structure of the text. +By default, the API chooses the format. +In this default scenario, all rows must have the same number of fields for a delimited format to be detected. +If the format is `delimited` and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. +** *`grok_pattern` (Optional, string)*: If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text. +The name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter. +If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". +If `grok_pattern` is not specified, the structure finder creates a Grok pattern. +** *`quote` (Optional, string)*: If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. +Only a single character is supported. +If this parameter is not specified, the default value is a double quote (`"`). +If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. +** *`should_trim_fields` (Optional, boolean)*: If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. +If this parameter is not specified and the delimiter is pipe (`|`), the default value is true. +Otherwise, the default value is `false`. +** *`timeout` (Optional, string | -1 | 0)*: The maximum amount of time that the structure analysis can take. +If the analysis is still running when the timeout expires, it will be stopped. +** *`timestamp_field` (Optional, string)*: The name of the field that contains the primary timestamp of each record in the text. +In particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field. + +If the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`. +Therefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified. + +For structured text, if you specify this parameter, the field must exist within the text. + +If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. +For structured text, it is not compulsory to have a timestamp in the text. +** *`timestamp_format` (Optional, string)*: The Java time format of the timestamp field in the text. +Only a subset of Java time format letter groups are supported: + +* `a` +* `d` +* `dd` +* `EEE` +* `EEEE` +* `H` +* `HH` +* `h` +* `M` +* `MM` +* `MMM` +* `MMMM` +* `mm` +* `ss` +* `XX` +* `XXX` +* `yy` +* `yyyy` +* `zzz` + +Additionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`). +Spacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes. +For example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. + +One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`. +Another is when the timestamp format is one that the structure finder does not consider by default. + +If this parameter is not specified, the structure finder chooses the best format from a built-in set. + +If the special value `null` is specified, the structure finder will not look for a primary timestamp in the text. +When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. [discrete] ==== find_structure -Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch. +Find the structure of a text file. +The text file must contain data that is suitable to be ingested into Elasticsearch. + +This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. +Unlike other Elasticsearch endpoints, the data that is posted to this endpoint does not need to be UTF-8 encoded and in JSON format. +It must, however, be text; binary text formats are not currently supported. +The size is limited to the Elasticsearch HTTP receive buffer size, which defaults to 100 Mb. + +The response from the API contains: + +* A couple of messages from the beginning of the text. +* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. +* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. +* Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. + +All this information can be calculated by the structure finder with no guidance. +However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. {ref}/find-structure.html[Endpoint documentation] [source,ts] @@ -10855,25 +15625,105 @@ client.textStructure.findStructure({ ... }) * *Request (object):* ** *`text_files` (Optional, TJsonDocument[])* -** *`charset` (Optional, string)*: The text’s character set. It must be a character set that is supported by the JVM that Elasticsearch uses. For example, UTF-8, UTF-16LE, windows-1252, or EUC-JP. If this parameter is not specified, the structure finder chooses an appropriate character set. -** *`column_names` (Optional, string)*: If you have set format to delimited, you can specify the column names in a list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named "column1", "column2", "column3", etc. -** *`delimiter` (Optional, string)*: If you have set format to delimited, you can specify the character used to delimit the values in each row. Only a single character is supported; the delimiter cannot have multiple characters. By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (|). In this default scenario, all rows must have the same number of fields for the delimited format to be detected. If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. -** *`ecs_compatibility` (Optional, string)*: The mode of compatibility with ECS compliant Grok patterns (disabled or v1, default: disabled). -** *`explain` (Optional, boolean)*: If this parameter is set to true, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result. -** *`format` (Optional, string)*: The high level structure of the text. Valid values are ndjson, xml, delimited, and semi_structured_text. By default, the API chooses the format. In this default scenario, all rows must have the same number of fields for a delimited format to be detected. If the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. -** *`grok_pattern` (Optional, string)*: If you have set format to semi_structured_text, you can specify a Grok pattern that is used to extract fields from every message in the text. The name of the timestamp field in the Grok pattern must match what is specified in the timestamp_field parameter. If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". If grok_pattern is not specified, the structure finder creates a Grok pattern. -** *`has_header_row` (Optional, boolean)*: If you have set format to delimited, you can use this parameter to indicate whether the column names are in the first row of the text. If this parameter is not specified, the structure finder guesses based on the similarity of the first row of the text to other rows. -** *`line_merge_size_limit` (Optional, number)*: The maximum number of characters in a message when lines are merged to form messages while analyzing semi-structured text. If you have extremely long messages you may need to increase this, but be aware that this may lead to very long processing times if the way to group lines into messages is misdetected. -** *`lines_to_sample` (Optional, number)*: The number of lines to include in the structural analysis, starting from the beginning of the text. The minimum is 2; If the value of this parameter is greater than the number of lines in the text, the analysis proceeds (as long as there are at least two lines in the text) for all of the lines. -** *`quote` (Optional, string)*: If you have set format to delimited, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. Only a single character is supported. If this parameter is not specified, the default value is a double quote ("). If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. -** *`should_trim_fields` (Optional, boolean)*: If you have set format to delimited, you can specify whether values between delimiters should have whitespace trimmed from them. If this parameter is not specified and the delimiter is pipe (|), the default value is true. Otherwise, the default value is false. -** *`timeout` (Optional, string | -1 | 0)*: Sets the maximum amount of time that the structure analysis make take. If the analysis is still running when the timeout expires then it will be aborted. -** *`timestamp_field` (Optional, string)*: Optional parameter to specify the timestamp field in the file +** *`charset` (Optional, string)*: The text's character set. +It must be a character set that is supported by the JVM that Elasticsearch uses. +For example, `UTF-8`, `UTF-16LE`, `windows-1252`, or `EUC-JP`. +If this parameter is not specified, the structure finder chooses an appropriate character set. +** *`column_names` (Optional, string)*: If you have set format to `delimited`, you can specify the column names in a list. +If this parameter is not specified, the structure finder uses the column names from the header row of the text. +If the text does not have a header role, columns are named "column1", "column2", "column3", for example. +** *`delimiter` (Optional, string)*: If you have set `format` to `delimited`, you can specify the character used to delimit the values in each row. +Only a single character is supported; the delimiter cannot have multiple characters. +By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`). +In this default scenario, all rows must have the same number of fields for the delimited format to be detected. +If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. +** *`ecs_compatibility` (Optional, string)*: The mode of compatibility with ECS compliant Grok patterns. +Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. +Valid values are `disabled` and `v1`. +This setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input. +If the structure finder identifies a common structure but has no idea of meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output, with the intention that a user who knows the meanings rename these fields before using it. +** *`explain` (Optional, boolean)*: If this parameter is set to `true`, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result. +If the structure finder produces unexpected results for some text, use this query parameter to help you determine why the returned structure was chosen. +** *`format` (Optional, string)*: The high level structure of the text. +Valid values are `ndjson`, `xml`, `delimited`, and `semi_structured_text`. +By default, the API chooses the format. +In this default scenario, all rows must have the same number of fields for a delimited format to be detected. +If the format is set to `delimited` and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. +** *`grok_pattern` (Optional, string)*: If you have set `format` to `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text. +The name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter. +If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". +If `grok_pattern` is not specified, the structure finder creates a Grok pattern. +** *`has_header_row` (Optional, boolean)*: If you have set `format` to `delimited`, you can use this parameter to indicate whether the column names are in the first row of the text. +If this parameter is not specified, the structure finder guesses based on the similarity of the first row of the text to other rows. +** *`line_merge_size_limit` (Optional, number)*: The maximum number of characters in a message when lines are merged to form messages while analyzing semi-structured text. +If you have extremely long messages you may need to increase this, but be aware that this may lead to very long processing times if the way to group lines into messages is misdetected. +** *`lines_to_sample` (Optional, number)*: The number of lines to include in the structural analysis, starting from the beginning of the text. +The minimum is 2. +If the value of this parameter is greater than the number of lines in the text, the analysis proceeds (as long as there are at least two lines in the text) for all of the lines. + +NOTE: The number of lines and the variation of the lines affects the speed of the analysis. +For example, if you upload text where the first 1000 lines are all variations on the same message, the analysis will find more commonality than would be seen with a bigger sample. +If possible, however, it is more efficient to upload sample text with more variety in the first 1000 lines than to request analysis of 100000 lines to achieve some variety. +** *`quote` (Optional, string)*: If you have set `format` to `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. +Only a single character is supported. +If this parameter is not specified, the default value is a double quote (`"`). +If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. +** *`should_trim_fields` (Optional, boolean)*: If you have set `format` to `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. +If this parameter is not specified and the delimiter is pipe (`|`), the default value is `true`. +Otherwise, the default value is `false`. +** *`timeout` (Optional, string | -1 | 0)*: The maximum amount of time that the structure analysis can take. +If the analysis is still running when the timeout expires then it will be stopped. +** *`timestamp_field` (Optional, string)*: The name of the field that contains the primary timestamp of each record in the text. +In particular, if the text were ingested into an index, this is the field that would be used to populate the `@timestamp` field. + +If the `format` is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`. +Therefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified. + +For structured text, if you specify this parameter, the field must exist within the text. + +If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. +For structured text, it is not compulsory to have a timestamp in the text. ** *`timestamp_format` (Optional, string)*: The Java time format of the timestamp field in the text. +Only a subset of Java time format letter groups are supported: + +* `a` +* `d` +* `dd` +* `EEE` +* `EEEE` +* `H` +* `HH` +* `h` +* `M` +* `MM` +* `MMM` +* `MMMM` +* `mm` +* `ss` +* `XX` +* `XXX` +* `yy` +* `yyyy` +* `zzz` + +Additionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and separated from the `ss` by a `.`, `,` or `:`. +Spacing and punctuation is also permitted with the exception of `?`, newline and carriage return, together with literal text enclosed in single quotes. +For example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. + +One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`. +Another is when the timestamp format is one that the structure finder does not consider by default. + +If this parameter is not specified, the structure finder chooses the best format from a built-in set. + +If the special value `null` is specified the structure finder will not look for a primary timestamp in the text. +When the format is semi-structured text this will result in the structure finder treating the text as single-line messages. + [discrete] ==== test_grok_pattern -Tests a Grok pattern on some text. +Test a Grok pattern. +Test a Grok pattern on one or more lines of text. +The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. {ref}/test-grok-pattern.html[Endpoint documentation] [source,ts] @@ -10885,16 +15735,17 @@ client.textStructure.testGrokPattern({ grok_pattern, text }) ==== Arguments * *Request (object):* -** *`grok_pattern` (string)*: Grok pattern to run on the text. -** *`text` (string[])*: Lines of text to run the Grok pattern on. -** *`ecs_compatibility` (Optional, string)*: The mode of compatibility with ECS compliant Grok patterns (disabled or v1, default: disabled). +** *`grok_pattern` (string)*: The Grok pattern to run on the text. +** *`text` (string[])*: The lines of text to run the Grok pattern on. +** *`ecs_compatibility` (Optional, string)*: The mode of compatibility with ECS compliant Grok patterns. +Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. +Valid values are `disabled` and `v1`. [discrete] === transform [discrete] ==== delete_transform Delete a transform. -Deletes a transform. {ref}/delete-transform.html[Endpoint documentation] [source,ts] @@ -10925,7 +15776,7 @@ client.transform.getNodeStats() [discrete] ==== get_transform Get transforms. -Retrieves configuration information for transforms. +Get configuration information for transforms. {ref}/get-transform.html[Endpoint documentation] [source,ts] @@ -10943,9 +15794,9 @@ wildcard expression. You can get information for all transforms by using ``. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no transforms that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no transforms that match. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. @@ -10958,7 +15809,8 @@ be retrieved and then added to another cluster. [discrete] ==== get_transform_stats Get transform stats. -Retrieves usage information for transforms. + +Get usage information for transforms. {ref}/get-transform-stats.html[Endpoint documentation] [source,ts] @@ -10976,9 +15828,9 @@ wildcard expression. You can get information for all transforms by using ``. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no transforms that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no transforms that match. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. @@ -11087,7 +15939,7 @@ the exception of privilege checks. [discrete] ==== reset_transform Reset a transform. -Resets a transform. + Before you can reset it, you must stop it; alternatively, use the `force` query parameter. If the destination index was created by the transform, it is deleted. @@ -11105,15 +15957,16 @@ client.transform.resetTransform({ transform_id }) hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. ** *`force` (Optional, boolean)*: If this value is `true`, the transform is reset regardless of its current state. If it's `false`, the transform must be stopped before it can be reset. +** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== schedule_now_transform Schedule a transform to start now. -Instantly runs a transform to process data. -If you _schedule_now a transform, it will process the new data instantly, -without waiting for the configured frequency interval. After _schedule_now API is called, -the transform will be processed again at now + frequency unless _schedule_now API +Instantly run a transform to process data. +If you run this API, the transform will process the new data instantly, +without waiting for the configured frequency interval. After the API is called, +the transform will be processed again at `now + frequency` unless the API is called again in the meantime. {ref}/schedule-now-transform.html[Endpoint documentation] @@ -11132,7 +15985,6 @@ client.transform.scheduleNowTransform({ transform_id }) [discrete] ==== start_transform Start a transform. -Starts a transform. When you start a transform, it creates the destination index if it does not already exist. The `number_of_shards` is set to `1` and the `auto_expand_replicas` is set to `0-1`. If it is a pivot transform, it deduces the mapping @@ -11208,7 +16060,7 @@ privileges for the source indices. You must also have `index` and `read` privile Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the time of update and runs with those privileges. -{ref}/update-transform.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-update-transform[Endpoint documentation] [source,ts] ---- client.transform.updateTransform({ transform_id }) @@ -11239,14 +16091,23 @@ timeout expires, the request fails and returns an error. [discrete] ==== upgrade_transforms -Upgrades all transforms. -This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. It -also cleans up the internal data structures that store the transform state and checkpoints. The upgrade does not -affect the source and destination indices. The upgrade also does not affect the roles that transforms use when -Elasticsearch security features are enabled; the role used to read source data and write to the destination index -remains unchanged. +Upgrade all transforms. -{ref}/upgrade-transforms.html[Endpoint documentation] +Transforms are compatible across minor versions and between supported major versions. +However, over time, the format of transform configuration information may change. +This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. +It also cleans up the internal data structures that store the transform state and checkpoints. +The upgrade does not affect the source and destination indices. +The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. + +If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. +Resolve the issue then re-run the process again. +A summary is returned when the upgrade is finished. + +To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. +You may want to perform a recent cluster backup prior to the upgrade. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-upgrade-transforms[Endpoint documentation] [source,ts] ---- client.transform.upgradeTransforms({ ... }) @@ -11264,9 +16125,18 @@ returns an error. === watcher [discrete] ==== ack_watch -Acknowledges a watch, manually throttling the execution of the watch's actions. +Acknowledge a watch. +Acknowledging a watch enables you to manually throttle the execution of the watch's actions. + +The acknowledgement state of an action is stored in the `status.actions..ack.state` structure. -{ref}/watcher-api-ack-watch.html[Endpoint documentation] +IMPORTANT: If the specified watch is currently being executed, this API will return an error +The reason for this behavior is to prevent overwriting the watch status from a watch execution. + +Acknowledging an action throttles further executions of that action until its `ack.state` is reset to `awaits_successful_execution`. +This happens when the condition of the watch is not met (the condition evaluates to false). + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-ack-watch[Endpoint documentation] [source,ts] ---- client.watcher.ackWatch({ watch_id }) @@ -11276,14 +16146,16 @@ client.watcher.ackWatch({ watch_id }) ==== Arguments * *Request (object):* -** *`watch_id` (string)*: Watch ID -** *`action_id` (Optional, string | string[])*: A list of the action ids to be acked +** *`watch_id` (string)*: The watch identifier. +** *`action_id` (Optional, string | string[])*: A list of the action identifiers to acknowledge. +If you omit this parameter, all of the actions of the watch are acknowledged. [discrete] ==== activate_watch -Activates a currently inactive watch. +Activate a watch. +A watch can be either active or inactive. -{ref}/watcher-api-activate-watch.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-activate-watch[Endpoint documentation] [source,ts] ---- client.watcher.activateWatch({ watch_id }) @@ -11293,13 +16165,14 @@ client.watcher.activateWatch({ watch_id }) ==== Arguments * *Request (object):* -** *`watch_id` (string)*: Watch ID +** *`watch_id` (string)*: The watch identifier. [discrete] ==== deactivate_watch -Deactivates a currently active watch. +Deactivate a watch. +A watch can be either active or inactive. -{ref}/watcher-api-deactivate-watch.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-deactivate-watch[Endpoint documentation] [source,ts] ---- client.watcher.deactivateWatch({ watch_id }) @@ -11309,13 +16182,20 @@ client.watcher.deactivateWatch({ watch_id }) ==== Arguments * *Request (object):* -** *`watch_id` (string)*: Watch ID +** *`watch_id` (string)*: The watch identifier. [discrete] ==== delete_watch -Removes a watch from Watcher. +Delete a watch. +When the watch is removed, the document representing the watch in the `.watches` index is gone and it will never be run again. + +Deleting a watch does not delete any watch execution records related to this watch from the watch history. + +IMPORTANT: Deleting a watch must be done by using only this API. +Do not delete the watch directly from the `.watches` index using the Elasticsearch delete document API +When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the `.watches` index. -{ref}/watcher-api-delete-watch.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-delete-watch[Endpoint documentation] [source,ts] ---- client.watcher.deleteWatch({ id }) @@ -11325,14 +16205,26 @@ client.watcher.deleteWatch({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Watch ID +** *`id` (string)*: The watch identifier. [discrete] ==== execute_watch +Run a watch. This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes. -For testing and debugging purposes, you also have fine-grained control on how the watch runs. You can execute the watch without executing all of its actions or alternatively by simulating them. You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after execution. -{ref}/watcher-api-execute-watch.html[Endpoint documentation] +For testing and debugging purposes, you also have fine-grained control on how the watch runs. +You can run the watch without running all of its actions or alternatively by simulating them. +You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs. + +You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline. +This serves as great tool for testing and debugging your watches prior to adding them to Watcher. + +When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches. +If your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch. + +When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-execute-watch[Endpoint documentation] [source,ts] ---- client.watcher.executeWatch({ ... }) @@ -11342,32 +16234,43 @@ client.watcher.executeWatch({ ... }) ==== Arguments * *Request (object):* -** *`id` (Optional, string)*: Identifier for the watch. +** *`id` (Optional, string)*: The watch identifier. ** *`action_modes` (Optional, Record)*: Determines how to handle the watch actions as part of the watch execution. ** *`alternative_input` (Optional, Record)*: When present, the watch uses this object as a payload instead of executing its own input. ** *`ignore_condition` (Optional, boolean)*: When set to `true`, the watch execution uses the always condition. This can also be specified as an HTTP parameter. -** *`record_execution` (Optional, boolean)*: When set to `true`, the watch record representing the watch execution result is persisted to the `.watcher-history` index for the current time. In addition, the status of the watch is updated, possibly throttling subsequent executions. This can also be specified as an HTTP parameter. +** *`record_execution` (Optional, boolean)*: When set to `true`, the watch record representing the watch execution result is persisted to the `.watcher-history` index for the current time. +In addition, the status of the watch is updated, possibly throttling subsequent runs. +This can also be specified as an HTTP parameter. ** *`simulated_actions` (Optional, { actions, all, use_all })* -** *`trigger_data` (Optional, { scheduled_time, triggered_time })*: This structure is parsed as the data of the trigger event that will be used during the watch execution -** *`watch` (Optional, { actions, condition, input, metadata, status, throttle_period, throttle_period_in_millis, transform, trigger })*: When present, this watch is used instead of the one specified in the request. This watch is not persisted to the index and record_execution cannot be set. +** *`trigger_data` (Optional, { scheduled_time, triggered_time })*: This structure is parsed as the data of the trigger event that will be used during the watch execution. +** *`watch` (Optional, { actions, condition, input, metadata, status, throttle_period, throttle_period_in_millis, transform, trigger })*: When present, this watch is used instead of the one specified in the request. +This watch is not persisted to the index and `record_execution` cannot be set. ** *`debug` (Optional, boolean)*: Defines whether the watch runs in debug mode. [discrete] ==== get_settings -Retrieve settings for the watcher system index +Get Watcher index settings. +Get settings for the Watcher internal index (`.watches`). +Only a subset of settings are shown, for example `index.auto_expand_replicas` and `index.number_of_replicas`. -{ref}/watcher-api-get-settings.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-settings[Endpoint documentation] [source,ts] ---- -client.watcher.getSettings() +client.watcher.getSettings({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] ==== get_watch -Retrieves a watch by its ID. +Get a watch. -{ref}/watcher-api-get-watch.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-watch[Endpoint documentation] [source,ts] ---- client.watcher.getWatch({ id }) @@ -11377,13 +16280,24 @@ client.watcher.getWatch({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Watch ID +** *`id` (string)*: The watch identifier. [discrete] ==== put_watch -Creates a new watch, or updates an existing one. +Create or update a watch. +When a watch is registered, a new document that represents the watch is added to the `.watches` index and its trigger is immediately registered with the relevant trigger engine. +Typically for the `schedule` trigger, the scheduler is the trigger engine. + +IMPORTANT: You must use Kibana or this API to create a watch. +Do not add a watch directly to the `.watches` index by using the Elasticsearch index API. +If Elasticsearch security features are enabled, do not give users write privileges on the `.watches` index. + +When you add a watch you can also define its initial active state by setting the *active* parameter. + +When Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges. +If the user is able to read index `a`, but not index `b`, the same will apply when the watch runs. -{ref}/watcher-api-put-watch.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-put-watch[Endpoint documentation] [source,ts] ---- client.watcher.putWatch({ id }) @@ -11393,24 +16307,32 @@ client.watcher.putWatch({ id }) ==== Arguments * *Request (object):* -** *`id` (string)*: Watch ID -** *`actions` (Optional, Record)* -** *`condition` (Optional, { always, array_compare, compare, never, script })* -** *`input` (Optional, { chain, http, search, simple })* -** *`metadata` (Optional, Record)* -** *`throttle_period` (Optional, string)* -** *`transform` (Optional, { chain, script, search })* -** *`trigger` (Optional, { schedule })* -** *`active` (Optional, boolean)*: Specify whether the watch is in/active by default +** *`id` (string)*: The identifier for the watch. +** *`actions` (Optional, Record)*: The list of actions that will be run if the condition matches. +** *`condition` (Optional, { always, array_compare, compare, never, script })*: The condition that defines if the actions should be run. +** *`input` (Optional, { chain, http, search, simple })*: The input that defines the input that loads the data for the watch. +** *`metadata` (Optional, Record)*: Metadata JSON that will be copied into the history entries. +** *`throttle_period` (Optional, string | -1 | 0)*: The minimum time between actions being run. +The default is 5 seconds. +This default can be changed in the config file with the setting `xpack.watcher.throttle.period.default_period`. +If both this value and the `throttle_period_in_millis` parameter are specified, Watcher uses the last parameter included in the request. +** *`throttle_period_in_millis` (Optional, Unit)*: Minimum time in milliseconds between actions being run. Defaults to 5000. If both this value and the throttle_period parameter are specified, Watcher uses the last parameter included in the request. +** *`transform` (Optional, { chain, script, search })*: The transform that processes the watch payload to prepare it for the watch actions. +** *`trigger` (Optional, { schedule })*: The trigger that defines when the watch should run. +** *`active` (Optional, boolean)*: The initial state of the watch. +The default value is `true`, which means the watch is active by default. ** *`if_primary_term` (Optional, number)*: only update the watch if the last operation that has changed the watch has the specified primary term ** *`if_seq_no` (Optional, number)*: only update the watch if the last operation that has changed the watch has the specified sequence number ** *`version` (Optional, number)*: Explicit version number for concurrency control [discrete] ==== query_watches -Retrieves stored watches. +Query watches. +Get all registered watches in a paginated manner and optionally filter watches by a query. -{ref}/watcher-api-query-watches.html[Endpoint documentation] +Note that only the `_id` and `metadata.*` fields are queryable or sortable. + +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-query-watches[Endpoint documentation] [source,ts] ---- client.watcher.queryWatches({ ... }) @@ -11420,28 +16342,38 @@ client.watcher.queryWatches({ ... }) ==== Arguments * *Request (object):* -** *`from` (Optional, number)*: The offset from the first result to fetch. Needs to be non-negative. -** *`size` (Optional, number)*: The number of hits to return. Needs to be non-negative. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Optional, query filter watches to be returned. -** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: Optional sort definition. -** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Optional search After to do pagination using last hit’s sort values. +** *`from` (Optional, number)*: The offset from the first result to fetch. +It must be non-negative. +** *`size` (Optional, number)*: The number of hits to return. +It must be non-negative. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_grid, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: A query that filters the watches to be returned. +** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: One or more fields used to sort the search results. +** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Retrieve the next page of hits using a set of sort values from the previous page. [discrete] ==== start -Starts Watcher if it is not already running. +Start the watch service. +Start the Watcher service if it is not already running. -{ref}/watcher-api-start.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-start[Endpoint documentation] [source,ts] ---- -client.watcher.start() +client.watcher.start({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. [discrete] ==== stats -Retrieves the current Watcher metrics. +Get Watcher statistics. +This API always returns basic metrics. +You retrieve more metrics by using the metric parameter. -{ref}/watcher-api-stats.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stats[Endpoint documentation] [source,ts] ---- client.watcher.stats({ ... }) @@ -11456,31 +16388,60 @@ client.watcher.stats({ ... }) [discrete] ==== stop -Stops Watcher if it is running. +Stop the watch service. +Stop the Watcher service if it is running. -{ref}/watcher-api-stop.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stop[Endpoint documentation] [source,ts] ---- -client.watcher.stop() +client.watcher.stop({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. [discrete] ==== update_settings -Update settings for the watcher system index +Update Watcher index settings. +Update settings for the Watcher internal index (`.watches`). +Only a subset of settings can be modified. +This includes `index.auto_expand_replicas`, `index.number_of_replicas`, `index.routing.allocation.exclude.*`, +`index.routing.allocation.include.*` and `index.routing.allocation.require.*`. +Modification of `index.routing.allocation.include._tier_preference` is an exception and is not allowed as the +Watcher shards must always be in the `data_content` tier. -{ref}/watcher-api-update-settings.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-update-settings[Endpoint documentation] [source,ts] ---- -client.watcher.updateSettings() +client.watcher.updateSettings({ ... }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`index.auto_expand_replicas` (Optional, string)* +** *`index.number_of_replicas` (Optional, number)* +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for a response. +If no response is received before the timeout expires, the request fails and returns an error. [discrete] === xpack [discrete] ==== info -Provides general information about the installed X-Pack features. +Get information. +The information provided by the API includes: + +* Build information including the build number and timestamp. +* License information about the currently installed license. +* Feature information for the features that are currently enabled and available under the current license. {ref}/info-api.html[Endpoint documentation] [source,ts] @@ -11492,15 +16453,19 @@ client.xpack.info({ ... }) ==== Arguments * *Request (object):* -** *`categories` (Optional, string[])*: A list of the information categories to include in the response. For example, `build,license,features`. +** *`categories` (Optional, Enum("build" | "features" | "license")[])*: A list of the information categories to include in the response. +For example, `build,license,features`. ** *`accept_enterprise` (Optional, boolean)*: If this param is used it must be set to true -** *`human` (Optional, boolean)*: Defines whether additional human-readable information is included in the response. In particular, it adds descriptions and a tag line. +** *`human` (Optional, boolean)*: Defines whether additional human-readable information is included in the response. +In particular, it adds descriptions and a tag line. [discrete] ==== usage -This API provides information about which features are currently enabled and available under the current license and some usage statistics. +Get usage information. +Get information about the features that are currently enabled and available under the current license. +The API also provides some usage statistics. -{ref}/usage-api.html[Endpoint documentation] +https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-xpack[Endpoint documentation] [source,ts] ---- client.xpack.usage({ ... }) @@ -11510,5 +16475,7 @@ client.xpack.usage({ ... }) ==== Arguments * *Request (object):* -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If no response is received before the timeout expires, the request fails and returns an error. +To indicate that the request should never timeout, set it to `-1`. diff --git a/docs/timeout-best-practices.asciidoc b/docs/timeout-best-practices.asciidoc new file mode 100644 index 000000000..0d2fb4772 --- /dev/null +++ b/docs/timeout-best-practices.asciidoc @@ -0,0 +1,10 @@ +[[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. + +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: + +* Ensure keep-alive is enabled; this is the default, so no settings need to be changed, unless you have set `agent` to `false` or provided an alternate `agent` that disables keep-alive +* If using the default `UndiciConnection`, disable request timeouts by setting `timeout` to `0` +* If using the legacy `HttpConnection`, set `timeout` to a very large number (e.g. `86400000`, or one day) diff --git a/docs/transport.asciidoc b/docs/transport.asciidoc index 5096616ea..d32606b63 100644 --- a/docs/transport.asciidoc +++ b/docs/transport.asciidoc @@ -1,7 +1,7 @@ [[transport]] === Transport -This class is responsible for performing the request to {es} and handling +This class is responsible for performing the request to {es} and handling errors, it also handles sniffing. [source,js] @@ -20,7 +20,7 @@ const client = new Client({ }) ---- -Sometimes you need to inject a small snippet of your code and then continue to +Sometimes you need to inject a small snippet of your code and then continue to use the usual client code. In such cases, call `super.method`: [source,js] @@ -35,8 +35,39 @@ class MyTransport extends Transport { ==== Supported content types -- `application/json`, in this case the transport will return a plain JavaScript object -- `text/plain`, in this case the transport will return a plain string -- `application/vnd.mapbox-vector-tile`, in this case the transport will return a Buffer -- `application/vnd.elasticsearch+json`, in this case the transport will return a plain JavaScript object +Depending on the `content-type` of the response, the transport will return the body as different types: +[cols="1,1"] +|=== +|Content-Type |JavaScript type + +|`application/json` +|`object` + +|`text/plain` +|`string` + +|`application/vnd.elasticsearch+json` +|`object` + +|`application/vnd.mapbox-vector-tile` +|`Buffer` + +|`application/vnd.apache.arrow.stream` +|`Buffer` + +|`application/vnd.elasticsearch+arrow+stream` +|`Buffer` + +|`application/smile` +|`Buffer` + +|`application/vnd.elasticsearch+smile` +|`Buffer` + +|`application/cbor` +|`Buffer` + +|`application/vnd.elasticsearch+cbor` +|`Buffer` +|=== diff --git a/index.d.ts b/index.d.ts index 89be0131c..adc25b52b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -25,3 +25,4 @@ export * as estypes from './lib/api/types' export * as estypesWithBody from './lib/api/typesWithBodyKey' export { Client, SniffingTransport } export type { ClientOptions, NodeOptions } from './lib/client' +export * as helpers from './lib/helpers' diff --git a/package.json b/package.json index 31e6da8a4..4473b9861 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,25 @@ { "name": "@elastic/elasticsearch", - "version": "8.15.0", - "versionCanary": "8.15.0-canary.0", + "version": "8.18.2", + "versionCanary": "8.18.2-canary.0", "description": "The official Elasticsearch client for Node.js", "main": "./index.js", "types": "index.d.ts", "exports": { - "require": "./index.js" + "require": "./index.js", + "import": "./index.js", + "types": "./index.d.ts" }, "scripts": { "test": "npm run build && npm run lint && tap", "test:unit": "npm run build && tap", "test:unit-bun": "bun run build && bunx tap", + "test:esm": "npm run build && cd test/esm/ && npm install && node test-import.mjs", "test:coverage-100": "npm run build && tap --coverage --100", "test:coverage-report": "npm run build && tap --coverage && nyc report --reporter=text-lcov > coverage.lcov", "test:coverage-ui": "npm run build && tap --coverage --coverage-report=html", - "test:integration": "tsc && node test/integration/index.js", + "test:integration-build": "npm run build && node test/integration/index.js", + "test:integration": "npm run test:integration-build && env tap run --jobs=1 --reporter=junit --reporter-file=report-junit.xml generated-tests/", "lint": "ts-standard src", "lint:fix": "ts-standard --fix src", "license-checker": "license-checker --production --onlyAllow='MIT;Apache-2.0;Apache1.1;ISC;BSD-3-Clause;BSD-2-Clause;0BSD'", @@ -53,49 +57,47 @@ "node": ">=18" }, "devDependencies": { - "@elastic/request-converter": "^8.15.2", - "@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1", - "@types/debug": "^4.1.7", - "@types/ms": "^0.7.31", - "@types/node": "^17.0.31", - "@types/sinonjs__fake-timers": "^8.1.2", - "@types/split2": "^3.2.1", - "@types/stoppable": "^1.1.1", - "@types/tap": "^15.0.7", - "chai": "^4.3.7", - "cross-zip": "^4.0.0", - "desm": "^1.2.0", - "into-stream": "^7.0.0", - "js-yaml": "^4.1.0", - "license-checker": "^25.0.1", - "minimist": "^1.2.6", - "ms": "^2.1.3", - "node-abort-controller": "^3.0.1", - "node-fetch": "^2.6.7", - "ora": "^5.4.1", - "proxy": "^1.0.2", - "rimraf": "^3.0.2", - "semver": "^7.3.7", - "split2": "^4.1.0", - "stoppable": "^1.1.0", - "tap": "^16.1.0", - "ts-node": "^10.7.0", - "ts-standard": "^11.0.0", - "typescript": "^4.6.4", - "workq": "^3.0.0", - "xmlbuilder2": "^3.0.2", - "zx": "^7.2.2" + "@elastic/request-converter": "8.17.0", + "@sinonjs/fake-timers": "github:sinonjs/fake-timers#48f089f", + "@types/debug": "4.1.12", + "@types/ms": "0.7.34", + "@types/node": "22.10.7", + "@types/sinonjs__fake-timers": "8.1.5", + "@types/split2": "4.2.3", + "@types/stoppable": "1.1.3", + "chai": "5.1.2", + "cross-zip": "4.0.1", + "desm": "1.3.1", + "into-stream": "8.0.1", + "js-yaml": "4.1.0", + "license-checker": "25.0.1", + "minimist": "1.2.8", + "ms": "2.1.3", + "node-abort-controller": "3.1.1", + "node-fetch": "2.7.0", + "ora": "5.4.1", + "proxy": "1.0.2", + "rimraf": "5.0.10", + "semver": "7.7.1", + "split2": "4.2.0", + "stoppable": "1.1.0", + "tap": "21.0.1", + "ts-node": "10.9.2", + "ts-standard": "12.0.2", + "typescript": "5.7.3", + "workq": "3.0.0", + "xmlbuilder2": "3.1.1", + "zx": "7.2.3" }, "dependencies": { - "@elastic/transport": "^8.7.0", + "@elastic/transport": "^8.9.6", + "apache-arrow": "18.x - 19.x", "tslib": "^2.4.0" }, "tap": { - "ts": true, - "jsx": false, - "flow": false, - "coverage": false, - "check-coverage": false, - "files": "test/unit/{*,**/*}.test.ts" + "disable-coverage": true, + "files": [ + "test/unit/{*,**/*}.test.ts" + ] } } diff --git a/scripts/download-artifacts.js b/scripts/download-artifacts.js index 9618838be..c763a7523 100644 --- a/scripts/download-artifacts.js +++ b/scripts/download-artifacts.js @@ -17,162 +17,102 @@ * under the License. */ -'use strict' - const { join } = require('path') -const minimist = require('minimist') const stream = require('stream') const { promisify } = require('util') const { createWriteStream, promises } = require('fs') -const rimraf = require('rimraf') +const { rimraf } = require('rimraf') const fetch = require('node-fetch') const crossZip = require('cross-zip') const ora = require('ora') -const { mkdir, writeFile } = promises +const { mkdir, cp } = promises const pipeline = promisify(stream.pipeline) const unzip = promisify(crossZip.unzip) -const rm = promisify(rimraf) - -const esFolder = join(__dirname, '..', 'elasticsearch') -const zipFolder = join(esFolder, 'artifacts.zip') -const specFolder = join(esFolder, 'rest-api-spec', 'api') -const freeTestFolder = join(esFolder, 'rest-api-spec', 'test', 'free') -const xPackTestFolder = join(esFolder, 'rest-api-spec', 'test', 'platinum') -const artifactInfo = join(esFolder, 'info.json') - -async function downloadArtifacts (opts) { - if (typeof opts.version !== 'string') { - throw new Error('Missing version') - } - const log = ora('Checking out spec and test').start() +const testYamlFolder = join(__dirname, '..', 'yaml-rest-tests') +const zipFile = join(__dirname, '..', 'elasticsearch-clients-tests.zip') - log.text = 'Resolving versions' - let resolved - try { - resolved = await resolve(opts.version, opts.hash) - } catch (err) { - log.fail(err.message) - process.exit(1) - } +const schemaFolder = join(__dirname, '..', 'schema') +const schemaJson = join(schemaFolder, 'schema.json') - opts.id = opts.id || resolved.id - opts.hash = opts.hash || resolved.hash - opts.version = resolved.version +async function downloadArtifacts (localTests, version = 'main') { + const log = ora('Checking out spec and test').start() - const info = loadInfo() + const { GITHUB_TOKEN } = process.env - if (info && info.version === opts.version) { - if (info.hash === opts.hash && info.id === opts.id) { - log.succeed('The artifact copy present locally is already up to date') - return - } + if (version !== 'main') { + version = version.split('.').slice(0, 2).join('.') } - log.text = 'Cleanup checkouts/elasticsearch' - await rm(esFolder) - await mkdir(esFolder, { recursive: true }) + log.text = 'Clean tests folder' + await rimraf(testYamlFolder) + await mkdir(testYamlFolder, { recursive: true }) - log.text = 'Downloading artifacts' - const response = await fetch(resolved.url) - if (!response.ok) { - log.fail(`unexpected response ${response.statusText}`) - process.exit(1) - } - await pipeline(response.body, createWriteStream(zipFolder)) + log.text = `Fetch test YAML files for version ${version}` - log.text = 'Unzipping' - await unzip(zipFolder, esFolder) + if (localTests) { + log.text = `Copying local tests from ${localTests}` + await cp(localTests, testYamlFolder, { recursive: true }) + } else { + if (!GITHUB_TOKEN) { + log.fail("Missing required environment variable 'GITHUB_TOKEN'") + process.exit(1) + } - log.text = 'Cleanup' - await rm(zipFolder) + const response = await fetch(`https://api.github.com/repos/elastic/elasticsearch-clients-tests/zipball/${version}`, { + headers: { + Authorization: `Bearer ${GITHUB_TOKEN}`, + Accept: 'application/vnd.github+json' + } + }) - log.text = 'Update info' - await writeFile(artifactInfo, JSON.stringify(opts), 'utf8') + if (!response.ok) { + log.fail(`unexpected response ${response.statusText}`) + process.exit(1) + } - log.succeed('Done') -} + log.text = 'Downloading tests zipball' + await pipeline(response.body, createWriteStream(zipFile)) -function loadInfo () { - try { - return require(artifactInfo) - } catch (err) { - return null - } -} + log.text = 'Unzipping tests' + await unzip(zipFile, testYamlFolder) -async function resolve (version, hash) { - const response = await fetch(`https://artifacts-api.elastic.co/v1/versions/${version}`) - if (!response.ok) { - throw new Error(`unexpected response ${response.statusText}`) + log.text = 'Cleanup' + await rimraf(zipFile) } - const data = await response.json() - const esBuilds = data.version.builds - .filter(build => build.projects.elasticsearch != null) - .map(build => { - return { - projects: build.projects.elasticsearch, - buildId: build.build_id, - date: build.start_time, - version: build.version - } - }) - .sort((a, b) => { - const dA = new Date(a.date) - const dB = new Date(b.date) - if (dA > dB) return -1 - if (dA < dB) return 1 - return 0 - }) + log.text = 'Fetching Elasticsearch specification' + await rimraf(schemaFolder) + await mkdir(schemaFolder, { recursive: true }) - if (hash != null) { - const build = esBuilds.find(build => build.projects.commit_hash === hash) - if (!build) { - throw new Error(`Can't find any build with hash '${hash}'`) - } - const zipKey = Object.keys(build.projects.packages).find(key => key.startsWith('rest-resources-zip-') && key.endsWith('.zip')) - return { - url: build.projects.packages[zipKey].url, - id: build.buildId, - hash: build.projects.commit_hash, - version: build.version - } + const response = await fetch(`https://raw.githubusercontent.com/elastic/elasticsearch-specification/${version}/output/schema/schema.json`) + if (!response.ok) { + log.fail(`unexpected response ${response.statusText}`) + process.exit(1) } - const lastBuild = esBuilds[0] - const zipKey = Object.keys(lastBuild.projects.packages).find(key => key.startsWith('rest-resources-zip-') && key.endsWith('.zip')) - return { - url: lastBuild.projects.packages[zipKey].url, - id: lastBuild.buildId, - hash: lastBuild.projects.commit_hash, - version: lastBuild.version - } + log.text = 'Downloading schema.json' + await pipeline(response.body, createWriteStream(schemaJson)) + + log.succeed('Done') } -async function main (options) { - delete options._ - await downloadArtifacts(options) +async function main () { + await downloadArtifacts() } + if (require.main === module) { process.on('unhandledRejection', function (err) { console.error(err) process.exit(1) }) - const options = minimist(process.argv.slice(2), { - string: ['id', 'version', 'hash'] - }) - main(options).catch(t => { + main().catch(t => { console.log(t) process.exit(2) }) } module.exports = downloadArtifacts -module.exports.locations = { - specFolder, - freeTestFolder, - xPackTestFolder -} +module.exports.locations = { testYamlFolder, zipFile, schemaJson } diff --git a/scripts/generate-docs-examples.js b/scripts/generate-docs-examples.js index a9c229095..50c11a124 100644 --- a/scripts/generate-docs-examples.js +++ b/scripts/generate-docs-examples.js @@ -20,7 +20,7 @@ const { join } = require('path') const { writeFile } = require('fs/promises') const fetch = require('node-fetch') -const rimraf = require('rimraf') +const { rimraf } = require('rimraf') const ora = require('ora') const { convertRequests } = require('@elastic/request-converter') const minimist = require('minimist') @@ -91,6 +91,7 @@ ${source.trim()} } const options = minimist(process.argv.slice(2), { + boolean: ['debug'], string: ['version'], default: { version: 'master' @@ -102,7 +103,7 @@ generate(options.version) .catch(err => log.fail(err.message)) .finally(() => { const keys = Object.keys(failures) - if (keys.length > 0) { + if (keys.length > 0 && options.debug) { let message = 'Some examples failed to generate:\n\n' for (const key of keys) { message += `${key}: ${failures[key]}\n` diff --git a/src/api/api/async_search.ts b/src/api/api/async_search.ts index 4a8cef916..5e97e97bb 100644 --- a/src/api/api/async_search.ts +++ b/src/api/api/async_search.ts @@ -45,8 +45,8 @@ export default class AsyncSearch { } /** - * Deletes an async search by identifier. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the `cancel_task` cluster privilege. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html | Elasticsearch API documentation} + * Delete an async search. If the asynchronous search is still running, it is cancelled. Otherwise, the saved search results are deleted. If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the `cancel_task` cluster privilege. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/async-search.html | Elasticsearch API documentation} */ async delete (this: That, params: T.AsyncSearchDeleteRequest | TB.AsyncSearchDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async delete (this: That, params: T.AsyncSearchDeleteRequest | TB.AsyncSearchDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class AsyncSearch { } /** - * Retrieves the results of a previously submitted async search request given its identifier. If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html | Elasticsearch API documentation} + * Get async search results. Retrieve the results of a previously submitted asynchronous search request. If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/async-search.html | Elasticsearch API documentation} */ async get> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async get> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> @@ -109,8 +109,8 @@ export default class AsyncSearch { } /** - * Get async search status Retrieves the status of a previously submitted async search request given its identifier, without retrieving search results. If the Elasticsearch security features are enabled, use of this API is restricted to the `monitoring_user` role. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html | Elasticsearch API documentation} + * Get the async search status. Get the status of a previously submitted async search request given its identifier, without retrieving search results. If the Elasticsearch security features are enabled, the access to the status of a specific async search is restricted to: * The user or API key that submitted the original async search request. * Users that have the `monitor` cluster privilege or greater privileges. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/async-search.html | Elasticsearch API documentation} */ async status (this: That, params: T.AsyncSearchStatusRequest | TB.AsyncSearchStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async status (this: That, params: T.AsyncSearchStatusRequest | TB.AsyncSearchStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -141,8 +141,8 @@ export default class AsyncSearch { } /** - * Runs a search request asynchronously. When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field, hence partial results become available following the sort criteria that was requested. Warning: Async search does not support scroll nor search requests that only include the suggest section. By default, Elasticsearch doesn’t allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. The maximum allowed size for a stored async search response can be set by changing the `search.max_async_search_response_size` cluster level setting. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html | Elasticsearch API documentation} + * Run an async search. When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. The maximum allowed size for a stored async search response can be set by changing the `search.max_async_search_response_size` cluster level setting. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/async-search.html | Elasticsearch API documentation} */ async submit> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async submit> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/autoscaling.ts b/src/api/api/autoscaling.ts index 04a2ab060..33c56b5de 100644 --- a/src/api/api/autoscaling.ts +++ b/src/api/api/autoscaling.ts @@ -45,8 +45,8 @@ export default class Autoscaling { } /** - * Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-delete-autoscaling-policy.html | Elasticsearch API documentation} + * Delete an autoscaling policy. NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/autoscaling-delete-autoscaling-policy.html | Elasticsearch API documentation} */ async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest | TB.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest | TB.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Autoscaling { } /** - * Gets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-get-autoscaling-capacity.html | Elasticsearch API documentation} + * Get the autoscaling capacity. NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. This API gets the current autoscaling capacity based on the configured autoscaling policy. It will return information to size the cluster appropriately to the current workload. The `required_capacity` is calculated as the maximum of the `required_capacity` result of all individual deciders that are enabled for the policy. The operator should verify that the `current_nodes` match the operator’s knowledge of the cluster to avoid making autoscaling decisions based on stale or incomplete information. The response contains decider-specific information you can use to diagnose how and why autoscaling determined a certain capacity was required. This information is provided for diagnosis only. Do not use this information to make autoscaling decisions. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/autoscaling-get-autoscaling-capacity.html | Elasticsearch API documentation} */ async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest | TB.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest | TB.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -107,8 +107,8 @@ export default class Autoscaling { } /** - * Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-get-autoscaling-capacity.html | Elasticsearch API documentation} + * Get an autoscaling policy. NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/autoscaling-get-autoscaling-capacity.html | Elasticsearch API documentation} */ async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest | TB.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest | TB.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -139,8 +139,8 @@ export default class Autoscaling { } /** - * Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-put-autoscaling-policy.html | Elasticsearch API documentation} + * Create or update an autoscaling policy. NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/autoscaling-put-autoscaling-policy.html | Elasticsearch API documentation} */ async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest | TB.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest | TB.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/bulk.ts b/src/api/api/bulk.ts index b7a5dfa84..e499622bd 100644 --- a/src/api/api/bulk.ts +++ b/src/api/api/bulk.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Bulk index or delete documents. Performs multiple indexing or delete operations in a single API call. This reduces overhead and can greatly increase indexing speed. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html | Elasticsearch API documentation} + * Bulk index or delete documents. Perform multiple `index`, `create`, `delete`, and `update` actions in a single request. This reduces overhead and can greatly increase indexing speed. If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: * To use the `create` action, you must have the `create_doc`, `create`, `index`, or `write` index privilege. Data streams support only the `create` action. * To use the `index` action, you must have the `create`, `index`, or `write` index privilege. * To use the `delete` action, you must have the `delete` or `write` index privilege. * To use the `update` action, you must have the `index` or `write` index privilege. * To automatically create a data stream or index with a bulk API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. * To make the result of a bulk operation visible to search using the `refresh` parameter, you must have the `maintenance` or `manage` index privilege. Automatic data stream creation requires a matching index template with data stream enabled. The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: ``` action_and_meta_data\n optional_source\n action_and_meta_data\n optional_source\n .... action_and_meta_data\n optional_source\n ``` The `index` and `create` actions expect a source on the next line and have the same semantics as the `op_type` parameter in the standard index API. A `create` action fails if a document with the same ID already exists in the target An `index` action adds or replaces a document as necessary. NOTE: Data streams support only the `create` action. To update or delete a document in a data stream, you must target the backing index containing the document. An `update` action expects that the partial doc, upsert, and script and its options are specified on the next line. A `delete` action does not expect a source on the next line and has the same semantics as the standard delete API. NOTE: The final line of data must end with a newline character (`\n`). Each newline character may be preceded by a carriage return (`\r`). When sending NDJSON data to the `_bulk` endpoint, use a `Content-Type` header of `application/json` or `application/x-ndjson`. Because this format uses literal newline characters (`\n`) as delimiters, make sure that the JSON actions and sources are not pretty printed. If you provide a target in the request path, it is used for any actions that don't explicitly specify an `_index` argument. A note on the format: the idea here is to make processing as fast as possible. As some of the actions are redirected to other shards on other nodes, only `action_meta_data` is parsed on the receiving node side. Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. There is no "correct" number of actions to perform in a single bulk request. Experiment with different settings to find the optimal size for your particular workload. Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. **Client suppport for bulk requests** Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: * Go: Check out `esutil.BulkIndexer` * Perl: Check out `Search::Elasticsearch::Client::5_0::Bulk` and `Search::Elasticsearch::Client::5_0::Scroll` * Python: Check out `elasticsearch.helpers.*` * JavaScript: Check out `client.helpers.*` * .NET: Check out `BulkAllObservable` * PHP: Check out bulk indexing. **Submitting bulk requests with cURL** If you're providing text file input to `curl`, you must use the `--data-binary` flag instead of plain `-d`. The latter doesn't preserve newlines. For example: ``` $ cat requests { "index" : { "_index" : "test", "_id" : "1" } } { "field1" : "value1" } $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} ``` **Optimistic concurrency control** Each `index` and `delete` action within a bulk API call may include the `if_seq_no` and `if_primary_term` parameters in their respective action and meta data lines. The `if_seq_no` and `if_primary_term` parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. **Versioning** Each bulk item can include the version value using the `version` field. It automatically follows the behavior of the index or delete operation based on the `_version` mapping. It also support the `version_type`. **Routing** Each bulk item can include the routing value using the `routing` field. It automatically follows the behavior of the index or delete operation based on the `_routing` mapping. NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. **Wait for active shards** When making bulk calls, you can set the `wait_for_active_shards` parameter to require a minimum number of shard copies to be active before starting to process the bulk request. **Refresh** Control when the changes made by this request are visible to search. NOTE: Only the shards that receive the bulk request will be affected by refresh. Imagine a `_bulk?refresh=wait_for` request with three documents in it that happen to be routed to different shards in an index with five shards. The request will only wait for those three shards to refresh. The other two shards that make up the index do not participate in the `_bulk` request at all. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-bulk.html | Elasticsearch API documentation} */ export default async function BulkApi (this: That, params: T.BulkRequest | TB.BulkRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function BulkApi (this: That, params: T.BulkRequest | TB.BulkRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/cat.ts b/src/api/api/cat.ts index e06c34728..c39e7c3e6 100644 --- a/src/api/api/cat.ts +++ b/src/api/api/cat.ts @@ -45,8 +45,8 @@ export default class Cat { } /** - * Get aliases. Retrieves the cluster’s index aliases, including filter and routing information. The API does not return data stream aliases. CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html | Elasticsearch API documentation} + * Get aliases. Get the cluster's index aliases, including filter and routing information. This API does not return data stream aliases. IMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-alias.html | Elasticsearch API documentation} */ async aliases (this: That, params?: T.CatAliasesRequest | TB.CatAliasesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async aliases (this: That, params?: T.CatAliasesRequest | TB.CatAliasesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -85,8 +85,8 @@ export default class Cat { } /** - * Provides a snapshot of the number of shards allocated to each data node and their disk space. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html | Elasticsearch API documentation} + * Get shard allocation information. Get a snapshot of the number of shards allocated to each data node and their disk space. IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-allocation.html | Elasticsearch API documentation} */ async allocation (this: That, params?: T.CatAllocationRequest | TB.CatAllocationRequest, options?: TransportRequestOptionsWithOutMeta): Promise async allocation (this: That, params?: T.CatAllocationRequest | TB.CatAllocationRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -125,8 +125,8 @@ export default class Cat { } /** - * Get component templates. Returns information about component templates in a cluster. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get component template API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-component-templates.html | Elasticsearch API documentation} + * Get component templates. Get information about component templates in a cluster. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get component template API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-component-templates.html | Elasticsearch API documentation} */ async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest | TB.CatComponentTemplatesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest | TB.CatComponentTemplatesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -165,8 +165,8 @@ export default class Cat { } /** - * Get a document count. Provides quick access to a document count for a data stream, an index, or an entire cluster. The document count only includes live documents, not deleted documents which have not yet been removed by the merge process. CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the count API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html | Elasticsearch API documentation} + * Get a document count. Get quick access to a document count for a data stream, an index, or an entire cluster. The document count only includes live documents, not deleted documents which have not yet been removed by the merge process. IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the count API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-count.html | Elasticsearch API documentation} */ async count (this: That, params?: T.CatCountRequest | TB.CatCountRequest, options?: TransportRequestOptionsWithOutMeta): Promise async count (this: That, params?: T.CatCountRequest | TB.CatCountRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -205,8 +205,8 @@ export default class Cat { } /** - * Returns the amount of heap memory currently used by the field data cache on every data node in the cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes stats API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html | Elasticsearch API documentation} + * Get field data cache information. Get the amount of heap memory currently used by the field data cache on every data node in the cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes stats API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-fielddata.html | Elasticsearch API documentation} */ async fielddata (this: That, params?: T.CatFielddataRequest | TB.CatFielddataRequest, options?: TransportRequestOptionsWithOutMeta): Promise async fielddata (this: That, params?: T.CatFielddataRequest | TB.CatFielddataRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -245,8 +245,8 @@ export default class Cat { } /** - * Returns the health status of a cluster, similar to the cluster health API. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the cluster health API. This API is often used to check malfunctioning clusters. To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: `HH:MM:SS`, which is human-readable but includes no date information; `Unix epoch time`, which is machine-sortable and includes date information. The latter format is useful for cluster recoveries that take multiple days. You can use the cat health API to verify cluster health across multiple nodes. You also can use the API to track the recovery of a large cluster over a longer period of time. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html | Elasticsearch API documentation} + * Get the cluster health status. IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the cluster health API. This API is often used to check malfunctioning clusters. To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: `HH:MM:SS`, which is human-readable but includes no date information; `Unix epoch time`, which is machine-sortable and includes date information. The latter format is useful for cluster recoveries that take multiple days. You can use the cat health API to verify cluster health across multiple nodes. You also can use the API to track the recovery of a large cluster over a longer period of time. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-health.html | Elasticsearch API documentation} */ async health (this: That, params?: T.CatHealthRequest | TB.CatHealthRequest, options?: TransportRequestOptionsWithOutMeta): Promise async health (this: That, params?: T.CatHealthRequest | TB.CatHealthRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -275,8 +275,8 @@ export default class Cat { } /** - * Get CAT help. Returns help for the CAT APIs. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html | Elasticsearch API documentation} + * Get CAT help. Get help for the CAT APIs. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat.html | Elasticsearch API documentation} */ async help (this: That, params?: T.CatHelpRequest | TB.CatHelpRequest, options?: TransportRequestOptionsWithOutMeta): Promise async help (this: That, params?: T.CatHelpRequest | TB.CatHelpRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -305,8 +305,8 @@ export default class Cat { } /** - * Get index information. Returns high-level information about indices in a cluster, including backing indices for data streams. Use this request to get the following information for each index in a cluster: - shard count - document count - deleted document count - primary store size - total store size of all shards, including shard replicas These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents. To get an accurate count of Elasticsearch documents, use the cat count or count APIs. CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use an index endpoint. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html | Elasticsearch API documentation} + * Get index information. Get high-level information about indices in a cluster, including backing indices for data streams. Use this request to get the following information for each index in a cluster: - shard count - document count - deleted document count - primary store size - total store size of all shards, including shard replicas These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents. To get an accurate count of Elasticsearch documents, use the cat count or count APIs. CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use an index endpoint. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-indices.html | Elasticsearch API documentation} */ async indices (this: That, params?: T.CatIndicesRequest | TB.CatIndicesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async indices (this: That, params?: T.CatIndicesRequest | TB.CatIndicesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -345,8 +345,8 @@ export default class Cat { } /** - * Returns information about the master node, including the ID, bound IP address, and name. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html | Elasticsearch API documentation} + * Get master node information. Get information about the master node, including the ID, bound IP address, and name. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-master.html | Elasticsearch API documentation} */ async master (this: That, params?: T.CatMasterRequest | TB.CatMasterRequest, options?: TransportRequestOptionsWithOutMeta): Promise async master (this: That, params?: T.CatMasterRequest | TB.CatMasterRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -375,8 +375,8 @@ export default class Cat { } /** - * Get data frame analytics jobs. Returns configuration and usage information about data frame analytics jobs. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get data frame analytics jobs statistics API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-dfanalytics.html | Elasticsearch API documentation} + * Get data frame analytics jobs. Get configuration and usage information about data frame analytics jobs. IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get data frame analytics jobs statistics API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-dfanalytics.html | Elasticsearch API documentation} */ async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest | TB.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest | TB.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -415,8 +415,8 @@ export default class Cat { } /** - * Get datafeeds. Returns configuration and usage information about datafeeds. This API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get datafeed statistics API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-datafeeds.html | Elasticsearch API documentation} + * Get datafeeds. Get configuration and usage information about datafeeds. This API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get datafeed statistics API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-datafeeds.html | Elasticsearch API documentation} */ async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest | TB.CatMlDatafeedsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest | TB.CatMlDatafeedsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -455,8 +455,8 @@ export default class Cat { } /** - * Get anomaly detection jobs. Returns configuration and usage information for anomaly detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get anomaly detection job statistics API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-anomaly-detectors.html | Elasticsearch API documentation} + * Get anomaly detection jobs. Get configuration and usage information for anomaly detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get anomaly detection job statistics API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-anomaly-detectors.html | Elasticsearch API documentation} */ async mlJobs (this: That, params?: T.CatMlJobsRequest | TB.CatMlJobsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async mlJobs (this: That, params?: T.CatMlJobsRequest | TB.CatMlJobsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -495,8 +495,8 @@ export default class Cat { } /** - * Get trained models. Returns configuration and usage information about inference trained models. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get trained models statistics API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-trained-model.html | Elasticsearch API documentation} + * Get trained models. Get configuration and usage information about inference trained models. IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get trained models statistics API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-trained-model.html | Elasticsearch API documentation} */ async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest | TB.CatMlTrainedModelsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest | TB.CatMlTrainedModelsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -535,8 +535,8 @@ export default class Cat { } /** - * Returns information about custom node attributes. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html | Elasticsearch API documentation} + * Get node attribute information. Get information about custom node attributes. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-nodeattrs.html | Elasticsearch API documentation} */ async nodeattrs (this: That, params?: T.CatNodeattrsRequest | TB.CatNodeattrsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async nodeattrs (this: That, params?: T.CatNodeattrsRequest | TB.CatNodeattrsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -565,8 +565,8 @@ export default class Cat { } /** - * Returns information about the nodes in a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html | Elasticsearch API documentation} + * Get node information. Get information about the nodes in a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-nodes.html | Elasticsearch API documentation} */ async nodes (this: That, params?: T.CatNodesRequest | TB.CatNodesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async nodes (this: That, params?: T.CatNodesRequest | TB.CatNodesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -595,8 +595,8 @@ export default class Cat { } /** - * Returns cluster-level changes that have not yet been executed. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the pending cluster tasks API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html | Elasticsearch API documentation} + * Get pending task information. Get information about cluster-level changes that have not yet taken effect. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the pending cluster tasks API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-pending-tasks.html | Elasticsearch API documentation} */ async pendingTasks (this: That, params?: T.CatPendingTasksRequest | TB.CatPendingTasksRequest, options?: TransportRequestOptionsWithOutMeta): Promise async pendingTasks (this: That, params?: T.CatPendingTasksRequest | TB.CatPendingTasksRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -625,8 +625,8 @@ export default class Cat { } /** - * Returns a list of plugins running on each node of a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html | Elasticsearch API documentation} + * Get plugin information. Get a list of plugins running on each node of a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-plugins.html | Elasticsearch API documentation} */ async plugins (this: That, params?: T.CatPluginsRequest | TB.CatPluginsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async plugins (this: That, params?: T.CatPluginsRequest | TB.CatPluginsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -655,8 +655,8 @@ export default class Cat { } /** - * Returns information about ongoing and completed shard recoveries. Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or syncing a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing. For data streams, the API returns information about the stream’s backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index recovery API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html | Elasticsearch API documentation} + * Get shard recovery information. Get information about ongoing and completed shard recoveries. Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or syncing a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing. For data streams, the API returns information about the stream’s backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index recovery API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-recovery.html | Elasticsearch API documentation} */ async recovery (this: That, params?: T.CatRecoveryRequest | TB.CatRecoveryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async recovery (this: That, params?: T.CatRecoveryRequest | TB.CatRecoveryRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -695,8 +695,8 @@ export default class Cat { } /** - * Returns the snapshot repositories for a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot repository API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html | Elasticsearch API documentation} + * Get snapshot repository information. Get a list of snapshot repositories for a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot repository API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-repositories.html | Elasticsearch API documentation} */ async repositories (this: That, params?: T.CatRepositoriesRequest | TB.CatRepositoriesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async repositories (this: That, params?: T.CatRepositoriesRequest | TB.CatRepositoriesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -725,8 +725,8 @@ export default class Cat { } /** - * Returns low-level information about the Lucene segments in index shards. For data streams, the API returns information about the backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index segments API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html | Elasticsearch API documentation} + * Get segment information. Get low-level information about the Lucene segments in index shards. For data streams, the API returns information about the backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index segments API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-segments.html | Elasticsearch API documentation} */ async segments (this: That, params?: T.CatSegmentsRequest | TB.CatSegmentsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async segments (this: That, params?: T.CatSegmentsRequest | TB.CatSegmentsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -765,8 +765,8 @@ export default class Cat { } /** - * Returns information about the shards in a cluster. For data streams, the API returns information about the backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html | Elasticsearch API documentation} + * Get shard information. Get information about the shards in a cluster. For data streams, the API returns information about the backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-shards.html | Elasticsearch API documentation} */ async shards (this: That, params?: T.CatShardsRequest | TB.CatShardsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async shards (this: That, params?: T.CatShardsRequest | TB.CatShardsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -805,8 +805,8 @@ export default class Cat { } /** - * Returns information about the snapshots stored in one or more repositories. A snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html | Elasticsearch API documentation} + * Get snapshot information. Get information about the snapshots stored in one or more repositories. A snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-snapshots.html | Elasticsearch API documentation} */ async snapshots (this: That, params?: T.CatSnapshotsRequest | TB.CatSnapshotsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async snapshots (this: That, params?: T.CatSnapshotsRequest | TB.CatSnapshotsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -845,8 +845,8 @@ export default class Cat { } /** - * Returns information about tasks currently executing in the cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the task management API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html | Elasticsearch API documentation} + * Get task information. Get information about tasks currently running in the cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the task management API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-tasks.html | Elasticsearch API documentation} */ async tasks (this: That, params?: T.CatTasksRequest | TB.CatTasksRequest, options?: TransportRequestOptionsWithOutMeta): Promise async tasks (this: That, params?: T.CatTasksRequest | TB.CatTasksRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -875,8 +875,8 @@ export default class Cat { } /** - * Returns information about index templates in a cluster. You can use index templates to apply index settings and field mappings to new indices at creation. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html | Elasticsearch API documentation} + * Get index template information. Get information about the index templates in a cluster. You can use index templates to apply index settings and field mappings to new indices at creation. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-templates.html | Elasticsearch API documentation} */ async templates (this: That, params?: T.CatTemplatesRequest | TB.CatTemplatesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async templates (this: That, params?: T.CatTemplatesRequest | TB.CatTemplatesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -915,8 +915,8 @@ export default class Cat { } /** - * Returns thread pool statistics for each node in a cluster. Returned information includes all built-in thread pools and custom thread pools. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html | Elasticsearch API documentation} + * Get thread pool statistics. Get thread pool statistics for each node in a cluster. Returned information includes all built-in thread pools and custom thread pools. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-thread-pool.html | Elasticsearch API documentation} */ async threadPool (this: That, params?: T.CatThreadPoolRequest | TB.CatThreadPoolRequest, options?: TransportRequestOptionsWithOutMeta): Promise async threadPool (this: That, params?: T.CatThreadPoolRequest | TB.CatThreadPoolRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -955,8 +955,8 @@ export default class Cat { } /** - * Get transforms. Returns configuration and usage information about transforms. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get transform statistics API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-transforms.html | Elasticsearch API documentation} + * Get transform information. Get configuration and usage information about transforms. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get transform statistics API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-transforms.html | Elasticsearch API documentation} */ async transforms (this: That, params?: T.CatTransformsRequest | TB.CatTransformsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async transforms (this: That, params?: T.CatTransformsRequest | TB.CatTransformsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/ccr.ts b/src/api/api/ccr.ts index ec3db24c8..d8c81a1d0 100644 --- a/src/api/api/ccr.ts +++ b/src/api/api/ccr.ts @@ -45,8 +45,8 @@ export default class Ccr { } /** - * Deletes auto-follow patterns. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-delete-auto-follow-pattern.html | Elasticsearch API documentation} + * Delete auto-follow patterns. Delete a collection of cross-cluster replication auto-follow patterns. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-delete-auto-follow-pattern.html | Elasticsearch API documentation} */ async deleteAutoFollowPattern (this: That, params: T.CcrDeleteAutoFollowPatternRequest | TB.CcrDeleteAutoFollowPatternRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteAutoFollowPattern (this: That, params: T.CcrDeleteAutoFollowPatternRequest | TB.CcrDeleteAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,15 +77,15 @@ export default class Ccr { } /** - * Creates a new follower index configured to follow the referenced leader index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-put-follow.html | Elasticsearch API documentation} + * Create a follower. Create a cross-cluster replication follower index that follows a specific leader index. When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-put-follow.html | Elasticsearch API documentation} */ async follow (this: That, params: T.CcrFollowRequest | TB.CcrFollowRequest, options?: TransportRequestOptionsWithOutMeta): Promise async follow (this: That, params: T.CcrFollowRequest | TB.CcrFollowRequest, options?: TransportRequestOptionsWithMeta): Promise> async follow (this: That, params: T.CcrFollowRequest | TB.CcrFollowRequest, options?: TransportRequestOptions): Promise async follow (this: That, params: T.CcrFollowRequest | TB.CcrFollowRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedBody: string[] = ['leader_index', 'max_outstanding_read_requests', 'max_outstanding_write_requests', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size', 'read_poll_timeout', 'remote_cluster'] + const acceptedBody: string[] = ['data_stream_name', 'leader_index', 'max_outstanding_read_requests', 'max_outstanding_write_requests', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size', 'read_poll_timeout', 'remote_cluster', 'settings'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -121,8 +121,8 @@ export default class Ccr { } /** - * Retrieves information about all follower indices, including parameters and status for each follower index - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-get-follow-info.html | Elasticsearch API documentation} + * Get follower information. Get information about all cross-cluster replication follower indices. For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-get-follow-info.html | Elasticsearch API documentation} */ async followInfo (this: That, params: T.CcrFollowInfoRequest | TB.CcrFollowInfoRequest, options?: TransportRequestOptionsWithOutMeta): Promise async followInfo (this: That, params: T.CcrFollowInfoRequest | TB.CcrFollowInfoRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -153,8 +153,8 @@ export default class Ccr { } /** - * Retrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-get-follow-stats.html | Elasticsearch API documentation} + * Get follower stats. Get cross-cluster replication follower stats. The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-get-follow-stats.html | Elasticsearch API documentation} */ async followStats (this: That, params: T.CcrFollowStatsRequest | TB.CcrFollowStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async followStats (this: That, params: T.CcrFollowStatsRequest | TB.CcrFollowStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -185,8 +185,8 @@ export default class Ccr { } /** - * Removes the follower retention leases from the leader. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-post-forget-follower.html | Elasticsearch API documentation} + * Forget a follower. Remove the cross-cluster replication follower retention leases from the leader. A following index takes out retention leases on its leader index. These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. This API exists to enable manually removing the leases when the unfollow API is unable to do so. NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-post-forget-follower.html | Elasticsearch API documentation} */ async forgetFollower (this: That, params: T.CcrForgetFollowerRequest | TB.CcrForgetFollowerRequest, options?: TransportRequestOptionsWithOutMeta): Promise async forgetFollower (this: That, params: T.CcrForgetFollowerRequest | TB.CcrForgetFollowerRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -229,8 +229,8 @@ export default class Ccr { } /** - * Gets configured auto-follow patterns. Returns the specified auto-follow pattern collection. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-get-auto-follow-pattern.html | Elasticsearch API documentation} + * Get auto-follow patterns. Get cross-cluster replication auto-follow patterns. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-get-auto-follow-pattern.html | Elasticsearch API documentation} */ async getAutoFollowPattern (this: That, params?: T.CcrGetAutoFollowPatternRequest | TB.CcrGetAutoFollowPatternRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getAutoFollowPattern (this: That, params?: T.CcrGetAutoFollowPatternRequest | TB.CcrGetAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -269,8 +269,8 @@ export default class Ccr { } /** - * Pauses an auto-follow pattern - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-pause-auto-follow-pattern.html | Elasticsearch API documentation} + * Pause an auto-follow pattern. Pause a cross-cluster replication auto-follow pattern. When the API returns, the auto-follow pattern is inactive. New indices that are created on the remote cluster and match the auto-follow patterns are ignored. You can resume auto-following with the resume auto-follow pattern API. When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-pause-auto-follow-pattern.html | Elasticsearch API documentation} */ async pauseAutoFollowPattern (this: That, params: T.CcrPauseAutoFollowPatternRequest | TB.CcrPauseAutoFollowPatternRequest, options?: TransportRequestOptionsWithOutMeta): Promise async pauseAutoFollowPattern (this: That, params: T.CcrPauseAutoFollowPatternRequest | TB.CcrPauseAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -301,8 +301,8 @@ export default class Ccr { } /** - * Pauses a follower index. The follower index will not fetch any additional operations from the leader index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-post-pause-follow.html | Elasticsearch API documentation} + * Pause a follower. Pause a cross-cluster replication follower index. The follower index will not fetch any additional operations from the leader index. You can resume following with the resume follower API. You can pause and resume a follower index to change the configuration of the following task. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-post-pause-follow.html | Elasticsearch API documentation} */ async pauseFollow (this: That, params: T.CcrPauseFollowRequest | TB.CcrPauseFollowRequest, options?: TransportRequestOptionsWithOutMeta): Promise async pauseFollow (this: That, params: T.CcrPauseFollowRequest | TB.CcrPauseFollowRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -333,8 +333,8 @@ export default class Ccr { } /** - * Creates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-put-auto-follow-pattern.html | Elasticsearch API documentation} + * Create or update auto-follow patterns. Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. This API can also be used to update auto-follow patterns. NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-put-auto-follow-pattern.html | Elasticsearch API documentation} */ async putAutoFollowPattern (this: That, params: T.CcrPutAutoFollowPatternRequest | TB.CcrPutAutoFollowPatternRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putAutoFollowPattern (this: That, params: T.CcrPutAutoFollowPatternRequest | TB.CcrPutAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -377,8 +377,8 @@ export default class Ccr { } /** - * Resumes an auto-follow pattern that has been paused - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-resume-auto-follow-pattern.html | Elasticsearch API documentation} + * Resume an auto-follow pattern. Resume a cross-cluster replication auto-follow pattern that was paused. The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-resume-auto-follow-pattern.html | Elasticsearch API documentation} */ async resumeAutoFollowPattern (this: That, params: T.CcrResumeAutoFollowPatternRequest | TB.CcrResumeAutoFollowPatternRequest, options?: TransportRequestOptionsWithOutMeta): Promise async resumeAutoFollowPattern (this: That, params: T.CcrResumeAutoFollowPatternRequest | TB.CcrResumeAutoFollowPatternRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -409,8 +409,8 @@ export default class Ccr { } /** - * Resumes a follower index that has been paused - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-post-resume-follow.html | Elasticsearch API documentation} + * Resume a follower. Resume a cross-cluster replication follower index that was paused. The follower index could have been paused with the pause follower API. Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. When this API returns, the follower index will resume fetching operations from the leader index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-post-resume-follow.html | Elasticsearch API documentation} */ async resumeFollow (this: That, params: T.CcrResumeFollowRequest | TB.CcrResumeFollowRequest, options?: TransportRequestOptionsWithOutMeta): Promise async resumeFollow (this: That, params: T.CcrResumeFollowRequest | TB.CcrResumeFollowRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -453,8 +453,8 @@ export default class Ccr { } /** - * Gets all stats related to cross-cluster replication. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-get-stats.html | Elasticsearch API documentation} + * Get cross-cluster replication stats. This API returns stats about auto-following and the same shard-level stats as the get follower stats API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-get-stats.html | Elasticsearch API documentation} */ async stats (this: That, params?: T.CcrStatsRequest | TB.CcrStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stats (this: That, params?: T.CcrStatsRequest | TB.CcrStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -483,8 +483,8 @@ export default class Ccr { } /** - * Stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-post-unfollow.html | Elasticsearch API documentation} + * Unfollow an index. Convert a cross-cluster replication follower index to a regular index. The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. The follower index must be paused and closed before you call the unfollow API. > info > Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ccr-post-unfollow.html | Elasticsearch API documentation} */ async unfollow (this: That, params: T.CcrUnfollowRequest | TB.CcrUnfollowRequest, options?: TransportRequestOptionsWithOutMeta): Promise async unfollow (this: That, params: T.CcrUnfollowRequest | TB.CcrUnfollowRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/clear_scroll.ts b/src/api/api/clear_scroll.ts index 7c4848d45..b3a94d76f 100644 --- a/src/api/api/clear_scroll.ts +++ b/src/api/api/clear_scroll.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Clears the search context and results for a scrolling search. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/clear-scroll-api.html | Elasticsearch API documentation} + * Clear a scrolling search. Clear the search context and results for a scrolling search. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/clear-scroll-api.html | Elasticsearch API documentation} */ export default async function ClearScrollApi (this: That, params?: T.ClearScrollRequest | TB.ClearScrollRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function ClearScrollApi (this: That, params?: T.ClearScrollRequest | TB.ClearScrollRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/close_point_in_time.ts b/src/api/api/close_point_in_time.ts index c4c779e5e..0ab48f4e8 100644 --- a/src/api/api/close_point_in_time.ts +++ b/src/api/api/close_point_in_time.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Closes a point-in-time. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html | Elasticsearch API documentation} + * Close a point in time. A point in time must be opened explicitly before being used in search requests. The `keep_alive` parameter tells Elasticsearch how long it should persist. A point in time is automatically closed when the `keep_alive` period has elapsed. However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/point-in-time-api.html | Elasticsearch API documentation} */ export default async function ClosePointInTimeApi (this: That, params: T.ClosePointInTimeRequest | TB.ClosePointInTimeRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function ClosePointInTimeApi (this: That, params: T.ClosePointInTimeRequest | TB.ClosePointInTimeRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/cluster.ts b/src/api/api/cluster.ts index 6795c7f13..6f2c6c504 100644 --- a/src/api/api/cluster.ts +++ b/src/api/api/cluster.ts @@ -45,8 +45,8 @@ export default class Cluster { } /** - * Provides explanations for shard allocations in the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html | Elasticsearch API documentation} + * Explain the shard allocations. Get explanations for shard allocations in the cluster. For unassigned shards, it provides an explanation for why the shard is unassigned. For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-allocation-explain.html | Elasticsearch API documentation} */ async allocationExplain (this: That, params?: T.ClusterAllocationExplainRequest | TB.ClusterAllocationExplainRequest, options?: TransportRequestOptionsWithOutMeta): Promise async allocationExplain (this: That, params?: T.ClusterAllocationExplainRequest | TB.ClusterAllocationExplainRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -87,8 +87,8 @@ export default class Cluster { } /** - * Delete component templates. Deletes component templates. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html | Elasticsearch API documentation} + * Delete component templates. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-component-template.html | Elasticsearch API documentation} */ async deleteComponentTemplate (this: That, params: T.ClusterDeleteComponentTemplateRequest | TB.ClusterDeleteComponentTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteComponentTemplate (this: That, params: T.ClusterDeleteComponentTemplateRequest | TB.ClusterDeleteComponentTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -119,8 +119,8 @@ export default class Cluster { } /** - * Clears cluster voting config exclusions. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html | Elasticsearch API documentation} + * Clear cluster voting config exclusions. Remove master-eligible nodes from the voting configuration exclusion list. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions | Elasticsearch API documentation} */ async deleteVotingConfigExclusions (this: That, params?: T.ClusterDeleteVotingConfigExclusionsRequest | TB.ClusterDeleteVotingConfigExclusionsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteVotingConfigExclusions (this: That, params?: T.ClusterDeleteVotingConfigExclusionsRequest | TB.ClusterDeleteVotingConfigExclusionsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -150,7 +150,7 @@ export default class Cluster { /** * Check component templates. Returns information about whether a particular component template exists. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-component-template.html | Elasticsearch API documentation} */ async existsComponentTemplate (this: That, params: T.ClusterExistsComponentTemplateRequest | TB.ClusterExistsComponentTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async existsComponentTemplate (this: That, params: T.ClusterExistsComponentTemplateRequest | TB.ClusterExistsComponentTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -181,8 +181,8 @@ export default class Cluster { } /** - * Get component templates. Retrieves information about component templates. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html | Elasticsearch API documentation} + * Get component templates. Get information about component templates. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-component-template.html | Elasticsearch API documentation} */ async getComponentTemplate (this: That, params?: T.ClusterGetComponentTemplateRequest | TB.ClusterGetComponentTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getComponentTemplate (this: That, params?: T.ClusterGetComponentTemplateRequest | TB.ClusterGetComponentTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -221,8 +221,8 @@ export default class Cluster { } /** - * Returns cluster-wide settings. By default, it returns only settings that have been explicitly defined. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html | Elasticsearch API documentation} + * Get cluster-wide settings. By default, it returns only settings that have been explicitly defined. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-get-settings.html | Elasticsearch API documentation} */ async getSettings (this: That, params?: T.ClusterGetSettingsRequest | TB.ClusterGetSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getSettings (this: That, params?: T.ClusterGetSettingsRequest | TB.ClusterGetSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -251,8 +251,8 @@ export default class Cluster { } /** - * The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices. The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html | Elasticsearch API documentation} + * Get the cluster health status. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices. The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. The index level status is controlled by the worst shard status. One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. The cluster status is controlled by the worst index status. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-health.html | Elasticsearch API documentation} */ async health (this: That, params?: T.ClusterHealthRequest | TB.ClusterHealthRequest, options?: TransportRequestOptionsWithOutMeta): Promise async health (this: That, params?: T.ClusterHealthRequest | TB.ClusterHealthRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -292,7 +292,7 @@ export default class Cluster { /** * Get cluster info. Returns basic information about the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-info.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-info.html | Elasticsearch API documentation} */ async info (this: That, params: T.ClusterInfoRequest | TB.ClusterInfoRequest, options?: TransportRequestOptionsWithOutMeta): Promise async info (this: That, params: T.ClusterInfoRequest | TB.ClusterInfoRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -323,8 +323,8 @@ export default class Cluster { } /** - * Returns cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet been executed. NOTE: This API returns a list of any pending updates to the cluster state. These are distinct from the tasks reported by the Task Management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html | Elasticsearch API documentation} + * Get the pending cluster tasks. Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. NOTE: This API returns a list of any pending updates to the cluster state. These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-pending.html | Elasticsearch API documentation} */ async pendingTasks (this: That, params?: T.ClusterPendingTasksRequest | TB.ClusterPendingTasksRequest, options?: TransportRequestOptionsWithOutMeta): Promise async pendingTasks (this: That, params?: T.ClusterPendingTasksRequest | TB.ClusterPendingTasksRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -353,8 +353,8 @@ export default class Cluster { } /** - * Updates the cluster voting config exclusions by node ids or node names. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html | Elasticsearch API documentation} + * Update voting configuration exclusions. Update the cluster voting config exclusions by node IDs or node names. By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. Clusters should have no voting configuration exclusions in normal operation. Once the excluded nodes have stopped, clear the voting configuration exclusions with `DELETE /_cluster/voting_config_exclusions`. This API waits for the nodes to be fully removed from the cluster before it returns. If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use `DELETE /_cluster/voting_config_exclusions?wait_for_removal=false` to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. A response to `POST /_cluster/voting_config_exclusions` with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling `DELETE /_cluster/voting_config_exclusions`. If the call to `POST /_cluster/voting_config_exclusions` fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. In that case, you may safely retry the call. NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions | Elasticsearch API documentation} */ async postVotingConfigExclusions (this: That, params?: T.ClusterPostVotingConfigExclusionsRequest | TB.ClusterPostVotingConfigExclusionsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async postVotingConfigExclusions (this: That, params?: T.ClusterPostVotingConfigExclusionsRequest | TB.ClusterPostVotingConfigExclusionsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -383,8 +383,8 @@ export default class Cluster { } /** - * Create or update a component template. Creates or updates a component template. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. An index template can be composed of multiple component templates. To use a component template, specify it in an index template’s `composed_of` list. Component templates are only applied to new data streams and indices as part of a matching index template. Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. Component templates are only used during index creation. For data streams, this includes data stream creation and the creation of a stream’s backing indices. Changes to component templates do not affect existing indices, including a stream’s backing indices. You can use C-style `/* *\/` block comments in component templates. You can include comments anywhere in the request body except before the opening curly bracket. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html | Elasticsearch API documentation} + * Create or update a component template. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. An index template can be composed of multiple component templates. To use a component template, specify it in an index template’s `composed_of` list. Component templates are only applied to new data streams and indices as part of a matching index template. Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. Component templates are only used during index creation. For data streams, this includes data stream creation and the creation of a stream’s backing indices. Changes to component templates do not affect existing indices, including a stream’s backing indices. You can use C-style `/* *\/` block comments in component templates. You can include comments anywhere in the request body except before the opening curly bracket. **Applying component templates** You cannot directly apply a component template to a data stream or index. To be applied, a component template must be included in an index template's `composed_of` list. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-component-template.html | Elasticsearch API documentation} */ async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest | TB.ClusterPutComponentTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest | TB.ClusterPutComponentTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -427,8 +427,8 @@ export default class Cluster { } /** - * Updates the cluster settings. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html | Elasticsearch API documentation} + * Update the cluster settings. Configure and update dynamic settings on a running cluster. You can also configure dynamic settings locally on an unstarted or shut down node in `elasticsearch.yml`. Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart. You can also reset transient or persistent settings by assigning them a null value. If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) `elasticsearch.yml` setting; 4) Default setting value. For example, you can apply a transient setting to override a persistent setting or `elasticsearch.yml` setting. However, a change to an `elasticsearch.yml` setting will not override a defined transient or persistent setting. TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster. If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings. Only use `elasticsearch.yml` for static cluster settings and node settings. The API doesn’t require a restart and ensures a setting’s value is the same on all nodes. WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead. If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-update-settings.html | Elasticsearch API documentation} */ async putSettings (this: That, params?: T.ClusterPutSettingsRequest | TB.ClusterPutSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putSettings (this: That, params?: T.ClusterPutSettingsRequest | TB.ClusterPutSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -469,8 +469,8 @@ export default class Cluster { } /** - * The cluster remote info API allows you to retrieve all of the configured remote cluster information. It returns connection and endpoint information keyed by the configured remote cluster alias. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html | Elasticsearch API documentation} + * Get remote cluster information. Get information about configured remote clusters. The API returns connection and endpoint information keyed by the configured remote cluster alias. > info > This API returns information that reflects current state on the local cluster. > The `connected` field does not necessarily reflect whether a remote cluster is down or unavailable, only whether there is currently an open connection to it. > Elasticsearch does not spontaneously try to reconnect to a disconnected remote cluster. > To trigger a reconnection, attempt a cross-cluster search, ES|QL cross-cluster search, or try the [resolve cluster endpoint](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-resolve-cluster). + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-remote-info.html | Elasticsearch API documentation} */ async remoteInfo (this: That, params?: T.ClusterRemoteInfoRequest | TB.ClusterRemoteInfoRequest, options?: TransportRequestOptionsWithOutMeta): Promise async remoteInfo (this: That, params?: T.ClusterRemoteInfoRequest | TB.ClusterRemoteInfoRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -499,8 +499,8 @@ export default class Cluster { } /** - * Allows to manually change the allocation of individual shards in the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html | Elasticsearch API documentation} + * Reroute the cluster. Manually change the allocation of individual shards in the cluster. For example, a shard can be moved from one node to another explicitly, an allocation can be canceled, and an unassigned shard can be explicitly allocated to a specific node. It is important to note that after processing any reroute commands Elasticsearch will perform rebalancing as normal (respecting the values of settings such as `cluster.routing.rebalance.enable`) in order to remain in a balanced state. For example, if the requested allocation includes moving a shard from node1 to node2 then this may cause a shard to be moved from node2 back to node1 to even things out. The cluster can be set to disable allocations using the `cluster.routing.allocation.enable` setting. If allocations are disabled then the only allocations that will be performed are explicit ones given using the reroute command, and consequent allocations due to rebalancing. The cluster will attempt to allocate a shard a maximum of `index.allocation.max_retries` times in a row (defaults to `5`), before giving up and leaving the shard unallocated. This scenario can be caused by structural problems such as having an analyzer which refers to a stopwords file which doesn’t exist on all nodes. Once the problem has been corrected, allocation can be manually retried by calling the reroute API with the `?retry_failed` URI query parameter, which will attempt a single retry round for these shards. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-reroute.html | Elasticsearch API documentation} */ async reroute (this: That, params?: T.ClusterRerouteRequest | TB.ClusterRerouteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async reroute (this: That, params?: T.ClusterRerouteRequest | TB.ClusterRerouteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -541,8 +541,8 @@ export default class Cluster { } /** - * Returns a comprehensive information about the state of the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html | Elasticsearch API documentation} + * Get the cluster state. Get comprehensive information about the state of the cluster. The cluster state is an internal data structure which keeps track of a variety of information needed by every node, including the identity and attributes of the other nodes in the cluster; cluster-wide settings; index metadata, including the mapping and settings for each index; the location and status of every shard copy in the cluster. The elected master node ensures that every node in the cluster has a copy of the same cluster state. This API lets you retrieve a representation of this internal state for debugging or diagnostic purposes. You may need to consult the Elasticsearch source code to determine the precise meaning of the response. By default the API will route requests to the elected master node since this node is the authoritative source of cluster states. You can also retrieve the cluster state held on the node handling the API request by adding the `?local=true` query parameter. Elasticsearch may need to expend significant effort to compute a response to this API in larger clusters, and the response may comprise a very large quantity of data. If you use this API repeatedly, your cluster may become unstable. WARNING: The response is a representation of an internal data structure. Its format is not subject to the same compatibility guarantees as other more stable APIs and may change from version to version. Do not query this API using external monitoring tools. Instead, obtain the information you require using other more stable cluster APIs. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-state.html | Elasticsearch API documentation} */ async state (this: That, params?: T.ClusterStateRequest | TB.ClusterStateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async state (this: That, params?: T.ClusterStateRequest | TB.ClusterStateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -585,8 +585,8 @@ export default class Cluster { } /** - * Returns cluster statistics. It returns basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html | Elasticsearch API documentation} + * Get cluster statistics. Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-stats.html | Elasticsearch API documentation} */ async stats (this: That, params?: T.ClusterStatsRequest | TB.ClusterStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stats (this: That, params?: T.ClusterStatsRequest | TB.ClusterStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/connector.ts b/src/api/api/connector.ts index 6a2585bc8..a535e37d1 100644 --- a/src/api/api/connector.ts +++ b/src/api/api/connector.ts @@ -45,8 +45,8 @@ export default class Connector { } /** - * Updates the last_seen field in the connector, and sets it to current timestamp - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-api.html | Elasticsearch API documentation} + * Check in a connector. Update the `last_seen` field in the connector and set it to the current timestamp. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/check-in-connector-api.html | Elasticsearch API documentation} */ async checkIn (this: That, params: T.ConnectorCheckInRequest | TB.ConnectorCheckInRequest, options?: TransportRequestOptionsWithOutMeta): Promise async checkIn (this: That, params: T.ConnectorCheckInRequest | TB.ConnectorCheckInRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Connector { } /** - * Deletes a connector. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-api.html | Elasticsearch API documentation} + * Delete a connector. Removes a connector and associated sync jobs. This is a destructive action that is not recoverable. NOTE: This action doesn’t delete any API keys, ingest pipelines, or data indices associated with the connector. These need to be removed manually. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-connector-api.html | Elasticsearch API documentation} */ async delete (this: That, params: T.ConnectorDeleteRequest | TB.ConnectorDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async delete (this: That, params: T.ConnectorDeleteRequest | TB.ConnectorDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -109,8 +109,8 @@ export default class Connector { } /** - * Retrieves a connector. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-api.html | Elasticsearch API documentation} + * Get a connector. Get the details about a connector. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-connector-api.html | Elasticsearch API documentation} */ async get (this: That, params: T.ConnectorGetRequest | TB.ConnectorGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async get (this: That, params: T.ConnectorGetRequest | TB.ConnectorGetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -141,8 +141,8 @@ export default class Connector { } /** - * Updates last sync stats in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-last-sync-api.html | Elasticsearch API documentation} + * Update the connector last sync stats. Update the fields related to the last sync of a connector. This action is used for analytics and monitoring. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-last-sync-api.html | Elasticsearch API documentation} */ async lastSync (this: That, params: T.ConnectorLastSyncRequest | TB.ConnectorLastSyncRequest, options?: TransportRequestOptionsWithOutMeta): Promise async lastSync (this: That, params: T.ConnectorLastSyncRequest | TB.ConnectorLastSyncRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -185,8 +185,8 @@ export default class Connector { } /** - * Returns existing connectors. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-api.html | Elasticsearch API documentation} + * Get all connectors. Get information about all connectors. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/list-connector-api.html | Elasticsearch API documentation} */ async list (this: That, params?: T.ConnectorListRequest | TB.ConnectorListRequest, options?: TransportRequestOptionsWithOutMeta): Promise async list (this: That, params?: T.ConnectorListRequest | TB.ConnectorListRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -215,8 +215,8 @@ export default class Connector { } /** - * Creates a connector. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-api.html | Elasticsearch API documentation} + * Create a connector. Connectors are Elasticsearch integrations that bring content from third-party data sources, which can be deployed on Elastic Cloud or hosted on your own infrastructure. Elastic managed connectors (Native connectors) are a managed service on Elastic Cloud. Self-managed connectors (Connector clients) are self-managed on your infrastructure. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/create-connector-api.html | Elasticsearch API documentation} */ async post (this: That, params?: T.ConnectorPostRequest | TB.ConnectorPostRequest, options?: TransportRequestOptionsWithOutMeta): Promise async post (this: That, params?: T.ConnectorPostRequest | TB.ConnectorPostRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -257,8 +257,8 @@ export default class Connector { } /** - * Creates or updates a connector. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-api.html | Elasticsearch API documentation} + * Create or update a connector. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/create-connector-api.html | Elasticsearch API documentation} */ async put (this: That, params?: T.ConnectorPutRequest | TB.ConnectorPutRequest, options?: TransportRequestOptionsWithOutMeta): Promise async put (this: That, params?: T.ConnectorPutRequest | TB.ConnectorPutRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -430,8 +430,8 @@ export default class Connector { } /** - * Cancels a connector sync job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cancel-connector-sync-job-api.html | Elasticsearch API documentation} + * Cancel a connector sync job. Cancel a connector sync job, which sets the status to cancelling and updates `cancellation_requested_at` to the current time. The connector service is then responsible for setting the status of connector sync jobs to cancelled. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cancel-connector-sync-job-api.html | Elasticsearch API documentation} */ async syncJobCancel (this: That, params: T.ConnectorSyncJobCancelRequest | TB.ConnectorSyncJobCancelRequest, options?: TransportRequestOptionsWithOutMeta): Promise async syncJobCancel (this: That, params: T.ConnectorSyncJobCancelRequest | TB.ConnectorSyncJobCancelRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -462,22 +462,22 @@ export default class Connector { } /** - * Checks in a connector sync job (refreshes 'last_seen'). - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-sync-job-api.html | Elasticsearch API documentation} + * Check in a connector sync job. Check in a connector sync job and set the `last_seen` field to the current time before updating it in the internal index. To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/check-in-connector-sync-job-api.html | Elasticsearch API documentation} */ - async syncJobCheckIn (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async syncJobCheckIn (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async syncJobCheckIn (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async syncJobCheckIn (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async syncJobCheckIn (this: That, params: T.ConnectorSyncJobCheckInRequest | TB.ConnectorSyncJobCheckInRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async syncJobCheckIn (this: That, params: T.ConnectorSyncJobCheckInRequest | TB.ConnectorSyncJobCheckInRequest, options?: TransportRequestOptionsWithMeta): Promise> + async syncJobCheckIn (this: That, params: T.ConnectorSyncJobCheckInRequest | TB.ConnectorSyncJobCheckInRequest, options?: TransportRequestOptions): Promise + async syncJobCheckIn (this: That, params: T.ConnectorSyncJobCheckInRequest | TB.ConnectorSyncJobCheckInRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] const querystring: Record = {} const body = undefined - params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -494,22 +494,34 @@ export default class Connector { } /** - * Claims a connector sync job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/claim-connector-sync-job-api.html | Elasticsearch API documentation} + * Claim a connector sync job. This action updates the job status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time. Additionally, it can set the `sync_cursor` property for the sync job. This API is not intended for direct connector management by users. It supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch. To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/claim-connector-sync-job-api.html | Elasticsearch API documentation} */ - async syncJobClaim (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async syncJobClaim (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async syncJobClaim (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async syncJobClaim (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async syncJobClaim (this: That, params: T.ConnectorSyncJobClaimRequest | TB.ConnectorSyncJobClaimRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async syncJobClaim (this: That, params: T.ConnectorSyncJobClaimRequest | TB.ConnectorSyncJobClaimRequest, options?: TransportRequestOptionsWithMeta): Promise> + async syncJobClaim (this: That, params: T.ConnectorSyncJobClaimRequest | TB.ConnectorSyncJobClaimRequest, options?: TransportRequestOptions): Promise + async syncJobClaim (this: That, params: T.ConnectorSyncJobClaimRequest | TB.ConnectorSyncJobClaimRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] + const acceptedBody: string[] = ['sync_cursor', 'worker_hostname'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -526,8 +538,8 @@ export default class Connector { } /** - * Deletes a connector sync job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-sync-job-api.html | Elasticsearch API documentation} + * Delete a connector sync job. Remove a connector sync job and its associated data. This is a destructive action that is not recoverable. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-connector-sync-job-api.html | Elasticsearch API documentation} */ async syncJobDelete (this: That, params: T.ConnectorSyncJobDeleteRequest | TB.ConnectorSyncJobDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async syncJobDelete (this: That, params: T.ConnectorSyncJobDeleteRequest | TB.ConnectorSyncJobDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -558,22 +570,34 @@ export default class Connector { } /** - * Sets an error for a connector sync job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-error-api.html | Elasticsearch API documentation} + * Set a connector sync job error. Set the `error` field for a connector sync job and set its `status` to `error`. To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/set-connector-sync-job-error-api.html | Elasticsearch API documentation} */ - async syncJobError (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async syncJobError (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async syncJobError (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async syncJobError (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async syncJobError (this: That, params: T.ConnectorSyncJobErrorRequest | TB.ConnectorSyncJobErrorRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async syncJobError (this: That, params: T.ConnectorSyncJobErrorRequest | TB.ConnectorSyncJobErrorRequest, options?: TransportRequestOptionsWithMeta): Promise> + async syncJobError (this: That, params: T.ConnectorSyncJobErrorRequest | TB.ConnectorSyncJobErrorRequest, options?: TransportRequestOptions): Promise + async syncJobError (this: That, params: T.ConnectorSyncJobErrorRequest | TB.ConnectorSyncJobErrorRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] + const acceptedBody: string[] = ['error'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -590,8 +614,8 @@ export default class Connector { } /** - * Retrieves a connector sync job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-sync-job-api.html | Elasticsearch API documentation} + * Get a connector sync job. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-connector-sync-job-api.html | Elasticsearch API documentation} */ async syncJobGet (this: That, params: T.ConnectorSyncJobGetRequest | TB.ConnectorSyncJobGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async syncJobGet (this: That, params: T.ConnectorSyncJobGetRequest | TB.ConnectorSyncJobGetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -622,8 +646,8 @@ export default class Connector { } /** - * Lists connector sync jobs. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-sync-jobs-api.html | Elasticsearch API documentation} + * Get all connector sync jobs. Get information about all stored connector sync jobs listed by their creation date in ascending order. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/list-connector-sync-jobs-api.html | Elasticsearch API documentation} */ async syncJobList (this: That, params?: T.ConnectorSyncJobListRequest | TB.ConnectorSyncJobListRequest, options?: TransportRequestOptionsWithOutMeta): Promise async syncJobList (this: That, params?: T.ConnectorSyncJobListRequest | TB.ConnectorSyncJobListRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -652,8 +676,8 @@ export default class Connector { } /** - * Creates a connector sync job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-sync-job-api.html | Elasticsearch API documentation} + * Create a connector sync job. Create a connector sync job document in the internal index and initialize its counters and timestamps with default values. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/create-connector-sync-job-api.html | Elasticsearch API documentation} */ async syncJobPost (this: That, params: T.ConnectorSyncJobPostRequest | TB.ConnectorSyncJobPostRequest, options?: TransportRequestOptionsWithOutMeta): Promise async syncJobPost (this: That, params: T.ConnectorSyncJobPostRequest | TB.ConnectorSyncJobPostRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -693,22 +717,34 @@ export default class Connector { } /** - * Updates the stats fields in the connector sync job document. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-stats-api.html | Elasticsearch API documentation} + * Set the connector sync job stats. Stats include: `deleted_document_count`, `indexed_document_count`, `indexed_document_volume`, and `total_document_count`. You can also update `last_seen`. This API is mainly used by the connector service for updating sync job information. To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/set-connector-sync-job-stats-api.html | Elasticsearch API documentation} */ - async syncJobUpdateStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async syncJobUpdateStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async syncJobUpdateStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async syncJobUpdateStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async syncJobUpdateStats (this: That, params: T.ConnectorSyncJobUpdateStatsRequest | TB.ConnectorSyncJobUpdateStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async syncJobUpdateStats (this: That, params: T.ConnectorSyncJobUpdateStatsRequest | TB.ConnectorSyncJobUpdateStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> + async syncJobUpdateStats (this: That, params: T.ConnectorSyncJobUpdateStatsRequest | TB.ConnectorSyncJobUpdateStatsRequest, options?: TransportRequestOptions): Promise + async syncJobUpdateStats (this: That, params: T.ConnectorSyncJobUpdateStatsRequest | TB.ConnectorSyncJobUpdateStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] + const acceptedBody: string[] = ['deleted_document_count', 'indexed_document_count', 'indexed_document_volume', 'last_seen', 'metadata', 'total_document_count'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -725,8 +761,8 @@ export default class Connector { } /** - * Activates the valid draft filtering for a connector. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html | Elasticsearch API documentation} + * Activate the connector draft filter. Activates the valid draft filtering for a connector. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-filtering-api.html | Elasticsearch API documentation} */ async updateActiveFiltering (this: That, params: T.ConnectorUpdateActiveFilteringRequest | TB.ConnectorUpdateActiveFilteringRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateActiveFiltering (this: That, params: T.ConnectorUpdateActiveFilteringRequest | TB.ConnectorUpdateActiveFilteringRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -757,8 +793,8 @@ export default class Connector { } /** - * Updates the API key id in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-api-key-id-api.html | Elasticsearch API documentation} + * Update the connector API key ID. Update the `api_key_id` and `api_key_secret_id` fields of a connector. You can specify the ID of the API key used for authorization and the ID of the connector secret where the API key is stored. The connector secret ID is required only for Elastic managed (native) connectors. Self-managed connectors (connector clients) do not use this field. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-api-key-id-api.html | Elasticsearch API documentation} */ async updateApiKeyId (this: That, params: T.ConnectorUpdateApiKeyIdRequest | TB.ConnectorUpdateApiKeyIdRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateApiKeyId (this: That, params: T.ConnectorUpdateApiKeyIdRequest | TB.ConnectorUpdateApiKeyIdRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -801,8 +837,8 @@ export default class Connector { } /** - * Updates the configuration field in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-configuration-api.html | Elasticsearch API documentation} + * Update the connector configuration. Update the configuration field in the connector document. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-configuration-api.html | Elasticsearch API documentation} */ async updateConfiguration (this: That, params: T.ConnectorUpdateConfigurationRequest | TB.ConnectorUpdateConfigurationRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateConfiguration (this: That, params: T.ConnectorUpdateConfigurationRequest | TB.ConnectorUpdateConfigurationRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -845,8 +881,8 @@ export default class Connector { } /** - * Updates the filtering field in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-error-api.html | Elasticsearch API documentation} + * Update the connector error field. Set the error field for the connector. If the error provided in the request body is non-null, the connector’s status is updated to error. Otherwise, if the error is reset to null, the connector status is updated to connected. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-error-api.html | Elasticsearch API documentation} */ async updateError (this: That, params: T.ConnectorUpdateErrorRequest | TB.ConnectorUpdateErrorRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateError (this: That, params: T.ConnectorUpdateErrorRequest | TB.ConnectorUpdateErrorRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -889,22 +925,34 @@ export default class Connector { } /** - * Updates the connector features in the connector document. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-features-api.html | Elasticsearch API documentation} + * Update the connector features. Update the connector features in the connector document. This API can be used to control the following aspects of a connector: * document-level security * incremental syncs * advanced sync rules * basic sync rules Normally, the running connector service automatically manages these features. However, you can use this API to override the default behavior. To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-features-api.html | Elasticsearch API documentation} */ - async updateFeatures (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async updateFeatures (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async updateFeatures (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async updateFeatures (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async updateFeatures (this: That, params: T.ConnectorUpdateFeaturesRequest | TB.ConnectorUpdateFeaturesRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async updateFeatures (this: That, params: T.ConnectorUpdateFeaturesRequest | TB.ConnectorUpdateFeaturesRequest, options?: TransportRequestOptionsWithMeta): Promise> + async updateFeatures (this: That, params: T.ConnectorUpdateFeaturesRequest | TB.ConnectorUpdateFeaturesRequest, options?: TransportRequestOptions): Promise + async updateFeatures (this: That, params: T.ConnectorUpdateFeaturesRequest | TB.ConnectorUpdateFeaturesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] + const acceptedBody: string[] = ['features'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -921,8 +969,8 @@ export default class Connector { } /** - * Updates the filtering field in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html | Elasticsearch API documentation} + * Update the connector filtering. Update the draft filtering configuration of a connector and marks the draft validation state as edited. The filtering draft is activated once validated by the running Elastic connector service. The filtering property is used to configure sync rules (both basic and advanced) for a connector. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-filtering-api.html | Elasticsearch API documentation} */ async updateFiltering (this: That, params: T.ConnectorUpdateFilteringRequest | TB.ConnectorUpdateFilteringRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateFiltering (this: That, params: T.ConnectorUpdateFilteringRequest | TB.ConnectorUpdateFilteringRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -965,8 +1013,8 @@ export default class Connector { } /** - * Updates the draft filtering validation info for a connector. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-validation-api.html | Elasticsearch API documentation} + * Update the connector draft filtering validation. Update the draft filtering validation info for a connector. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-filtering-validation-api.html | Elasticsearch API documentation} */ async updateFilteringValidation (this: That, params: T.ConnectorUpdateFilteringValidationRequest | TB.ConnectorUpdateFilteringValidationRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateFilteringValidation (this: That, params: T.ConnectorUpdateFilteringValidationRequest | TB.ConnectorUpdateFilteringValidationRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1009,8 +1057,8 @@ export default class Connector { } /** - * Updates the index_name in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-index-name-api.html | Elasticsearch API documentation} + * Update the connector index name. Update the `index_name` field of a connector, specifying the index where the data ingested by the connector is stored. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-index-name-api.html | Elasticsearch API documentation} */ async updateIndexName (this: That, params: T.ConnectorUpdateIndexNameRequest | TB.ConnectorUpdateIndexNameRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateIndexName (this: That, params: T.ConnectorUpdateIndexNameRequest | TB.ConnectorUpdateIndexNameRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1053,8 +1101,8 @@ export default class Connector { } /** - * Updates the name and description fields in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-name-description-api.html | Elasticsearch API documentation} + * Update the connector name and description. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-name-description-api.html | Elasticsearch API documentation} */ async updateName (this: That, params: T.ConnectorUpdateNameRequest | TB.ConnectorUpdateNameRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateName (this: That, params: T.ConnectorUpdateNameRequest | TB.ConnectorUpdateNameRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1097,8 +1145,8 @@ export default class Connector { } /** - * Updates the is_native flag in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-native-api.html | Elasticsearch API documentation} + * Update the connector is_native flag. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-native-api.html | Elasticsearch API documentation} */ async updateNative (this: That, params: T.ConnectorUpdateNativeRequest | TB.ConnectorUpdateNativeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateNative (this: That, params: T.ConnectorUpdateNativeRequest | TB.ConnectorUpdateNativeRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1141,8 +1189,8 @@ export default class Connector { } /** - * Updates the pipeline field in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-pipeline-api.html | Elasticsearch API documentation} + * Update the connector pipeline. When you create a new connector, the configuration of an ingest pipeline is populated with default settings. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-pipeline-api.html | Elasticsearch API documentation} */ async updatePipeline (this: That, params: T.ConnectorUpdatePipelineRequest | TB.ConnectorUpdatePipelineRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updatePipeline (this: That, params: T.ConnectorUpdatePipelineRequest | TB.ConnectorUpdatePipelineRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1185,8 +1233,8 @@ export default class Connector { } /** - * Updates the scheduling field in the connector document - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-scheduling-api.html | Elasticsearch API documentation} + * Update the connector scheduling. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-scheduling-api.html | Elasticsearch API documentation} */ async updateScheduling (this: That, params: T.ConnectorUpdateSchedulingRequest | TB.ConnectorUpdateSchedulingRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateScheduling (this: That, params: T.ConnectorUpdateSchedulingRequest | TB.ConnectorUpdateSchedulingRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1229,8 +1277,8 @@ export default class Connector { } /** - * Updates the service type of the connector - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-service-type-api.html | Elasticsearch API documentation} + * Update the connector service type. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-service-type-api.html | Elasticsearch API documentation} */ async updateServiceType (this: That, params: T.ConnectorUpdateServiceTypeRequest | TB.ConnectorUpdateServiceTypeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateServiceType (this: That, params: T.ConnectorUpdateServiceTypeRequest | TB.ConnectorUpdateServiceTypeRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1273,8 +1321,8 @@ export default class Connector { } /** - * Updates the status of the connector - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-status-api.html | Elasticsearch API documentation} + * Update the connector status. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-connector-status-api.html | Elasticsearch API documentation} */ async updateStatus (this: That, params: T.ConnectorUpdateStatusRequest | TB.ConnectorUpdateStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateStatus (this: That, params: T.ConnectorUpdateStatusRequest | TB.ConnectorUpdateStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/count.ts b/src/api/api/count.ts index 32e09ad9b..218add448 100644 --- a/src/api/api/count.ts +++ b/src/api/api/count.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Returns number of documents matching a query. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html | Elasticsearch API documentation} + * Count search results. Get the number of documents matching a query. The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. The query is optional. When no query is provided, the API uses `match_all` to count all the documents. The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. The operation is broadcast across all shards. For each shard ID group, a replica is chosen and the search is run against it. This means that replicas increase the scalability of the count. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-count.html | Elasticsearch API documentation} */ export default async function CountApi (this: That, params?: T.CountRequest | TB.CountRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function CountApi (this: That, params?: T.CountRequest | TB.CountRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/create.ts b/src/api/api/create.ts index f130eb4ac..c358439dc 100644 --- a/src/api/api/create.ts +++ b/src/api/api/create.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Index a document. Adds a JSON document to the specified data stream or index and makes it searchable. If the target is an index and the document already exists, the request updates the document and increments its version. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html | Elasticsearch API documentation} + * Create a new document in the index. You can index a new JSON document with the `//_doc/` or `//_create/<_id>` APIs Using `_create` guarantees that the document is indexed only if it does not already exist. It returns a 409 response when a document with a same ID already exists in the index. To update an existing document, you must use the `//_doc/` API. If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: * To add a document using the `PUT //_create/<_id>` or `POST //_create/<_id>` request formats, you must have the `create_doc`, `create`, `index`, or `write` index privilege. * To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. Automatic data stream creation requires a matching index template with data stream enabled. **Automatically create data streams and indices** If the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream. If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. If no mapping exists, the index operation creates a dynamic mapping. By default, new fields and objects are automatically added to the mapping if needed. Automatic index creation is controlled by the `action.auto_create_index` setting. If it is `true`, any index can be created automatically. You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely. Specify a comma-separated list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. When a list is specified, the default behaviour is to disallow. NOTE: The `action.auto_create_index` setting affects the automatic creation of indices only. It does not affect the creation of data streams. **Routing** By default, shard placement — or routing — is controlled by using a hash of the document's ID value. For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter. When setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself. This does come at the (very minimal) cost of an additional document parsing pass. If the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. **Distributed** The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. **Active shards** To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. By default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`). This default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`. To alter this behavior per operation, use the `wait_for_active_shards request` parameter. Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1). Specifying a negative value or a number greater than the number of shard copies will throw an error. For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. If `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. However, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. The `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-index_.html | Elasticsearch API documentation} */ export default async function CreateApi (this: That, params: T.CreateRequest | TB.CreateRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function CreateApi (this: That, params: T.CreateRequest | TB.CreateRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/dangling_indices.ts b/src/api/api/dangling_indices.ts index e042d801a..a01872931 100644 --- a/src/api/api/dangling_indices.ts +++ b/src/api/api/dangling_indices.ts @@ -45,8 +45,8 @@ export default class DanglingIndices { } /** - * Deletes the specified dangling index - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html | Elasticsearch API documentation} + * Delete a dangling index. If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. For example, this can happen if you delete more than `cluster.indices.tombstones.size` indices while an Elasticsearch node is offline. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/dangling-index-delete.html | Elasticsearch API documentation} */ async deleteDanglingIndex (this: That, params: T.DanglingIndicesDeleteDanglingIndexRequest | TB.DanglingIndicesDeleteDanglingIndexRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteDanglingIndex (this: That, params: T.DanglingIndicesDeleteDanglingIndexRequest | TB.DanglingIndicesDeleteDanglingIndexRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class DanglingIndices { } /** - * Imports the specified dangling index - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html | Elasticsearch API documentation} + * Import a dangling index. If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. For example, this can happen if you delete more than `cluster.indices.tombstones.size` indices while an Elasticsearch node is offline. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/dangling-index-import.html | Elasticsearch API documentation} */ async importDanglingIndex (this: That, params: T.DanglingIndicesImportDanglingIndexRequest | TB.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptionsWithOutMeta): Promise async importDanglingIndex (this: That, params: T.DanglingIndicesImportDanglingIndexRequest | TB.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -109,8 +109,8 @@ export default class DanglingIndices { } /** - * Returns all dangling indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html | Elasticsearch API documentation} + * Get the dangling indices. If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. For example, this can happen if you delete more than `cluster.indices.tombstones.size` indices while an Elasticsearch node is offline. Use this API to list dangling indices, which you can then import or delete. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/dangling-indices-list.html | Elasticsearch API documentation} */ async listDanglingIndices (this: That, params?: T.DanglingIndicesListDanglingIndicesRequest | TB.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async listDanglingIndices (this: That, params?: T.DanglingIndicesListDanglingIndicesRequest | TB.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/delete.ts b/src/api/api/delete.ts index 387a22356..14ade536c 100644 --- a/src/api/api/delete.ts +++ b/src/api/api/delete.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Delete a document. Removes a JSON document from the specified index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html | Elasticsearch API documentation} + * Delete a document. Remove a JSON document from the specified index. NOTE: You cannot send deletion requests directly to a data stream. To delete a document in a data stream, you must target the backing index containing the document. **Optimistic concurrency control** Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters. If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`. **Versioning** Each document indexed is versioned. When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. Every write operation run on a document, deletes included, causes its version to be incremented. The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. The length of time for which a deleted document's version remains available is determined by the `index.gc_deletes` index setting. **Routing** If routing is used during indexing, the routing value also needs to be specified to delete a document. If the `_routing` mapping is set to `required` and no routing value is specified, the delete API throws a `RoutingMissingException` and rejects the request. For example: ``` DELETE /my-index-000001/_doc/1?routing=shard-1 ``` This request deletes the document with ID 1, but it is routed based on the user. The document is not deleted if the correct routing is not specified. **Distributed** The delete operation gets hashed into a specific shard ID. It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-delete.html | Elasticsearch API documentation} */ export default async function DeleteApi (this: That, params: T.DeleteRequest | TB.DeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function DeleteApi (this: That, params: T.DeleteRequest | TB.DeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/delete_by_query.ts b/src/api/api/delete_by_query.ts index 68776b013..098c7a208 100644 --- a/src/api/api/delete_by_query.ts +++ b/src/api/api/delete_by_query.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Delete documents. Deletes documents that match the specified query. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html | Elasticsearch API documentation} + * Delete documents. Deletes documents that match the specified query. If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: * `read` * `delete` or `write` You can specify the query criteria in the request URI or the request body using the same syntax as the search API. When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. A bulk delete request is performed for each batch of matching documents. If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. Any delete requests that completed successfully still stick, they are not rolled back. You can opt to count version conflicts instead of halting and returning by setting `conflicts` to `proceed`. Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than `max_docs` until it has successfully deleted `max_docs documents`, or it has gone through every document in the source query. **Throttling delete requests** To control the rate at which delete by query issues batches of delete operations, you can set `requests_per_second` to any positive decimal number. This pads each batch with a wait time to throttle the rate. Set `requests_per_second` to `-1` to disable throttling. Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. By default the batch size is `1000`, so if `requests_per_second` is set to `500`: ``` target_time = 1000 / 500 per second = 2 seconds wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds ``` Since the batch is issued as a single `_bulk` request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. This is "bursty" instead of "smooth". **Slicing** Delete by query supports sliced scroll to parallelize the delete process. This can improve efficiency and provide a convenient way to break the request down into smaller parts. Setting `slices` to `auto` lets Elasticsearch choose the number of slices to use. This setting will use one slice per shard, up to a certain limit. If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. Adding slices to the delete by query operation creates sub-requests which means it has some quirks: * You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. * Fetching the status of the task for the request with slices only contains the status of completed slices. * These sub-requests are individually addressable for things like cancellation and rethrottling. * Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. * Canceling the request with `slices` will cancel each sub-request. * Due to the nature of `slices` each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. * Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being deleted. * Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: * Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many `slices` hurts performance. Setting `slices` higher than the number of shards generally does not improve efficiency and adds overhead. * Delete performance scales linearly across available resources with the number of slices. Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. **Cancel a delete by query operation** Any delete by query can be canceled using the task cancel API. For example: ``` POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel ``` The task ID can be found by using the get tasks API. Cancellation should happen quickly but might take a few seconds. The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-delete-by-query.html | Elasticsearch API documentation} */ export default async function DeleteByQueryApi (this: That, params: T.DeleteByQueryRequest | TB.DeleteByQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function DeleteByQueryApi (this: That, params: T.DeleteByQueryRequest | TB.DeleteByQueryRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/delete_by_query_rethrottle.ts b/src/api/api/delete_by_query_rethrottle.ts index d7847a1ba..b6198c660 100644 --- a/src/api/api/delete_by_query_rethrottle.ts +++ b/src/api/api/delete_by_query_rethrottle.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Changes the number of requests per second for a particular Delete By Query operation. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html | Elasticsearch API documentation} + * Throttle a delete by query operation. Change the number of requests per second for a particular delete by query operation. Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-delete-by-query.html#docs-delete-by-query-rethrottle | Elasticsearch API documentation} */ export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest | TB.DeleteByQueryRethrottleRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest | TB.DeleteByQueryRethrottleRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/delete_script.ts b/src/api/api/delete_script.ts index 801d4aae7..a5ad712d7 100644 --- a/src/api/api/delete_script.ts +++ b/src/api/api/delete_script.ts @@ -40,7 +40,7 @@ interface That { transport: Transport } /** * Delete a script or search template. Deletes a stored script or search template. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-stored-script-api.html | Elasticsearch API documentation} */ export default async function DeleteScriptApi (this: That, params: T.DeleteScriptRequest | TB.DeleteScriptRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function DeleteScriptApi (this: That, params: T.DeleteScriptRequest | TB.DeleteScriptRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/enrich.ts b/src/api/api/enrich.ts index ada26a215..637fe1b9b 100644 --- a/src/api/api/enrich.ts +++ b/src/api/api/enrich.ts @@ -46,7 +46,7 @@ export default class Enrich { /** * Delete an enrich policy. Deletes an existing enrich policy and its enrich index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-enrich-policy-api.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-enrich-policy-api.html | Elasticsearch API documentation} */ async deletePolicy (this: That, params: T.EnrichDeletePolicyRequest | TB.EnrichDeletePolicyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deletePolicy (this: That, params: T.EnrichDeletePolicyRequest | TB.EnrichDeletePolicyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Enrich { } /** - * Creates the enrich index for an existing enrich policy. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/execute-enrich-policy-api.html | Elasticsearch API documentation} + * Run an enrich policy. Create the enrich index for an existing enrich policy. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/execute-enrich-policy-api.html | Elasticsearch API documentation} */ async executePolicy (this: That, params: T.EnrichExecutePolicyRequest | TB.EnrichExecutePolicyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async executePolicy (this: That, params: T.EnrichExecutePolicyRequest | TB.EnrichExecutePolicyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -110,7 +110,7 @@ export default class Enrich { /** * Get an enrich policy. Returns information about an enrich policy. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-enrich-policy-api.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-enrich-policy-api.html | Elasticsearch API documentation} */ async getPolicy (this: That, params?: T.EnrichGetPolicyRequest | TB.EnrichGetPolicyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getPolicy (this: That, params?: T.EnrichGetPolicyRequest | TB.EnrichGetPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -150,7 +150,7 @@ export default class Enrich { /** * Create an enrich policy. Creates an enrich policy. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-enrich-policy-api.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-enrich-policy-api.html | Elasticsearch API documentation} */ async putPolicy (this: That, params: T.EnrichPutPolicyRequest | TB.EnrichPutPolicyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putPolicy (this: That, params: T.EnrichPutPolicyRequest | TB.EnrichPutPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -194,7 +194,7 @@ export default class Enrich { /** * Get enrich stats. Returns enrich coordinator statistics and information about enrich policies that are currently executing. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/enrich-stats-api.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/enrich-stats-api.html | Elasticsearch API documentation} */ async stats (this: That, params?: T.EnrichStatsRequest | TB.EnrichStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stats (this: That, params?: T.EnrichStatsRequest | TB.EnrichStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/eql.ts b/src/api/api/eql.ts index 0e0ddd859..6958c031b 100644 --- a/src/api/api/eql.ts +++ b/src/api/api/eql.ts @@ -45,8 +45,8 @@ export default class Eql { } /** - * Deletes an async EQL search or a stored synchronous EQL search. The API also deletes results for the search. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/eql-search-api.html | Elasticsearch API documentation} + * Delete an async EQL search. Delete an async EQL search or a stored synchronous EQL search. The API also deletes results for the search. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-eql-delete | Elasticsearch API documentation} */ async delete (this: That, params: T.EqlDeleteRequest | TB.EqlDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async delete (this: That, params: T.EqlDeleteRequest | TB.EqlDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Eql { } /** - * Returns the current status and available results for an async EQL search or a stored synchronous EQL search. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-eql-search-api.html | Elasticsearch API documentation} + * Get async EQL search results. Get the current status and available results for an async EQL search or a stored synchronous EQL search. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-async-eql-search-api.html | Elasticsearch API documentation} */ async get (this: That, params: T.EqlGetRequest | TB.EqlGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async get (this: That, params: T.EqlGetRequest | TB.EqlGetRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> @@ -109,8 +109,8 @@ export default class Eql { } /** - * Returns the current status for an async EQL search or a stored synchronous EQL search without returning results. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-eql-status-api.html | Elasticsearch API documentation} + * Get the async EQL status. Get the current status for an async EQL search or a stored synchronous EQL search without returning results. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-async-eql-status-api.html | Elasticsearch API documentation} */ async getStatus (this: That, params: T.EqlGetStatusRequest | TB.EqlGetStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getStatus (this: That, params: T.EqlGetStatusRequest | TB.EqlGetStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -141,15 +141,15 @@ export default class Eql { } /** - * Returns results matching a query expressed in Event Query Language (EQL) - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/eql-search-api.html | Elasticsearch API documentation} + * Get EQL search results. Returns search results for an Event Query Language (EQL) query. EQL assumes each document in a data stream or index corresponds to an event. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/eql-search-api.html | Elasticsearch API documentation} */ async search (this: That, params: T.EqlSearchRequest | TB.EqlSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async search (this: That, params: T.EqlSearchRequest | TB.EqlSearchRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> async search (this: That, params: T.EqlSearchRequest | TB.EqlSearchRequest, options?: TransportRequestOptions): Promise> async search (this: That, params: T.EqlSearchRequest | TB.EqlSearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedBody: string[] = ['query', 'case_sensitive', 'event_category_field', 'tiebreaker_field', 'timestamp_field', 'fetch_size', 'filter', 'keep_alive', 'keep_on_completion', 'wait_for_completion_timeout', 'size', 'fields', 'result_position', 'runtime_mappings'] + const acceptedBody: string[] = ['query', 'case_sensitive', 'event_category_field', 'tiebreaker_field', 'timestamp_field', 'fetch_size', 'filter', 'keep_alive', 'keep_on_completion', 'wait_for_completion_timeout', 'allow_partial_search_results', 'allow_partial_sequence_results', 'size', 'fields', 'result_position', 'runtime_mappings', 'max_samples_per_key'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body diff --git a/src/api/api/esql.ts b/src/api/api/esql.ts index da1570d79..a24cf9fdc 100644 --- a/src/api/api/esql.ts +++ b/src/api/api/esql.ts @@ -45,22 +45,34 @@ export default class Esql { } /** - * Executes an ESQL request asynchronously - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-api.html | Elasticsearch API documentation} + * Run an async ES|QL query. Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/esql-async-query-api.html | Elasticsearch API documentation} */ - async asyncQuery (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async asyncQuery (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async asyncQuery (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async asyncQuery (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest | TB.EsqlAsyncQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest | TB.EsqlAsyncQueryRequest, options?: TransportRequestOptionsWithMeta): Promise> + async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest | TB.EsqlAsyncQueryRequest, options?: TransportRequestOptions): Promise + async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest | TB.EsqlAsyncQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] + const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'profile', 'query', 'tables', 'include_ccs_metadata', 'wait_for_completion_timeout'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -74,22 +86,54 @@ export default class Esql { } /** - * Retrieves the results of a previously submitted async query request given its ID. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-get-api.html | Elasticsearch API documentation} + * Delete an async ES|QL query. If the query is still running, it is cancelled. Otherwise, the stored results are deleted. If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: * The authenticated user that submitted the original query request * Users with the `cancel_task` cluster privilege + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/esql-async-query-delete-api.html | Elasticsearch API documentation} */ - async asyncQueryGet (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async asyncQueryGet (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async asyncQueryGet (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async asyncQueryGet (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest | TB.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest | TB.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> + async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest | TB.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptions): Promise + async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest | TB.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const querystring: Record = {} const body = undefined - params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'DELETE' + const path = `/_query/async/${encodeURIComponent(params.id.toString())}` + const meta: TransportRequestMetadata = { + name: 'esql.async_query_delete', + pathParts: { + id: params.id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Get async ES|QL query results. Get the current status and available results or stored results for an ES|QL asynchronous query. If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/esql-async-query-get-api.html | Elasticsearch API documentation} + */ + async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest | TB.EsqlAsyncQueryGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest | TB.EsqlAsyncQueryGetRequest, options?: TransportRequestOptionsWithMeta): Promise> + async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest | TB.EsqlAsyncQueryGetRequest, options?: TransportRequestOptions): Promise + async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest | TB.EsqlAsyncQueryGetRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['id'] + const querystring: Record = {} + const body = undefined + + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -106,15 +150,47 @@ export default class Esql { } /** - * Executes an ES|QL request - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-rest.html | Elasticsearch API documentation} + * Stop async ES|QL query. This API interrupts the query execution and returns the results so far. If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/esql-async-query-stop-api.html | Elasticsearch API documentation} + */ + async asyncQueryStop (this: That, params: T.EsqlAsyncQueryStopRequest | TB.EsqlAsyncQueryStopRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async asyncQueryStop (this: That, params: T.EsqlAsyncQueryStopRequest | TB.EsqlAsyncQueryStopRequest, options?: TransportRequestOptionsWithMeta): Promise> + async asyncQueryStop (this: That, params: T.EsqlAsyncQueryStopRequest | TB.EsqlAsyncQueryStopRequest, options?: TransportRequestOptions): Promise + async asyncQueryStop (this: That, params: T.EsqlAsyncQueryStopRequest | TB.EsqlAsyncQueryStopRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['id'] + const querystring: Record = {} + const body = undefined + + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_query/async/${encodeURIComponent(params.id.toString())}/stop` + const meta: TransportRequestMetadata = { + name: 'esql.async_query_stop', + pathParts: { + id: params.id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Run an ES|QL query. Get search results for an ES|QL (Elasticsearch query language) query. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/esql-rest.html | Elasticsearch API documentation} */ async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptionsWithMeta): Promise> async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptions): Promise async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'profile', 'query', 'tables'] + const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'profile', 'query', 'tables', 'include_ccs_metadata'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body diff --git a/src/api/api/exists.ts b/src/api/api/exists.ts index 8f5033eb2..74d44e5e4 100644 --- a/src/api/api/exists.ts +++ b/src/api/api/exists.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Check a document. Checks if a specified document exists. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html | Elasticsearch API documentation} + * Check a document. Verify that a document exists. For example, check to see if a document with the `_id` 0 exists: ``` HEAD my-index-000001/_doc/0 ``` If the document exists, the API returns a status code of `200 - OK`. If the document doesn’t exist, the API returns `404 - Not Found`. **Versioning support** You can use the `version` parameter to check the document only if its current version is equal to the specified one. Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. The old version of the document doesn't disappear immediately, although you won't be able to access it. Elasticsearch cleans up deleted documents in the background as you continue to index more data. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-get.html | Elasticsearch API documentation} */ export default async function ExistsApi (this: That, params: T.ExistsRequest | TB.ExistsRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function ExistsApi (this: That, params: T.ExistsRequest | TB.ExistsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/exists_source.ts b/src/api/api/exists_source.ts index 8c6f14496..a7a4eac13 100644 --- a/src/api/api/exists_source.ts +++ b/src/api/api/exists_source.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Check for a document source. Checks if a document's `_source` is stored. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html | Elasticsearch API documentation} + * Check for a document source. Check whether a document source exists in an index. For example: ``` HEAD my-index-000001/_source/1 ``` A document's source is not available if it is disabled in the mapping. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-get.html | Elasticsearch API documentation} */ export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest | TB.ExistsSourceRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest | TB.ExistsSourceRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/explain.ts b/src/api/api/explain.ts index a65f6dc7a..d1e60765b 100644 --- a/src/api/api/explain.ts +++ b/src/api/api/explain.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Explain a document match result. Returns information about why a specific document matches, or doesn’t match, a query. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html | Elasticsearch API documentation} + * Explain a document match result. Get information about why a specific document matches, or doesn't match, a query. It computes a score explanation for a query and a specific document. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-explain.html | Elasticsearch API documentation} */ export default async function ExplainApi (this: That, params: T.ExplainRequest | TB.ExplainRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function ExplainApi (this: That, params: T.ExplainRequest | TB.ExplainRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/features.ts b/src/api/api/features.ts index 6ec8b7c75..070555d68 100644 --- a/src/api/api/features.ts +++ b/src/api/api/features.ts @@ -45,8 +45,8 @@ export default class Features { } /** - * Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-features-api.html | Elasticsearch API documentation} + * Get the features. Get a list of features that can be included in snapshots using the `feature_states` field when creating a snapshot. You can use this API to determine which feature states to include when taking a snapshot. By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. A feature state includes one or more system indices necessary for a given feature to function. In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. The features listed by this API are a combination of built-in features and features defined by plugins. In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-features-api.html | Elasticsearch API documentation} */ async getFeatures (this: That, params?: T.FeaturesGetFeaturesRequest | TB.FeaturesGetFeaturesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getFeatures (this: That, params?: T.FeaturesGetFeaturesRequest | TB.FeaturesGetFeaturesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -75,8 +75,8 @@ export default class Features { } /** - * Resets the internal state of features, usually by deleting system indices - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Reset the features. Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. WARNING: Intended for development and testing use only. Do not reset features on a production cluster. Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. This deletes all state information stored in system indices. The response code is HTTP 200 if the state is successfully reset for all features. It is HTTP 500 if the reset operation failed for any feature. Note that select features might provide a way to reset particular system indices. Using this API resets all features, both those that are built-in and implemented as plugins. To list the features that will be affected, use the get features API. IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/reset-features-api.html | Elasticsearch API documentation} */ async resetFeatures (this: That, params?: T.FeaturesResetFeaturesRequest | TB.FeaturesResetFeaturesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async resetFeatures (this: That, params?: T.FeaturesResetFeaturesRequest | TB.FeaturesResetFeaturesRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/field_caps.ts b/src/api/api/field_caps.ts index 7a2c5bc12..f063e225d 100644 --- a/src/api/api/field_caps.ts +++ b/src/api/api/field_caps.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * The field capabilities API returns the information about the capabilities of fields among multiple indices. The field capabilities API returns runtime fields like any other field. For example, a runtime field with a type of keyword is returned as any other field that belongs to the `keyword` family. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html | Elasticsearch API documentation} + * Get the field capabilities. Get information about the capabilities of fields among multiple indices. For data streams, the API returns field capabilities among the stream’s backing indices. It returns runtime fields like any other field. For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the `keyword` family. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-field-caps.html | Elasticsearch API documentation} */ export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/fleet.ts b/src/api/api/fleet.ts index 4fe0b0ed8..af1d01967 100644 --- a/src/api/api/fleet.ts +++ b/src/api/api/fleet.ts @@ -107,8 +107,8 @@ export default class Fleet { } /** - * Returns the current global checkpoints for an index. This API is design for internal use by the fleet server project. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-global-checkpoints.html | Elasticsearch API documentation} + * Get global checkpoints. Get the current global checkpoints for an index. This API is designed for internal use by the Fleet server project. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-global-checkpoints.html | Elasticsearch API documentation} */ async globalCheckpoints (this: That, params: T.FleetGlobalCheckpointsRequest | TB.FleetGlobalCheckpointsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async globalCheckpoints (this: That, params: T.FleetGlobalCheckpointsRequest | TB.FleetGlobalCheckpointsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -140,6 +140,7 @@ export default class Fleet { /** * Executes several [fleet searches](https://www.elastic.co/guide/en/elasticsearch/reference/current/fleet-search.html) with a single API request. The API follows the same structure as the [multi search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) API. However, similar to the fleet search API, it supports the wait_for_checkpoints parameter. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/fleet-multi-search.html | Elasticsearch API documentation} */ async msearch (this: That, params: T.FleetMsearchRequest | TB.FleetMsearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async msearch (this: That, params: T.FleetMsearchRequest | TB.FleetMsearchRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> @@ -211,6 +212,7 @@ export default class Fleet { /** * The purpose of the fleet search api is to provide a search api where the search will only be executed after provided checkpoint has been processed and is visible for searches inside of Elasticsearch. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/fleet-search.html | Elasticsearch API documentation} */ async search (this: That, params: T.FleetSearchRequest | TB.FleetSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async search (this: That, params: T.FleetSearchRequest | TB.FleetSearchRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/get.ts b/src/api/api/get.ts index 3a64e8f07..5fe9068c2 100644 --- a/src/api/api/get.ts +++ b/src/api/api/get.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Get a document by its ID. Retrieves the document with the specified ID from an index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html | Elasticsearch API documentation} + * Get a document by its ID. Get a document and its source or stored fields from an index. By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). In the case where stored fields are requested with the `stored_fields` parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. To turn off realtime behavior, set the `realtime` parameter to false. **Source filtering** By default, the API returns the contents of the `_source` field unless you have used the `stored_fields` parameter or the `_source` field is turned off. You can turn off `_source` retrieval by using the `_source` parameter: ``` GET my-index-000001/_doc/0?_source=false ``` If you only need one or two fields from the `_source`, use the `_source_includes` or `_source_excludes` parameters to include or filter out particular fields. This can be helpful with large documents where partial retrieval can save on network overhead Both parameters take a comma separated list of fields or wildcard expressions. For example: ``` GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities ``` If you only want to specify includes, you can use a shorter notation: ``` GET my-index-000001/_doc/0?_source=*.id ``` **Routing** If routing is used during indexing, the routing value also needs to be specified to retrieve a document. For example: ``` GET my-index-000001/_doc/2?routing=user1 ``` This request gets the document with ID 2, but it is routed based on the user. The document is not fetched if the correct routing is not specified. **Distributed** The GET operation is hashed into a specific shard ID. It is then redirected to one of the replicas within that shard ID and returns the result. The replicas are the primary shard and its replicas within that shard ID group. This means that the more replicas you have, the better your GET scaling will be. **Versioning support** You can use the `version` parameter to retrieve the document only if its current version is equal to the specified one. Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. The old version of the document doesn't disappear immediately, although you won't be able to access it. Elasticsearch cleans up deleted documents in the background as you continue to index more data. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-get.html | Elasticsearch API documentation} */ export default async function GetApi (this: That, params: T.GetRequest | TB.GetRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function GetApi (this: That, params: T.GetRequest | TB.GetRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/get_script.ts b/src/api/api/get_script.ts index e84a69da1..3c77b96af 100644 --- a/src/api/api/get_script.ts +++ b/src/api/api/get_script.ts @@ -40,7 +40,7 @@ interface That { transport: Transport } /** * Get a script or search template. Retrieves a stored script or search template. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-stored-script-api.html | Elasticsearch API documentation} */ export default async function GetScriptApi (this: That, params: T.GetScriptRequest | TB.GetScriptRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function GetScriptApi (this: That, params: T.GetScriptRequest | TB.GetScriptRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/get_script_context.ts b/src/api/api/get_script_context.ts index f242c6870..54a537536 100644 --- a/src/api/api/get_script_context.ts +++ b/src/api/api/get_script_context.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Returns all script contexts. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html | Elasticsearch API documentation} + * Get script contexts. Get a list of supported script contexts and their methods. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-script-contexts-api.html | Elasticsearch API documentation} */ export default async function GetScriptContextApi (this: That, params?: T.GetScriptContextRequest | TB.GetScriptContextRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function GetScriptContextApi (this: That, params?: T.GetScriptContextRequest | TB.GetScriptContextRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/get_script_languages.ts b/src/api/api/get_script_languages.ts index 1487bedf3..dacb4ba3b 100644 --- a/src/api/api/get_script_languages.ts +++ b/src/api/api/get_script_languages.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Returns available script types, languages and contexts - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html | Elasticsearch API documentation} + * Get script languages. Get a list of available script types, languages, and contexts. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-script-languages-api.html | Elasticsearch API documentation} */ export default async function GetScriptLanguagesApi (this: That, params?: T.GetScriptLanguagesRequest | TB.GetScriptLanguagesRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function GetScriptLanguagesApi (this: That, params?: T.GetScriptLanguagesRequest | TB.GetScriptLanguagesRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/get_source.ts b/src/api/api/get_source.ts index 79abedad1..196ff3938 100644 --- a/src/api/api/get_source.ts +++ b/src/api/api/get_source.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Get a document's source. Returns the source of a document. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html | Elasticsearch API documentation} + * Get a document's source. Get the source of a document. For example: ``` GET my-index-000001/_source/1 ``` You can use the source filtering parameters to control which parts of the `_source` are returned: ``` GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities ``` + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-get.html | Elasticsearch API documentation} */ export default async function GetSourceApi (this: That, params: T.GetSourceRequest | TB.GetSourceRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function GetSourceApi (this: That, params: T.GetSourceRequest | TB.GetSourceRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/graph.ts b/src/api/api/graph.ts index 01d14aa5d..921e9b53a 100644 --- a/src/api/api/graph.ts +++ b/src/api/api/graph.ts @@ -45,8 +45,8 @@ export default class Graph { } /** - * Extracts and summarizes information about the documents and terms in an Elasticsearch data stream or index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/graph-explore-api.html | Elasticsearch API documentation} + * Explore graph analytics. Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. An initial request to the `_explore` API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. Subsequent requests enable you to spider out from one more vertices of interest. You can exclude vertices that have already been returned. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/graph-explore-api.html | Elasticsearch API documentation} */ async explore (this: That, params: T.GraphExploreRequest | TB.GraphExploreRequest, options?: TransportRequestOptionsWithOutMeta): Promise async explore (this: That, params: T.GraphExploreRequest | TB.GraphExploreRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/health_report.ts b/src/api/api/health_report.ts index 58e098339..491d8664d 100644 --- a/src/api/api/health_report.ts +++ b/src/api/api/health_report.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Returns the health of the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/health-api.html | Elasticsearch API documentation} + * Get the cluster health. Get a report with the health status of an Elasticsearch cluster. The report contains a list of indicators that compose Elasticsearch functionality. Each indicator has a health status of: green, unknown, yellow or red. The indicator will provide an explanation and metadata describing the reason for its current health status. The cluster’s status is controlled by the worst indicator status. In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. The root cause and remediation steps are encapsulated in a diagnosis. A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/health-api.html | Elasticsearch API documentation} */ export default async function HealthReportApi (this: That, params?: T.HealthReportRequest | TB.HealthReportRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function HealthReportApi (this: That, params?: T.HealthReportRequest | TB.HealthReportRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/ilm.ts b/src/api/api/ilm.ts index 48c35c9fb..d9d5ad612 100644 --- a/src/api/api/ilm.ts +++ b/src/api/api/ilm.ts @@ -45,8 +45,8 @@ export default class Ilm { } /** - * Deletes the specified lifecycle policy definition. You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-delete-lifecycle.html | Elasticsearch API documentation} + * Delete a lifecycle policy. You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-delete-lifecycle.html | Elasticsearch API documentation} */ async deleteLifecycle (this: That, params: T.IlmDeleteLifecycleRequest | TB.IlmDeleteLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteLifecycle (this: That, params: T.IlmDeleteLifecycleRequest | TB.IlmDeleteLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Ilm { } /** - * Retrieves information about the index’s current lifecycle state, such as the currently executing phase, action, and step. Shows when the index entered each one, the definition of the running phase, and information about any failures. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-explain-lifecycle.html | Elasticsearch API documentation} + * Explain the lifecycle state. Get the current lifecycle status for one or more indices. For data streams, the API retrieves the current lifecycle status for the stream's backing indices. The response indicates when the index entered each lifecycle state, provides the definition of the running phase, and information about any failures. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-explain-lifecycle.html | Elasticsearch API documentation} */ async explainLifecycle (this: That, params: T.IlmExplainLifecycleRequest | TB.IlmExplainLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async explainLifecycle (this: That, params: T.IlmExplainLifecycleRequest | TB.IlmExplainLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -109,8 +109,8 @@ export default class Ilm { } /** - * Retrieves a lifecycle policy. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-get-lifecycle.html | Elasticsearch API documentation} + * Get lifecycle policies. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-get-lifecycle.html | Elasticsearch API documentation} */ async getLifecycle (this: That, params?: T.IlmGetLifecycleRequest | TB.IlmGetLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getLifecycle (this: That, params?: T.IlmGetLifecycleRequest | TB.IlmGetLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -149,8 +149,8 @@ export default class Ilm { } /** - * Retrieves the current index lifecycle management (ILM) status. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-get-status.html | Elasticsearch API documentation} + * Get the ILM status. Get the current index lifecycle management status. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-get-status.html | Elasticsearch API documentation} */ async getStatus (this: That, params?: T.IlmGetStatusRequest | TB.IlmGetStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getStatus (this: That, params?: T.IlmGetStatusRequest | TB.IlmGetStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -179,8 +179,8 @@ export default class Ilm { } /** - * Switches the indices, ILM policies, and legacy, composable and component templates from using custom node attributes and attribute-based allocation filters to using data tiers, and optionally deletes one legacy index template.+ Using node roles enables ILM to automatically move the indices between data tiers. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-migrate-to-data-tiers.html | Elasticsearch API documentation} + * Migrate to data tiers routing. Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. Optionally, delete one legacy index template. Using node roles enables ILM to automatically move the indices between data tiers. Migrating away from custom node attributes routing can be manually performed. This API provides an automated way of performing three out of the four manual steps listed in the migration guide: 1. Stop setting the custom hot attribute on new indices. 1. Remove custom allocation settings from existing ILM policies. 1. Replace custom allocation settings from existing indices with the corresponding tier preference. ILM must be stopped before performing the migration. Use the stop ILM and get ILM status APIs to wait until the reported operation mode is `STOPPED`. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-migrate-to-data-tiers.html | Elasticsearch API documentation} */ async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest | TB.IlmMigrateToDataTiersRequest, options?: TransportRequestOptionsWithOutMeta): Promise async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest | TB.IlmMigrateToDataTiersRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -221,8 +221,8 @@ export default class Ilm { } /** - * Manually moves an index into the specified step and executes that step. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-move-to-step.html | Elasticsearch API documentation} + * Move to a lifecycle step. Manually move an index into a specific step in the lifecycle policy and run that step. WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. You must specify both the current step and the step to be executed in the body of the request. The request will fail if the current step does not match the step currently running for the index This is to prevent the index from being moved from an unexpected step into the next step. When specifying the target (`next_step`) to which the index will be moved, either the name or both the action and name fields are optional. If only the phase is specified, the index will move to the first step of the first action in the target phase. If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. Only actions specified in the ILM policy are considered valid. An index cannot move to a step that is not part of its policy. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-move-to-step.html | Elasticsearch API documentation} */ async moveToStep (this: That, params: T.IlmMoveToStepRequest | TB.IlmMoveToStepRequest, options?: TransportRequestOptionsWithOutMeta): Promise async moveToStep (this: That, params: T.IlmMoveToStepRequest | TB.IlmMoveToStepRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -265,8 +265,8 @@ export default class Ilm { } /** - * Creates a lifecycle policy. If the specified policy exists, the policy is replaced and the policy version is incremented. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-put-lifecycle.html | Elasticsearch API documentation} + * Create or update a lifecycle policy. If the specified policy exists, it is replaced and the policy version is incremented. NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-put-lifecycle.html | Elasticsearch API documentation} */ async putLifecycle (this: That, params: T.IlmPutLifecycleRequest | TB.IlmPutLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putLifecycle (this: That, params: T.IlmPutLifecycleRequest | TB.IlmPutLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -309,8 +309,8 @@ export default class Ilm { } /** - * Removes the assigned lifecycle policy and stops managing the specified index - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-remove-policy.html | Elasticsearch API documentation} + * Remove policies from an index. Remove the assigned lifecycle policies from an index or a data stream's backing indices. It also stops managing the indices. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-remove-policy.html | Elasticsearch API documentation} */ async removePolicy (this: That, params: T.IlmRemovePolicyRequest | TB.IlmRemovePolicyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async removePolicy (this: That, params: T.IlmRemovePolicyRequest | TB.IlmRemovePolicyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -341,8 +341,8 @@ export default class Ilm { } /** - * Retries executing the policy for an index that is in the ERROR step. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-retry-policy.html | Elasticsearch API documentation} + * Retry a policy. Retry running the lifecycle policy for an index that is in the ERROR step. The API sets the policy back to the step where the error occurred and runs the step. Use the explain lifecycle state API to determine whether an index is in the ERROR step. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-retry-policy.html | Elasticsearch API documentation} */ async retry (this: That, params: T.IlmRetryRequest | TB.IlmRetryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async retry (this: That, params: T.IlmRetryRequest | TB.IlmRetryRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -373,8 +373,8 @@ export default class Ilm { } /** - * Start the index lifecycle management (ILM) plugin. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-start.html | Elasticsearch API documentation} + * Start the ILM plugin. Start the index lifecycle management plugin if it is currently stopped. ILM is started automatically when the cluster is formed. Restarting ILM is necessary only when it has been stopped using the stop ILM API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-start.html | Elasticsearch API documentation} */ async start (this: That, params?: T.IlmStartRequest | TB.IlmStartRequest, options?: TransportRequestOptionsWithOutMeta): Promise async start (this: That, params?: T.IlmStartRequest | TB.IlmStartRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -403,8 +403,8 @@ export default class Ilm { } /** - * Halts all lifecycle management operations and stops the index lifecycle management (ILM) plugin - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-stop.html | Elasticsearch API documentation} + * Stop the ILM plugin. Halt all lifecycle management operations and stop the index lifecycle management plugin. This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. Use the get ILM status API to check whether ILM is running. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-stop.html | Elasticsearch API documentation} */ async stop (this: That, params?: T.IlmStopRequest | TB.IlmStopRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stop (this: That, params?: T.IlmStopRequest | TB.IlmStopRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/index.ts b/src/api/api/index.ts index 89fba417f..19295105f 100644 --- a/src/api/api/index.ts +++ b/src/api/api/index.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Index a document. Adds a JSON document to the specified data stream or index and makes it searchable. If the target is an index and the document already exists, the request updates the document and increments its version. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html | Elasticsearch API documentation} + * Create or update a document in an index. Add a JSON document to the specified data stream or index and make it searchable. If the target is an index and the document already exists, the request updates the document and increments its version. NOTE: You cannot use this API to send update requests for existing documents in a data stream. If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: * To add or overwrite a document using the `PUT //_doc/<_id>` request format, you must have the `create`, `index`, or `write` index privilege. * To add a document using the `POST //_doc/` request format, you must have the `create_doc`, `create`, `index`, or `write` index privilege. * To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. Automatic data stream creation requires a matching index template with data stream enabled. NOTE: Replica shards might not all be started when an indexing operation returns successfully. By default, only the primary is required. Set `wait_for_active_shards` to change this default behavior. **Automatically create data streams and indices** If the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream. If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. If no mapping exists, the index operation creates a dynamic mapping. By default, new fields and objects are automatically added to the mapping if needed. Automatic index creation is controlled by the `action.auto_create_index` setting. If it is `true`, any index can be created automatically. You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely. Specify a comma-separated list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. When a list is specified, the default behaviour is to disallow. NOTE: The `action.auto_create_index` setting affects the automatic creation of indices only. It does not affect the creation of data streams. **Optimistic concurrency control** Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters. If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`. **Routing** By default, shard placement — or routing — is controlled by using a hash of the document's ID value. For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter. When setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself. This does come at the (very minimal) cost of an additional document parsing pass. If the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. **Distributed** The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. **Active shards** To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. By default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`). This default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`. To alter this behavior per operation, use the `wait_for_active_shards request` parameter. Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1). Specifying a negative value or a number greater than the number of shard copies will throw an error. For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. If `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. However, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. The `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed. **No operation (noop) updates** When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. If this isn't acceptable use the `_update` API with `detect_noop` set to `true`. The `detect_noop` option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. There isn't a definitive rule for when noop updates aren't acceptable. It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. **Versioning** Each indexed document is given a version number. By default, internal versioning is used that starts at 1 and increments with each update, deletes included. Optionally, the version number can be set to an external value (for example, if maintained in a database). To enable this functionality, `version_type` should be set to `external`. The value provided must be a numeric, long value greater than or equal to 0, and less than around `9.2e+18`. NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. If no version is provided, the operation runs without any version checks. When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. If true, the document will be indexed and the new version number used. If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: ``` PUT my-index-000001/_doc/1?version=2&version_type=external { "user": { "id": "elkbee" } } In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-index_.html | Elasticsearch API documentation} */ export default async function IndexApi (this: That, params: T.IndexRequest | TB.IndexRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function IndexApi (this: That, params: T.IndexRequest | TB.IndexRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/indices.ts b/src/api/api/indices.ts index b1cff556b..21c8e988e 100644 --- a/src/api/api/indices.ts +++ b/src/api/api/indices.ts @@ -45,8 +45,8 @@ export default class Indices { } /** - * Add an index block. Limits the operations allowed on an index by blocking specific operation types. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html | Elasticsearch API documentation} + * Add an index block. Add an index block to an index. Index blocks limit the operations allowed on an index by blocking specific operation types. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/index-modules-blocks.html#add-index-block | Elasticsearch API documentation} */ async addBlock (this: That, params: T.IndicesAddBlockRequest | TB.IndicesAddBlockRequest, options?: TransportRequestOptionsWithOutMeta): Promise async addBlock (this: That, params: T.IndicesAddBlockRequest | TB.IndicesAddBlockRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -78,8 +78,8 @@ export default class Indices { } /** - * Performs analysis on a text string and returns the resulting tokens. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html | Elasticsearch API documentation} + * Get tokens from text analysis. The analyze API performs analysis on a text string and returns the resulting tokens. Generating excessive amount of tokens may cause a node to run out of memory. The `index.analyze.max_token_count` setting enables you to limit the number of tokens that can be produced. If more than this limit of tokens gets generated, an error occurs. The `_analyze` endpoint without a specified index will always use `10000` as its limit. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-analyze.html | Elasticsearch API documentation} */ async analyze (this: That, params?: T.IndicesAnalyzeRequest | TB.IndicesAnalyzeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async analyze (this: That, params?: T.IndicesAnalyzeRequest | TB.IndicesAnalyzeRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -130,8 +130,40 @@ export default class Indices { } /** - * Clears the caches of one or more indices. For data streams, the API clears the caches of the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html | Elasticsearch API documentation} + * Cancel a migration reindex operation. Cancel a migration reindex attempt for a data stream or index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/migrate-data-stream.html | Elasticsearch API documentation} + */ + async cancelMigrateReindex (this: That, params: T.IndicesCancelMigrateReindexRequest | TB.IndicesCancelMigrateReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async cancelMigrateReindex (this: That, params: T.IndicesCancelMigrateReindexRequest | TB.IndicesCancelMigrateReindexRequest, options?: TransportRequestOptionsWithMeta): Promise> + async cancelMigrateReindex (this: That, params: T.IndicesCancelMigrateReindexRequest | TB.IndicesCancelMigrateReindexRequest, options?: TransportRequestOptions): Promise + async cancelMigrateReindex (this: That, params: T.IndicesCancelMigrateReindexRequest | TB.IndicesCancelMigrateReindexRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['index'] + const querystring: Record = {} + const body = undefined + + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_migration/reindex/${encodeURIComponent(params.index.toString())}/_cancel` + const meta: TransportRequestMetadata = { + name: 'indices.cancel_migrate_reindex', + pathParts: { + index: params.index + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Clear the cache. Clear the cache of one or more indices. For data streams, the API clears the caches of the stream's backing indices. By default, the clear cache API clears all caches. To clear only specific caches, use the `fielddata`, `query`, or `request` parameters. To clear the cache only of specific fields, use the `fields` parameter. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-clearcache.html | Elasticsearch API documentation} */ async clearCache (this: That, params?: T.IndicesClearCacheRequest | TB.IndicesClearCacheRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearCache (this: That, params?: T.IndicesClearCacheRequest | TB.IndicesClearCacheRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -170,8 +202,8 @@ export default class Indices { } /** - * Clones an existing index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html | Elasticsearch API documentation} + * Clone an index. Clone an existing index into a new index. Each original primary shard is cloned into a new primary shard in the new index. IMPORTANT: Elasticsearch does not apply index templates to the resulting index. The API also does not copy index metadata from the original index. Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. For example, if you clone a CCR follower index, the resulting clone will not be a follower index. The clone API copies most index settings from the source index to the resulting index, with the exception of `index.number_of_replicas` and `index.auto_expand_replicas`. To set the number of replicas in the resulting index, configure these settings in the clone request. Cloning works as follows: * First, it creates a new target index with the same definition as the source index. * Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. * Finally, it recovers the target index as though it were a closed index which had just been re-opened. IMPORTANT: Indices can only be cloned if they meet the following requirements: * The index must be marked as read-only and have a cluster health status of green. * The target index must not exist. * The source index must have the same number of primary shards as the target index. * The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. The current write index on a data stream cannot be cloned. In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. NOTE: Mappings cannot be specified in the `_clone` request. The mappings of the source index will be used for the target index. **Monitor the cloning process** The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the `wait_for_status` parameter to `yellow`. The `_clone` API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. At this point, all shards are in the state unassigned. If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. Once the primary shard is allocated, it moves to state initializing, and the clone process begins. When the clone operation completes, the shard will become active. At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. **Wait for active shards** Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-clone-index.html | Elasticsearch API documentation} */ async clone (this: That, params: T.IndicesCloneRequest | TB.IndicesCloneRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clone (this: That, params: T.IndicesCloneRequest | TB.IndicesCloneRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -215,8 +247,8 @@ export default class Indices { } /** - * Closes an index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-close.html | Elasticsearch API documentation} + * Close an index. A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. It is not possible to index documents or to search for documents in a closed index. Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. The shards will then go through the normal recovery process. The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. You can open and close multiple indices. An error is thrown if the request explicitly refers to a missing index. This behaviour can be turned off using the `ignore_unavailable=true` parameter. By default, you must explicitly name the indices you are opening or closing. To open or close indices with `_all`, `*`, or other wildcard expressions, change the` action.destructive_requires_name` setting to `false`. This setting can also be changed with the cluster update settings API. Closed indices consume a significant amount of disk-space which can cause problems in managed environments. Closing indices can be turned off with the cluster settings API by setting `cluster.indices.close.enable` to `false`. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-close.html | Elasticsearch API documentation} */ async close (this: That, params: T.IndicesCloseRequest | TB.IndicesCloseRequest, options?: TransportRequestOptionsWithOutMeta): Promise async close (this: That, params: T.IndicesCloseRequest | TB.IndicesCloseRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -247,8 +279,8 @@ export default class Indices { } /** - * Create an index. Creates a new index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html | Elasticsearch API documentation} + * Create an index. You can use the create index API to add a new index to an Elasticsearch cluster. When creating an index, you can specify the following: * Settings for the index. * Mappings for fields in the index. * Index aliases **Wait for active shards** By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. The index creation response will indicate what happened. For example, `acknowledged` indicates whether the index was successfully created in the cluster, `while shards_acknowledged` indicates whether the requisite number of shard copies were started for each shard in the index before timing out. Note that it is still possible for either `acknowledged` or `shards_acknowledged` to be `false`, but for the index creation to be successful. These values simply indicate whether the operation completed before the timeout. If `acknowledged` is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. If `shards_acknowledged` is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, `acknowledged` is `true`). You can change the default of only waiting for the primary shards to start through the index setting `index.write.wait_for_active_shards`. Note that changing this setting will also affect the `wait_for_active_shards` value on all subsequent write operations. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-create-index.html | Elasticsearch API documentation} */ async create (this: That, params: T.IndicesCreateRequest | TB.IndicesCreateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async create (this: That, params: T.IndicesCreateRequest | TB.IndicesCreateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -291,8 +323,8 @@ export default class Indices { } /** - * Create a data stream. Creates a data stream. You must have a matching index template with data stream enabled. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html | Elasticsearch API documentation} + * Create a data stream. You must have a matching index template with data stream enabled. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-create-data-stream.html | Elasticsearch API documentation} */ async createDataStream (this: That, params: T.IndicesCreateDataStreamRequest | TB.IndicesCreateDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise async createDataStream (this: That, params: T.IndicesCreateDataStreamRequest | TB.IndicesCreateDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -323,8 +355,46 @@ export default class Indices { } /** - * Get data stream stats. Retrieves statistics for one or more data streams. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html | Elasticsearch API documentation} + * Create an index from a source index. Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/migrate-data-stream.html | Elasticsearch API documentation} + */ + async createFrom (this: That, params: T.IndicesCreateFromRequest | TB.IndicesCreateFromRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async createFrom (this: That, params: T.IndicesCreateFromRequest | TB.IndicesCreateFromRequest, options?: TransportRequestOptionsWithMeta): Promise> + async createFrom (this: That, params: T.IndicesCreateFromRequest | TB.IndicesCreateFromRequest, options?: TransportRequestOptions): Promise + async createFrom (this: That, params: T.IndicesCreateFromRequest | TB.IndicesCreateFromRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['source', 'dest'] + const acceptedBody: string[] = ['create_from'] + const querystring: Record = {} + // @ts-expect-error + let body: any = params.body ?? undefined + + for (const key in params) { + if (acceptedBody.includes(key)) { + // @ts-expect-error + body = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_create_from/${encodeURIComponent(params.source.toString())}/${encodeURIComponent(params.dest.toString())}` + const meta: TransportRequestMetadata = { + name: 'indices.create_from', + pathParts: { + source: params.source, + dest: params.dest + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Get data stream stats. Get statistics for one or more data streams. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/data-stream-stats-api.html | Elasticsearch API documentation} */ async dataStreamsStats (this: That, params?: T.IndicesDataStreamsStatsRequest | TB.IndicesDataStreamsStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async dataStreamsStats (this: That, params?: T.IndicesDataStreamsStatsRequest | TB.IndicesDataStreamsStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -363,8 +433,8 @@ export default class Indices { } /** - * Delete indices. Deletes one or more indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html | Elasticsearch API documentation} + * Delete indices. Deleting an index deletes its documents, shards, and metadata. It does not delete related Kibana components, such as data views, visualizations, or dashboards. You cannot delete the current write index of a data stream. To delete the index, you must roll over the data stream so a new write index is created. You can then use the delete index API to delete the previous write index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-delete-index.html | Elasticsearch API documentation} */ async delete (this: That, params: T.IndicesDeleteRequest | TB.IndicesDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async delete (this: That, params: T.IndicesDeleteRequest | TB.IndicesDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -396,7 +466,7 @@ export default class Indices { /** * Delete an alias. Removes a data stream or index from an alias. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-delete-alias.html | Elasticsearch API documentation} */ async deleteAlias (this: That, params: T.IndicesDeleteAliasRequest | TB.IndicesDeleteAliasRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteAlias (this: That, params: T.IndicesDeleteAliasRequest | TB.IndicesDeleteAliasRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -436,7 +506,7 @@ export default class Indices { /** * Delete data stream lifecycles. Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-delete-lifecycle.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/data-streams-delete-lifecycle.html | Elasticsearch API documentation} */ async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -468,7 +538,7 @@ export default class Indices { /** * Delete data streams. Deletes one or more data streams and their backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-delete-data-stream.html | Elasticsearch API documentation} */ async deleteDataStream (this: That, params: T.IndicesDeleteDataStreamRequest | TB.IndicesDeleteDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteDataStream (this: That, params: T.IndicesDeleteDataStreamRequest | TB.IndicesDeleteDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -500,7 +570,7 @@ export default class Indices { /** * Delete an index template. The provided may contain multiple template names separated by a comma. If multiple template names are specified then there is no wildcard support and the provided names should match completely with existing templates. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-delete-template.html | Elasticsearch API documentation} */ async deleteIndexTemplate (this: That, params: T.IndicesDeleteIndexTemplateRequest | TB.IndicesDeleteIndexTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteIndexTemplate (this: That, params: T.IndicesDeleteIndexTemplateRequest | TB.IndicesDeleteIndexTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -531,8 +601,8 @@ export default class Indices { } /** - * Deletes a legacy index template. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template-v1.html | Elasticsearch API documentation} + * Delete a legacy index template. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-delete-template-v1.html | Elasticsearch API documentation} */ async deleteTemplate (this: That, params: T.IndicesDeleteTemplateRequest | TB.IndicesDeleteTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteTemplate (this: That, params: T.IndicesDeleteTemplateRequest | TB.IndicesDeleteTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -563,8 +633,8 @@ export default class Indices { } /** - * Analyzes the disk usage of each field of an index or data stream. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-disk-usage.html | Elasticsearch API documentation} + * Analyze the index disk usage. Analyze the disk usage of each field of an index or data stream. This API might not support indices created in previous Elasticsearch versions. The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index `store_size` value because some small metadata files are ignored and some parts of data files might not be scanned by the API. Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. The stored size of the `_id` field is likely underestimated while the `_source` field is overestimated. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-disk-usage.html | Elasticsearch API documentation} */ async diskUsage (this: That, params: T.IndicesDiskUsageRequest | TB.IndicesDiskUsageRequest, options?: TransportRequestOptionsWithOutMeta): Promise async diskUsage (this: That, params: T.IndicesDiskUsageRequest | TB.IndicesDiskUsageRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -595,8 +665,8 @@ export default class Indices { } /** - * Aggregates a time series (TSDS) index and stores pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-downsample-data-stream.html | Elasticsearch API documentation} + * Downsample an index. Aggregate a time series (TSDS) index and store pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval. For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. All documents within an hour interval are summarized and stored as a single document in the downsample index. NOTE: Only indices in a time series data stream are supported. Neither field nor document level security can be defined on the source index. The source index must be read only (`index.blocks.write: true`). + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-downsample-data-stream.html | Elasticsearch API documentation} */ async downsample (this: That, params: T.IndicesDownsampleRequest | TB.IndicesDownsampleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async downsample (this: That, params: T.IndicesDownsampleRequest | TB.IndicesDownsampleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -633,8 +703,8 @@ export default class Indices { } /** - * Check indices. Checks if one or more indices, index aliases, or data streams exist. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html | Elasticsearch API documentation} + * Check indices. Check if one or more indices, index aliases, or data streams exist. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-exists.html | Elasticsearch API documentation} */ async exists (this: That, params: T.IndicesExistsRequest | TB.IndicesExistsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async exists (this: That, params: T.IndicesExistsRequest | TB.IndicesExistsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -665,8 +735,8 @@ export default class Indices { } /** - * Check aliases. Checks if one or more data stream or index aliases exist. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html | Elasticsearch API documentation} + * Check aliases. Check if one or more data stream or index aliases exist. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-exists-alias | Elasticsearch API documentation} */ async existsAlias (this: That, params: T.IndicesExistsAliasRequest | TB.IndicesExistsAliasRequest, options?: TransportRequestOptionsWithOutMeta): Promise async existsAlias (this: That, params: T.IndicesExistsAliasRequest | TB.IndicesExistsAliasRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -705,8 +775,8 @@ export default class Indices { } /** - * Returns information about whether a particular index template exists. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/index-templates.html | Elasticsearch API documentation} + * Check index templates. Check whether index templates exist. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-exists-index-template | Elasticsearch API documentation} */ async existsIndexTemplate (this: That, params: T.IndicesExistsIndexTemplateRequest | TB.IndicesExistsIndexTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async existsIndexTemplate (this: That, params: T.IndicesExistsIndexTemplateRequest | TB.IndicesExistsIndexTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -737,8 +807,8 @@ export default class Indices { } /** - * Check existence of index templates. Returns information about whether a particular index template exists. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html | Elasticsearch API documentation} + * Check existence of index templates. Get information about whether index templates exist. Index templates define settings, mappings, and aliases that can be applied automatically to new indices. IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-template-exists-v1.html | Elasticsearch API documentation} */ async existsTemplate (this: That, params: T.IndicesExistsTemplateRequest | TB.IndicesExistsTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async existsTemplate (this: That, params: T.IndicesExistsTemplateRequest | TB.IndicesExistsTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -769,8 +839,8 @@ export default class Indices { } /** - * Get the status for a data stream lifecycle. Retrieves information about an index or data stream’s current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-explain-lifecycle.html | Elasticsearch API documentation} + * Get the status for a data stream lifecycle. Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/data-streams-explain-lifecycle.html | Elasticsearch API documentation} */ async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -801,8 +871,8 @@ export default class Indices { } /** - * Returns field usage information for each shard and field of an index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/field-usage-stats.html | Elasticsearch API documentation} + * Get field usage stats. Get field usage information for each shard and field of an index. Field usage statistics are automatically captured when queries are running on a cluster. A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. The response body reports the per-shard usage count of the data structures that back the fields in the index. A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/field-usage-stats.html | Elasticsearch API documentation} */ async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest | TB.IndicesFieldUsageStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest | TB.IndicesFieldUsageStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -833,8 +903,8 @@ export default class Indices { } /** - * Flushes one or more data streams or indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html | Elasticsearch API documentation} + * Flush data streams or indices. Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. After each operation has been flushed it is permanently stored in the Lucene index. This may mean that there is no need to maintain an additional copy of it in the transaction log. The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-flush.html | Elasticsearch API documentation} */ async flush (this: That, params?: T.IndicesFlushRequest | TB.IndicesFlushRequest, options?: TransportRequestOptionsWithOutMeta): Promise async flush (this: That, params?: T.IndicesFlushRequest | TB.IndicesFlushRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -873,8 +943,8 @@ export default class Indices { } /** - * Performs the force merge operation on one or more indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html | Elasticsearch API documentation} + * Force a merge. Perform the force merge operation on the shards of one or more indices. For data streams, the API forces a merge on the shards of the stream's backing indices. Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". These soft-deleted documents are automatically cleaned up during regular segment merges. But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. **Blocks during a force merge** Calls to this API block until the merge is complete (unless request contains `wait_for_completion=false`). If the client connection is lost before completion then the force merge process will continue in the background. Any new requests to force merge the same indices will also block until the ongoing force merge is complete. **Running force merge asynchronously** If the request contains `wait_for_completion=false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. However, you can not cancel this task as the force merge task is not cancelable. Elasticsearch creates a record of this task as a document at `_tasks/`. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. **Force merging multiple indices** You can force merge multiple indices with a single request by targeting: * One or more data streams that contain multiple backing indices * Multiple indices * One or more aliases * All data streams and indices in a cluster Each targeted shard is force-merged separately using the force_merge threadpool. By default each node only has a single `force_merge` thread which means that the shards on that node are force-merged one at a time. If you expand the `force_merge` threadpool on a node then it will force merge its shards in parallel Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case `max_num_segments parameter` is set to `1`, to rewrite all segments into a new one. **Data streams and time-based indices** Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. In these cases, each index only receives indexing traffic for a certain period of time. Once an index receive no more writes, its shards can be force-merged to a single segment. This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. For example: ``` POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 ``` + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-forcemerge.html | Elasticsearch API documentation} */ async forcemerge (this: That, params?: T.IndicesForcemergeRequest | TB.IndicesForcemergeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async forcemerge (this: That, params?: T.IndicesForcemergeRequest | TB.IndicesForcemergeRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -913,8 +983,8 @@ export default class Indices { } /** - * Get index information. Returns information about one or more indices. For data streams, the API returns information about the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html | Elasticsearch API documentation} + * Get index information. Get information about one or more indices. For data streams, the API returns information about the stream’s backing indices. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-index.html | Elasticsearch API documentation} */ async get (this: That, params: T.IndicesGetRequest | TB.IndicesGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async get (this: That, params: T.IndicesGetRequest | TB.IndicesGetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -946,7 +1016,7 @@ export default class Indices { /** * Get aliases. Retrieves information for one or more data stream or index aliases. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-alias.html | Elasticsearch API documentation} */ async getAlias (this: That, params?: T.IndicesGetAliasRequest | TB.IndicesGetAliasRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getAlias (this: That, params?: T.IndicesGetAliasRequest | TB.IndicesGetAliasRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -992,8 +1062,8 @@ export default class Indices { } /** - * Get data stream lifecycles. Retrieves the data stream lifecycle configuration of one or more data streams. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-get-lifecycle.html | Elasticsearch API documentation} + * Get data stream lifecycles. Get the data stream lifecycle configuration of one or more data streams. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/data-streams-get-lifecycle.html | Elasticsearch API documentation} */ async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1024,8 +1094,38 @@ export default class Indices { } /** - * Get data streams. Retrieves information about one or more data streams. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html | Elasticsearch API documentation} + * Get data stream lifecycle stats. Get statistics about the data streams that are managed by a data stream lifecycle. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/data-streams-get-lifecycle-stats.html | Elasticsearch API documentation} + */ + async getDataLifecycleStats (this: That, params?: T.IndicesGetDataLifecycleStatsRequest | TB.IndicesGetDataLifecycleStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async getDataLifecycleStats (this: That, params?: T.IndicesGetDataLifecycleStatsRequest | TB.IndicesGetDataLifecycleStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> + async getDataLifecycleStats (this: That, params?: T.IndicesGetDataLifecycleStatsRequest | TB.IndicesGetDataLifecycleStatsRequest, options?: TransportRequestOptions): Promise + async getDataLifecycleStats (this: That, params?: T.IndicesGetDataLifecycleStatsRequest | TB.IndicesGetDataLifecycleStatsRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = [] + const querystring: Record = {} + const body = undefined + + params = params ?? {} + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'GET' + const path = '/_lifecycle/stats' + const meta: TransportRequestMetadata = { + name: 'indices.get_data_lifecycle_stats' + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Get data streams. Get information about one or more data streams. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-data-stream.html | Elasticsearch API documentation} */ async getDataStream (this: That, params?: T.IndicesGetDataStreamRequest | TB.IndicesGetDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getDataStream (this: That, params?: T.IndicesGetDataStreamRequest | TB.IndicesGetDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1064,8 +1164,8 @@ export default class Indices { } /** - * Get mapping definitions. Retrieves mapping definitions for one or more fields. For data streams, the API retrieves field mappings for the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html | Elasticsearch API documentation} + * Get mapping definitions. Retrieves mapping definitions for one or more fields. For data streams, the API retrieves field mappings for the stream’s backing indices. This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-field-mapping.html | Elasticsearch API documentation} */ async getFieldMapping (this: That, params: T.IndicesGetFieldMappingRequest | TB.IndicesGetFieldMappingRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getFieldMapping (this: That, params: T.IndicesGetFieldMappingRequest | TB.IndicesGetFieldMappingRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1104,8 +1204,8 @@ export default class Indices { } /** - * Get index templates. Returns information about one or more index templates. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html | Elasticsearch API documentation} + * Get index templates. Get information about one or more index templates. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-template.html | Elasticsearch API documentation} */ async getIndexTemplate (this: That, params?: T.IndicesGetIndexTemplateRequest | TB.IndicesGetIndexTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getIndexTemplate (this: That, params?: T.IndicesGetIndexTemplateRequest | TB.IndicesGetIndexTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1144,8 +1244,8 @@ export default class Indices { } /** - * Get mapping definitions. Retrieves mapping definitions for one or more indices. For data streams, the API retrieves mappings for the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html | Elasticsearch API documentation} + * Get mapping definitions. For data streams, the API retrieves mappings for the stream’s backing indices. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-mapping.html | Elasticsearch API documentation} */ async getMapping (this: That, params?: T.IndicesGetMappingRequest | TB.IndicesGetMappingRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getMapping (this: That, params?: T.IndicesGetMappingRequest | TB.IndicesGetMappingRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1184,8 +1284,40 @@ export default class Indices { } /** - * Get index settings. Returns setting information for one or more indices. For data streams, returns setting information for the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html | Elasticsearch API documentation} + * Get the migration reindexing status. Get the status of a migration reindex attempt for a data stream or index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/migrate-data-stream.html | Elasticsearch API documentation} + */ + async getMigrateReindexStatus (this: That, params: T.IndicesGetMigrateReindexStatusRequest | TB.IndicesGetMigrateReindexStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async getMigrateReindexStatus (this: That, params: T.IndicesGetMigrateReindexStatusRequest | TB.IndicesGetMigrateReindexStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> + async getMigrateReindexStatus (this: That, params: T.IndicesGetMigrateReindexStatusRequest | TB.IndicesGetMigrateReindexStatusRequest, options?: TransportRequestOptions): Promise + async getMigrateReindexStatus (this: That, params: T.IndicesGetMigrateReindexStatusRequest | TB.IndicesGetMigrateReindexStatusRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['index'] + const querystring: Record = {} + const body = undefined + + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'GET' + const path = `/_migration/reindex/${encodeURIComponent(params.index.toString())}/_status` + const meta: TransportRequestMetadata = { + name: 'indices.get_migrate_reindex_status', + pathParts: { + index: params.index + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Get index settings. Get setting information for one or more indices. For data streams, it returns setting information for the stream's backing indices. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-settings.html | Elasticsearch API documentation} */ async getSettings (this: That, params?: T.IndicesGetSettingsRequest | TB.IndicesGetSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getSettings (this: That, params?: T.IndicesGetSettingsRequest | TB.IndicesGetSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1231,8 +1363,8 @@ export default class Indices { } /** - * Get index templates. Retrieves information about one or more index templates. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html | Elasticsearch API documentation} + * Get index templates. Get information about one or more index templates. IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-template-v1.html | Elasticsearch API documentation} */ async getTemplate (this: That, params?: T.IndicesGetTemplateRequest | TB.IndicesGetTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getTemplate (this: That, params?: T.IndicesGetTemplateRequest | TB.IndicesGetTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1270,9 +1402,43 @@ export default class Indices { return await this.transport.request({ path, method, querystring, body, meta }, options) } + /** + * Reindex legacy backing indices. Reindex all legacy backing indices for a data stream. This operation occurs in a persistent task. The persistent task ID is returned immediately and the reindexing work is completed in that task. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/migrate-data-stream.html | Elasticsearch API documentation} + */ + async migrateReindex (this: That, params: T.IndicesMigrateReindexRequest | TB.IndicesMigrateReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async migrateReindex (this: That, params: T.IndicesMigrateReindexRequest | TB.IndicesMigrateReindexRequest, options?: TransportRequestOptionsWithMeta): Promise> + async migrateReindex (this: That, params: T.IndicesMigrateReindexRequest | TB.IndicesMigrateReindexRequest, options?: TransportRequestOptions): Promise + async migrateReindex (this: That, params: T.IndicesMigrateReindexRequest | TB.IndicesMigrateReindexRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = [] + const acceptedBody: string[] = ['reindex'] + const querystring: Record = {} + // @ts-expect-error + let body: any = params.body ?? undefined + + for (const key in params) { + if (acceptedBody.includes(key)) { + // @ts-expect-error + body = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = '/_migration/reindex' + const meta: TransportRequestMetadata = { + name: 'indices.migrate_reindex' + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + /** * Convert an index alias to a data stream. Converts an index alias to a data stream. You must have a matching index template that is data stream enabled. The alias must meet the following criteria: The alias must have a write index; All indices for the alias must have a `@timestamp` field mapping of a `date` or `date_nanos` field type; The alias must not have any filters; The alias must not use custom routing. If successful, the request removes the alias and creates a data stream with the same name. The indices for the alias become hidden backing indices for the stream. The write index for the alias becomes the write index for the stream. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-migrate-to-data-stream | Elasticsearch API documentation} */ async migrateToDataStream (this: That, params: T.IndicesMigrateToDataStreamRequest | TB.IndicesMigrateToDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise async migrateToDataStream (this: That, params: T.IndicesMigrateToDataStreamRequest | TB.IndicesMigrateToDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1304,7 +1470,7 @@ export default class Indices { /** * Update data streams. Performs one or more data stream modification actions in a single atomic operation. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-modify-data-stream | Elasticsearch API documentation} */ async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1344,8 +1510,8 @@ export default class Indices { } /** - * Opens a closed index. For data streams, the API opens any closed backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html | Elasticsearch API documentation} + * Open a closed index. For data streams, the API opens any closed backing indices. A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. It is not possible to index documents or to search for documents in a closed index. This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. The shards will then go through the normal recovery process. The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. You can open and close multiple indices. An error is thrown if the request explicitly refers to a missing index. This behavior can be turned off by using the `ignore_unavailable=true` parameter. By default, you must explicitly name the indices you are opening or closing. To open or close indices with `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`. This setting can also be changed with the cluster update settings API. Closed indices consume a significant amount of disk-space which can cause problems in managed environments. Closing indices can be turned off with the cluster settings API by setting `cluster.indices.close.enable` to `false`. Because opening or closing an index allocates its shards, the `wait_for_active_shards` setting on index creation applies to the `_open` and `_close` index actions as well. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-open-close.html | Elasticsearch API documentation} */ async open (this: That, params: T.IndicesOpenRequest | TB.IndicesOpenRequest, options?: TransportRequestOptionsWithOutMeta): Promise async open (this: That, params: T.IndicesOpenRequest | TB.IndicesOpenRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1376,8 +1542,8 @@ export default class Indices { } /** - * Promotes a data stream from a replicated data stream managed by CCR to a regular data stream - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html | Elasticsearch API documentation} + * Promote a data stream. Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. These data streams can't be rolled over in the local cluster. These replicated data streams roll over only if the upstream data stream rolls over. In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. If this is missing, the data stream will not be able to roll over until a matching index template is created. This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-promote-data-stream | Elasticsearch API documentation} */ async promoteDataStream (this: That, params: T.IndicesPromoteDataStreamRequest | TB.IndicesPromoteDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise async promoteDataStream (this: That, params: T.IndicesPromoteDataStreamRequest | TB.IndicesPromoteDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1409,7 +1575,7 @@ export default class Indices { /** * Create or update an alias. Adds a data stream or index to an alias. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-put-alias | Elasticsearch API documentation} */ async putAlias (this: That, params: T.IndicesPutAliasRequest | TB.IndicesPutAliasRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putAlias (this: That, params: T.IndicesPutAliasRequest | TB.IndicesPutAliasRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1461,14 +1627,14 @@ export default class Indices { /** * Update data stream lifecycles. Update the data stream lifecycle of the specified data streams. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-put-lifecycle.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-put-data-lifecycle | Elasticsearch API documentation} */ async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptions): Promise async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedBody: string[] = ['data_retention', 'downsampling'] + const acceptedBody: string[] = ['data_retention', 'downsampling', 'enabled'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -1504,8 +1670,8 @@ export default class Indices { } /** - * Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html | Elasticsearch API documentation} + * Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices. Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. Index templates are applied during data stream or index creation. For data streams, these settings and mappings are applied when the stream's backing indices are created. Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. You can use C-style `/* *\/` block comments in index templates. You can include comments anywhere in the request body, except before the opening curly bracket. **Multiple matching templates** If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. **Composing aliases, mappings, and settings** When multiple component templates are specified in the `composed_of` field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. Any mappings, settings, or aliases from the parent index template are merged in next. Finally, any configuration on the index request itself is merged. Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. This recursive merging strategy applies not only to field mappings, but also root options like `dynamic_templates` and `meta`. If an earlier component contains a `dynamic_templates` block, then by default new `dynamic_templates` entries are appended onto the end. If an entry already exists with the same key, then it is overwritten by the new definition. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-put-index-template | Elasticsearch API documentation} */ async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest | TB.IndicesPutIndexTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest | TB.IndicesPutIndexTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1548,8 +1714,8 @@ export default class Indices { } /** - * Update field mappings. Adds new fields to an existing data stream or index. You can also use this API to change the search settings of existing fields. For data streams, these changes are applied to all backing indices by default. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html | Elasticsearch API documentation} + * Update field mappings. Add new fields to an existing data stream or index. You can also use this API to change the search settings of existing fields and add new properties to existing object fields. For data streams, these changes are applied to all backing indices by default. **Add multi-fields to an existing field** Multi-fields let you index the same field in different ways. You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. You can populate the new multi-field with the update by query API. **Change supported mapping parameters for an existing field** The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. For example, you can use the update mapping API to update the `ignore_above` parameter. **Change the mapping of an existing field** Except for supported mapping parameters, you can't change the mapping or field type of an existing field. Changing an existing field could invalidate data that's already indexed. If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. **Rename a field** Renaming a field would invalidate data already indexed under the old field name. Instead, add an alias field to create an alternate field name. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-put-mapping.html | Elasticsearch API documentation} */ async putMapping (this: That, params: T.IndicesPutMappingRequest | TB.IndicesPutMappingRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putMapping (this: That, params: T.IndicesPutMappingRequest | TB.IndicesPutMappingRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1592,8 +1758,8 @@ export default class Indices { } /** - * Update index settings. Changes dynamic index settings in real time. For data streams, index setting changes are applied to all backing indices by default. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html | Elasticsearch API documentation} + * Update index settings. Changes dynamic index settings in real time. For data streams, index setting changes are applied to all backing indices by default. To revert a setting to the default value, use a null value. The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. To preserve existing settings from being updated, set the `preserve_existing` parameter to `true`. NOTE: You can only define new analyzers on closed indices. To add an analyzer, you must close the index, define the analyzer, and reopen the index. You cannot close the write index of a data stream. To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. This affects searches and any new data added to the stream after the rollover. However, it does not affect the data stream's backing indices or their existing data. To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-update-settings.html | Elasticsearch API documentation} */ async putSettings (this: That, params: T.IndicesPutSettingsRequest | TB.IndicesPutSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putSettings (this: That, params: T.IndicesPutSettingsRequest | TB.IndicesPutSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1636,8 +1802,8 @@ export default class Indices { } /** - * Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html | Elasticsearch API documentation} + * Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices. Elasticsearch applies templates to new indices based on an index pattern that matches the index name. IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. Composable templates always take precedence over legacy templates. If no composable template matches a new index, matching legacy templates are applied according to their order. Index templates are only applied during index creation. Changes to index templates do not affect existing indices. Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. You can use C-style `/* *\/` block comments in index templates. You can include comments anywhere in the request body, except before the opening curly bracket. **Indices matching multiple templates** Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-templates-v1.html | Elasticsearch API documentation} */ async putTemplate (this: That, params: T.IndicesPutTemplateRequest | TB.IndicesPutTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putTemplate (this: That, params: T.IndicesPutTemplateRequest | TB.IndicesPutTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1680,8 +1846,8 @@ export default class Indices { } /** - * Returns information about ongoing and completed shard recoveries for one or more indices. For data streams, the API returns information for the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html | Elasticsearch API documentation} + * Get index recovery information. Get information about ongoing and completed shard recoveries for one or more indices. For data streams, the API returns information for the stream's backing indices. All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing. Recovery automatically occurs during the following processes: * When creating an index for the first time. * When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. * Creation of new replica shard copies from the primary. * Relocation of a shard copy to a different node in the same cluster. * A snapshot restore operation. * A clone, shrink, or split operation. You can determine the cause of a shard recovery using the recovery or cat recovery APIs. The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-recovery.html | Elasticsearch API documentation} */ async recovery (this: That, params?: T.IndicesRecoveryRequest | TB.IndicesRecoveryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async recovery (this: That, params?: T.IndicesRecoveryRequest | TB.IndicesRecoveryRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1720,8 +1886,8 @@ export default class Indices { } /** - * Refresh an index. A refresh makes recent operations performed on one or more indices available for search. For data streams, the API runs the refresh operation on the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html | Elasticsearch API documentation} + * Refresh an index. A refresh makes recent operations performed on one or more indices available for search. For data streams, the API runs the refresh operation on the stream’s backing indices. By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. You can change this default interval with the `index.refresh_interval` setting. Refresh requests are synchronous and do not return a response until the refresh operation completes. Refreshes are resource-intensive. To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's `refresh=wait_for` query parameter option. This option ensures the indexing operation waits for a periodic refresh before running the search. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-refresh.html | Elasticsearch API documentation} */ async refresh (this: That, params?: T.IndicesRefreshRequest | TB.IndicesRefreshRequest, options?: TransportRequestOptionsWithOutMeta): Promise async refresh (this: That, params?: T.IndicesRefreshRequest | TB.IndicesRefreshRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1760,8 +1926,8 @@ export default class Indices { } /** - * Reloads an index's search analyzers and their resources. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html | Elasticsearch API documentation} + * Reload search analyzers. Reload an index's search analyzers and their resources. For data streams, the API reloads search analyzers and resources for the stream's backing indices. IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. You can use the reload search analyzers API to pick up changes to synonym files used in the `synonym_graph` or `synonym` token filter of a search analyzer. To be eligible, the token filter must have an `updateable` flag of `true` and only be used in search analyzers. NOTE: This API does not perform a reload for each shard of an index. Instead, it performs a reload for each node containing index shards. As a result, the total shard count returned by the API can differ from the number of index shards. Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-reload-analyzers.html | Elasticsearch API documentation} */ async reloadSearchAnalyzers (this: That, params: T.IndicesReloadSearchAnalyzersRequest | TB.IndicesReloadSearchAnalyzersRequest, options?: TransportRequestOptionsWithOutMeta): Promise async reloadSearchAnalyzers (this: That, params: T.IndicesReloadSearchAnalyzersRequest | TB.IndicesReloadSearchAnalyzersRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1792,17 +1958,18 @@ export default class Indices { } /** - * Resolves the specified index expressions to return information about each cluster, including the local cluster, if included. Multiple patterns and remote clusters are supported. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html | Elasticsearch API documentation} + * Resolve the cluster. Resolve the specified index expressions to return information about each cluster, including the local "querying" cluster, if included. If no index expression is provided, the API will return information about all the remote clusters that are configured on the querying cluster. This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. You use the same index expression with this endpoint as you would for cross-cluster search. Index and cluster exclusions are also supported with this endpoint. For each cluster in the index expression, information is returned about: * Whether the querying ("local") cluster is currently connected to each remote cluster specified in the index expression. Note that this endpoint actively attempts to contact the remote clusters, unlike the `remote/info` endpoint. * Whether each remote cluster is configured with `skip_unavailable` as `true` or `false`. * Whether there are any indices, aliases, or data streams on that cluster that match the index expression. * Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). * Cluster version information, including the Elasticsearch server version. For example, `GET /_resolve/cluster/my-index-*,cluster*:my-index-*` returns information about the local cluster and all remotely configured clusters that start with the alias `cluster*`. Each cluster returns information about whether it has any indices, aliases or data streams that match `my-index-*`. ## Note on backwards compatibility The ability to query without an index expression was added in version 8.18, so when querying remote clusters older than that, the local cluster will send the index expression `dummy*` to those remote clusters. Thus, if an errors occur, you may see a reference to that index expression even though you didn't request it. If it causes a problem, you can instead include an index expression like `*:*` to bypass the issue. ## Advantages of using this endpoint before a cross-cluster search You may want to exclude a cluster or index from a search when: * A remote cluster is not currently connected and is configured with `skip_unavailable=false`. Running a cross-cluster search under those conditions will cause the entire search to fail. * A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is `logs*,remote1:logs*` and the remote1 cluster has no indices, aliases or data streams that match `logs*`. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. * The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the `_resolve/cluster` response will be present. (This is also where security/permission errors will be shown.) * A remote cluster is an older version that does not support the feature you want to use in your search. ## Test availability of remote clusters The `remote/info` endpoint is commonly used to test whether the "local" cluster (the cluster being queried) is connected to its remote clusters, but it does not necessarily reflect whether the remote cluster is available or not. The remote cluster may be available, while the local cluster is not currently connected to it. You can use the `_resolve/cluster` API to attempt to reconnect to remote clusters. For example with `GET _resolve/cluster` or `GET _resolve/cluster/*:*`. The `connected` field in the response will indicate whether it was successful. If a connection was (re-)established, this will also cause the `remote/info` endpoint to now indicate a connected status. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-resolve-cluster-api.html | Elasticsearch API documentation} */ - async resolveCluster (this: That, params: T.IndicesResolveClusterRequest | TB.IndicesResolveClusterRequest, options?: TransportRequestOptionsWithOutMeta): Promise - async resolveCluster (this: That, params: T.IndicesResolveClusterRequest | TB.IndicesResolveClusterRequest, options?: TransportRequestOptionsWithMeta): Promise> - async resolveCluster (this: That, params: T.IndicesResolveClusterRequest | TB.IndicesResolveClusterRequest, options?: TransportRequestOptions): Promise - async resolveCluster (this: That, params: T.IndicesResolveClusterRequest | TB.IndicesResolveClusterRequest, options?: TransportRequestOptions): Promise { + async resolveCluster (this: That, params?: T.IndicesResolveClusterRequest | TB.IndicesResolveClusterRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async resolveCluster (this: That, params?: T.IndicesResolveClusterRequest | TB.IndicesResolveClusterRequest, options?: TransportRequestOptionsWithMeta): Promise> + async resolveCluster (this: That, params?: T.IndicesResolveClusterRequest | TB.IndicesResolveClusterRequest, options?: TransportRequestOptions): Promise + async resolveCluster (this: That, params?: T.IndicesResolveClusterRequest | TB.IndicesResolveClusterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const querystring: Record = {} const body = undefined + params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue @@ -1812,8 +1979,15 @@ export default class Indices { } } - const method = 'GET' - const path = `/_resolve/cluster/${encodeURIComponent(params.name.toString())}` + let method = '' + let path = '' + if (params.name != null) { + method = 'GET' + path = `/_resolve/cluster/${encodeURIComponent(params.name.toString())}` + } else { + method = 'GET' + path = '/_resolve/cluster' + } const meta: TransportRequestMetadata = { name: 'indices.resolve_cluster', pathParts: { @@ -1824,8 +1998,8 @@ export default class Indices { } /** - * Resolves the specified name(s) and/or index patterns for indices, aliases, and data streams. Multiple patterns and remote clusters are supported. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index-api.html | Elasticsearch API documentation} + * Resolve indices. Resolve the names and/or index patterns for indices, aliases, and data streams. Multiple patterns and remote clusters are supported. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-resolve-index-api.html | Elasticsearch API documentation} */ async resolveIndex (this: That, params: T.IndicesResolveIndexRequest | TB.IndicesResolveIndexRequest, options?: TransportRequestOptionsWithOutMeta): Promise async resolveIndex (this: That, params: T.IndicesResolveIndexRequest | TB.IndicesResolveIndexRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1856,8 +2030,8 @@ export default class Indices { } /** - * Roll over to a new index. Creates a new index for a data stream or index alias. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html | Elasticsearch API documentation} + * Roll over to a new index. TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. The rollover API creates a new index for a data stream or index alias. The API behavior depends on the rollover target. **Roll over a data stream** If you roll over a data stream, the API creates a new write index for the stream. The stream's previous write index becomes a regular backing index. A rollover also increments the data stream's generation. **Roll over an index alias with a write index** TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. If an index alias points to multiple indices, one of the indices must be a write index. The rollover API creates a new write index for the alias with `is_write_index` set to `true`. The API also `sets is_write_index` to `false` for the previous write index. **Roll over an index alias with one index** If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. NOTE: A rollover creates a new index and is subject to the `wait_for_active_shards` setting. **Increment index names for an alias** When you roll over an index alias, you can specify a name for the new index. If you don't specify a name and the current index ends with `-` and a number, such as `my-index-000001` or `my-index-3`, the new index name increments that number. For example, if you roll over an alias with a current index of `my-index-000001`, the rollover creates a new index named `my-index-000002`. This number is always six characters and zero-padded, regardless of the previous index's name. If you use an index alias for time series data, you can use date math in the index name to track the rollover date. For example, you can create an alias that points to an index named ``. If you create the index on May 6, 2099, the index's name is `my-index-2099.05.06-000001`. If you roll over the alias on May 7, 2099, the new index's name is `my-index-2099.05.07-000002`. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-rollover-index.html | Elasticsearch API documentation} */ async rollover (this: That, params: T.IndicesRolloverRequest | TB.IndicesRolloverRequest, options?: TransportRequestOptionsWithOutMeta): Promise async rollover (this: That, params: T.IndicesRolloverRequest | TB.IndicesRolloverRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1908,8 +2082,8 @@ export default class Indices { } /** - * Returns low-level information about the Lucene segments in index shards. For data streams, the API returns information about the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html | Elasticsearch API documentation} + * Get index segments. Get low-level information about the Lucene segments in index shards. For data streams, the API returns information about the stream's backing indices. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-segments.html | Elasticsearch API documentation} */ async segments (this: That, params?: T.IndicesSegmentsRequest | TB.IndicesSegmentsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async segments (this: That, params?: T.IndicesSegmentsRequest | TB.IndicesSegmentsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1948,8 +2122,8 @@ export default class Indices { } /** - * Retrieves store information about replica shards in one or more indices. For data streams, the API retrieves store information for the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html | Elasticsearch API documentation} + * Get index shard stores. Get store information about replica shards in one or more indices. For data streams, the API retrieves store information for the stream's backing indices. The index shard stores API returns the following information: * The node on which each replica shard exists. * The allocation ID for each replica shard. * A unique ID for each replica shard. * Any errors encountered while opening the shard index or from an earlier failure. By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-shards-stores.html | Elasticsearch API documentation} */ async shardStores (this: That, params?: T.IndicesShardStoresRequest | TB.IndicesShardStoresRequest, options?: TransportRequestOptionsWithOutMeta): Promise async shardStores (this: That, params?: T.IndicesShardStoresRequest | TB.IndicesShardStoresRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1988,8 +2162,8 @@ export default class Indices { } /** - * Shrinks an existing index into a new index with fewer primary shards. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html | Elasticsearch API documentation} + * Shrink an index. Shrink an index into a new index with fewer primary shards. Before you can shrink an index: * The index must be read-only. * A copy of every shard in the index must reside on the same node. * The index must have a green health status. To make shard allocation easier, we recommend you also remove the index's replica shards. You can later re-add replica shards as part of the shrink operation. The requested number of primary shards in the target index must be a factor of the number of shards in the source index. For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. If the number of shards in the index is a prime number it can only be shrunk into a single primary shard Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. A shrink operation: * Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. * Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. * Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the `.routing.allocation.initial_recovery._id` index setting. IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: * The target index must not exist. * The source index must have more primary shards than the target index. * The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. * The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. * The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-shrink-index.html | Elasticsearch API documentation} */ async shrink (this: That, params: T.IndicesShrinkRequest | TB.IndicesShrinkRequest, options?: TransportRequestOptionsWithOutMeta): Promise async shrink (this: That, params: T.IndicesShrinkRequest | TB.IndicesShrinkRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2033,8 +2207,8 @@ export default class Indices { } /** - * Simulate an index. Returns the index configuration that would be applied to the specified index from an existing index template. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-index.html | Elasticsearch API documentation} + * Simulate an index. Get the index configuration that would be applied to the specified index from an existing index template. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-simulate-index.html | Elasticsearch API documentation} */ async simulateIndexTemplate (this: That, params: T.IndicesSimulateIndexTemplateRequest | TB.IndicesSimulateIndexTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async simulateIndexTemplate (this: That, params: T.IndicesSimulateIndexTemplateRequest | TB.IndicesSimulateIndexTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2065,8 +2239,8 @@ export default class Indices { } /** - * Simulate an index template. Returns the index configuration that would be applied by a particular index template. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html | Elasticsearch API documentation} + * Simulate an index template. Get the index configuration that would be applied by a particular index template. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-simulate-template.html | Elasticsearch API documentation} */ async simulateTemplate (this: That, params?: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async simulateTemplate (this: That, params?: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2117,8 +2291,8 @@ export default class Indices { } /** - * Splits an existing index into a new index with more primary shards. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html | Elasticsearch API documentation} + * Split an index. Split an index into a new index with more primary shards. * Before you can split an index: * The index must be read-only. * The cluster health status must be green. You can do make an index read-only with the following request using the add index block API: ``` PUT /my_source_index/_block/write ``` The current write index on a data stream cannot be split. In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the `index.number_of_routing_shards` setting. The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. For instance, a 5 shard index with `number_of_routing_shards` set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. A split operation: * Creates a new target index with the same definition as the source index, but with a larger number of primary shards. * Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. * Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. * Recovers the target index as though it were a closed index which had just been re-opened. IMPORTANT: Indices can only be split if they satisfy the following requirements: * The target index must not exist. * The source index must have fewer primary shards than the target index. * The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. * The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-split-index.html | Elasticsearch API documentation} */ async split (this: That, params: T.IndicesSplitRequest | TB.IndicesSplitRequest, options?: TransportRequestOptionsWithOutMeta): Promise async split (this: That, params: T.IndicesSplitRequest | TB.IndicesSplitRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2162,8 +2336,8 @@ export default class Indices { } /** - * Returns statistics for one or more indices. For data streams, the API retrieves statistics for the stream’s backing indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html | Elasticsearch API documentation} + * Get index statistics. For data streams, the API retrieves statistics for the stream's backing indices. By default, the returned statistics are index-level with `primaries` and `total` aggregations. `primaries` are the values for only the primary shards. `total` are the accumulated values for both primary and replica shards. To get shard-level statistics, set the `level` parameter to `shards`. NOTE: When moving to another node, the shard-level statistics for a shard are cleared. Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-stats.html | Elasticsearch API documentation} */ async stats (this: That, params?: T.IndicesStatsRequest | TB.IndicesStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stats (this: That, params?: T.IndicesStatsRequest | TB.IndicesStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2209,8 +2383,8 @@ export default class Indices { } /** - * Unfreezes an index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/unfreeze-index-api.html | Elasticsearch API documentation} + * Unfreeze an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/unfreeze-index-api.html | Elasticsearch API documentation} */ async unfreeze (this: That, params: T.IndicesUnfreezeRequest | TB.IndicesUnfreezeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async unfreeze (this: That, params: T.IndicesUnfreezeRequest | TB.IndicesUnfreezeRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2242,7 +2416,7 @@ export default class Indices { /** * Create or update an alias. Adds a data stream or index to an alias. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-update-aliases | Elasticsearch API documentation} */ async updateAliases (this: That, params?: T.IndicesUpdateAliasesRequest | TB.IndicesUpdateAliasesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateAliases (this: That, params?: T.IndicesUpdateAliasesRequest | TB.IndicesUpdateAliasesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2284,7 +2458,7 @@ export default class Indices { /** * Validate a query. Validates a query without running it. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-validate.html | Elasticsearch API documentation} */ async validateQuery (this: That, params?: T.IndicesValidateQueryRequest | TB.IndicesValidateQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async validateQuery (this: That, params?: T.IndicesValidateQueryRequest | TB.IndicesValidateQueryRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/inference.ts b/src/api/api/inference.ts index ad69cb84a..abf9b67ae 100644 --- a/src/api/api/inference.ts +++ b/src/api/api/inference.ts @@ -44,9 +44,90 @@ export default class Inference { this.transport = transport } + /** + * Perform chat completion inference + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/chat-completion-inference-api.html | Elasticsearch API documentation} + */ + async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest | TB.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest | TB.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptionsWithMeta): Promise> + async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest | TB.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptions): Promise + async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest | TB.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['inference_id'] + const acceptedBody: string[] = ['chat_completion_request'] + const querystring: Record = {} + // @ts-expect-error + let body: any = params.body ?? undefined + + for (const key in params) { + if (acceptedBody.includes(key)) { + // @ts-expect-error + body = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_inference/chat_completion/${encodeURIComponent(params.inference_id.toString())}/_stream` + const meta: TransportRequestMetadata = { + name: 'inference.chat_completion_unified', + pathParts: { + inference_id: params.inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Perform completion inference on the service + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-inference-api.html | Elasticsearch API documentation} + */ + async completion (this: That, params: T.InferenceCompletionRequest | TB.InferenceCompletionRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async completion (this: That, params: T.InferenceCompletionRequest | TB.InferenceCompletionRequest, options?: TransportRequestOptionsWithMeta): Promise> + async completion (this: That, params: T.InferenceCompletionRequest | TB.InferenceCompletionRequest, options?: TransportRequestOptions): Promise + async completion (this: That, params: T.InferenceCompletionRequest | TB.InferenceCompletionRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['inference_id'] + const acceptedBody: string[] = ['input', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_inference/completion/${encodeURIComponent(params.inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.completion', + pathParts: { + inference_id: params.inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + /** * Delete an inference endpoint - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-inference-api.html | Elasticsearch API documentation} */ async delete (this: That, params: T.InferenceDeleteRequest | TB.InferenceDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async delete (this: That, params: T.InferenceDeleteRequest | TB.InferenceDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -86,7 +167,7 @@ export default class Inference { /** * Get an inference endpoint - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-inference-api.html | Elasticsearch API documentation} */ async get (this: That, params?: T.InferenceGetRequest | TB.InferenceGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async get (this: That, params?: T.InferenceGetRequest | TB.InferenceGetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -129,8 +210,8 @@ export default class Inference { } /** - * Perform inference on the service - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html | Elasticsearch API documentation} + * Perform inference on the service. This API enables you to use machine learning models to perform specific tasks on data that you provide as an input. It returns a response with the results of the tasks. The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API. For details about using this API with a service, such as Amazon Bedrock, Anthropic, or HuggingFace, refer to the service-specific documentation. > info > The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-inference-api.html | Elasticsearch API documentation} */ async inference (this: That, params: T.InferenceInferenceRequest | TB.InferenceInferenceRequest, options?: TransportRequestOptionsWithOutMeta): Promise async inference (this: That, params: T.InferenceInferenceRequest | TB.InferenceInferenceRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -181,8 +262,8 @@ export default class Inference { } /** - * Create an inference endpoint - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html | Elasticsearch API documentation} + * Create an inference endpoint. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-inference-api.html | Elasticsearch API documentation} */ async put (this: That, params: T.InferencePutRequest | TB.InferencePutRequest, options?: TransportRequestOptionsWithOutMeta): Promise async put (this: That, params: T.InferencePutRequest | TB.InferencePutRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -224,4 +305,945 @@ export default class Inference { } return await this.transport.request({ path, method, querystring, body, meta }, options) } + + /** + * Create an AlibabaCloud AI Search inference endpoint. Create an inference endpoint to perform an inference task with the `alibabacloud-ai-search` service. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-alibabacloud-ai-search.html | Elasticsearch API documentation} + */ + async putAlibabacloud (this: That, params: T.InferencePutAlibabacloudRequest | TB.InferencePutAlibabacloudRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putAlibabacloud (this: That, params: T.InferencePutAlibabacloudRequest | TB.InferencePutAlibabacloudRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putAlibabacloud (this: That, params: T.InferencePutAlibabacloudRequest | TB.InferencePutAlibabacloudRequest, options?: TransportRequestOptions): Promise + async putAlibabacloud (this: That, params: T.InferencePutAlibabacloudRequest | TB.InferencePutAlibabacloudRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'alibabacloud_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.alibabacloud_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_alibabacloud', + pathParts: { + task_type: params.task_type, + alibabacloud_inference_id: params.alibabacloud_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create an Amazon Bedrock inference endpoint. Creates an inference endpoint to perform an inference task with the `amazonbedrock` service. >info > You need to provide the access and secret keys only once, during the inference model creation. The get inference API does not retrieve your access or secret keys. After creating the inference model, you cannot change the associated key pairs. If you want to use a different access and secret key pair, delete the inference model and recreate it with the same name and the updated keys. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-amazon-bedrock.html | Elasticsearch API documentation} + */ + async putAmazonbedrock (this: That, params: T.InferencePutAmazonbedrockRequest | TB.InferencePutAmazonbedrockRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putAmazonbedrock (this: That, params: T.InferencePutAmazonbedrockRequest | TB.InferencePutAmazonbedrockRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putAmazonbedrock (this: That, params: T.InferencePutAmazonbedrockRequest | TB.InferencePutAmazonbedrockRequest, options?: TransportRequestOptions): Promise + async putAmazonbedrock (this: That, params: T.InferencePutAmazonbedrockRequest | TB.InferencePutAmazonbedrockRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'amazonbedrock_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.amazonbedrock_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_amazonbedrock', + pathParts: { + task_type: params.task_type, + amazonbedrock_inference_id: params.amazonbedrock_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create an Anthropic inference endpoint. Create an inference endpoint to perform an inference task with the `anthropic` service. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-anthropic.html | Elasticsearch API documentation} + */ + async putAnthropic (this: That, params: T.InferencePutAnthropicRequest | TB.InferencePutAnthropicRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putAnthropic (this: That, params: T.InferencePutAnthropicRequest | TB.InferencePutAnthropicRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putAnthropic (this: That, params: T.InferencePutAnthropicRequest | TB.InferencePutAnthropicRequest, options?: TransportRequestOptions): Promise + async putAnthropic (this: That, params: T.InferencePutAnthropicRequest | TB.InferencePutAnthropicRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'anthropic_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.anthropic_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_anthropic', + pathParts: { + task_type: params.task_type, + anthropic_inference_id: params.anthropic_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create an Azure AI studio inference endpoint. Create an inference endpoint to perform an inference task with the `azureaistudio` service. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-azure-ai-studio.html | Elasticsearch API documentation} + */ + async putAzureaistudio (this: That, params: T.InferencePutAzureaistudioRequest | TB.InferencePutAzureaistudioRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putAzureaistudio (this: That, params: T.InferencePutAzureaistudioRequest | TB.InferencePutAzureaistudioRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putAzureaistudio (this: That, params: T.InferencePutAzureaistudioRequest | TB.InferencePutAzureaistudioRequest, options?: TransportRequestOptions): Promise + async putAzureaistudio (this: That, params: T.InferencePutAzureaistudioRequest | TB.InferencePutAzureaistudioRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'azureaistudio_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.azureaistudio_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_azureaistudio', + pathParts: { + task_type: params.task_type, + azureaistudio_inference_id: params.azureaistudio_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create an Azure OpenAI inference endpoint. Create an inference endpoint to perform an inference task with the `azureopenai` service. The list of chat completion models that you can choose from in your Azure OpenAI deployment include: * [GPT-4 and GPT-4 Turbo models](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#gpt-4-and-gpt-4-turbo-models) * [GPT-3.5](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#gpt-35) The list of embeddings models that you can choose from in your deployment can be found in the [Azure models documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#embeddings). When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-azure-openai.html | Elasticsearch API documentation} + */ + async putAzureopenai (this: That, params: T.InferencePutAzureopenaiRequest | TB.InferencePutAzureopenaiRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putAzureopenai (this: That, params: T.InferencePutAzureopenaiRequest | TB.InferencePutAzureopenaiRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putAzureopenai (this: That, params: T.InferencePutAzureopenaiRequest | TB.InferencePutAzureopenaiRequest, options?: TransportRequestOptions): Promise + async putAzureopenai (this: That, params: T.InferencePutAzureopenaiRequest | TB.InferencePutAzureopenaiRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'azureopenai_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.azureopenai_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_azureopenai', + pathParts: { + task_type: params.task_type, + azureopenai_inference_id: params.azureopenai_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create a Cohere inference endpoint. Create an inference endpoint to perform an inference task with the `cohere` service. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-cohere.html | Elasticsearch API documentation} + */ + async putCohere (this: That, params: T.InferencePutCohereRequest | TB.InferencePutCohereRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putCohere (this: That, params: T.InferencePutCohereRequest | TB.InferencePutCohereRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putCohere (this: That, params: T.InferencePutCohereRequest | TB.InferencePutCohereRequest, options?: TransportRequestOptions): Promise + async putCohere (this: That, params: T.InferencePutCohereRequest | TB.InferencePutCohereRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'cohere_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.cohere_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_cohere', + pathParts: { + task_type: params.task_type, + cohere_inference_id: params.cohere_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create an Elasticsearch inference endpoint. Create an inference endpoint to perform an inference task with the `elasticsearch` service. > info > Your Elasticsearch deployment contains preconfigured ELSER and E5 inference endpoints, you only need to create the enpoints using the API if you want to customize the settings. If you use the ELSER or the E5 model through the `elasticsearch` service, the API request will automatically download and deploy the model if it isn't downloaded yet. > info > You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-elasticsearch.html | Elasticsearch API documentation} + */ + async putElasticsearch (this: That, params: T.InferencePutElasticsearchRequest | TB.InferencePutElasticsearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putElasticsearch (this: That, params: T.InferencePutElasticsearchRequest | TB.InferencePutElasticsearchRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putElasticsearch (this: That, params: T.InferencePutElasticsearchRequest | TB.InferencePutElasticsearchRequest, options?: TransportRequestOptions): Promise + async putElasticsearch (this: That, params: T.InferencePutElasticsearchRequest | TB.InferencePutElasticsearchRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'elasticsearch_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.elasticsearch_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_elasticsearch', + pathParts: { + task_type: params.task_type, + elasticsearch_inference_id: params.elasticsearch_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create an ELSER inference endpoint. Create an inference endpoint to perform an inference task with the `elser` service. You can also deploy ELSER by using the Elasticsearch inference integration. > info > Your Elasticsearch deployment contains a preconfigured ELSER inference endpoint, you only need to create the enpoint using the API if you want to customize the settings. The API request will automatically download and deploy the ELSER model if it isn't already downloaded. > info > You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-elser.html | Elasticsearch API documentation} + */ + async putElser (this: That, params: T.InferencePutElserRequest | TB.InferencePutElserRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putElser (this: That, params: T.InferencePutElserRequest | TB.InferencePutElserRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putElser (this: That, params: T.InferencePutElserRequest | TB.InferencePutElserRequest, options?: TransportRequestOptions): Promise + async putElser (this: That, params: T.InferencePutElserRequest | TB.InferencePutElserRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'elser_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.elser_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_elser', + pathParts: { + task_type: params.task_type, + elser_inference_id: params.elser_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create an Google AI Studio inference endpoint. Create an inference endpoint to perform an inference task with the `googleaistudio` service. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-google-ai-studio.html | Elasticsearch API documentation} + */ + async putGoogleaistudio (this: That, params: T.InferencePutGoogleaistudioRequest | TB.InferencePutGoogleaistudioRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putGoogleaistudio (this: That, params: T.InferencePutGoogleaistudioRequest | TB.InferencePutGoogleaistudioRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putGoogleaistudio (this: That, params: T.InferencePutGoogleaistudioRequest | TB.InferencePutGoogleaistudioRequest, options?: TransportRequestOptions): Promise + async putGoogleaistudio (this: That, params: T.InferencePutGoogleaistudioRequest | TB.InferencePutGoogleaistudioRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'googleaistudio_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.googleaistudio_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_googleaistudio', + pathParts: { + task_type: params.task_type, + googleaistudio_inference_id: params.googleaistudio_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create a Google Vertex AI inference endpoint. Create an inference endpoint to perform an inference task with the `googlevertexai` service. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-google-vertex-ai.html | Elasticsearch API documentation} + */ + async putGooglevertexai (this: That, params: T.InferencePutGooglevertexaiRequest | TB.InferencePutGooglevertexaiRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putGooglevertexai (this: That, params: T.InferencePutGooglevertexaiRequest | TB.InferencePutGooglevertexaiRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putGooglevertexai (this: That, params: T.InferencePutGooglevertexaiRequest | TB.InferencePutGooglevertexaiRequest, options?: TransportRequestOptions): Promise + async putGooglevertexai (this: That, params: T.InferencePutGooglevertexaiRequest | TB.InferencePutGooglevertexaiRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'googlevertexai_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.googlevertexai_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_googlevertexai', + pathParts: { + task_type: params.task_type, + googlevertexai_inference_id: params.googlevertexai_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create a Hugging Face inference endpoint. Create an inference endpoint to perform an inference task with the `hugging_face` service. You must first create an inference endpoint on the Hugging Face endpoint page to get an endpoint URL. Select the model you want to use on the new endpoint creation page (for example `intfloat/e5-small-v2`), then select the sentence embeddings task under the advanced configuration section. Create the endpoint and copy the URL after the endpoint initialization has been finished. The following models are recommended for the Hugging Face service: * `all-MiniLM-L6-v2` * `all-MiniLM-L12-v2` * `all-mpnet-base-v2` * `e5-base-v2` * `e5-small-v2` * `multilingual-e5-base` * `multilingual-e5-small` When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-hugging-face.html | Elasticsearch API documentation} + */ + async putHuggingFace (this: That, params: T.InferencePutHuggingFaceRequest | TB.InferencePutHuggingFaceRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putHuggingFace (this: That, params: T.InferencePutHuggingFaceRequest | TB.InferencePutHuggingFaceRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putHuggingFace (this: That, params: T.InferencePutHuggingFaceRequest | TB.InferencePutHuggingFaceRequest, options?: TransportRequestOptions): Promise + async putHuggingFace (this: That, params: T.InferencePutHuggingFaceRequest | TB.InferencePutHuggingFaceRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'huggingface_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.huggingface_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_hugging_face', + pathParts: { + task_type: params.task_type, + huggingface_inference_id: params.huggingface_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create an JinaAI inference endpoint. Create an inference endpoint to perform an inference task with the `jinaai` service. To review the available `rerank` models, refer to . To review the available `text_embedding` models, refer to the . When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-jinaai.html | Elasticsearch API documentation} + */ + async putJinaai (this: That, params: T.InferencePutJinaaiRequest | TB.InferencePutJinaaiRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putJinaai (this: That, params: T.InferencePutJinaaiRequest | TB.InferencePutJinaaiRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putJinaai (this: That, params: T.InferencePutJinaaiRequest | TB.InferencePutJinaaiRequest, options?: TransportRequestOptions): Promise + async putJinaai (this: That, params: T.InferencePutJinaaiRequest | TB.InferencePutJinaaiRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'jinaai_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.jinaai_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_jinaai', + pathParts: { + task_type: params.task_type, + jinaai_inference_id: params.jinaai_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create a Mistral inference endpoint. Creates an inference endpoint to perform an inference task with the `mistral` service. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/{brnach}/infer-service-mistral.html | Elasticsearch API documentation} + */ + async putMistral (this: That, params: T.InferencePutMistralRequest | TB.InferencePutMistralRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putMistral (this: That, params: T.InferencePutMistralRequest | TB.InferencePutMistralRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putMistral (this: That, params: T.InferencePutMistralRequest | TB.InferencePutMistralRequest, options?: TransportRequestOptions): Promise + async putMistral (this: That, params: T.InferencePutMistralRequest | TB.InferencePutMistralRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'mistral_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.mistral_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_mistral', + pathParts: { + task_type: params.task_type, + mistral_inference_id: params.mistral_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create an OpenAI inference endpoint. Create an inference endpoint to perform an inference task with the `openai` service or `openai` compatible APIs. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-openai.html | Elasticsearch API documentation} + */ + async putOpenai (this: That, params: T.InferencePutOpenaiRequest | TB.InferencePutOpenaiRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putOpenai (this: That, params: T.InferencePutOpenaiRequest | TB.InferencePutOpenaiRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putOpenai (this: That, params: T.InferencePutOpenaiRequest | TB.InferencePutOpenaiRequest, options?: TransportRequestOptions): Promise + async putOpenai (this: That, params: T.InferencePutOpenaiRequest | TB.InferencePutOpenaiRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'openai_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.openai_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_openai', + pathParts: { + task_type: params.task_type, + openai_inference_id: params.openai_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create a VoyageAI inference endpoint. Create an inference endpoint to perform an inference task with the `voyageai` service. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-voyageai.html | Elasticsearch API documentation} + */ + async putVoyageai (this: That, params: T.InferencePutVoyageaiRequest | TB.InferencePutVoyageaiRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putVoyageai (this: That, params: T.InferencePutVoyageaiRequest | TB.InferencePutVoyageaiRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putVoyageai (this: That, params: T.InferencePutVoyageaiRequest | TB.InferencePutVoyageaiRequest, options?: TransportRequestOptions): Promise + async putVoyageai (this: That, params: T.InferencePutVoyageaiRequest | TB.InferencePutVoyageaiRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'voyageai_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.voyageai_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_voyageai', + pathParts: { + task_type: params.task_type, + voyageai_inference_id: params.voyageai_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create a Watsonx inference endpoint. Create an inference endpoint to perform an inference task with the `watsonxai` service. You need an IBM Cloud Databases for Elasticsearch deployment to use the `watsonxai` inference service. You can provision one through the IBM catalog, the Cloud Databases CLI plug-in, the Cloud Databases API, or Terraform. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-watsonx-ai.html | Elasticsearch API documentation} + */ + async putWatsonx (this: That, params: T.InferencePutWatsonxRequest | TB.InferencePutWatsonxRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putWatsonx (this: That, params: T.InferencePutWatsonxRequest | TB.InferencePutWatsonxRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putWatsonx (this: That, params: T.InferencePutWatsonxRequest | TB.InferencePutWatsonxRequest, options?: TransportRequestOptions): Promise + async putWatsonx (this: That, params: T.InferencePutWatsonxRequest | TB.InferencePutWatsonxRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'watsonx_inference_id'] + const acceptedBody: string[] = ['service', 'service_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.watsonx_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_watsonx', + pathParts: { + task_type: params.task_type, + watsonx_inference_id: params.watsonx_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Perform rereanking inference on the service + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-inference-api.html | Elasticsearch API documentation} + */ + async rerank (this: That, params: T.InferenceRerankRequest | TB.InferenceRerankRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async rerank (this: That, params: T.InferenceRerankRequest | TB.InferenceRerankRequest, options?: TransportRequestOptionsWithMeta): Promise> + async rerank (this: That, params: T.InferenceRerankRequest | TB.InferenceRerankRequest, options?: TransportRequestOptions): Promise + async rerank (this: That, params: T.InferenceRerankRequest | TB.InferenceRerankRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['inference_id'] + const acceptedBody: string[] = ['query', 'input', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_inference/rerank/${encodeURIComponent(params.inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.rerank', + pathParts: { + inference_id: params.inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Perform sparse embedding inference on the service + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-inference-api.html | Elasticsearch API documentation} + */ + async sparseEmbedding (this: That, params: T.InferenceSparseEmbeddingRequest | TB.InferenceSparseEmbeddingRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async sparseEmbedding (this: That, params: T.InferenceSparseEmbeddingRequest | TB.InferenceSparseEmbeddingRequest, options?: TransportRequestOptionsWithMeta): Promise> + async sparseEmbedding (this: That, params: T.InferenceSparseEmbeddingRequest | TB.InferenceSparseEmbeddingRequest, options?: TransportRequestOptions): Promise + async sparseEmbedding (this: That, params: T.InferenceSparseEmbeddingRequest | TB.InferenceSparseEmbeddingRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['inference_id'] + const acceptedBody: string[] = ['input', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_inference/sparse_embedding/${encodeURIComponent(params.inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.sparse_embedding', + pathParts: { + inference_id: params.inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Perform streaming inference. Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. This API works only with the completion task type. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. This API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege). You must use a client that supports streaming. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/stream-inference-api.html | Elasticsearch API documentation} + */ + async streamCompletion (this: That, params: T.InferenceStreamCompletionRequest | TB.InferenceStreamCompletionRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async streamCompletion (this: That, params: T.InferenceStreamCompletionRequest | TB.InferenceStreamCompletionRequest, options?: TransportRequestOptionsWithMeta): Promise> + async streamCompletion (this: That, params: T.InferenceStreamCompletionRequest | TB.InferenceStreamCompletionRequest, options?: TransportRequestOptions): Promise + async streamCompletion (this: That, params: T.InferenceStreamCompletionRequest | TB.InferenceStreamCompletionRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['inference_id'] + const acceptedBody: string[] = ['input', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_inference/completion/${encodeURIComponent(params.inference_id.toString())}/_stream` + const meta: TransportRequestMetadata = { + name: 'inference.stream_completion', + pathParts: { + inference_id: params.inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Perform text embedding inference on the service + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-inference-api.html | Elasticsearch API documentation} + */ + async textEmbedding (this: That, params: T.InferenceTextEmbeddingRequest | TB.InferenceTextEmbeddingRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async textEmbedding (this: That, params: T.InferenceTextEmbeddingRequest | TB.InferenceTextEmbeddingRequest, options?: TransportRequestOptionsWithMeta): Promise> + async textEmbedding (this: That, params: T.InferenceTextEmbeddingRequest | TB.InferenceTextEmbeddingRequest, options?: TransportRequestOptions): Promise + async textEmbedding (this: That, params: T.InferenceTextEmbeddingRequest | TB.InferenceTextEmbeddingRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['inference_id'] + const acceptedBody: string[] = ['input', 'task_settings'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_inference/text_embedding/${encodeURIComponent(params.inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.text_embedding', + pathParts: { + inference_id: params.inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Update an inference endpoint. Modify `task_settings`, secrets (within `service_settings`), or `num_allocations` for an inference endpoint, depending on the specific endpoint service and `task_type`. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-inference-api.html | Elasticsearch API documentation} + */ + async update (this: That, params: T.InferenceUpdateRequest | TB.InferenceUpdateRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async update (this: That, params: T.InferenceUpdateRequest | TB.InferenceUpdateRequest, options?: TransportRequestOptionsWithMeta): Promise> + async update (this: That, params: T.InferenceUpdateRequest | TB.InferenceUpdateRequest, options?: TransportRequestOptions): Promise + async update (this: That, params: T.InferenceUpdateRequest | TB.InferenceUpdateRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['inference_id', 'task_type'] + const acceptedBody: string[] = ['inference_config'] + const querystring: Record = {} + // @ts-expect-error + let body: any = params.body ?? undefined + + for (const key in params) { + if (acceptedBody.includes(key)) { + // @ts-expect-error + body = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + let method = '' + let path = '' + if (params.task_type != null && params.inference_id != null) { + method = 'PUT' + path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}/_update` + } else { + method = 'PUT' + path = `/_inference/${encodeURIComponent(params.inference_id.toString())}/_update` + } + const meta: TransportRequestMetadata = { + name: 'inference.update', + pathParts: { + inference_id: params.inference_id, + task_type: params.task_type + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } } diff --git a/src/api/api/info.ts b/src/api/api/info.ts index 83ce76773..0447a429e 100644 --- a/src/api/api/info.ts +++ b/src/api/api/info.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Get cluster info. Returns basic information about the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/index.html | Elasticsearch API documentation} + * Get cluster info. Get basic build, version, and cluster information. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/rest-api-root.html | Elasticsearch API documentation} */ export default async function InfoApi (this: That, params?: T.InfoRequest | TB.InfoRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function InfoApi (this: That, params?: T.InfoRequest | TB.InfoRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/ingest.ts b/src/api/api/ingest.ts index 122680b7d..8d9fe216e 100644 --- a/src/api/api/ingest.ts +++ b/src/api/api/ingest.ts @@ -45,8 +45,8 @@ export default class Ingest { } /** - * Deletes a geoip database configuration. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html | Elasticsearch API documentation} + * Delete GeoIP database configurations. Delete one or more IP geolocation database configurations. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ingest-delete-geoip-database | Elasticsearch API documentation} */ async deleteGeoipDatabase (this: That, params: T.IngestDeleteGeoipDatabaseRequest | TB.IngestDeleteGeoipDatabaseRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteGeoipDatabase (this: That, params: T.IngestDeleteGeoipDatabaseRequest | TB.IngestDeleteGeoipDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,40 @@ export default class Ingest { } /** - * Deletes one or more existing ingest pipeline. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html | Elasticsearch API documentation} + * Delete IP geolocation database configurations. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-ip-location-database-api.html | Elasticsearch API documentation} + */ + async deleteIpLocationDatabase (this: That, params: T.IngestDeleteIpLocationDatabaseRequest | TB.IngestDeleteIpLocationDatabaseRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async deleteIpLocationDatabase (this: That, params: T.IngestDeleteIpLocationDatabaseRequest | TB.IngestDeleteIpLocationDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise> + async deleteIpLocationDatabase (this: That, params: T.IngestDeleteIpLocationDatabaseRequest | TB.IngestDeleteIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise + async deleteIpLocationDatabase (this: That, params: T.IngestDeleteIpLocationDatabaseRequest | TB.IngestDeleteIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['id'] + const querystring: Record = {} + const body = undefined + + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'DELETE' + const path = `/_ingest/ip_location/database/${encodeURIComponent(params.id.toString())}` + const meta: TransportRequestMetadata = { + name: 'ingest.delete_ip_location_database', + pathParts: { + id: params.id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Delete pipelines. Delete one or more ingest pipelines. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-pipeline-api.html | Elasticsearch API documentation} */ async deletePipeline (this: That, params: T.IngestDeletePipelineRequest | TB.IngestDeletePipelineRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deletePipeline (this: That, params: T.IngestDeletePipelineRequest | TB.IngestDeletePipelineRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -109,8 +141,8 @@ export default class Ingest { } /** - * Gets download statistics for GeoIP2 databases used with the geoip processor. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/geoip-processor.html | Elasticsearch API documentation} + * Get GeoIP statistics. Get download statistics for GeoIP2 databases that are used with the GeoIP processor. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/geoip-processor.html | Elasticsearch API documentation} */ async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest | TB.IngestGeoIpStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest | TB.IngestGeoIpStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -139,8 +171,8 @@ export default class Ingest { } /** - * Returns information about one or more geoip database configurations. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html | Elasticsearch API documentation} + * Get GeoIP database configurations. Get information about one or more IP geolocation database configurations. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ingest-get-geoip-database | Elasticsearch API documentation} */ async getGeoipDatabase (this: That, params?: T.IngestGetGeoipDatabaseRequest | TB.IngestGetGeoipDatabaseRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getGeoipDatabase (this: That, params?: T.IngestGetGeoipDatabaseRequest | TB.IngestGetGeoipDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -179,8 +211,48 @@ export default class Ingest { } /** - * Returns information about one or more ingest pipelines. This API returns a local reference of the pipeline. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html | Elasticsearch API documentation} + * Get IP geolocation database configurations. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-ip-location-database-api.html | Elasticsearch API documentation} + */ + async getIpLocationDatabase (this: That, params?: T.IngestGetIpLocationDatabaseRequest | TB.IngestGetIpLocationDatabaseRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async getIpLocationDatabase (this: That, params?: T.IngestGetIpLocationDatabaseRequest | TB.IngestGetIpLocationDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise> + async getIpLocationDatabase (this: That, params?: T.IngestGetIpLocationDatabaseRequest | TB.IngestGetIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise + async getIpLocationDatabase (this: That, params?: T.IngestGetIpLocationDatabaseRequest | TB.IngestGetIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['id'] + const querystring: Record = {} + const body = undefined + + params = params ?? {} + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + let method = '' + let path = '' + if (params.id != null) { + method = 'GET' + path = `/_ingest/ip_location/database/${encodeURIComponent(params.id.toString())}` + } else { + method = 'GET' + path = '/_ingest/ip_location/database' + } + const meta: TransportRequestMetadata = { + name: 'ingest.get_ip_location_database', + pathParts: { + id: params.id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Get pipelines. Get information about one or more ingest pipelines. This API returns a local reference of the pipeline. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-pipeline-api.html | Elasticsearch API documentation} */ async getPipeline (this: That, params?: T.IngestGetPipelineRequest | TB.IngestGetPipelineRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getPipeline (this: That, params?: T.IngestGetPipelineRequest | TB.IngestGetPipelineRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -219,8 +291,8 @@ export default class Ingest { } /** - * Extracts structured fields out of a single text field within a document. You choose which field to extract matched fields from, as well as the grok pattern you expect will match. A grok pattern is like a regular expression that supports aliased expressions that can be reused. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html | Elasticsearch API documentation} + * Run a grok processor. Extract structured fields out of a single text field within a document. You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. A grok pattern is like a regular expression that supports aliased expressions that can be reused. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/grok-processor.html | Elasticsearch API documentation} */ async processorGrok (this: That, params?: T.IngestProcessorGrokRequest | TB.IngestProcessorGrokRequest, options?: TransportRequestOptionsWithOutMeta): Promise async processorGrok (this: That, params?: T.IngestProcessorGrokRequest | TB.IngestProcessorGrokRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -249,8 +321,8 @@ export default class Ingest { } /** - * Returns information about one or more geoip database configurations. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html | Elasticsearch API documentation} + * Create or update a GeoIP database configuration. Refer to the create or update IP geolocation database configuration API. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ingest-put-geoip-database | Elasticsearch API documentation} */ async putGeoipDatabase (this: That, params: T.IngestPutGeoipDatabaseRequest | TB.IngestPutGeoipDatabaseRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putGeoipDatabase (this: That, params: T.IngestPutGeoipDatabaseRequest | TB.IngestPutGeoipDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -293,15 +365,52 @@ export default class Ingest { } /** - * Creates or updates an ingest pipeline. Changes made using this API take effect immediately. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html | Elasticsearch API documentation} + * Create or update an IP geolocation database configuration. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-ip-location-database-api.html | Elasticsearch API documentation} + */ + async putIpLocationDatabase (this: That, params: T.IngestPutIpLocationDatabaseRequest | TB.IngestPutIpLocationDatabaseRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putIpLocationDatabase (this: That, params: T.IngestPutIpLocationDatabaseRequest | TB.IngestPutIpLocationDatabaseRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putIpLocationDatabase (this: That, params: T.IngestPutIpLocationDatabaseRequest | TB.IngestPutIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise + async putIpLocationDatabase (this: That, params: T.IngestPutIpLocationDatabaseRequest | TB.IngestPutIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['id'] + const acceptedBody: string[] = ['configuration'] + const querystring: Record = {} + // @ts-expect-error + let body: any = params.body ?? undefined + + for (const key in params) { + if (acceptedBody.includes(key)) { + // @ts-expect-error + body = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_ingest/ip_location/database/${encodeURIComponent(params.id.toString())}` + const meta: TransportRequestMetadata = { + name: 'ingest.put_ip_location_database', + pathParts: { + id: params.id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Create or update a pipeline. Changes made using this API take effect immediately. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ingest.html | Elasticsearch API documentation} */ async putPipeline (this: That, params: T.IngestPutPipelineRequest | TB.IngestPutPipelineRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putPipeline (this: That, params: T.IngestPutPipelineRequest | TB.IngestPutPipelineRequest, options?: TransportRequestOptionsWithMeta): Promise> async putPipeline (this: That, params: T.IngestPutPipelineRequest | TB.IngestPutPipelineRequest, options?: TransportRequestOptions): Promise async putPipeline (this: That, params: T.IngestPutPipelineRequest | TB.IngestPutPipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedBody: string[] = ['_meta', 'description', 'on_failure', 'processors', 'version'] + const acceptedBody: string[] = ['_meta', 'description', 'on_failure', 'processors', 'version', 'deprecated'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -337,8 +446,8 @@ export default class Ingest { } /** - * Executes an ingest pipeline against a set of provided documents. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html | Elasticsearch API documentation} + * Simulate a pipeline. Run an ingest pipeline against a set of provided documents. You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/simulate-pipeline-api.html | Elasticsearch API documentation} */ async simulate (this: That, params: T.IngestSimulateRequest | TB.IngestSimulateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async simulate (this: That, params: T.IngestSimulateRequest | TB.IngestSimulateRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/knn_search.ts b/src/api/api/knn_search.ts index fe30ca47a..152dba580 100644 --- a/src/api/api/knn_search.ts +++ b/src/api/api/knn_search.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Performs a kNN search. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html | Elasticsearch API documentation} + * Run a knn search. NOTE: The kNN search API has been replaced by the `knn` option in the search API. Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. Given a query vector, the API finds the k closest vectors and returns those documents as search hits. Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. This means the results returned are not always the true k closest neighbors. The kNN search API supports restricting the search using a filter. The search will return the top k documents that also match the filter query. A kNN search response has the exact same structure as a search API response. However, certain sections have a meaning specific to kNN search: * The document `_score` is determined by the similarity between the query and document vector. * The `hits.total` object contains the total number of nearest neighbor candidates considered, which is `num_candidates * num_shards`. The `hits.total.relation` will always be `eq`, indicating an exact value. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/knn-search-api.html | Elasticsearch API documentation} */ export default async function KnnSearchApi (this: That, params: T.KnnSearchRequest | TB.KnnSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function KnnSearchApi (this: That, params: T.KnnSearchRequest | TB.KnnSearchRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/license.ts b/src/api/api/license.ts index 4d12f0806..181bf3269 100644 --- a/src/api/api/license.ts +++ b/src/api/api/license.ts @@ -45,8 +45,8 @@ export default class License { } /** - * Deletes licensing information for the cluster - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-license.html | Elasticsearch API documentation} + * Delete the license. When the license expires, your subscription level reverts to Basic. If the operator privileges feature is enabled, only operator users can use this API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-license.html | Elasticsearch API documentation} */ async delete (this: That, params?: T.LicenseDeleteRequest | TB.LicenseDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async delete (this: That, params?: T.LicenseDeleteRequest | TB.LicenseDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -75,8 +75,8 @@ export default class License { } /** - * Get license information. Returns information about your Elastic license, including its type, its status, when it was issued, and when it expires. For more information about the different types of licenses, refer to [Elastic Stack subscriptions](https://www.elastic.co/subscriptions). - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-license.html | Elasticsearch API documentation} + * Get license information. Get information about your Elastic license including its type, its status, when it was issued, and when it expires. >info > If the master node is generating a new cluster state, the get license API may return a `404 Not Found` response. > If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-license.html | Elasticsearch API documentation} */ async get (this: That, params?: T.LicenseGetRequest | TB.LicenseGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async get (this: That, params?: T.LicenseGetRequest | TB.LicenseGetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -105,8 +105,8 @@ export default class License { } /** - * Retrieves information about the status of the basic license. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-basic-status.html | Elasticsearch API documentation} + * Get the basic license status. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-basic-status.html | Elasticsearch API documentation} */ async getBasicStatus (this: That, params?: T.LicenseGetBasicStatusRequest | TB.LicenseGetBasicStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getBasicStatus (this: That, params?: T.LicenseGetBasicStatusRequest | TB.LicenseGetBasicStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -135,8 +135,8 @@ export default class License { } /** - * Retrieves information about the status of the trial license. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trial-status.html | Elasticsearch API documentation} + * Get the trial status. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-trial-status.html | Elasticsearch API documentation} */ async getTrialStatus (this: That, params?: T.LicenseGetTrialStatusRequest | TB.LicenseGetTrialStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getTrialStatus (this: That, params?: T.LicenseGetTrialStatusRequest | TB.LicenseGetTrialStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -165,8 +165,8 @@ export default class License { } /** - * Updates the license for the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-license.html | Elasticsearch API documentation} + * Update the license. You can update your license at runtime without shutting down your nodes. License updates take effect immediately. If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. You must then re-submit the API request with the acknowledge parameter set to true. NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. If the operator privileges feature is enabled, only operator users can use this API. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-license-post | Elasticsearch API documentation} */ async post (this: That, params?: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptionsWithOutMeta): Promise async post (this: That, params?: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -207,8 +207,8 @@ export default class License { } /** - * The start basic API enables you to initiate an indefinite basic license, which gives access to all the basic features. If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. You must then re-submit the API request with the acknowledge parameter set to true. To check the status of your basic license, use the following API: [Get basic status](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-basic-status.html). - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/start-basic.html | Elasticsearch API documentation} + * Start a basic license. Start an indefinite basic license, which gives access to all the basic features. NOTE: In order to start a basic license, you must not currently have a basic license. If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. You must then re-submit the API request with the `acknowledge` parameter set to `true`. To check the status of your basic license, use the get basic license API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/start-basic.html | Elasticsearch API documentation} */ async postStartBasic (this: That, params?: T.LicensePostStartBasicRequest | TB.LicensePostStartBasicRequest, options?: TransportRequestOptionsWithOutMeta): Promise async postStartBasic (this: That, params?: T.LicensePostStartBasicRequest | TB.LicensePostStartBasicRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -237,8 +237,8 @@ export default class License { } /** - * The start trial API enables you to start a 30-day trial, which gives access to all subscription features. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trial.html | Elasticsearch API documentation} + * Start a trial. Start a 30-day trial, which gives access to all subscription features. NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. To check the status of your trial, use the get trial status API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/start-trial.html | Elasticsearch API documentation} */ async postStartTrial (this: That, params?: T.LicensePostStartTrialRequest | TB.LicensePostStartTrialRequest, options?: TransportRequestOptionsWithOutMeta): Promise async postStartTrial (this: That, params?: T.LicensePostStartTrialRequest | TB.LicensePostStartTrialRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/logstash.ts b/src/api/api/logstash.ts index f92f8c5c3..06f7038e9 100644 --- a/src/api/api/logstash.ts +++ b/src/api/api/logstash.ts @@ -45,8 +45,8 @@ export default class Logstash { } /** - * Deletes a pipeline used for Logstash Central Management. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/logstash-api-delete-pipeline.html | Elasticsearch API documentation} + * Delete a Logstash pipeline. Delete a pipeline that is used for Logstash Central Management. If the request succeeds, you receive an empty response with an appropriate status code. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/logstash-api-delete-pipeline.html | Elasticsearch API documentation} */ async deletePipeline (this: That, params: T.LogstashDeletePipelineRequest | TB.LogstashDeletePipelineRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deletePipeline (this: That, params: T.LogstashDeletePipelineRequest | TB.LogstashDeletePipelineRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Logstash { } /** - * Retrieves pipelines used for Logstash Central Management. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/logstash-api-get-pipeline.html | Elasticsearch API documentation} + * Get Logstash pipelines. Get pipelines that are used for Logstash Central Management. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/logstash-api-get-pipeline.html | Elasticsearch API documentation} */ async getPipeline (this: That, params?: T.LogstashGetPipelineRequest | TB.LogstashGetPipelineRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getPipeline (this: That, params?: T.LogstashGetPipelineRequest | TB.LogstashGetPipelineRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -117,8 +117,8 @@ export default class Logstash { } /** - * Creates or updates a pipeline used for Logstash Central Management. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/logstash-api-put-pipeline.html | Elasticsearch API documentation} + * Create or update a Logstash pipeline. Create a pipeline that is used for Logstash Central Management. If the specified pipeline exists, it is replaced. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/logstash-api-put-pipeline.html | Elasticsearch API documentation} */ async putPipeline (this: That, params: T.LogstashPutPipelineRequest | TB.LogstashPutPipelineRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putPipeline (this: That, params: T.LogstashPutPipelineRequest | TB.LogstashPutPipelineRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/mget.ts b/src/api/api/mget.ts index 75ffcaef0..a1da8c54c 100644 --- a/src/api/api/mget.ts +++ b/src/api/api/mget.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Allows to get multiple documents in one request. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html | Elasticsearch API documentation} + * Get multiple documents. Get multiple JSON documents by ID from one or more indices. If you specify an index in the request URI, you only need to specify the document IDs in the request body. To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. **Filter source fields** By default, the `_source` field is returned for every document (if stored). Use the `_source` and `_source_include` or `source_exclude` attributes to filter what fields are returned for a particular document. You can include the `_source`, `_source_includes`, and `_source_excludes` query parameters in the request URI to specify the defaults to use when there are no per-document instructions. **Get stored fields** Use the `stored_fields` attribute to specify the set of stored fields you want to retrieve. Any requested fields that are not stored are ignored. You can include the `stored_fields` query parameter in the request URI to specify the defaults to use when there are no per-document instructions. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-multi-get.html | Elasticsearch API documentation} */ export default async function MgetApi (this: That, params?: T.MgetRequest | TB.MgetRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function MgetApi (this: That, params?: T.MgetRequest | TB.MgetRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/migration.ts b/src/api/api/migration.ts index 48bb46c23..f752dba2e 100644 --- a/src/api/api/migration.ts +++ b/src/api/api/migration.ts @@ -45,8 +45,8 @@ export default class Migration { } /** - * Retrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/migration-api-deprecation.html | Elasticsearch API documentation} + * Get deprecation information. Get information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version. TIP: This APIs is designed for indirect use by the Upgrade Assistant. You are strongly recommended to use the Upgrade Assistant. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/migration-api-deprecation.html | Elasticsearch API documentation} */ async deprecations (this: That, params?: T.MigrationDeprecationsRequest | TB.MigrationDeprecationsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deprecations (this: That, params?: T.MigrationDeprecationsRequest | TB.MigrationDeprecationsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -85,8 +85,8 @@ export default class Migration { } /** - * Find out whether system features need to be upgraded or not - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/migration-api-feature-upgrade.html | Elasticsearch API documentation} + * Get feature migration information. Version upgrades sometimes require changes to how features store configuration information and data in system indices. Check which features need to be migrated and the status of any migrations that are in progress. TIP: This API is designed for indirect use by the Upgrade Assistant. You are strongly recommended to use the Upgrade Assistant. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/feature-migration-api.html | Elasticsearch API documentation} */ async getFeatureUpgradeStatus (this: That, params?: T.MigrationGetFeatureUpgradeStatusRequest | TB.MigrationGetFeatureUpgradeStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getFeatureUpgradeStatus (this: That, params?: T.MigrationGetFeatureUpgradeStatusRequest | TB.MigrationGetFeatureUpgradeStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -115,8 +115,8 @@ export default class Migration { } /** - * Begin upgrades for system features - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/migration-api-feature-upgrade.html | Elasticsearch API documentation} + * Start the feature migration. Version upgrades sometimes require changes to how features store configuration information and data in system indices. This API starts the automatic migration process. Some functionality might be temporarily unavailable during the migration process. TIP: The API is designed for indirect use by the Upgrade Assistant. We strongly recommend you use the Upgrade Assistant. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/feature-migration-api.html | Elasticsearch API documentation} */ async postFeatureUpgrade (this: That, params?: T.MigrationPostFeatureUpgradeRequest | TB.MigrationPostFeatureUpgradeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async postFeatureUpgrade (this: That, params?: T.MigrationPostFeatureUpgradeRequest | TB.MigrationPostFeatureUpgradeRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/ml.ts b/src/api/api/ml.ts index d45ba30d7..3a7769c85 100644 --- a/src/api/api/ml.ts +++ b/src/api/api/ml.ts @@ -46,7 +46,7 @@ export default class Ml { /** * Clear trained model deployment cache. Cache will be cleared on all nodes where the trained model is assigned. A trained model deployment may have an inference cache enabled. As requests are handled by each allocated node, their responses may be cached on that individual node. Calling this API clears the caches without restarting the deployment. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/clear-trained-model-deployment-cache.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/clear-trained-model-deployment-cache.html | Elasticsearch API documentation} */ async clearTrainedModelDeploymentCache (this: That, params: T.MlClearTrainedModelDeploymentCacheRequest | TB.MlClearTrainedModelDeploymentCacheRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearTrainedModelDeploymentCache (this: That, params: T.MlClearTrainedModelDeploymentCacheRequest | TB.MlClearTrainedModelDeploymentCacheRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -78,7 +78,7 @@ export default class Ml { /** * Close anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. When a datafeed that has a specified end date stops, it automatically closes its associated job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-close-job.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-close-job.html | Elasticsearch API documentation} */ async closeJob (this: That, params: T.MlCloseJobRequest | TB.MlCloseJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async closeJob (this: That, params: T.MlCloseJobRequest | TB.MlCloseJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -121,8 +121,8 @@ export default class Ml { } /** - * Delete a calendar. Removes all scheduled events from a calendar, then deletes it. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar.html | Elasticsearch API documentation} + * Delete a calendar. Remove all scheduled events from a calendar, then delete it. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-delete-calendar.html | Elasticsearch API documentation} */ async deleteCalendar (this: That, params: T.MlDeleteCalendarRequest | TB.MlDeleteCalendarRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteCalendar (this: That, params: T.MlDeleteCalendarRequest | TB.MlDeleteCalendarRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -154,7 +154,7 @@ export default class Ml { /** * Delete events from a calendar. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-event.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-delete-calendar-event.html | Elasticsearch API documentation} */ async deleteCalendarEvent (this: That, params: T.MlDeleteCalendarEventRequest | TB.MlDeleteCalendarEventRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteCalendarEvent (this: That, params: T.MlDeleteCalendarEventRequest | TB.MlDeleteCalendarEventRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -187,7 +187,7 @@ export default class Ml { /** * Delete anomaly jobs from a calendar. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-job.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-delete-calendar-job.html | Elasticsearch API documentation} */ async deleteCalendarJob (this: That, params: T.MlDeleteCalendarJobRequest | TB.MlDeleteCalendarJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteCalendarJob (this: That, params: T.MlDeleteCalendarJobRequest | TB.MlDeleteCalendarJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -220,7 +220,7 @@ export default class Ml { /** * Delete a data frame analytics job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-dfanalytics.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-dfanalytics.html | Elasticsearch API documentation} */ async deleteDataFrameAnalytics (this: That, params: T.MlDeleteDataFrameAnalyticsRequest | TB.MlDeleteDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteDataFrameAnalytics (this: That, params: T.MlDeleteDataFrameAnalyticsRequest | TB.MlDeleteDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -252,7 +252,7 @@ export default class Ml { /** * Delete a datafeed. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-datafeed.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-delete-datafeed.html | Elasticsearch API documentation} */ async deleteDatafeed (this: That, params: T.MlDeleteDatafeedRequest | TB.MlDeleteDatafeedRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteDatafeed (this: That, params: T.MlDeleteDatafeedRequest | TB.MlDeleteDatafeedRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -283,8 +283,8 @@ export default class Ml { } /** - * Delete expired ML data. Deletes all job results, model snapshots and forecast data that have exceeded their retention days period. Machine learning state documents that are not associated with any job are also deleted. You can limit the request to a single or set of anomaly detection jobs by using a job identifier, a group name, a comma-separated list of jobs, or a wildcard expression. You can delete expired data for all anomaly detection jobs by using _all, by specifying * as the , or by omitting the . - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-expired-data.html | Elasticsearch API documentation} + * Delete expired ML data. Delete all job results, model snapshots and forecast data that have exceeded their retention days period. Machine learning state documents that are not associated with any job are also deleted. You can limit the request to a single or set of anomaly detection jobs by using a job identifier, a group name, a comma-separated list of jobs, or a wildcard expression. You can delete expired data for all anomaly detection jobs by using `_all`, by specifying `*` as the ``, or by omitting the ``. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-delete-expired-data.html | Elasticsearch API documentation} */ async deleteExpiredData (this: That, params?: T.MlDeleteExpiredDataRequest | TB.MlDeleteExpiredDataRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteExpiredData (this: That, params?: T.MlDeleteExpiredDataRequest | TB.MlDeleteExpiredDataRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -336,7 +336,7 @@ export default class Ml { /** * Delete a filter. If an anomaly detection job references the filter, you cannot delete the filter. You must update or delete the job before you can delete the filter. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-filter.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-delete-filter.html | Elasticsearch API documentation} */ async deleteFilter (this: That, params: T.MlDeleteFilterRequest | TB.MlDeleteFilterRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteFilter (this: That, params: T.MlDeleteFilterRequest | TB.MlDeleteFilterRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -368,7 +368,7 @@ export default class Ml { /** * Delete forecasts from a job. By default, forecasts are retained for 14 days. You can specify a different retention period with the `expires_in` parameter in the forecast jobs API. The delete forecast API enables you to delete one or more forecasts before they expire. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-forecast.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-delete-forecast.html | Elasticsearch API documentation} */ async deleteForecast (this: That, params: T.MlDeleteForecastRequest | TB.MlDeleteForecastRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteForecast (this: That, params: T.MlDeleteForecastRequest | TB.MlDeleteForecastRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -408,7 +408,7 @@ export default class Ml { /** * Delete an anomaly detection job. All job configuration, model state and results are deleted. It is not currently possible to delete multiple jobs using wildcards or a comma separated list. If you delete a job that has a datafeed, the request first tries to delete the datafeed. This behavior is equivalent to calling the delete datafeed API with the same timeout and force parameters as the delete job request. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-job.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-delete-job.html | Elasticsearch API documentation} */ async deleteJob (this: That, params: T.MlDeleteJobRequest | TB.MlDeleteJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteJob (this: That, params: T.MlDeleteJobRequest | TB.MlDeleteJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -440,7 +440,7 @@ export default class Ml { /** * Delete a model snapshot. You cannot delete the active model snapshot. To delete that snapshot, first revert to a different one. To identify the active model snapshot, refer to the `model_snapshot_id` in the results from the get jobs API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-snapshot.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-delete-snapshot.html | Elasticsearch API documentation} */ async deleteModelSnapshot (this: That, params: T.MlDeleteModelSnapshotRequest | TB.MlDeleteModelSnapshotRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteModelSnapshot (this: That, params: T.MlDeleteModelSnapshotRequest | TB.MlDeleteModelSnapshotRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -473,7 +473,7 @@ export default class Ml { /** * Delete an unreferenced trained model. The request deletes a trained inference model that is not referenced by an ingest pipeline. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-trained-models.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-trained-models.html | Elasticsearch API documentation} */ async deleteTrainedModel (this: That, params: T.MlDeleteTrainedModelRequest | TB.MlDeleteTrainedModelRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteTrainedModel (this: That, params: T.MlDeleteTrainedModelRequest | TB.MlDeleteTrainedModelRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -505,7 +505,7 @@ export default class Ml { /** * Delete a trained model alias. This API deletes an existing model alias that refers to a trained model. If the model alias is missing or refers to a model other than the one identified by the `model_id`, this API returns an error. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-trained-models-aliases.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-trained-models-aliases.html | Elasticsearch API documentation} */ async deleteTrainedModelAlias (this: That, params: T.MlDeleteTrainedModelAliasRequest | TB.MlDeleteTrainedModelAliasRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteTrainedModelAlias (this: That, params: T.MlDeleteTrainedModelAliasRequest | TB.MlDeleteTrainedModelAliasRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -537,8 +537,8 @@ export default class Ml { } /** - * Estimate job model memory usage. Makes an estimation of the memory usage for an anomaly detection job model. It is based on analysis configuration details for the job and cardinality estimates for the fields it references. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-apis.html | Elasticsearch API documentation} + * Estimate job model memory usage. Make an estimation of the memory usage for an anomaly detection job model. The estimate is based on analysis configuration details for the job and cardinality estimates for the fields it references. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-estimate-model-memory.html | Elasticsearch API documentation} */ async estimateModelMemory (this: That, params?: T.MlEstimateModelMemoryRequest | TB.MlEstimateModelMemoryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async estimateModelMemory (this: That, params?: T.MlEstimateModelMemoryRequest | TB.MlEstimateModelMemoryRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -580,7 +580,7 @@ export default class Ml { /** * Evaluate data frame analytics. The API packages together commonly used evaluation metrics for various types of machine learning features. This has been designed for use on indexes created by data frame analytics. Evaluation requires both a ground truth field and an analytics result field to be present. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/evaluate-dfanalytics.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/evaluate-dfanalytics.html | Elasticsearch API documentation} */ async evaluateDataFrame (this: That, params: T.MlEvaluateDataFrameRequest | TB.MlEvaluateDataFrameRequest, options?: TransportRequestOptionsWithOutMeta): Promise async evaluateDataFrame (this: That, params: T.MlEvaluateDataFrameRequest | TB.MlEvaluateDataFrameRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -621,7 +621,7 @@ export default class Ml { /** * Explain data frame analytics config. This API provides explanations for a data frame analytics config that either exists already or one that has not been created yet. The following explanations are provided: * which fields are included or not in the analysis and why, * how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - * @see {@link http://www.elastic.co/guide/en/elasticsearch/reference/master/explain-dfanalytics.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/explain-dfanalytics.html | Elasticsearch API documentation} */ async explainDataFrameAnalytics (this: That, params?: T.MlExplainDataFrameAnalyticsRequest | TB.MlExplainDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async explainDataFrameAnalytics (this: That, params?: T.MlExplainDataFrameAnalyticsRequest | TB.MlExplainDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -673,7 +673,7 @@ export default class Ml { /** * Force buffered data to be processed. The flush jobs API is only applicable when sending data for analysis using the post data API. Depending on the content of the buffer, then it might additionally calculate new results. Both flush and close operations are similar, however the flush is more efficient if you are expecting to send more data for analysis. When flushing, the job remains open and is available to continue analyzing data. A close operation additionally prunes and persists the model state to disk and the job must be opened again before analyzing further data. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-flush-job.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-flush-job.html | Elasticsearch API documentation} */ async flushJob (this: That, params: T.MlFlushJobRequest | TB.MlFlushJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async flushJob (this: That, params: T.MlFlushJobRequest | TB.MlFlushJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -717,7 +717,7 @@ export default class Ml { /** * Predict future behavior of a time series. Forecasts are not supported for jobs that perform population analysis; an error occurs if you try to create a forecast for a job that has an `over_field_name` in its configuration. Forcasts predict future behavior based on historical data. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-forecast.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-forecast.html | Elasticsearch API documentation} */ async forecast (this: That, params: T.MlForecastRequest | TB.MlForecastRequest, options?: TransportRequestOptionsWithOutMeta): Promise async forecast (this: That, params: T.MlForecastRequest | TB.MlForecastRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -761,7 +761,7 @@ export default class Ml { /** * Get anomaly detection job results for buckets. The API presents a chronological view of the records, grouped by bucket. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-bucket.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-bucket.html | Elasticsearch API documentation} */ async getBuckets (this: That, params: T.MlGetBucketsRequest | TB.MlGetBucketsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getBuckets (this: That, params: T.MlGetBucketsRequest | TB.MlGetBucketsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -813,7 +813,7 @@ export default class Ml { /** * Get info about events in calendars. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-calendar-event.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-calendar-event.html | Elasticsearch API documentation} */ async getCalendarEvents (this: That, params: T.MlGetCalendarEventsRequest | TB.MlGetCalendarEventsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getCalendarEvents (this: That, params: T.MlGetCalendarEventsRequest | TB.MlGetCalendarEventsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -845,7 +845,7 @@ export default class Ml { /** * Get calendar configuration info. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-calendar.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-calendar.html | Elasticsearch API documentation} */ async getCalendars (this: That, params?: T.MlGetCalendarsRequest | TB.MlGetCalendarsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getCalendars (this: That, params?: T.MlGetCalendarsRequest | TB.MlGetCalendarsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -897,7 +897,7 @@ export default class Ml { /** * Get anomaly detection job results for categories. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-category.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-category.html | Elasticsearch API documentation} */ async getCategories (this: That, params: T.MlGetCategoriesRequest | TB.MlGetCategoriesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getCategories (this: That, params: T.MlGetCategoriesRequest | TB.MlGetCategoriesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -949,7 +949,7 @@ export default class Ml { /** * Get data frame analytics job configuration info. You can get information for multiple data frame analytics jobs in a single API request by using a comma-separated list of data frame analytics jobs or a wildcard expression. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-dfanalytics.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-dfanalytics.html | Elasticsearch API documentation} */ async getDataFrameAnalytics (this: That, params?: T.MlGetDataFrameAnalyticsRequest | TB.MlGetDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getDataFrameAnalytics (this: That, params?: T.MlGetDataFrameAnalyticsRequest | TB.MlGetDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -988,8 +988,8 @@ export default class Ml { } /** - * Get data frame analytics jobs usage info. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-dfanalytics-stats.html | Elasticsearch API documentation} + * Get data frame analytics job stats. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-dfanalytics-stats.html | Elasticsearch API documentation} */ async getDataFrameAnalyticsStats (this: That, params?: T.MlGetDataFrameAnalyticsStatsRequest | TB.MlGetDataFrameAnalyticsStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getDataFrameAnalyticsStats (this: That, params?: T.MlGetDataFrameAnalyticsStatsRequest | TB.MlGetDataFrameAnalyticsStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1028,8 +1028,8 @@ export default class Ml { } /** - * Get datafeeds usage info. You can get statistics for multiple datafeeds in a single API request by using a comma-separated list of datafeeds or a wildcard expression. You can get statistics for all datafeeds by using `_all`, by specifying `*` as the ``, or by omitting the ``. If the datafeed is stopped, the only information you receive is the `datafeed_id` and the `state`. This API returns a maximum of 10,000 datafeeds. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-datafeed-stats.html | Elasticsearch API documentation} + * Get datafeed stats. You can get statistics for multiple datafeeds in a single API request by using a comma-separated list of datafeeds or a wildcard expression. You can get statistics for all datafeeds by using `_all`, by specifying `*` as the ``, or by omitting the ``. If the datafeed is stopped, the only information you receive is the `datafeed_id` and the `state`. This API returns a maximum of 10,000 datafeeds. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-datafeed-stats.html | Elasticsearch API documentation} */ async getDatafeedStats (this: That, params?: T.MlGetDatafeedStatsRequest | TB.MlGetDatafeedStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getDatafeedStats (this: That, params?: T.MlGetDatafeedStatsRequest | TB.MlGetDatafeedStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1069,7 +1069,7 @@ export default class Ml { /** * Get datafeeds configuration info. You can get information for multiple datafeeds in a single API request by using a comma-separated list of datafeeds or a wildcard expression. You can get information for all datafeeds by using `_all`, by specifying `*` as the ``, or by omitting the ``. This API returns a maximum of 10,000 datafeeds. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-datafeed.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-datafeed.html | Elasticsearch API documentation} */ async getDatafeeds (this: That, params?: T.MlGetDatafeedsRequest | TB.MlGetDatafeedsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getDatafeeds (this: That, params?: T.MlGetDatafeedsRequest | TB.MlGetDatafeedsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1109,7 +1109,7 @@ export default class Ml { /** * Get filters. You can get a single filter or all filters. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-filter.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-filter.html | Elasticsearch API documentation} */ async getFilters (this: That, params?: T.MlGetFiltersRequest | TB.MlGetFiltersRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getFilters (this: That, params?: T.MlGetFiltersRequest | TB.MlGetFiltersRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1149,7 +1149,7 @@ export default class Ml { /** * Get anomaly detection job results for influencers. Influencers are the entities that have contributed to, or are to blame for, the anomalies. Influencer results are available only if an `influencer_field_name` is specified in the job configuration. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-influencer.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-influencer.html | Elasticsearch API documentation} */ async getInfluencers (this: That, params: T.MlGetInfluencersRequest | TB.MlGetInfluencersRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getInfluencers (this: That, params: T.MlGetInfluencersRequest | TB.MlGetInfluencersRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1192,8 +1192,8 @@ export default class Ml { } /** - * Get anomaly detection jobs usage info. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-job-stats.html | Elasticsearch API documentation} + * Get anomaly detection job stats. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-job-stats.html | Elasticsearch API documentation} */ async getJobStats (this: That, params?: T.MlGetJobStatsRequest | TB.MlGetJobStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getJobStats (this: That, params?: T.MlGetJobStatsRequest | TB.MlGetJobStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1233,7 +1233,7 @@ export default class Ml { /** * Get anomaly detection jobs configuration info. You can get information for multiple anomaly detection jobs in a single API request by using a group name, a comma-separated list of jobs, or a wildcard expression. You can get information for all anomaly detection jobs by using `_all`, by specifying `*` as the ``, or by omitting the ``. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-job.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-job.html | Elasticsearch API documentation} */ async getJobs (this: That, params?: T.MlGetJobsRequest | TB.MlGetJobsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getJobs (this: That, params?: T.MlGetJobsRequest | TB.MlGetJobsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1273,7 +1273,7 @@ export default class Ml { /** * Get machine learning memory usage info. Get information about how machine learning jobs and trained models are using memory, on each node, both within the JVM heap, and natively, outside of the JVM. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-ml-memory.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-ml-memory.html | Elasticsearch API documentation} */ async getMemoryStats (this: That, params?: T.MlGetMemoryStatsRequest | TB.MlGetMemoryStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getMemoryStats (this: That, params?: T.MlGetMemoryStatsRequest | TB.MlGetMemoryStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1313,7 +1313,7 @@ export default class Ml { /** * Get anomaly detection job model snapshot upgrade usage info. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-job-model-snapshot-upgrade-stats.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-job-model-snapshot-upgrade-stats.html | Elasticsearch API documentation} */ async getModelSnapshotUpgradeStats (this: That, params: T.MlGetModelSnapshotUpgradeStatsRequest | TB.MlGetModelSnapshotUpgradeStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getModelSnapshotUpgradeStats (this: That, params: T.MlGetModelSnapshotUpgradeStatsRequest | TB.MlGetModelSnapshotUpgradeStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1346,7 +1346,7 @@ export default class Ml { /** * Get model snapshots info. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-snapshot.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-snapshot.html | Elasticsearch API documentation} */ async getModelSnapshots (this: That, params: T.MlGetModelSnapshotsRequest | TB.MlGetModelSnapshotsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getModelSnapshots (this: That, params: T.MlGetModelSnapshotsRequest | TB.MlGetModelSnapshotsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1398,7 +1398,7 @@ export default class Ml { /** * Get overall bucket results. Retrievs overall bucket results that summarize the bucket results of multiple anomaly detection jobs. The `overall_score` is calculated by combining the scores of all the buckets within the overall bucket span. First, the maximum `anomaly_score` per anomaly detection job in the overall bucket is calculated. Then the `top_n` of those scores are averaged to result in the `overall_score`. This means that you can fine-tune the `overall_score` so that it is more or less sensitive to the number of jobs that detect an anomaly at the same time. For example, if you set `top_n` to `1`, the `overall_score` is the maximum bucket score in the overall bucket. Alternatively, if you set `top_n` to the number of jobs, the `overall_score` is high only when all jobs detect anomalies in that overall bucket. If you set the `bucket_span` parameter (to a value greater than its default), the `overall_score` is the maximum `overall_score` of the overall buckets that have a span equal to the jobs' largest bucket span. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-overall-buckets.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-overall-buckets.html | Elasticsearch API documentation} */ async getOverallBuckets (this: That, params: T.MlGetOverallBucketsRequest | TB.MlGetOverallBucketsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getOverallBuckets (this: That, params: T.MlGetOverallBucketsRequest | TB.MlGetOverallBucketsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1442,7 +1442,7 @@ export default class Ml { /** * Get anomaly records for an anomaly detection job. Records contain the detailed analytical results. They describe the anomalous activity that has been identified in the input data based on the detector configuration. There can be many anomaly records depending on the characteristics and size of the input data. In practice, there are often too many to be able to manually process them. The machine learning features therefore perform a sophisticated aggregation of the anomaly records into buckets. The number of record results depends on the number of anomalies found in each bucket, which relates to the number of time series being modeled and the number of detectors. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-get-record.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-record.html | Elasticsearch API documentation} */ async getRecords (this: That, params: T.MlGetRecordsRequest | TB.MlGetRecordsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getRecords (this: That, params: T.MlGetRecordsRequest | TB.MlGetRecordsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1486,7 +1486,7 @@ export default class Ml { /** * Get trained model configuration info. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trained-models.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-trained-models.html | Elasticsearch API documentation} */ async getTrainedModels (this: That, params?: T.MlGetTrainedModelsRequest | TB.MlGetTrainedModelsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getTrainedModels (this: That, params?: T.MlGetTrainedModelsRequest | TB.MlGetTrainedModelsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1526,7 +1526,7 @@ export default class Ml { /** * Get trained models usage info. You can get usage information for multiple trained models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trained-models-stats.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-trained-models-stats.html | Elasticsearch API documentation} */ async getTrainedModelsStats (this: That, params?: T.MlGetTrainedModelsStatsRequest | TB.MlGetTrainedModelsStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getTrainedModelsStats (this: That, params?: T.MlGetTrainedModelsStatsRequest | TB.MlGetTrainedModelsStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1566,7 +1566,7 @@ export default class Ml { /** * Evaluate a trained model. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/infer-trained-model.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-trained-model.html | Elasticsearch API documentation} */ async inferTrainedModel (this: That, params: T.MlInferTrainedModelRequest | TB.MlInferTrainedModelRequest, options?: TransportRequestOptionsWithOutMeta): Promise async inferTrainedModel (this: That, params: T.MlInferTrainedModelRequest | TB.MlInferTrainedModelRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1609,8 +1609,8 @@ export default class Ml { } /** - * Return ML defaults and limits. Returns defaults and limits used by machine learning. This endpoint is designed to be used by a user interface that needs to fully understand machine learning configurations where some options are not specified, meaning that the defaults should be used. This endpoint may be used to find out what those defaults are. It also provides information about the maximum size of machine learning jobs that could run in the current cluster configuration. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-ml-info.html | Elasticsearch API documentation} + * Get machine learning information. Get defaults and limits used by machine learning. This endpoint is designed to be used by a user interface that needs to fully understand machine learning configurations where some options are not specified, meaning that the defaults should be used. This endpoint may be used to find out what those defaults are. It also provides information about the maximum size of machine learning jobs that could run in the current cluster configuration. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-ml-info.html | Elasticsearch API documentation} */ async info (this: That, params?: T.MlInfoRequest | TB.MlInfoRequest, options?: TransportRequestOptionsWithOutMeta): Promise async info (this: That, params?: T.MlInfoRequest | TB.MlInfoRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1640,7 +1640,7 @@ export default class Ml { /** * Open anomaly detection jobs. An anomaly detection job must be opened to be ready to receive and analyze data. It can be opened and closed multiple times throughout its lifecycle. When you open a new job, it starts with an empty model. When you open an existing job, the most recent model state is automatically loaded. The job is ready to resume its analysis from where it left off, once new data is received. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-open-job.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-open-job.html | Elasticsearch API documentation} */ async openJob (this: That, params: T.MlOpenJobRequest | TB.MlOpenJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async openJob (this: That, params: T.MlOpenJobRequest | TB.MlOpenJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1684,7 +1684,7 @@ export default class Ml { /** * Add scheduled events to the calendar. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-post-calendar-event.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-post-calendar-event.html | Elasticsearch API documentation} */ async postCalendarEvents (this: That, params: T.MlPostCalendarEventsRequest | TB.MlPostCalendarEventsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async postCalendarEvents (this: That, params: T.MlPostCalendarEventsRequest | TB.MlPostCalendarEventsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1728,7 +1728,7 @@ export default class Ml { /** * Send data to an anomaly detection job for analysis. IMPORTANT: For each job, data can be accepted from only a single connection at a time. It is not currently possible to post data to multiple jobs using wildcards or a comma-separated list. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-post-data.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-post-data.html | Elasticsearch API documentation} */ async postData (this: That, params: T.MlPostDataRequest | TB.MlPostDataRequest, options?: TransportRequestOptionsWithOutMeta): Promise async postData (this: That, params: T.MlPostDataRequest | TB.MlPostDataRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1764,8 +1764,8 @@ export default class Ml { } /** - * Preview features used by data frame analytics. Previews the extracted features used by a data frame analytics config. - * @see {@link http://www.elastic.co/guide/en/elasticsearch/reference/master/preview-dfanalytics.html | Elasticsearch API documentation} + * Preview features used by data frame analytics. Preview the extracted features used by a data frame analytics config. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/preview-dfanalytics.html | Elasticsearch API documentation} */ async previewDataFrameAnalytics (this: That, params?: T.MlPreviewDataFrameAnalyticsRequest | TB.MlPreviewDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async previewDataFrameAnalytics (this: That, params?: T.MlPreviewDataFrameAnalyticsRequest | TB.MlPreviewDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1817,7 +1817,7 @@ export default class Ml { /** * Preview a datafeed. This API returns the first "page" of search results from a datafeed. You can preview an existing datafeed or provide configuration details for a datafeed and anomaly detection job in the API. The preview shows the structure of the data that will be passed to the anomaly detection engine. IMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that called the API. However, when the datafeed starts it uses the roles of the last user that created or updated the datafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials. You can also use secondary authorization headers to supply the credentials. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-preview-datafeed.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-preview-datafeed.html | Elasticsearch API documentation} */ async previewDatafeed (this: That, params?: T.MlPreviewDatafeedRequest | TB.MlPreviewDatafeedRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async previewDatafeed (this: That, params?: T.MlPreviewDatafeedRequest | TB.MlPreviewDatafeedRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> @@ -1869,7 +1869,7 @@ export default class Ml { /** * Create a calendar. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-put-calendar.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-put-calendar.html | Elasticsearch API documentation} */ async putCalendar (this: That, params: T.MlPutCalendarRequest | TB.MlPutCalendarRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putCalendar (this: That, params: T.MlPutCalendarRequest | TB.MlPutCalendarRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1913,7 +1913,7 @@ export default class Ml { /** * Add anomaly detection job to calendar. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-put-calendar-job.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-put-calendar-job.html | Elasticsearch API documentation} */ async putCalendarJob (this: That, params: T.MlPutCalendarJobRequest | TB.MlPutCalendarJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putCalendarJob (this: That, params: T.MlPutCalendarJobRequest | TB.MlPutCalendarJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1945,15 +1945,15 @@ export default class Ml { } /** - * Create a data frame analytics job. This API creates a data frame analytics job that performs an analysis on the source indices and stores the outcome in a destination index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-dfanalytics.html | Elasticsearch API documentation} + * Create a data frame analytics job. This API creates a data frame analytics job that performs an analysis on the source indices and stores the outcome in a destination index. By default, the query used in the source configuration is `{"match_all": {}}`. If the destination index does not exist, it is created automatically when you start the job. If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-dfanalytics.html | Elasticsearch API documentation} */ async putDataFrameAnalytics (this: That, params: T.MlPutDataFrameAnalyticsRequest | TB.MlPutDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putDataFrameAnalytics (this: That, params: T.MlPutDataFrameAnalyticsRequest | TB.MlPutDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> async putDataFrameAnalytics (this: That, params: T.MlPutDataFrameAnalyticsRequest | TB.MlPutDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async putDataFrameAnalytics (this: That, params: T.MlPutDataFrameAnalyticsRequest | TB.MlPutDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedBody: string[] = ['allow_lazy_start', 'analysis', 'analyzed_fields', 'description', 'dest', 'max_num_threads', 'model_memory_limit', 'source', 'headers', 'version'] + const acceptedBody: string[] = ['allow_lazy_start', 'analysis', 'analyzed_fields', 'description', 'dest', 'max_num_threads', '_meta', 'model_memory_limit', 'source', 'headers', 'version'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -1989,15 +1989,15 @@ export default class Ml { } /** - * Create a datafeed. Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. You can associate only one datafeed with each anomaly detection job. The datafeed contains a query that runs at a defined interval (`frequency`). If you are concerned about delayed data, you can add a delay (`query_delay') at each interval. When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed directly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-put-datafeed.html | Elasticsearch API documentation} + * Create a datafeed. Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. You can associate only one datafeed with each anomaly detection job. The datafeed contains a query that runs at a defined interval (`frequency`). If you are concerned about delayed data, you can add a delay (`query_delay') at each interval. By default, the datafeed uses the following query: `{"match_all": {"boost": 1}}`. When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed directly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-put-datafeed.html | Elasticsearch API documentation} */ async putDatafeed (this: That, params: T.MlPutDatafeedRequest | TB.MlPutDatafeedRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putDatafeed (this: That, params: T.MlPutDatafeedRequest | TB.MlPutDatafeedRequest, options?: TransportRequestOptionsWithMeta): Promise> async putDatafeed (this: That, params: T.MlPutDatafeedRequest | TB.MlPutDatafeedRequest, options?: TransportRequestOptions): Promise async putDatafeed (this: That, params: T.MlPutDatafeedRequest | TB.MlPutDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedBody: string[] = ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size', 'headers'] + const acceptedBody: string[] = ['aggregations', 'aggs', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size', 'headers'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -2034,7 +2034,7 @@ export default class Ml { /** * Create a filter. A filter contains a list of strings. It can be used by one or more anomaly detection jobs. Specifically, filters are referenced in the `custom_rules` property of detector configuration objects. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-put-filter.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-put-filter.html | Elasticsearch API documentation} */ async putFilter (this: That, params: T.MlPutFilterRequest | TB.MlPutFilterRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putFilter (this: That, params: T.MlPutFilterRequest | TB.MlPutFilterRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2077,15 +2077,15 @@ export default class Ml { } /** - * Create an anomaly detection job. If you include a `datafeed_config`, you must have read index privileges on the source index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-put-job.html | Elasticsearch API documentation} + * Create an anomaly detection job. If you include a `datafeed_config`, you must have read index privileges on the source index. If you include a `datafeed_config` but do not provide a query, the datafeed uses `{"match_all": {"boost": 1}}`. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-put-job.html | Elasticsearch API documentation} */ async putJob (this: That, params: T.MlPutJobRequest | TB.MlPutJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putJob (this: That, params: T.MlPutJobRequest | TB.MlPutJobRequest, options?: TransportRequestOptionsWithMeta): Promise> async putJob (this: That, params: T.MlPutJobRequest | TB.MlPutJobRequest, options?: TransportRequestOptions): Promise async putJob (this: That, params: T.MlPutJobRequest | TB.MlPutJobRequest, options?: TransportRequestOptions): Promise { - const acceptedPath: string[] = ['job_id'] - const acceptedBody: string[] = ['allow_lazy_open', 'analysis_config', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'daily_model_snapshot_retention_after_days', 'data_description', 'datafeed_config', 'description', 'groups', 'model_plot_config', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_index_name', 'results_retention_days'] + const acceptedPath: string[] = [] + const acceptedBody: string[] = ['allow_lazy_open', 'analysis_config', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'daily_model_snapshot_retention_after_days', 'data_description', 'datafeed_config', 'description', 'job_id', 'groups', 'model_plot_config', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_index_name', 'results_retention_days'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -2122,7 +2122,7 @@ export default class Ml { /** * Create a trained model. Enable you to supply a trained model that is not created by data frame analytics. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-trained-models.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-trained-models.html | Elasticsearch API documentation} */ async putTrainedModel (this: That, params: T.MlPutTrainedModelRequest | TB.MlPutTrainedModelRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putTrainedModel (this: That, params: T.MlPutTrainedModelRequest | TB.MlPutTrainedModelRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2166,7 +2166,7 @@ export default class Ml { /** * Create or update a trained model alias. A trained model alias is a logical name used to reference a single trained model. You can use aliases instead of trained model identifiers to make it easier to reference your models. For example, you can use aliases in inference aggregations and processors. An alias must be unique and refer to only a single trained model. However, you can have multiple aliases for each trained model. If you use this API to update an alias such that it references a different trained model ID and the model uses a different type of data frame analytics, an error occurs. For example, this situation occurs if you have a trained model for regression analysis and a trained model for classification analysis; you cannot reassign an alias from one type of trained model to another. If you use this API to update an alias and there are very few input fields in common between the old and new trained models for the model alias, the API returns a warning. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-trained-models-aliases.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-trained-models-aliases.html | Elasticsearch API documentation} */ async putTrainedModelAlias (this: That, params: T.MlPutTrainedModelAliasRequest | TB.MlPutTrainedModelAliasRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putTrainedModelAlias (this: That, params: T.MlPutTrainedModelAliasRequest | TB.MlPutTrainedModelAliasRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2199,7 +2199,7 @@ export default class Ml { /** * Create part of a trained model definition. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-trained-model-definition-part.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-trained-model-definition-part.html | Elasticsearch API documentation} */ async putTrainedModelDefinitionPart (this: That, params: T.MlPutTrainedModelDefinitionPartRequest | TB.MlPutTrainedModelDefinitionPartRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putTrainedModelDefinitionPart (this: That, params: T.MlPutTrainedModelDefinitionPartRequest | TB.MlPutTrainedModelDefinitionPartRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2244,7 +2244,7 @@ export default class Ml { /** * Create a trained model vocabulary. This API is supported only for natural language processing (NLP) models. The vocabulary is stored in the index as described in `inference_config.*.vocabulary` of the trained model definition. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-trained-model-vocabulary.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-trained-model-vocabulary.html | Elasticsearch API documentation} */ async putTrainedModelVocabulary (this: That, params: T.MlPutTrainedModelVocabularyRequest | TB.MlPutTrainedModelVocabularyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putTrainedModelVocabulary (this: That, params: T.MlPutTrainedModelVocabularyRequest | TB.MlPutTrainedModelVocabularyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2288,7 +2288,7 @@ export default class Ml { /** * Reset an anomaly detection job. All model state and results are deleted. The job is ready to start over as if it had just been created. It is not currently possible to reset multiple jobs using wildcards or a comma separated list. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-reset-job.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-reset-job.html | Elasticsearch API documentation} */ async resetJob (this: That, params: T.MlResetJobRequest | TB.MlResetJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async resetJob (this: That, params: T.MlResetJobRequest | TB.MlResetJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2320,7 +2320,7 @@ export default class Ml { /** * Revert to a snapshot. The machine learning features react quickly to anomalous input, learning new behaviors in data. Highly anomalous input increases the variance in the models whilst the system learns whether this is a new step-change in behavior or a one-off event. In the case where this anomalous input is known to be a one-off, then it might be appropriate to reset the model state to a time before this event. For example, you might consider reverting to a saved snapshot after Black Friday or a critical system failure. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-revert-snapshot.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-revert-snapshot.html | Elasticsearch API documentation} */ async revertModelSnapshot (this: That, params: T.MlRevertModelSnapshotRequest | TB.MlRevertModelSnapshotRequest, options?: TransportRequestOptionsWithOutMeta): Promise async revertModelSnapshot (this: That, params: T.MlRevertModelSnapshotRequest | TB.MlRevertModelSnapshotRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2365,7 +2365,7 @@ export default class Ml { /** * Set upgrade_mode for ML indices. Sets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade. When upgrading your cluster, in some circumstances you must restart your nodes and reindex your machine learning indices. In those circumstances, there must be no machine learning jobs running. You can close the machine learning jobs, do the upgrade, then open all the jobs again. Alternatively, you can use this API to temporarily halt tasks associated with the jobs and datafeeds and prevent new jobs from opening. You can also use this API during upgrades that do not require you to reindex your machine learning indices, though stopping jobs is not a requirement in that case. You can see the current value for the upgrade_mode setting by using the get machine learning info API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-set-upgrade-mode.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-set-upgrade-mode.html | Elasticsearch API documentation} */ async setUpgradeMode (this: That, params?: T.MlSetUpgradeModeRequest | TB.MlSetUpgradeModeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async setUpgradeMode (this: That, params?: T.MlSetUpgradeModeRequest | TB.MlSetUpgradeModeRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2395,7 +2395,7 @@ export default class Ml { /** * Start a data frame analytics job. A data frame analytics job can be started and stopped multiple times throughout its lifecycle. If the destination index does not exist, it is created automatically the first time you start the data frame analytics job. The `index.number_of_shards` and `index.number_of_replicas` settings for the destination index are copied from the source index. If there are multiple source indices, the destination index copies the highest setting values. The mappings for the destination index are also copied from the source indices. If there are any mapping conflicts, the job fails to start. If the destination index exists, it is used as is. You can therefore set up the destination index in advance with custom settings and mappings. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/start-dfanalytics.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/start-dfanalytics.html | Elasticsearch API documentation} */ async startDataFrameAnalytics (this: That, params: T.MlStartDataFrameAnalyticsRequest | TB.MlStartDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async startDataFrameAnalytics (this: That, params: T.MlStartDataFrameAnalyticsRequest | TB.MlStartDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2427,7 +2427,7 @@ export default class Ml { /** * Start datafeeds. A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped multiple times throughout its lifecycle. Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs. If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. If new data was indexed for that exact millisecond between stopping and starting, it will be ignored. When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or update it had at the time of creation or update and runs the query using those same roles. If you provided secondary authorization headers when you created or updated the datafeed, those credentials are used instead. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-start-datafeed.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-start-datafeed.html | Elasticsearch API documentation} */ async startDatafeed (this: That, params: T.MlStartDatafeedRequest | TB.MlStartDatafeedRequest, options?: TransportRequestOptionsWithOutMeta): Promise async startDatafeed (this: That, params: T.MlStartDatafeedRequest | TB.MlStartDatafeedRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2471,18 +2471,30 @@ export default class Ml { /** * Start a trained model deployment. It allocates the model to every machine learning node. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trained-model-deployment.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/start-trained-model-deployment.html | Elasticsearch API documentation} */ async startTrainedModelDeployment (this: That, params: T.MlStartTrainedModelDeploymentRequest | TB.MlStartTrainedModelDeploymentRequest, options?: TransportRequestOptionsWithOutMeta): Promise async startTrainedModelDeployment (this: That, params: T.MlStartTrainedModelDeploymentRequest | TB.MlStartTrainedModelDeploymentRequest, options?: TransportRequestOptionsWithMeta): Promise> async startTrainedModelDeployment (this: That, params: T.MlStartTrainedModelDeploymentRequest | TB.MlStartTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise async startTrainedModelDeployment (this: That, params: T.MlStartTrainedModelDeploymentRequest | TB.MlStartTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] + const acceptedBody: string[] = ['adaptive_allocations'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error @@ -2503,7 +2515,7 @@ export default class Ml { /** * Stop data frame analytics jobs. A data frame analytics job can be started and stopped multiple times throughout its lifecycle. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/stop-dfanalytics.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/stop-dfanalytics.html | Elasticsearch API documentation} */ async stopDataFrameAnalytics (this: That, params: T.MlStopDataFrameAnalyticsRequest | TB.MlStopDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stopDataFrameAnalytics (this: That, params: T.MlStopDataFrameAnalyticsRequest | TB.MlStopDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2535,7 +2547,7 @@ export default class Ml { /** * Stop datafeeds. A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped multiple times throughout its lifecycle. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-stop-datafeed.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-stop-datafeed.html | Elasticsearch API documentation} */ async stopDatafeed (this: That, params: T.MlStopDatafeedRequest | TB.MlStopDatafeedRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stopDatafeed (this: That, params: T.MlStopDatafeedRequest | TB.MlStopDatafeedRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2579,7 +2591,7 @@ export default class Ml { /** * Stop a trained model deployment. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/stop-trained-model-deployment.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/stop-trained-model-deployment.html | Elasticsearch API documentation} */ async stopTrainedModelDeployment (this: That, params: T.MlStopTrainedModelDeploymentRequest | TB.MlStopTrainedModelDeploymentRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stopTrainedModelDeployment (this: That, params: T.MlStopTrainedModelDeploymentRequest | TB.MlStopTrainedModelDeploymentRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2611,7 +2623,7 @@ export default class Ml { /** * Update a data frame analytics job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-dfanalytics.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-data-frame-analytics | Elasticsearch API documentation} */ async updateDataFrameAnalytics (this: That, params: T.MlUpdateDataFrameAnalyticsRequest | TB.MlUpdateDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateDataFrameAnalytics (this: That, params: T.MlUpdateDataFrameAnalyticsRequest | TB.MlUpdateDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2655,7 +2667,7 @@ export default class Ml { /** * Update a datafeed. You must stop and start the datafeed for the changes to be applied. When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at the time of the update and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-update-datafeed.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-update-datafeed.html | Elasticsearch API documentation} */ async updateDatafeed (this: That, params: T.MlUpdateDatafeedRequest | TB.MlUpdateDatafeedRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateDatafeed (this: That, params: T.MlUpdateDatafeedRequest | TB.MlUpdateDatafeedRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2699,7 +2711,7 @@ export default class Ml { /** * Update a filter. Updates the description of a filter, adds items, or removes items from the list. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-update-filter.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-update-filter.html | Elasticsearch API documentation} */ async updateFilter (this: That, params: T.MlUpdateFilterRequest | TB.MlUpdateFilterRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateFilter (this: That, params: T.MlUpdateFilterRequest | TB.MlUpdateFilterRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2743,7 +2755,7 @@ export default class Ml { /** * Update an anomaly detection job. Updates certain properties of an anomaly detection job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-update-job.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-update-job.html | Elasticsearch API documentation} */ async updateJob (this: That, params: T.MlUpdateJobRequest | TB.MlUpdateJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateJob (this: That, params: T.MlUpdateJobRequest | TB.MlUpdateJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2787,7 +2799,7 @@ export default class Ml { /** * Update a snapshot. Updates certain properties of a snapshot. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-update-snapshot.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-update-snapshot.html | Elasticsearch API documentation} */ async updateModelSnapshot (this: That, params: T.MlUpdateModelSnapshotRequest | TB.MlUpdateModelSnapshotRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateModelSnapshot (this: That, params: T.MlUpdateModelSnapshotRequest | TB.MlUpdateModelSnapshotRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2832,14 +2844,14 @@ export default class Ml { /** * Update a trained model deployment. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-trained-model-deployment.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-trained-model-deployment | Elasticsearch API documentation} */ async updateTrainedModelDeployment (this: That, params: T.MlUpdateTrainedModelDeploymentRequest | TB.MlUpdateTrainedModelDeploymentRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateTrainedModelDeployment (this: That, params: T.MlUpdateTrainedModelDeploymentRequest | TB.MlUpdateTrainedModelDeploymentRequest, options?: TransportRequestOptionsWithMeta): Promise> async updateTrainedModelDeployment (this: That, params: T.MlUpdateTrainedModelDeploymentRequest | TB.MlUpdateTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise async updateTrainedModelDeployment (this: That, params: T.MlUpdateTrainedModelDeploymentRequest | TB.MlUpdateTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedBody: string[] = ['number_of_allocations'] + const acceptedBody: string[] = ['number_of_allocations', 'adaptive_allocations'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -2875,8 +2887,8 @@ export default class Ml { } /** - * Upgrade a snapshot. Upgrades an anomaly detection model snapshot to the latest major version. Over time, older snapshot formats are deprecated and removed. Anomaly detection jobs support only snapshots that are from the current or previous major version. This API provides a means to upgrade a snapshot to the current major version. This aids in preparing the cluster for an upgrade to the next major version. Only one snapshot per anomaly detection job can be upgraded at a time and the upgraded snapshot cannot be the current snapshot of the anomaly detection job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-upgrade-job-model-snapshot.html | Elasticsearch API documentation} + * Upgrade a snapshot. Upgrade an anomaly detection model snapshot to the latest major version. Over time, older snapshot formats are deprecated and removed. Anomaly detection jobs support only snapshots that are from the current or previous major version. This API provides a means to upgrade a snapshot to the current major version. This aids in preparing the cluster for an upgrade to the next major version. Only one snapshot per anomaly detection job can be upgraded at a time and the upgraded snapshot cannot be the current snapshot of the anomaly detection job. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-upgrade-job-model-snapshot.html | Elasticsearch API documentation} */ async upgradeJobSnapshot (this: That, params: T.MlUpgradeJobSnapshotRequest | TB.MlUpgradeJobSnapshotRequest, options?: TransportRequestOptionsWithOutMeta): Promise async upgradeJobSnapshot (this: That, params: T.MlUpgradeJobSnapshotRequest | TB.MlUpgradeJobSnapshotRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2908,8 +2920,8 @@ export default class Ml { } /** - * Validates an anomaly detection job. - * @see {@link https://www.elastic.co/guide/en/machine-learning/master/ml-jobs.html | Elasticsearch API documentation} + * Validate an anomaly detection job. + * @see {@link https://www.elastic.co/guide/en/machine-learning/8.18/ml-jobs.html | Elasticsearch API documentation} */ async validate (this: That, params?: T.MlValidateRequest | TB.MlValidateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async validate (this: That, params?: T.MlValidateRequest | TB.MlValidateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2950,8 +2962,8 @@ export default class Ml { } /** - * Validates an anomaly detection detector. - * @see {@link https://www.elastic.co/guide/en/machine-learning/master/ml-jobs.html | Elasticsearch API documentation} + * Validate an anomaly detection job. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8 | Elasticsearch API documentation} */ async validateDetector (this: That, params: T.MlValidateDetectorRequest | TB.MlValidateDetectorRequest, options?: TransportRequestOptionsWithOutMeta): Promise async validateDetector (this: That, params: T.MlValidateDetectorRequest | TB.MlValidateDetectorRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/monitoring.ts b/src/api/api/monitoring.ts index f58cf06af..8a10dcea9 100644 --- a/src/api/api/monitoring.ts +++ b/src/api/api/monitoring.ts @@ -45,8 +45,8 @@ export default class Monitoring { } /** - * Used by the monitoring features to send monitoring data. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/monitor-elasticsearch-cluster.html | Elasticsearch API documentation} + * Send monitoring data. This API is used by the monitoring features to send monitoring data. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8 | Elasticsearch API documentation} */ async bulk (this: That, params: T.MonitoringBulkRequest | TB.MonitoringBulkRequest, options?: TransportRequestOptionsWithOutMeta): Promise async bulk (this: That, params: T.MonitoringBulkRequest | TB.MonitoringBulkRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/msearch.ts b/src/api/api/msearch.ts index 5d5fbc912..858580d0d 100644 --- a/src/api/api/msearch.ts +++ b/src/api/api/msearch.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Allows to execute several search operations in one request. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html | Elasticsearch API documentation} + * Run multiple searches. The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. The structure is as follows: ``` header\n body\n header\n body\n ``` This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. IMPORTANT: The final line of data must end with a newline character `\n`. Each newline character may be preceded by a carriage return `\r`. When sending requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-multi-search.html | Elasticsearch API documentation} */ export default async function MsearchApi> (this: That, params: T.MsearchRequest | TB.MsearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function MsearchApi> (this: That, params: T.MsearchRequest | TB.MsearchRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/msearch_template.ts b/src/api/api/msearch_template.ts index a1897a483..a89b6a3fc 100644 --- a/src/api/api/msearch_template.ts +++ b/src/api/api/msearch_template.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Runs multiple templated searches with a single request. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html | Elasticsearch API documentation} + * Run multiple templated searches. Run multiple templated searches with a single request. If you are providing a text file or text input to `curl`, use the `--data-binary` flag instead of `-d` to preserve newlines. For example: ``` $ cat requests { "index": "my-index" } { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} { "index": "my-other-index" } { "id": "my-other-search-template", "params": { "query_type": "match_all" }} $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo ``` + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/multi-search-template.html | Elasticsearch API documentation} */ export default async function MsearchTemplateApi> (this: That, params: T.MsearchTemplateRequest | TB.MsearchTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function MsearchTemplateApi> (this: That, params: T.MsearchTemplateRequest | TB.MsearchTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/mtermvectors.ts b/src/api/api/mtermvectors.ts index 5fdb4a43b..d027fda97 100644 --- a/src/api/api/mtermvectors.ts +++ b/src/api/api/mtermvectors.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Returns multiple termvectors in one request. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html | Elasticsearch API documentation} + * Get multiple term vectors. Get multiple term vectors with a single request. You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a `docs` array with all the fetched termvectors. Each element has the structure provided by the termvectors API. **Artificial documents** You can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-multi-termvectors.html | Elasticsearch API documentation} */ export default async function MtermvectorsApi (this: That, params?: T.MtermvectorsRequest | TB.MtermvectorsRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function MtermvectorsApi (this: That, params?: T.MtermvectorsRequest | TB.MtermvectorsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/nodes.ts b/src/api/api/nodes.ts index caf750c89..db696c387 100644 --- a/src/api/api/nodes.ts +++ b/src/api/api/nodes.ts @@ -45,8 +45,8 @@ export default class Nodes { } /** - * You can use this API to clear the archived repositories metering information in the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/clear-repositories-metering-archive-api.html | Elasticsearch API documentation} + * Clear the archived repositories metering. Clear the archived repositories metering information in the cluster. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/clear-repositories-metering-archive-api.html | Elasticsearch API documentation} */ async clearRepositoriesMeteringArchive (this: That, params: T.NodesClearRepositoriesMeteringArchiveRequest | TB.NodesClearRepositoriesMeteringArchiveRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearRepositoriesMeteringArchive (this: That, params: T.NodesClearRepositoriesMeteringArchiveRequest | TB.NodesClearRepositoriesMeteringArchiveRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -78,8 +78,8 @@ export default class Nodes { } /** - * You can use the cluster repositories metering API to retrieve repositories metering information in a cluster. This API exposes monotonically non-decreasing counters and it’s expected that clients would durably store the information needed to compute aggregations over a period of time. Additionally, the information exposed by this API is volatile, meaning that it won’t be present after node restarts. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-repositories-metering-api.html | Elasticsearch API documentation} + * Get cluster repositories metering. Get repositories metering information for a cluster. This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-repositories-metering-api.html | Elasticsearch API documentation} */ async getRepositoriesMeteringInfo (this: That, params: T.NodesGetRepositoriesMeteringInfoRequest | TB.NodesGetRepositoriesMeteringInfoRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getRepositoriesMeteringInfo (this: That, params: T.NodesGetRepositoriesMeteringInfoRequest | TB.NodesGetRepositoriesMeteringInfoRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -110,8 +110,8 @@ export default class Nodes { } /** - * This API yields a breakdown of the hot threads on each selected node in the cluster. The output is plain text with a breakdown of each node’s top hot threads. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html | Elasticsearch API documentation} + * Get the hot threads for nodes. Get a breakdown of the hot threads on each selected node in the cluster. The output is plain text with a breakdown of the top hot threads for each node. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-nodes-hot-threads.html | Elasticsearch API documentation} */ async hotThreads (this: That, params?: T.NodesHotThreadsRequest | TB.NodesHotThreadsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async hotThreads (this: That, params?: T.NodesHotThreadsRequest | TB.NodesHotThreadsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -150,8 +150,8 @@ export default class Nodes { } /** - * Returns cluster nodes information. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html | Elasticsearch API documentation} + * Get node information. By default, the API returns all attributes and core settings for cluster nodes. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-nodes-info.html | Elasticsearch API documentation} */ async info (this: That, params?: T.NodesInfoRequest | TB.NodesInfoRequest, options?: TransportRequestOptionsWithOutMeta): Promise async info (this: That, params?: T.NodesInfoRequest | TB.NodesInfoRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -197,8 +197,8 @@ export default class Nodes { } /** - * Reloads the keystore on nodes in the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings | Elasticsearch API documentation} + * Reload the keystore on nodes in the cluster. Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. That is, you can change them on disk and reload them without restarting any nodes in the cluster. When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-nodes-reload-secure-settings.html | Elasticsearch API documentation} */ async reloadSecureSettings (this: That, params?: T.NodesReloadSecureSettingsRequest | TB.NodesReloadSecureSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async reloadSecureSettings (this: That, params?: T.NodesReloadSecureSettingsRequest | TB.NodesReloadSecureSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -249,8 +249,8 @@ export default class Nodes { } /** - * Returns cluster nodes statistics. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html | Elasticsearch API documentation} + * Get node statistics. Get statistics for nodes in a cluster. By default, all stats are returned. You can limit the returned information by using metrics. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-nodes-stats.html | Elasticsearch API documentation} */ async stats (this: That, params?: T.NodesStatsRequest | TB.NodesStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stats (this: That, params?: T.NodesStatsRequest | TB.NodesStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -303,8 +303,8 @@ export default class Nodes { } /** - * Returns information on the usage of features. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html | Elasticsearch API documentation} + * Get feature usage information. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster-nodes-usage.html | Elasticsearch API documentation} */ async usage (this: That, params?: T.NodesUsageRequest | TB.NodesUsageRequest, options?: TransportRequestOptionsWithOutMeta): Promise async usage (this: That, params?: T.NodesUsageRequest | TB.NodesUsageRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/open_point_in_time.ts b/src/api/api/open_point_in_time.ts index f0fdd689c..71b5fea50 100644 --- a/src/api/api/open_point_in_time.ts +++ b/src/api/api/open_point_in_time.ts @@ -39,19 +39,31 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * A search request by default executes against the most recent visible data of the target indices, which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple search requests using the same point in time. For example, if refreshes happen between `search_after` requests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html | Elasticsearch API documentation} + * Open a point in time. A search request by default runs against the most recent visible data of the target indices, which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple search requests using the same point in time. For example, if refreshes happen between `search_after` requests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time. A point in time must be opened explicitly before being used in search requests. A subsequent search request with the `pit` parameter must not specify `index`, `routing`, or `preference` values as these parameters are copied from the point in time. Just like regular searches, you can use `from` and `size` to page through point in time search results, up to the first 10,000 hits. If you want to retrieve more hits, use PIT with `search_after`. IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a `NoShardAvailableActionException` exception. To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. **Keeping point in time alive** The `keep_alive` parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. The value does not need to be long enough to process all data — it just needs to be long enough for the next request. Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. Once the smaller segments are no longer needed they are deleted. However, open point-in-times prevent the old segments from being deleted since they are still in use. TIP: Keeping older segments alive means that more disk space and file handles are needed. Ensure that you have configured your nodes to have ample free file handles. Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. Note that a point-in-time doesn't prevent its associated indices from being deleted. You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/point-in-time-api.html | Elasticsearch API documentation} */ export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest | TB.OpenPointInTimeRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest | TB.OpenPointInTimeRequest, options?: TransportRequestOptionsWithMeta): Promise> export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest | TB.OpenPointInTimeRequest, options?: TransportRequestOptions): Promise export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest | TB.OpenPointInTimeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] + const acceptedBody: string[] = ['index_filter'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error diff --git a/src/api/api/ping.ts b/src/api/api/ping.ts index 9d07552f0..ce0be21f5 100644 --- a/src/api/api/ping.ts +++ b/src/api/api/ping.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Ping the cluster. Returns whether the cluster is running. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/index.html | Elasticsearch API documentation} + * Ping the cluster. Get information about whether the cluster is running. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster.html | Elasticsearch API documentation} */ export default async function PingApi (this: That, params?: T.PingRequest | TB.PingRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function PingApi (this: That, params?: T.PingRequest | TB.PingRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/profiling.ts b/src/api/api/profiling.ts index 0d729387c..17de9f9ac 100644 --- a/src/api/api/profiling.ts +++ b/src/api/api/profiling.ts @@ -46,7 +46,7 @@ export default class Profiling { /** * Extracts a UI-optimized structure to render flamegraphs from Universal Profiling. - * @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/observability/8.18/universal-profiling.html | Elasticsearch API documentation} */ async flamegraph (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async flamegraph (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -75,7 +75,7 @@ export default class Profiling { /** * Extracts raw stacktrace information from Universal Profiling. - * @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/observability/8.18/universal-profiling.html | Elasticsearch API documentation} */ async stacktraces (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async stacktraces (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -104,7 +104,7 @@ export default class Profiling { /** * Returns basic information about the status of Universal Profiling. - * @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/observability/8.18/universal-profiling.html | Elasticsearch API documentation} */ async status (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async status (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -133,7 +133,7 @@ export default class Profiling { /** * Extracts a list of topN functions from Universal Profiling. - * @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/observability/8.18/universal-profiling.html | Elasticsearch API documentation} */ async topnFunctions (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async topnFunctions (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/put_script.ts b/src/api/api/put_script.ts index 94c3449d9..f21695d6b 100644 --- a/src/api/api/put_script.ts +++ b/src/api/api/put_script.ts @@ -40,7 +40,7 @@ interface That { transport: Transport } /** * Create or update a script or search template. Creates or updates a stored script or search template. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/create-stored-script-api.html | Elasticsearch API documentation} */ export default async function PutScriptApi (this: That, params: T.PutScriptRequest | TB.PutScriptRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function PutScriptApi (this: That, params: T.PutScriptRequest | TB.PutScriptRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/query_rules.ts b/src/api/api/query_rules.ts index 1a090d5ff..0b4e591b5 100644 --- a/src/api/api/query_rules.ts +++ b/src/api/api/query_rules.ts @@ -45,8 +45,8 @@ export default class QueryRules { } /** - * Deletes a query rule within a query ruleset. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-rule.html | Elasticsearch API documentation} + * Delete a query rule. Delete a query rule within a query ruleset. This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-query-rule.html | Elasticsearch API documentation} */ async deleteRule (this: That, params: T.QueryRulesDeleteRuleRequest | TB.QueryRulesDeleteRuleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteRule (this: That, params: T.QueryRulesDeleteRuleRequest | TB.QueryRulesDeleteRuleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -78,8 +78,8 @@ export default class QueryRules { } /** - * Deletes a query ruleset. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-ruleset.html | Elasticsearch API documentation} + * Delete a query ruleset. Remove a query ruleset and its associated data. This is a destructive action that is not recoverable. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-query-ruleset.html | Elasticsearch API documentation} */ async deleteRuleset (this: That, params: T.QueryRulesDeleteRulesetRequest | TB.QueryRulesDeleteRulesetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteRuleset (this: That, params: T.QueryRulesDeleteRulesetRequest | TB.QueryRulesDeleteRulesetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -110,8 +110,8 @@ export default class QueryRules { } /** - * Returns the details about a query rule within a query ruleset - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-rule.html | Elasticsearch API documentation} + * Get a query rule. Get details about a query rule within a query ruleset. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-query-rule.html | Elasticsearch API documentation} */ async getRule (this: That, params: T.QueryRulesGetRuleRequest | TB.QueryRulesGetRuleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getRule (this: That, params: T.QueryRulesGetRuleRequest | TB.QueryRulesGetRuleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -143,8 +143,8 @@ export default class QueryRules { } /** - * Returns the details about a query ruleset - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-ruleset.html | Elasticsearch API documentation} + * Get a query ruleset. Get details about a query ruleset. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-query-ruleset.html | Elasticsearch API documentation} */ async getRuleset (this: That, params: T.QueryRulesGetRulesetRequest | TB.QueryRulesGetRulesetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getRuleset (this: That, params: T.QueryRulesGetRulesetRequest | TB.QueryRulesGetRulesetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -175,8 +175,8 @@ export default class QueryRules { } /** - * Returns summarized information about existing query rulesets. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/list-query-rulesets.html | Elasticsearch API documentation} + * Get all query rulesets. Get summarized information about the query rulesets. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/list-query-rulesets.html | Elasticsearch API documentation} */ async listRulesets (this: That, params?: T.QueryRulesListRulesetsRequest | TB.QueryRulesListRulesetsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async listRulesets (this: That, params?: T.QueryRulesListRulesetsRequest | TB.QueryRulesListRulesetsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -205,8 +205,8 @@ export default class QueryRules { } /** - * Creates or updates a query rule within a query ruleset. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-rule.html | Elasticsearch API documentation} + * Create or update a query rule. Create or update a query rule within a query ruleset. IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. It is advised to use one or the other in query rulesets, to avoid errors. Additionally, pinned queries have a maximum limit of 100 pinned hits. If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-query-rule.html | Elasticsearch API documentation} */ async putRule (this: That, params: T.QueryRulesPutRuleRequest | TB.QueryRulesPutRuleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putRule (this: That, params: T.QueryRulesPutRuleRequest | TB.QueryRulesPutRuleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -250,8 +250,8 @@ export default class QueryRules { } /** - * Creates or updates a query ruleset. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-ruleset.html | Elasticsearch API documentation} + * Create or update a query ruleset. There is a limit of 100 rules per ruleset. This limit can be increased by using the `xpack.applications.rules.max_rules_per_ruleset` cluster setting. IMPORTANT: Due to limitations within pinned queries, you can only select documents using `ids` or `docs`, but cannot use both in single rule. It is advised to use one or the other in query rulesets, to avoid errors. Additionally, pinned queries have a maximum limit of 100 pinned hits. If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-query-ruleset.html | Elasticsearch API documentation} */ async putRuleset (this: That, params: T.QueryRulesPutRulesetRequest | TB.QueryRulesPutRulesetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putRuleset (this: That, params: T.QueryRulesPutRulesetRequest | TB.QueryRulesPutRulesetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -292,4 +292,48 @@ export default class QueryRules { } return await this.transport.request({ path, method, querystring, body, meta }, options) } + + /** + * Test a query ruleset. Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/test-query-ruleset.html | Elasticsearch API documentation} + */ + async test (this: That, params: T.QueryRulesTestRequest | TB.QueryRulesTestRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async test (this: That, params: T.QueryRulesTestRequest | TB.QueryRulesTestRequest, options?: TransportRequestOptionsWithMeta): Promise> + async test (this: That, params: T.QueryRulesTestRequest | TB.QueryRulesTestRequest, options?: TransportRequestOptions): Promise + async test (this: That, params: T.QueryRulesTestRequest | TB.QueryRulesTestRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['ruleset_id'] + const acceptedBody: string[] = ['match_criteria'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_query_rules/${encodeURIComponent(params.ruleset_id.toString())}/_test` + const meta: TransportRequestMetadata = { + name: 'query_rules.test', + pathParts: { + ruleset_id: params.ruleset_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } } diff --git a/src/api/api/rank_eval.ts b/src/api/api/rank_eval.ts index 010a984a6..03a654b26 100644 --- a/src/api/api/rank_eval.ts +++ b/src/api/api/rank_eval.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Enables you to evaluate the quality of ranked search results over a set of typical search queries. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html | Elasticsearch API documentation} + * Evaluate ranked search results. Evaluate the quality of ranked search results over a set of typical search queries. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-rank-eval.html | Elasticsearch API documentation} */ export default async function RankEvalApi (this: That, params: T.RankEvalRequest | TB.RankEvalRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function RankEvalApi (this: That, params: T.RankEvalRequest | TB.RankEvalRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/reindex.ts b/src/api/api/reindex.ts index 69d23a4f6..63f445829 100644 --- a/src/api/api/reindex.ts +++ b/src/api/api/reindex.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Reindex documents. Copies documents from a source to a destination. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html | Elasticsearch API documentation} + * Reindex documents. Copy documents from a source to a destination. You can copy all documents to the destination index or reindex a subset of the documents. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself. IMPORTANT: Reindex requires `_source` to be enabled for all documents in the source. The destination should be configured as wanted before calling the reindex API. Reindex does not copy the settings from the source or its associated template. Mappings, shard counts, and replicas, for example, must be configured ahead of time. If the Elasticsearch security features are enabled, you must have the following security privileges: * The `read` index privilege for the source data stream, index, or alias. * The `write` index privilege for the destination data stream, index, or index alias. * To automatically create a data stream or index with a reindex API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege for the destination data stream, index, or alias. * If reindexing from a remote cluster, the `source.remote.user` must have the `monitor` cluster privilege and the `read` index privilege for the source data stream, index, or alias. If reindexing from a remote cluster, you must explicitly allow the remote host in the `reindex.remote.whitelist` setting. Automatic data stream creation requires a matching index template with data stream enabled. The `dest` element can be configured like the index API to control optimistic concurrency control. Omitting `version_type` or setting it to `internal` causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. Setting `version_type` to `external` causes Elasticsearch to preserve the `version` from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. Setting `op_type` to `create` causes the reindex API to create only missing documents in the destination. All existing documents will cause a version conflict. IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an `op_type` of `create`. A reindex can only add new documents to a destination data stream. It cannot update existing documents in a destination data stream. By default, version conflicts abort the reindex process. To continue reindexing if there are conflicts, set the `conflicts` request body property to `proceed`. In this case, the response includes a count of the version conflicts that were encountered. Note that the handling of other error types is unaffected by the `conflicts` property. Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query. NOTE: The reindex API makes no effort to handle ID collisions. The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. Instead, make sure that IDs are unique by using a script. **Running reindex asynchronously** If the request contains `wait_for_completion=false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at `_tasks/`. **Reindex from multiple sources** If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. That way you can resume the process if there are any errors by removing the partially completed source and starting over. It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. For example, you can use a bash script like this: ``` for index in i1 i2 i3 i4 i5; do curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ "source": { "index": "'$index'" }, "dest": { "index": "'$index'-reindexed" } }' done ``` **Throttling** Set `requests_per_second` to any positive decimal number (`1.4`, `6`, `1000`, for example) to throttle the rate at which reindex issues batches of index operations. Requests are throttled by padding each batch with a wait time. To turn off throttling, set `requests_per_second` to `-1`. The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. By default the batch size is `1000`, so if `requests_per_second` is set to `500`: ``` target_time = 1000 / 500 per second = 2 seconds wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds ``` Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. This is "bursty" instead of "smooth". **Slicing** Reindex supports sliced scroll to parallelize the reindexing process. This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. NOTE: Reindexing from remote clusters does not support manual or automatic slicing. You can slice a reindex request manually by providing a slice ID and total number of slices to each request. You can also let reindex automatically parallelize by using sliced scroll to slice on `_id`. The `slices` parameter specifies the number of slices to use. Adding `slices` to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: * You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. * Fetching the status of the task for the request with `slices` only contains the status of completed slices. * These sub-requests are individually addressable for things like cancellation and rethrottling. * Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. * Canceling the request with `slices` will cancel each sub-request. * Due to the nature of `slices`, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. * Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being reindexed. * Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. If slicing automatically, setting `slices` to `auto` will choose a reasonable number for most indices. If slicing manually or otherwise tuning automatic slicing, use the following guidelines. Query performance is most efficient when the number of slices is equal to the number of shards in the index. If that number is large (for example, `500`), choose a lower number as too many slices will hurt performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. Indexing performance scales linearly across available resources with the number of slices. Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. **Modify documents during reindexing** Like `_update_by_query`, reindex operations support a script that modifies the document. Unlike `_update_by_query`, the script is allowed to modify the document's metadata. Just as in `_update_by_query`, you can set `ctx.op` to change the operation that is run on the destination. For example, set `ctx.op` to `noop` if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the `noop` counter in the response body. Set `ctx.op` to `delete` if your script decides that the document must be deleted from the destination. The deletion will be reported in the `deleted` counter in the response body. Setting `ctx.op` to anything else will return an error, as will setting any other field in `ctx`. Think of the possibilities! Just be careful; you are able to change: * `_id` * `_index` * `_version` * `_routing` Setting `_version` to `null` or clearing it from the `ctx` map is just like not sending the version in an indexing request. It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. **Reindex from remote** Reindex supports reindexing from a remote Elasticsearch cluster. The `host` parameter must contain a scheme, host, port, and optional path. The `username` and `password` parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. There are a range of settings available to configure the behavior of the HTTPS connection. When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. Remote hosts must be explicitly allowed with the `reindex.remote.whitelist` setting. It can be set to a comma delimited list of allowed remote host and port combinations. Scheme is ignored; only the host and port are used. For example: ``` reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] ``` The list of allowed hosts must be configured on any nodes that will coordinate the reindex. This feature should work with remote clusters of any version of Elasticsearch. This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. WARNING: Elasticsearch does not support forward compatibility across major versions. For example, you cannot reindex from a 7.x cluster into a 6.x cluster. To enable queries sent to older versions of Elasticsearch, the `query` parameter is sent directly to the remote host without validation or modification. NOTE: Reindexing from remote clusters does not support manual or automatic slicing. Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. If the remote index includes very large documents you'll need to use a smaller batch size. It is also possible to set the socket read timeout on the remote connection with the `socket_timeout` field and the connection timeout with the `connect_timeout` field. Both default to 30 seconds. **Configuring SSL parameters** Reindex from remote supports configurable SSL settings. These must be specified in the `elasticsearch.yml` file, with the exception of the secure settings, which you add in the Elasticsearch keystore. It is not possible to configure SSL in the body of the reindex request. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-reindex.html | Elasticsearch API documentation} */ export default async function ReindexApi (this: That, params: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function ReindexApi (this: That, params: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/reindex_rethrottle.ts b/src/api/api/reindex_rethrottle.ts index 4fedb4ed3..47ebc82f4 100644 --- a/src/api/api/reindex_rethrottle.ts +++ b/src/api/api/reindex_rethrottle.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Copies documents from a source to a destination. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html | Elasticsearch API documentation} + * Throttle a reindex operation. Change the number of requests per second for a particular reindex operation. For example: ``` POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 ``` Rethrottling that speeds up the query takes effect immediately. Rethrottling that slows down the query will take effect after completing the current batch. This behavior prevents scroll timeouts. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-reindex.html | Elasticsearch API documentation} */ export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest | TB.ReindexRethrottleRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest | TB.ReindexRethrottleRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/render_search_template.ts b/src/api/api/render_search_template.ts index cd31ab4c8..28a73ef74 100644 --- a/src/api/api/render_search_template.ts +++ b/src/api/api/render_search_template.ts @@ -39,15 +39,15 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Renders a search template as a search request body. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/render-search-template-api.html | Elasticsearch API documentation} + * Render a search template. Render a search template as a search request body. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/render-search-template-api.html | Elasticsearch API documentation} */ export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest | TB.RenderSearchTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest | TB.RenderSearchTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise> export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest | TB.RenderSearchTemplateRequest, options?: TransportRequestOptions): Promise export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest | TB.RenderSearchTemplateRequest, options?: TransportRequestOptions): Promise { - const acceptedPath: string[] = ['id'] - const acceptedBody: string[] = ['file', 'params', 'source'] + const acceptedPath: string[] = [] + const acceptedBody: string[] = ['id', 'file', 'params', 'source'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body diff --git a/src/api/api/rollup.ts b/src/api/api/rollup.ts index d9aad8fd7..27dd25b8f 100644 --- a/src/api/api/rollup.ts +++ b/src/api/api/rollup.ts @@ -45,8 +45,8 @@ export default class Rollup { } /** - * Deletes an existing rollup job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-delete-job.html | Elasticsearch API documentation} + * Delete a rollup job. A job must be stopped before it can be deleted. If you attempt to delete a started job, an error occurs. Similarly, if you attempt to delete a nonexistent job, an exception occurs. IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. The API does not delete any previously rolled up data. This is by design; a user may wish to roll up a static data set. Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). Thus the job can be deleted, leaving behind the rolled up data for analysis. If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: ``` POST my_rollup_index/_delete_by_query { "query": { "term": { "_rollup.id": "the_rollup_job_id" } } } ``` + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/rollup-delete-job.html | Elasticsearch API documentation} */ async deleteJob (this: That, params: T.RollupDeleteJobRequest | TB.RollupDeleteJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteJob (this: That, params: T.RollupDeleteJobRequest | TB.RollupDeleteJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Rollup { } /** - * Retrieves the configuration, stats, and status of rollup jobs. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-job.html | Elasticsearch API documentation} + * Get rollup job information. Get the configuration, stats, and status of rollup jobs. NOTE: This API returns only active (both `STARTED` and `STOPPED`) jobs. If a job was created, ran for a while, then was deleted, the API does not return any details about it. For details about a historical rollup job, the rollup capabilities API may be more useful. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/rollup-get-job.html | Elasticsearch API documentation} */ async getJobs (this: That, params?: T.RollupGetJobsRequest | TB.RollupGetJobsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getJobs (this: That, params?: T.RollupGetJobsRequest | TB.RollupGetJobsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -117,8 +117,8 @@ export default class Rollup { } /** - * Returns the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-caps.html | Elasticsearch API documentation} + * Get the rollup job capabilities. Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. This API enables you to inspect an index and determine: 1. Does this index have associated rollup data somewhere in the cluster? 2. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/rollup-get-rollup-caps.html | Elasticsearch API documentation} */ async getRollupCaps (this: That, params?: T.RollupGetRollupCapsRequest | TB.RollupGetRollupCapsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getRollupCaps (this: That, params?: T.RollupGetRollupCapsRequest | TB.RollupGetRollupCapsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -157,8 +157,8 @@ export default class Rollup { } /** - * Returns the rollup capabilities of all jobs inside of a rollup index (for example, the index where rollup data is stored). - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-index-caps.html | Elasticsearch API documentation} + * Get the rollup index capabilities. Get the rollup capabilities of all jobs inside of a rollup index. A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: * What jobs are stored in an index (or indices specified via a pattern)? * What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/rollup-get-rollup-index-caps.html | Elasticsearch API documentation} */ async getRollupIndexCaps (this: That, params: T.RollupGetRollupIndexCapsRequest | TB.RollupGetRollupIndexCapsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getRollupIndexCaps (this: That, params: T.RollupGetRollupIndexCapsRequest | TB.RollupGetRollupIndexCapsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -189,8 +189,8 @@ export default class Rollup { } /** - * Creates a rollup job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-put-job.html | Elasticsearch API documentation} + * Create a rollup job. WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. Jobs are created in a `STOPPED` state. You can start them with the start rollup jobs API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/rollup-put-job.html | Elasticsearch API documentation} */ async putJob (this: That, params: T.RollupPutJobRequest | TB.RollupPutJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putJob (this: That, params: T.RollupPutJobRequest | TB.RollupPutJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -233,8 +233,8 @@ export default class Rollup { } /** - * Enables searching rolled-up data using the standard Query DSL. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-search.html | Elasticsearch API documentation} + * Search rolled-up data. The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. The request body supports a subset of features from the regular search API. The following functionality is not available: `size`: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. `highlighter`, `suggestors`, `post_filter`, `profile`, `explain`: These are similarly disallowed. **Searching both historical rollup and non-rollup data** The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. This is done by simply adding the live indices to the URI. For example: ``` GET sensor-1,sensor_rollup/_rollup_search { "size": 0, "aggregations": { "max_temperature": { "max": { "field": "temperature" } } } } ``` The rollup search endpoint does two things when the search runs: * The original request is sent to the non-rollup index unaltered. * A rewritten version of the original request is sent to the rollup index. When the two responses are received, the endpoint rewrites the rollup response and merges the two together. During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/rollup-search.html | Elasticsearch API documentation} */ async rollupSearch> (this: That, params: T.RollupRollupSearchRequest | TB.RollupRollupSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async rollupSearch> (this: That, params: T.RollupRollupSearchRequest | TB.RollupRollupSearchRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> @@ -277,8 +277,8 @@ export default class Rollup { } /** - * Starts an existing, stopped rollup job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-start-job.html | Elasticsearch API documentation} + * Start rollup jobs. If you try to start a job that does not exist, an exception occurs. If you try to start a job that is already started, nothing happens. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/rollup-start-job.html | Elasticsearch API documentation} */ async startJob (this: That, params: T.RollupStartJobRequest | TB.RollupStartJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async startJob (this: That, params: T.RollupStartJobRequest | TB.RollupStartJobRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -309,8 +309,8 @@ export default class Rollup { } /** - * Stops an existing, started rollup job. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-stop-job.html | Elasticsearch API documentation} + * Stop rollup jobs. If you try to stop a job that does not exist, an exception occurs. If you try to stop a job that is already stopped, nothing happens. Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. This is accomplished with the `wait_for_completion` query parameter, and optionally a timeout. For example: ``` POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s ``` The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/rollup-stop-job.html | Elasticsearch API documentation} */ async stopJob (this: That, params: T.RollupStopJobRequest | TB.RollupStopJobRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stopJob (this: That, params: T.RollupStopJobRequest | TB.RollupStopJobRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/scripts_painless_execute.ts b/src/api/api/scripts_painless_execute.ts index a1a9fa0b5..28db03ea4 100644 --- a/src/api/api/scripts_painless_execute.ts +++ b/src/api/api/scripts_painless_execute.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Run a script. Runs a script and returns a result. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html | Elasticsearch API documentation} + * Run a script. Runs a script and returns a result. Use this API to build and test scripts, such as when defining a script for a runtime field. This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster. The API uses several _contexts_, which control how scripts are run, what variables are available at runtime, and what the return type is. Each context requires a script, but additional parameters depend on the context you're using for that script. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/painless/8.18/painless-execute-api.html | Elasticsearch API documentation} */ export default async function ScriptsPainlessExecuteApi (this: That, params?: T.ScriptsPainlessExecuteRequest | TB.ScriptsPainlessExecuteRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function ScriptsPainlessExecuteApi (this: That, params?: T.ScriptsPainlessExecuteRequest | TB.ScriptsPainlessExecuteRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/scroll.ts b/src/api/api/scroll.ts index 13b86d8ee..1c180dcf3 100644 --- a/src/api/api/scroll.ts +++ b/src/api/api/scroll.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Allows to retrieve a large numbers of results from a single search request. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll | Elasticsearch API documentation} + * Run a scrolling search. IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the `search_after` parameter with a point in time (PIT). The scroll API gets large sets of results from a single scrolling search request. To get the necessary scroll ID, submit a search API request that includes an argument for the `scroll` query parameter. The `scroll` parameter indicates how long Elasticsearch should retain the search context for the request. The search response returns a scroll ID in the `_scroll_id` response body parameter. You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search. You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context. IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/scroll-api.html | Elasticsearch API documentation} */ export default async function ScrollApi> (this: That, params: T.ScrollRequest | TB.ScrollRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function ScrollApi> (this: That, params: T.ScrollRequest | TB.ScrollRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/search.ts b/src/api/api/search.ts index 65dbb6c99..78429ef47 100644 --- a/src/api/api/search.ts +++ b/src/api/api/search.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Returns search hits that match the query defined in the request. You can provide search queries using the `q` query string parameter or the request body. If both are specified, only the query parameter is used. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html | Elasticsearch API documentation} + * Run a search. Get search hits that match the query defined in the request. You can provide search queries using the `q` query string parameter or the request body. If both are specified, only the query parameter is used. If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. To search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices. **Search slicing** When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties. By default the splitting is done first on the shards, then locally on each shard. The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. IMPORTANT: The same point-in-time ID should be used for all slices. If different PIT IDs are used, slices can overlap and miss documents. This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-search.html | Elasticsearch API documentation} */ export default async function SearchApi> (this: That, params?: T.SearchRequest | TB.SearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function SearchApi> (this: That, params?: T.SearchRequest | TB.SearchRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/search_application.ts b/src/api/api/search_application.ts index 52c8e9546..98159861a 100644 --- a/src/api/api/search_application.ts +++ b/src/api/api/search_application.ts @@ -45,8 +45,8 @@ export default class SearchApplication { } /** - * Deletes a search application. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-search-application.html | Elasticsearch API documentation} + * Delete a search application. Remove a search application and its associated alias. Indices attached to the search application are not removed. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-search-application.html | Elasticsearch API documentation} */ async delete (this: That, params: T.SearchApplicationDeleteRequest | TB.SearchApplicationDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async delete (this: That, params: T.SearchApplicationDeleteRequest | TB.SearchApplicationDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class SearchApplication { } /** - * Delete a behavioral analytics collection. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-analytics-collection.html | Elasticsearch API documentation} + * Delete a behavioral analytics collection. The associated data stream is also deleted. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-analytics-collection.html | Elasticsearch API documentation} */ async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -109,8 +109,8 @@ export default class SearchApplication { } /** - * Returns the details about a search application - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-search-application.html | Elasticsearch API documentation} + * Get search application details. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-search-application.html | Elasticsearch API documentation} */ async get (this: That, params: T.SearchApplicationGetRequest | TB.SearchApplicationGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async get (this: That, params: T.SearchApplicationGetRequest | TB.SearchApplicationGetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -141,8 +141,8 @@ export default class SearchApplication { } /** - * Returns the existing behavioral analytics collections. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/list-analytics-collection.html | Elasticsearch API documentation} + * Get behavioral analytics collections. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/list-analytics-collection.html | Elasticsearch API documentation} */ async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -181,8 +181,8 @@ export default class SearchApplication { } /** - * Returns the existing search applications. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/list-search-applications.html | Elasticsearch API documentation} + * Get search applications. Get information about search applications. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/list-analytics-collection.html | Elasticsearch API documentation} */ async list (this: That, params?: T.SearchApplicationListRequest | TB.SearchApplicationListRequest, options?: TransportRequestOptionsWithOutMeta): Promise async list (this: That, params?: T.SearchApplicationListRequest | TB.SearchApplicationListRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -211,22 +211,27 @@ export default class SearchApplication { } /** - * Creates a behavioral analytics event for existing collection. - * @see {@link http://todo.com/tbd | Elasticsearch API documentation} + * Create a behavioral analytics collection event. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-analytics-collection-event.html | Elasticsearch API documentation} */ - async postBehavioralAnalyticsEvent (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async postBehavioralAnalyticsEvent (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async postBehavioralAnalyticsEvent (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async postBehavioralAnalyticsEvent (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async postBehavioralAnalyticsEvent (this: That, params: T.SearchApplicationPostBehavioralAnalyticsEventRequest | TB.SearchApplicationPostBehavioralAnalyticsEventRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async postBehavioralAnalyticsEvent (this: That, params: T.SearchApplicationPostBehavioralAnalyticsEventRequest | TB.SearchApplicationPostBehavioralAnalyticsEventRequest, options?: TransportRequestOptionsWithMeta): Promise> + async postBehavioralAnalyticsEvent (this: That, params: T.SearchApplicationPostBehavioralAnalyticsEventRequest | TB.SearchApplicationPostBehavioralAnalyticsEventRequest, options?: TransportRequestOptions): Promise + async postBehavioralAnalyticsEvent (this: That, params: T.SearchApplicationPostBehavioralAnalyticsEventRequest | TB.SearchApplicationPostBehavioralAnalyticsEventRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['collection_name', 'event_type'] + const acceptedBody: string[] = ['payload'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + let body: any = params.body ?? undefined - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + // @ts-expect-error + body = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -244,8 +249,8 @@ export default class SearchApplication { } /** - * Creates or updates a search application. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-search-application.html | Elasticsearch API documentation} + * Create or update a search application. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-search-application.html | Elasticsearch API documentation} */ async put (this: That, params: T.SearchApplicationPutRequest | TB.SearchApplicationPutRequest, options?: TransportRequestOptionsWithOutMeta): Promise async put (this: That, params: T.SearchApplicationPutRequest | TB.SearchApplicationPutRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -281,8 +286,8 @@ export default class SearchApplication { } /** - * Creates a behavioral analytics collection. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-analytics-collection.html | Elasticsearch API documentation} + * Create a behavioral analytics collection. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-analytics-collection.html | Elasticsearch API documentation} */ async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -313,22 +318,34 @@ export default class SearchApplication { } /** - * Renders a query for given search application search parameters - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-application-render-query.html | Elasticsearch API documentation} + * Render a search application query. Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. If a parameter used in the search template is not specified in `params`, the parameter's default value will be used. The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. You must have `read` privileges on the backing alias of the search application. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-application-render-query.html | Elasticsearch API documentation} */ - async renderQuery (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async renderQuery (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async renderQuery (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async renderQuery (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async renderQuery (this: That, params: T.SearchApplicationRenderQueryRequest | TB.SearchApplicationRenderQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async renderQuery (this: That, params: T.SearchApplicationRenderQueryRequest | TB.SearchApplicationRenderQueryRequest, options?: TransportRequestOptionsWithMeta): Promise> + async renderQuery (this: That, params: T.SearchApplicationRenderQueryRequest | TB.SearchApplicationRenderQueryRequest, options?: TransportRequestOptions): Promise + async renderQuery (this: That, params: T.SearchApplicationRenderQueryRequest | TB.SearchApplicationRenderQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] + const acceptedBody: string[] = ['params'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -345,8 +362,8 @@ export default class SearchApplication { } /** - * Perform a search against a search application. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-application-search.html | Elasticsearch API documentation} + * Run a search application search. Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. Unspecified template parameters are assigned their default values if applicable. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-application-search.html | Elasticsearch API documentation} */ async search> (this: That, params: T.SearchApplicationSearchRequest | TB.SearchApplicationSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async search> (this: That, params: T.SearchApplicationSearchRequest | TB.SearchApplicationSearchRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/search_mvt.ts b/src/api/api/search_mvt.ts index 6d2f125b8..808eb312e 100644 --- a/src/api/api/search_mvt.ts +++ b/src/api/api/search_mvt.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Search a vector tile. Searches a vector tile for geospatial values. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-vector-tile-api.html | Elasticsearch API documentation} + * Search a vector tile. Search a vector tile for geospatial values. Before using this API, you should be familiar with the Mapbox vector tile specification. The API returns results as a binary mapbox vector tile. Internally, Elasticsearch translates a vector tile search API request into a search containing: * A `geo_bounding_box` query on the ``. The query uses the `//` tile as a bounding box. * A `geotile_grid` or `geohex_grid` aggregation on the ``. The `grid_agg` parameter determines the aggregation type. The aggregation uses the `//` tile as a bounding box. * Optionally, a `geo_bounds` aggregation on the ``. The search only includes this aggregation if the `exact_bounds` parameter is `true`. * If the optional parameter `with_labels` is `true`, the internal search will include a dynamic runtime field that calls the `getLabelPosition` function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. For example, Elasticsearch may translate a vector tile search API request with a `grid_agg` argument of `geotile` and an `exact_bounds` argument of `true` into the following search ``` GET my-index/_search { "size": 10000, "query": { "geo_bounding_box": { "my-geo-field": { "top_left": { "lat": -40.979898069620134, "lon": -45 }, "bottom_right": { "lat": -66.51326044311186, "lon": 0 } } } }, "aggregations": { "grid": { "geotile_grid": { "field": "my-geo-field", "precision": 11, "size": 65536, "bounds": { "top_left": { "lat": -40.979898069620134, "lon": -45 }, "bottom_right": { "lat": -66.51326044311186, "lon": 0 } } } }, "bounds": { "geo_bounds": { "field": "my-geo-field", "wrap_longitude": false } } } } ``` The API returns results as a binary Mapbox vector tile. Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: * A `hits` layer containing a feature for each `` value matching the `geo_bounding_box` query. * An `aggs` layer containing a feature for each cell of the `geotile_grid` or `geohex_grid`. The layer only contains features for cells with matching data. * A meta layer containing: * A feature containing a bounding box. By default, this is the bounding box of the tile. * Value ranges for any sub-aggregations on the `geotile_grid` or `geohex_grid`. * Metadata for the search. The API only returns features that can display at its zoom level. For example, if a polygon feature has no area at its zoom level, the API omits it. The API returns errors as UTF-8 encoded JSON. IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. If you specify both parameters, the query parameter takes precedence. **Grid precision for geotile** For a `grid_agg` of `geotile`, you can use cells in the `aggs` layer as tiles for lower zoom levels. `grid_precision` represents the additional zoom levels available through these cells. The final precision is computed by as follows: ` + grid_precision`. For example, if `` is 7 and `grid_precision` is 8, then the `geotile_grid` aggregation will use a precision of 15. The maximum final precision is 29. The `grid_precision` also determines the number of cells for the grid as follows: `(2^grid_precision) x (2^grid_precision)`. For example, a value of 8 divides the tile into a grid of 256 x 256 cells. The `aggs` layer only contains features for cells with matching data. **Grid precision for geohex** For a `grid_agg` of `geohex`, Elasticsearch uses `` and `grid_precision` to calculate a final precision as follows: ` + grid_precision`. This precision determines the H3 resolution of the hexagonal cells produced by the `geohex` aggregation. The following table maps the H3 resolution for each precision. For example, if `` is 3 and `grid_precision` is 3, the precision is 6. At a precision of 6, hexagonal cells have an H3 resolution of 2. If `` is 3 and `grid_precision` is 4, the precision is 7. At a precision of 7, hexagonal cells have an H3 resolution of 3. | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | | --------- | ---------------- | ------------- | ----------------| ----- | | 1 | 4 | 0 | 122 | 30.5 | | 2 | 16 | 0 | 122 | 7.625 | | 3 | 64 | 1 | 842 | 13.15625 | | 4 | 256 | 1 | 842 | 3.2890625 | | 5 | 1024 | 2 | 5882 | 5.744140625 | | 6 | 4096 | 2 | 5882 | 1.436035156 | | 7 | 16384 | 3 | 41162 | 2.512329102 | | 8 | 65536 | 3 | 41162 | 0.6280822754 | | 9 | 262144 | 4 | 288122 | 1.099098206 | | 10 | 1048576 | 4 | 288122 | 0.2747745514 | | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | Hexagonal cells don't align perfectly on a vector tile. Some cells may intersect more than one vector tile. To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-vector-tile-api.html | Elasticsearch API documentation} */ export default async function SearchMvtApi (this: That, params: T.SearchMvtRequest | TB.SearchMvtRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function SearchMvtApi (this: That, params: T.SearchMvtRequest | TB.SearchMvtRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/search_shards.ts b/src/api/api/search_shards.ts index c9b2b299d..0e4a4cdc0 100644 --- a/src/api/api/search_shards.ts +++ b/src/api/api/search_shards.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Returns information about the indices and shards that a search request would be executed against. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html | Elasticsearch API documentation} + * Get the search shards. Get the indices and shards that a search request would be run against. This information can be useful for working out issues or planning optimizations with routing and shard preferences. When filtered aliases are used, the filter is returned as part of the `indices` section. If the Elasticsearch security features are enabled, you must have the `view_index_metadata` or `manage` index privilege for the target data stream, index, or alias. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-shards.html | Elasticsearch API documentation} */ export default async function SearchShardsApi (this: That, params?: T.SearchShardsRequest | TB.SearchShardsRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function SearchShardsApi (this: That, params?: T.SearchShardsRequest | TB.SearchShardsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/search_template.ts b/src/api/api/search_template.ts index a158ad55a..a861c4403 100644 --- a/src/api/api/search_template.ts +++ b/src/api/api/search_template.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Runs a search with a search template. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-template.html | Elasticsearch API documentation} + * Run a search with a search template. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-template-api.html | Elasticsearch API documentation} */ export default async function SearchTemplateApi (this: That, params?: T.SearchTemplateRequest | TB.SearchTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function SearchTemplateApi (this: That, params?: T.SearchTemplateRequest | TB.SearchTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/searchable_snapshots.ts b/src/api/api/searchable_snapshots.ts index 90ac0b9e2..7918dc14a 100644 --- a/src/api/api/searchable_snapshots.ts +++ b/src/api/api/searchable_snapshots.ts @@ -45,8 +45,8 @@ export default class SearchableSnapshots { } /** - * Retrieve node-level cache statistics about searchable snapshots. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html | Elasticsearch API documentation} + * Get cache statistics. Get statistics about the shared cache for partially mounted indices. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/searchable-snapshots-api-cache-stats.html | Elasticsearch API documentation} */ async cacheStats (this: That, params?: T.SearchableSnapshotsCacheStatsRequest | TB.SearchableSnapshotsCacheStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async cacheStats (this: That, params?: T.SearchableSnapshotsCacheStatsRequest | TB.SearchableSnapshotsCacheStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -85,8 +85,8 @@ export default class SearchableSnapshots { } /** - * Clear the cache of searchable snapshots. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html | Elasticsearch API documentation} + * Clear the cache. Clear indices and data streams from the shared cache for partially mounted indices. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/searchable-snapshots-api-clear-cache.html | Elasticsearch API documentation} */ async clearCache (this: That, params?: T.SearchableSnapshotsClearCacheRequest | TB.SearchableSnapshotsClearCacheRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearCache (this: That, params?: T.SearchableSnapshotsClearCacheRequest | TB.SearchableSnapshotsClearCacheRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -125,8 +125,8 @@ export default class SearchableSnapshots { } /** - * Mount a snapshot as a searchable index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-mount-snapshot.html | Elasticsearch API documentation} + * Mount a snapshot. Mount a snapshot as a searchable snapshot index. Do not use this API for snapshots managed by index lifecycle management (ILM). Manually mounting ILM-managed snapshots can interfere with ILM processes. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/searchable-snapshots-api-mount-snapshot.html | Elasticsearch API documentation} */ async mount (this: That, params: T.SearchableSnapshotsMountRequest | TB.SearchableSnapshotsMountRequest, options?: TransportRequestOptionsWithOutMeta): Promise async mount (this: That, params: T.SearchableSnapshotsMountRequest | TB.SearchableSnapshotsMountRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -170,8 +170,8 @@ export default class SearchableSnapshots { } /** - * Retrieve shard-level statistics about searchable snapshots. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html | Elasticsearch API documentation} + * Get searchable snapshot statistics. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/searchable-snapshots-api-stats.html | Elasticsearch API documentation} */ async stats (this: That, params?: T.SearchableSnapshotsStatsRequest | TB.SearchableSnapshotsStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stats (this: That, params?: T.SearchableSnapshotsStatsRequest | TB.SearchableSnapshotsStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/security.ts b/src/api/api/security.ts index b5e25f38a..6f7ba4432 100644 --- a/src/api/api/security.ts +++ b/src/api/api/security.ts @@ -45,8 +45,8 @@ export default class Security { } /** - * Creates or updates a user profile on behalf of another user. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-activate-user-profile.html | Elasticsearch API documentation} + * Activate a user profile. Create or update a user profile on behalf of another user. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. The calling application must have either an `access_token` or a combination of `username` and `password` for the user that the profile document is intended for. Elastic reserves the right to change or remove this feature in future releases without prior notice. This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including `username`, `full_name,` `roles`, and the authentication realm. For example, in the JWT `access_token` case, the profile user's `username` is extracted from the JWT token claim pointed to by the `claims.principal` setting of the JWT realm that authenticated the token. When updating a profile document, the API enables the document if it was disabled. Any updates do not change existing content for either the `labels` or `data` fields. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-activate-user-profile.html | Elasticsearch API documentation} */ async activateUserProfile (this: That, params: T.SecurityActivateUserProfileRequest | TB.SecurityActivateUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise async activateUserProfile (this: That, params: T.SecurityActivateUserProfileRequest | TB.SecurityActivateUserProfileRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -87,7 +87,7 @@ export default class Security { /** * Authenticate a user. Authenticates a user and returns information about the authenticated user. Include the user information in a [basic auth header](https://en.wikipedia.org/wiki/Basic_access_authentication). A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. If the user cannot be authenticated, this API returns a 401 status code. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-authenticate.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-authenticate.html | Elasticsearch API documentation} */ async authenticate (this: That, params?: T.SecurityAuthenticateRequest | TB.SecurityAuthenticateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async authenticate (this: That, params?: T.SecurityAuthenticateRequest | TB.SecurityAuthenticateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -116,8 +116,8 @@ export default class Security { } /** - * The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The bulk delete roles API cannot delete roles that are defined in roles files. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-bulk-delete-role.html | Elasticsearch API documentation} + * Bulk delete roles. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The bulk delete roles API cannot delete roles that are defined in roles files. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-bulk-delete-role.html | Elasticsearch API documentation} */ async bulkDeleteRole (this: That, params: T.SecurityBulkDeleteRoleRequest | TB.SecurityBulkDeleteRoleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async bulkDeleteRole (this: That, params: T.SecurityBulkDeleteRoleRequest | TB.SecurityBulkDeleteRoleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -157,8 +157,8 @@ export default class Security { } /** - * The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The bulk create or update roles API cannot update roles that are defined in roles files. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-bulk-put-role.html | Elasticsearch API documentation} + * Bulk create or update roles. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The bulk create or update roles API cannot update roles that are defined in roles files. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-bulk-put-role.html | Elasticsearch API documentation} */ async bulkPutRole (this: That, params: T.SecurityBulkPutRoleRequest | TB.SecurityBulkPutRoleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async bulkPutRole (this: That, params: T.SecurityBulkPutRoleRequest | TB.SecurityBulkPutRoleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -198,22 +198,34 @@ export default class Security { } /** - * Updates the attributes of multiple existing API keys. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-bulk-update-api-keys.html | Elasticsearch API documentation} + * Bulk update API keys. Update the attributes for multiple API keys. IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. It is not possible to update expired or invalidated API keys. This API supports updates to API key access scope, metadata and expiration. The access scope of each API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request. The snapshot of the owner's permissions is updated automatically on every call. IMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-bulk-update-api-keys.html | Elasticsearch API documentation} */ - async bulkUpdateApiKeys (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async bulkUpdateApiKeys (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async bulkUpdateApiKeys (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async bulkUpdateApiKeys (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async bulkUpdateApiKeys (this: That, params: T.SecurityBulkUpdateApiKeysRequest | TB.SecurityBulkUpdateApiKeysRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async bulkUpdateApiKeys (this: That, params: T.SecurityBulkUpdateApiKeysRequest | TB.SecurityBulkUpdateApiKeysRequest, options?: TransportRequestOptionsWithMeta): Promise> + async bulkUpdateApiKeys (this: That, params: T.SecurityBulkUpdateApiKeysRequest | TB.SecurityBulkUpdateApiKeysRequest, options?: TransportRequestOptions): Promise + async bulkUpdateApiKeys (this: That, params: T.SecurityBulkUpdateApiKeysRequest | TB.SecurityBulkUpdateApiKeysRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] + const acceptedBody: string[] = ['expiration', 'ids', 'metadata', 'role_descriptors'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -227,8 +239,8 @@ export default class Security { } /** - * Changes the passwords of users in the native realm and built-in users. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-change-password.html | Elasticsearch API documentation} + * Change passwords. Change the passwords of users in the native realm and built-in users. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-change-password.html | Elasticsearch API documentation} */ async changePassword (this: That, params?: T.SecurityChangePasswordRequest | TB.SecurityChangePasswordRequest, options?: TransportRequestOptionsWithOutMeta): Promise async changePassword (this: That, params?: T.SecurityChangePasswordRequest | TB.SecurityChangePasswordRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -279,8 +291,8 @@ export default class Security { } /** - * Evicts a subset of all entries from the API key cache. The cache is also automatically cleared on state changes of the security index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-api-key-cache.html | Elasticsearch API documentation} + * Clear the API key cache. Evict a subset of all entries from the API key cache. The cache is also automatically cleared on state changes of the security index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-clear-api-key-cache.html | Elasticsearch API documentation} */ async clearApiKeyCache (this: That, params: T.SecurityClearApiKeyCacheRequest | TB.SecurityClearApiKeyCacheRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearApiKeyCache (this: That, params: T.SecurityClearApiKeyCacheRequest | TB.SecurityClearApiKeyCacheRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -311,8 +323,8 @@ export default class Security { } /** - * Evicts application privileges from the native application privileges cache. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-privilege-cache.html | Elasticsearch API documentation} + * Clear the privileges cache. Evict privileges from the native application privilege cache. The cache is also automatically cleared for applications that have their privileges updated. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-clear-privilege-cache.html | Elasticsearch API documentation} */ async clearCachedPrivileges (this: That, params: T.SecurityClearCachedPrivilegesRequest | TB.SecurityClearCachedPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearCachedPrivileges (this: That, params: T.SecurityClearCachedPrivilegesRequest | TB.SecurityClearCachedPrivilegesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -343,8 +355,8 @@ export default class Security { } /** - * Evicts users from the user cache. Can completely clear the cache or evict specific users. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-cache.html | Elasticsearch API documentation} + * Clear the user cache. Evict users from the user cache. You can completely clear the cache or evict specific users. User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. There are realm settings that you can use to configure the user cache. For more information, refer to the documentation about controlling the user cache. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-clear-cache.html | Elasticsearch API documentation} */ async clearCachedRealms (this: That, params: T.SecurityClearCachedRealmsRequest | TB.SecurityClearCachedRealmsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearCachedRealms (this: That, params: T.SecurityClearCachedRealmsRequest | TB.SecurityClearCachedRealmsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -375,8 +387,8 @@ export default class Security { } /** - * Evicts roles from the native role cache. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-role-cache.html | Elasticsearch API documentation} + * Clear the roles cache. Evict roles from the native role cache. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-clear-role-cache.html | Elasticsearch API documentation} */ async clearCachedRoles (this: That, params: T.SecurityClearCachedRolesRequest | TB.SecurityClearCachedRolesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearCachedRoles (this: That, params: T.SecurityClearCachedRolesRequest | TB.SecurityClearCachedRolesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -407,8 +419,8 @@ export default class Security { } /** - * Evicts tokens from the service account token caches. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-service-token-caches.html | Elasticsearch API documentation} + * Clear service account token caches. Evict a subset of all entries from the service account token caches. Two separate caches exist for service account tokens: one cache for tokens backed by the `service_tokens` file, and another for tokens backed by the `.security` index. This API clears matching entries from both caches. The cache for service account tokens backed by the `.security` index is cleared automatically on state changes of the security index. The cache for tokens backed by the `service_tokens` file is cleared automatically on file changes. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-clear-service-token-caches.html | Elasticsearch API documentation} */ async clearCachedServiceTokens (this: That, params: T.SecurityClearCachedServiceTokensRequest | TB.SecurityClearCachedServiceTokensRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearCachedServiceTokens (this: That, params: T.SecurityClearCachedServiceTokensRequest | TB.SecurityClearCachedServiceTokensRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -441,8 +453,8 @@ export default class Security { } /** - * Create an API key. Creates an API key for access without requiring basic authentication. A successful request returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-create-api-key.html | Elasticsearch API documentation} + * Create an API key. Create an API key for access without requiring basic authentication. IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. If you specify privileges, the API returns an error. A successful request returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. The API keys are created by the Elasticsearch API key service, which is automatically enabled. To configure or turn off the API key service, refer to API key service setting documentation. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-create-api-key.html | Elasticsearch API documentation} */ async createApiKey (this: That, params?: T.SecurityCreateApiKeyRequest | TB.SecurityCreateApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async createApiKey (this: That, params?: T.SecurityCreateApiKeyRequest | TB.SecurityCreateApiKeyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -483,22 +495,34 @@ export default class Security { } /** - * Creates a cross-cluster API key for API key based remote cluster access. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-create-cross-cluster-api-key.html | Elasticsearch API documentation} + * Create a cross-cluster API key. Create an API key of the `cross_cluster` type for the API key based remote cluster access. A `cross_cluster` API key cannot be used to authenticate through the REST interface. IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the `access` property. A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. By default, API keys never expire. You can specify expiration information when you create the API keys. Cross-cluster API keys can only be updated with the update cross-cluster API key API. Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-create-cross-cluster-api-key.html | Elasticsearch API documentation} */ - async createCrossClusterApiKey (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async createCrossClusterApiKey (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async createCrossClusterApiKey (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async createCrossClusterApiKey (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async createCrossClusterApiKey (this: That, params: T.SecurityCreateCrossClusterApiKeyRequest | TB.SecurityCreateCrossClusterApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async createCrossClusterApiKey (this: That, params: T.SecurityCreateCrossClusterApiKeyRequest | TB.SecurityCreateCrossClusterApiKeyRequest, options?: TransportRequestOptionsWithMeta): Promise> + async createCrossClusterApiKey (this: That, params: T.SecurityCreateCrossClusterApiKeyRequest | TB.SecurityCreateCrossClusterApiKeyRequest, options?: TransportRequestOptions): Promise + async createCrossClusterApiKey (this: That, params: T.SecurityCreateCrossClusterApiKeyRequest | TB.SecurityCreateCrossClusterApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] + const acceptedBody: string[] = ['access', 'expiration', 'metadata', 'name'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -512,8 +536,8 @@ export default class Security { } /** - * Creates a service accounts token for access without requiring basic authentication. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-create-service-token.html | Elasticsearch API documentation} + * Create a service account token. Create a service accounts token for access without requiring basic authentication. NOTE: Service account tokens never expire. You must actively delete them if they are no longer needed. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-create-service-token.html | Elasticsearch API documentation} */ async createServiceToken (this: That, params: T.SecurityCreateServiceTokenRequest | TB.SecurityCreateServiceTokenRequest, options?: TransportRequestOptionsWithOutMeta): Promise async createServiceToken (this: That, params: T.SecurityCreateServiceTokenRequest | TB.SecurityCreateServiceTokenRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -553,8 +577,49 @@ export default class Security { } /** - * Removes application privileges. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-privilege.html | Elasticsearch API documentation} + * Delegate PKI authentication. This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has `delegation.enabled` set to `true`. A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw `username_pattern` of the respective realm. This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-as if the user connected directly to Elasticsearch. IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. This is part of the TLS authentication process and it is delegated to the proxy that calls this API. The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-delegate-pki-authentication.html | Elasticsearch API documentation} + */ + async delegatePki (this: That, params: T.SecurityDelegatePkiRequest | TB.SecurityDelegatePkiRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async delegatePki (this: That, params: T.SecurityDelegatePkiRequest | TB.SecurityDelegatePkiRequest, options?: TransportRequestOptionsWithMeta): Promise> + async delegatePki (this: That, params: T.SecurityDelegatePkiRequest | TB.SecurityDelegatePkiRequest, options?: TransportRequestOptions): Promise + async delegatePki (this: That, params: T.SecurityDelegatePkiRequest | TB.SecurityDelegatePkiRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = [] + const acceptedBody: string[] = ['x509_certificate_chain'] + const querystring: Record = {} + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = '/_security/delegate_pki' + const meta: TransportRequestMetadata = { + name: 'security.delegate_pki' + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Delete application privileges. To use this API, you must have one of the following privileges: * The `manage_security` cluster privilege (or a greater privilege such as `all`). * The "Manage Application Privileges" global privilege for the application being referenced in the request. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-delete-privilege.html | Elasticsearch API documentation} */ async deletePrivileges (this: That, params: T.SecurityDeletePrivilegesRequest | TB.SecurityDeletePrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deletePrivileges (this: That, params: T.SecurityDeletePrivilegesRequest | TB.SecurityDeletePrivilegesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -586,8 +651,8 @@ export default class Security { } /** - * Removes roles in the native realm. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-role.html | Elasticsearch API documentation} + * Delete roles. Delete roles in the native realm. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The delete roles API cannot remove roles that are defined in roles files. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-delete-role.html | Elasticsearch API documentation} */ async deleteRole (this: That, params: T.SecurityDeleteRoleRequest | TB.SecurityDeleteRoleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteRole (this: That, params: T.SecurityDeleteRoleRequest | TB.SecurityDeleteRoleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -618,8 +683,8 @@ export default class Security { } /** - * Removes role mappings. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-role-mapping.html | Elasticsearch API documentation} + * Delete role mappings. Role mappings define which roles are assigned to each user. The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The delete role mappings API cannot remove role mappings that are defined in role mapping files. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-delete-role-mapping.html | Elasticsearch API documentation} */ async deleteRoleMapping (this: That, params: T.SecurityDeleteRoleMappingRequest | TB.SecurityDeleteRoleMappingRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteRoleMapping (this: That, params: T.SecurityDeleteRoleMappingRequest | TB.SecurityDeleteRoleMappingRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -650,8 +715,8 @@ export default class Security { } /** - * Deletes a service account token. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-service-token.html | Elasticsearch API documentation} + * Delete service account tokens. Delete service account tokens for a service in a specified namespace. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-delete-service-token.html | Elasticsearch API documentation} */ async deleteServiceToken (this: That, params: T.SecurityDeleteServiceTokenRequest | TB.SecurityDeleteServiceTokenRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteServiceToken (this: That, params: T.SecurityDeleteServiceTokenRequest | TB.SecurityDeleteServiceTokenRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -684,8 +749,8 @@ export default class Security { } /** - * Deletes users from the native realm. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-user.html | Elasticsearch API documentation} + * Delete users. Delete users from the native realm. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-delete-user.html | Elasticsearch API documentation} */ async deleteUser (this: That, params: T.SecurityDeleteUserRequest | TB.SecurityDeleteUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteUser (this: That, params: T.SecurityDeleteUserRequest | TB.SecurityDeleteUserRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -716,8 +781,8 @@ export default class Security { } /** - * Disables users in the native realm. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-disable-user.html | Elasticsearch API documentation} + * Disable users. Disable users in the native realm. By default, when you create users, they are enabled. You can use this API to revoke a user's access to Elasticsearch. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-disable-user.html | Elasticsearch API documentation} */ async disableUser (this: That, params: T.SecurityDisableUserRequest | TB.SecurityDisableUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise async disableUser (this: That, params: T.SecurityDisableUserRequest | TB.SecurityDisableUserRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -748,8 +813,8 @@ export default class Security { } /** - * Disables a user profile so it's not visible in user profile searches. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-disable-user-profile.html | Elasticsearch API documentation} + * Disable a user profile. Disable user profiles so that they are not visible in user profile searches. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. To re-enable a disabled user profile, use the enable user profile API . + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-disable-user-profile.html | Elasticsearch API documentation} */ async disableUserProfile (this: That, params: T.SecurityDisableUserProfileRequest | TB.SecurityDisableUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise async disableUserProfile (this: That, params: T.SecurityDisableUserProfileRequest | TB.SecurityDisableUserProfileRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -780,8 +845,8 @@ export default class Security { } /** - * Enables users in the native realm. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-enable-user.html | Elasticsearch API documentation} + * Enable users. Enable users in the native realm. By default, when you create users, they are enabled. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-enable-user.html | Elasticsearch API documentation} */ async enableUser (this: That, params: T.SecurityEnableUserRequest | TB.SecurityEnableUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise async enableUser (this: That, params: T.SecurityEnableUserRequest | TB.SecurityEnableUserRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -812,8 +877,8 @@ export default class Security { } /** - * Enables a user profile so it's visible in user profile searches. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-enable-user-profile.html | Elasticsearch API documentation} + * Enable a user profile. Enable user profiles to make them visible in user profile searches. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. When you activate a user profile, it's automatically enabled and visible in user profile searches. If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-enable-user-profile.html | Elasticsearch API documentation} */ async enableUserProfile (this: That, params: T.SecurityEnableUserProfileRequest | TB.SecurityEnableUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise async enableUserProfile (this: That, params: T.SecurityEnableUserProfileRequest | TB.SecurityEnableUserProfileRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -844,8 +909,8 @@ export default class Security { } /** - * Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-kibana-enrollment.html | Elasticsearch API documentation} + * Enroll Kibana. Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. NOTE: This API is currently intended for internal use only by Kibana. Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-kibana-enrollment.html | Elasticsearch API documentation} */ async enrollKibana (this: That, params?: T.SecurityEnrollKibanaRequest | TB.SecurityEnrollKibanaRequest, options?: TransportRequestOptionsWithOutMeta): Promise async enrollKibana (this: That, params?: T.SecurityEnrollKibanaRequest | TB.SecurityEnrollKibanaRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -874,8 +939,8 @@ export default class Security { } /** - * Allows a new node to join an existing cluster with security features enabled. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-node-enrollment.html | Elasticsearch API documentation} + * Enroll a node. Enroll a new node to allow it to join an existing cluster with security features enabled. The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-node-enrollment.html | Elasticsearch API documentation} */ async enrollNode (this: That, params?: T.SecurityEnrollNodeRequest | TB.SecurityEnrollNodeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async enrollNode (this: That, params?: T.SecurityEnrollNodeRequest | TB.SecurityEnrollNodeRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -905,7 +970,7 @@ export default class Security { /** * Get API key information. Retrieves information for one or more API keys. NOTE: If you have only the `manage_own_api_key` privilege, this API returns only the API keys that you own. If you have `read_security`, `manage_api_key` or greater privileges (including `manage_security`), this API returns all API keys regardless of ownership. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-api-key.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-api-key.html | Elasticsearch API documentation} */ async getApiKey (this: That, params?: T.SecurityGetApiKeyRequest | TB.SecurityGetApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getApiKey (this: That, params?: T.SecurityGetApiKeyRequest | TB.SecurityGetApiKeyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -934,8 +999,8 @@ export default class Security { } /** - * Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-builtin-privileges.html | Elasticsearch API documentation} + * Get builtin privileges. Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-builtin-privileges.html | Elasticsearch API documentation} */ async getBuiltinPrivileges (this: That, params?: T.SecurityGetBuiltinPrivilegesRequest | TB.SecurityGetBuiltinPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getBuiltinPrivileges (this: That, params?: T.SecurityGetBuiltinPrivilegesRequest | TB.SecurityGetBuiltinPrivilegesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -964,8 +1029,8 @@ export default class Security { } /** - * Retrieves application privileges. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-privileges.html | Elasticsearch API documentation} + * Get application privileges. To use this API, you must have one of the following privileges: * The `read_security` cluster privilege (or a greater privilege such as `manage_security` or `all`). * The "Manage Application Privileges" global privilege for the application being referenced in the request. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-privileges.html | Elasticsearch API documentation} */ async getPrivileges (this: That, params?: T.SecurityGetPrivilegesRequest | TB.SecurityGetPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getPrivileges (this: That, params?: T.SecurityGetPrivilegesRequest | TB.SecurityGetPrivilegesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1008,8 +1073,8 @@ export default class Security { } /** - * The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The get roles API cannot retrieve roles that are defined in roles files. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-role.html | Elasticsearch API documentation} + * Get roles. Get roles in the native realm. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The get roles API cannot retrieve roles that are defined in roles files. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-role.html | Elasticsearch API documentation} */ async getRole (this: That, params?: T.SecurityGetRoleRequest | TB.SecurityGetRoleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getRole (this: That, params?: T.SecurityGetRoleRequest | TB.SecurityGetRoleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1048,8 +1113,8 @@ export default class Security { } /** - * Retrieves role mappings. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-role-mapping.html | Elasticsearch API documentation} + * Get role mappings. Role mappings define which roles are assigned to each user. The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The get role mappings API cannot retrieve role mappings that are defined in role mapping files. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-role-mapping.html | Elasticsearch API documentation} */ async getRoleMapping (this: That, params?: T.SecurityGetRoleMappingRequest | TB.SecurityGetRoleMappingRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getRoleMapping (this: That, params?: T.SecurityGetRoleMappingRequest | TB.SecurityGetRoleMappingRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1088,8 +1153,8 @@ export default class Security { } /** - * This API returns a list of service accounts that match the provided path parameter(s). - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-service-accounts.html | Elasticsearch API documentation} + * Get service accounts. Get a list of service accounts that match the provided path parameters. NOTE: Currently, only the `elastic/fleet-server` service account is available. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-service-accounts.html | Elasticsearch API documentation} */ async getServiceAccounts (this: That, params?: T.SecurityGetServiceAccountsRequest | TB.SecurityGetServiceAccountsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getServiceAccounts (this: That, params?: T.SecurityGetServiceAccountsRequest | TB.SecurityGetServiceAccountsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1132,8 +1197,8 @@ export default class Security { } /** - * Retrieves information of all service credentials for a service account. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-service-credentials.html | Elasticsearch API documentation} + * Get service account credentials. To use this API, you must have at least the `read_security` cluster privilege (or a greater privilege such as `manage_service_account` or `manage_security`). The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. NOTE: For tokens backed by the `service_tokens` file, the API collects them from all nodes of the cluster. Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-service-credentials.html | Elasticsearch API documentation} */ async getServiceCredentials (this: That, params: T.SecurityGetServiceCredentialsRequest | TB.SecurityGetServiceCredentialsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getServiceCredentials (this: That, params: T.SecurityGetServiceCredentialsRequest | TB.SecurityGetServiceCredentialsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1165,13 +1230,13 @@ export default class Security { } /** - * Retrieve settings for the security system indices - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-settings.html | Elasticsearch API documentation} + * Get security index settings. Get the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of the index settings — those that are user-configurable—will be shown. This includes: * `index.auto_expand_replicas` * `index.number_of_replicas` + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-settings.html | Elasticsearch API documentation} */ - async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async getSettings (this: That, params?: T.SecurityGetSettingsRequest | TB.SecurityGetSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async getSettings (this: That, params?: T.SecurityGetSettingsRequest | TB.SecurityGetSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise> + async getSettings (this: That, params?: T.SecurityGetSettingsRequest | TB.SecurityGetSettingsRequest, options?: TransportRequestOptions): Promise + async getSettings (this: That, params?: T.SecurityGetSettingsRequest | TB.SecurityGetSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const querystring: Record = {} const body = undefined @@ -1181,6 +1246,7 @@ export default class Security { if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -1194,8 +1260,8 @@ export default class Security { } /** - * Creates a bearer token for access without requiring basic authentication. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-token.html | Elasticsearch API documentation} + * Get a token. Create a bearer token for access without requiring basic authentication. The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. Alternatively, you can explicitly enable the `xpack.security.authc.token.enabled` setting. When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. That time period is defined by the `xpack.security.authc.token.timeout` setting. If you want to invalidate a token immediately, you can do so by using the invalidate token API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-token.html | Elasticsearch API documentation} */ async getToken (this: That, params?: T.SecurityGetTokenRequest | TB.SecurityGetTokenRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getToken (this: That, params?: T.SecurityGetTokenRequest | TB.SecurityGetTokenRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1236,8 +1302,8 @@ export default class Security { } /** - * Retrieves information about users in the native realm and built-in users. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-user.html | Elasticsearch API documentation} + * Get users. Get information about users in the native realm and built-in users. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-user.html | Elasticsearch API documentation} */ async getUser (this: That, params?: T.SecurityGetUserRequest | TB.SecurityGetUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getUser (this: That, params?: T.SecurityGetUserRequest | TB.SecurityGetUserRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1276,8 +1342,8 @@ export default class Security { } /** - * Retrieves security privileges for the logged in user. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-user-privileges.html | Elasticsearch API documentation} + * Get user privileges. Get the security privileges for the logged in user. All users can use this API, but only to determine their own privileges. To check the privileges of other users, you must use the run as feature. To check whether a user has a specific list of privileges, use the has privileges API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-user-privileges.html | Elasticsearch API documentation} */ async getUserPrivileges (this: That, params?: T.SecurityGetUserPrivilegesRequest | TB.SecurityGetUserPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getUserPrivileges (this: That, params?: T.SecurityGetUserPrivilegesRequest | TB.SecurityGetUserPrivilegesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1306,8 +1372,8 @@ export default class Security { } /** - * Retrieves a user's profile using the unique profile ID. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-user-profile.html | Elasticsearch API documentation} + * Get a user profile. Get a user's profile using the unique profile ID. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-get-user-profile.html | Elasticsearch API documentation} */ async getUserProfile (this: That, params: T.SecurityGetUserProfileRequest | TB.SecurityGetUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getUserProfile (this: That, params: T.SecurityGetUserProfileRequest | TB.SecurityGetUserProfileRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1338,8 +1404,8 @@ export default class Security { } /** - * Creates an API key on behalf of another user. This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. It is not possible to use this API to create an API key without that user’s credentials. The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. In this case, the API key will be created on behalf of the impersonated user. This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. By default, API keys never expire. You can specify expiration information when you create the API keys. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-grant-api-key.html | Elasticsearch API documentation} + * Grant an API key. Create an API key on behalf of another user. This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. The caller must have authentication credentials for the user on whose behalf the API key will be created. It is not possible to use this API to create an API key without that user's credentials. The supported user authentication credential types are: * username and password * Elasticsearch access tokens * JWTs The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. In this case, the API key will be created on behalf of the impersonated user. This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. The API keys are created by the Elasticsearch API key service, which is automatically enabled. A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. By default, API keys never expire. You can specify expiration information when you create the API keys. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-grant-api-key.html | Elasticsearch API documentation} */ async grantApiKey (this: That, params: T.SecurityGrantApiKeyRequest | TB.SecurityGrantApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async grantApiKey (this: That, params: T.SecurityGrantApiKeyRequest | TB.SecurityGrantApiKeyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1379,8 +1445,8 @@ export default class Security { } /** - * Check user privileges. Determines whether the specified user has a specified list of privileges. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-has-privileges.html | Elasticsearch API documentation} + * Check user privileges. Determine whether the specified user has a specified list of privileges. All users can use this API, but only to determine their own privileges. To check the privileges of other users, you must use the run as feature. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-has-privileges.html | Elasticsearch API documentation} */ async hasPrivileges (this: That, params?: T.SecurityHasPrivilegesRequest | TB.SecurityHasPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async hasPrivileges (this: That, params?: T.SecurityHasPrivilegesRequest | TB.SecurityHasPrivilegesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1431,8 +1497,8 @@ export default class Security { } /** - * Determines whether the users associated with the specified profile IDs have all the requested privileges. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-has-privileges-user-profile.html | Elasticsearch API documentation} + * Check user profile privileges. Determine whether the users associated with the specified user profile IDs have all the requested privileges. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-has-privileges-user-profile.html | Elasticsearch API documentation} */ async hasPrivilegesUserProfile (this: That, params: T.SecurityHasPrivilegesUserProfileRequest | TB.SecurityHasPrivilegesUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise async hasPrivilegesUserProfile (this: That, params: T.SecurityHasPrivilegesUserProfileRequest | TB.SecurityHasPrivilegesUserProfileRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1472,8 +1538,8 @@ export default class Security { } /** - * Invalidate API keys. Invalidates one or more API keys. The `manage_api_key` privilege allows deleting any API keys. The `manage_own_api_key` only allows deleting API keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, an invalidation request must be issued in one of the three formats: - Set the parameter `owner=true`. - Or, set both `username` and `realm_name` to match the user’s identity. - Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the `ids` field. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-invalidate-api-key.html | Elasticsearch API documentation} + * Invalidate API keys. This API invalidates API keys created by the create API key or grant API key APIs. Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. To use this API, you must have at least the `manage_security`, `manage_api_key`, or `manage_own_api_key` cluster privileges. The `manage_security` privilege allows deleting any API key, including both REST and cross cluster API keys. The `manage_api_key` privilege allows deleting any REST API key, but not cross cluster API keys. The `manage_own_api_key` only allows deleting REST API keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, an invalidation request must be issued in one of the three formats: - Set the parameter `owner=true`. - Or, set both `username` and `realm_name` to match the user's identity. - Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the `ids` field. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-invalidate-api-key.html | Elasticsearch API documentation} */ async invalidateApiKey (this: That, params?: T.SecurityInvalidateApiKeyRequest | TB.SecurityInvalidateApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async invalidateApiKey (this: That, params?: T.SecurityInvalidateApiKeyRequest | TB.SecurityInvalidateApiKeyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1514,8 +1580,8 @@ export default class Security { } /** - * Invalidates one or more access tokens or refresh tokens. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-invalidate-token.html | Elasticsearch API documentation} + * Invalidate a token. The access tokens returned by the get token API have a finite period of time for which they are valid. After that time period, they can no longer be used. The time period is defined by the `xpack.security.authc.token.timeout` setting. The refresh tokens returned by the get token API are only valid for 24 hours. They can also be used exactly once. If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. NOTE: While all parameters are optional, at least one of them is required. More specifically, either one of `token` or `refresh_token` parameters is required. If none of these two are specified, then `realm_name` and/or `username` need to be specified. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-invalidate-token.html | Elasticsearch API documentation} */ async invalidateToken (this: That, params?: T.SecurityInvalidateTokenRequest | TB.SecurityInvalidateTokenRequest, options?: TransportRequestOptionsWithOutMeta): Promise async invalidateToken (this: That, params?: T.SecurityInvalidateTokenRequest | TB.SecurityInvalidateTokenRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1556,22 +1622,34 @@ export default class Security { } /** - * Exchanges an OpenID Connection authentication response message for an Elasticsearch access token and refresh token pair - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-oidc-authenticate.html | Elasticsearch API documentation} + * Authenticate OpenID Connect. Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-oidc-authenticate.html | Elasticsearch API documentation} */ - async oidcAuthenticate (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async oidcAuthenticate (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async oidcAuthenticate (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async oidcAuthenticate (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async oidcAuthenticate (this: That, params: T.SecurityOidcAuthenticateRequest | TB.SecurityOidcAuthenticateRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async oidcAuthenticate (this: That, params: T.SecurityOidcAuthenticateRequest | TB.SecurityOidcAuthenticateRequest, options?: TransportRequestOptionsWithMeta): Promise> + async oidcAuthenticate (this: That, params: T.SecurityOidcAuthenticateRequest | TB.SecurityOidcAuthenticateRequest, options?: TransportRequestOptions): Promise + async oidcAuthenticate (this: That, params: T.SecurityOidcAuthenticateRequest | TB.SecurityOidcAuthenticateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] + const acceptedBody: string[] = ['nonce', 'realm', 'redirect_uri', 'state'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -1585,22 +1663,34 @@ export default class Security { } /** - * Invalidates a refresh token and access token that was generated from the OpenID Connect Authenticate API - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-oidc-logout.html | Elasticsearch API documentation} + * Logout of OpenID Connect. Invalidate an access token and a refresh token that were generated as a response to the `/_security/oidc/authenticate` API. If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-oidc-logout.html | Elasticsearch API documentation} */ - async oidcLogout (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async oidcLogout (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async oidcLogout (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async oidcLogout (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async oidcLogout (this: That, params: T.SecurityOidcLogoutRequest | TB.SecurityOidcLogoutRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async oidcLogout (this: That, params: T.SecurityOidcLogoutRequest | TB.SecurityOidcLogoutRequest, options?: TransportRequestOptionsWithMeta): Promise> + async oidcLogout (this: That, params: T.SecurityOidcLogoutRequest | TB.SecurityOidcLogoutRequest, options?: TransportRequestOptions): Promise + async oidcLogout (this: That, params: T.SecurityOidcLogoutRequest | TB.SecurityOidcLogoutRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] + const acceptedBody: string[] = ['token', 'refresh_token'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -1614,22 +1704,35 @@ export default class Security { } /** - * Creates an OAuth 2.0 authentication request as a URL string - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-oidc-prepare-authentication.html | Elasticsearch API documentation} + * Prepare OpenID connect authentication. Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-oidc-prepare-authentication.html | Elasticsearch API documentation} */ - async oidcPrepareAuthentication (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async oidcPrepareAuthentication (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async oidcPrepareAuthentication (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async oidcPrepareAuthentication (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async oidcPrepareAuthentication (this: That, params?: T.SecurityOidcPrepareAuthenticationRequest | TB.SecurityOidcPrepareAuthenticationRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async oidcPrepareAuthentication (this: That, params?: T.SecurityOidcPrepareAuthenticationRequest | TB.SecurityOidcPrepareAuthenticationRequest, options?: TransportRequestOptionsWithMeta): Promise> + async oidcPrepareAuthentication (this: That, params?: T.SecurityOidcPrepareAuthenticationRequest | TB.SecurityOidcPrepareAuthenticationRequest, options?: TransportRequestOptions): Promise + async oidcPrepareAuthentication (this: That, params?: T.SecurityOidcPrepareAuthenticationRequest | TB.SecurityOidcPrepareAuthenticationRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] + const acceptedBody: string[] = ['iss', 'login_hint', 'nonce', 'realm', 'state'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -1643,8 +1746,8 @@ export default class Security { } /** - * Adds or updates application privileges. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-privileges.html | Elasticsearch API documentation} + * Create or update application privileges. To use this API, you must have one of the following privileges: * The `manage_security` cluster privilege (or a greater privilege such as `all`). * The "Manage Application Privileges" global privilege for the application being referenced in the request. Application names are formed from a prefix, with an optional suffix that conform to the following rules: * The prefix must begin with a lowercase ASCII letter. * The prefix must contain only ASCII letters or digits. * The prefix must be at least 3 characters long. * If the suffix exists, it must begin with either a dash `-` or `_`. * The suffix cannot contain any of the following characters: `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, `*`. * No part of the name can contain whitespace. Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters `_`, `-`, and `.`. Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: `/`, `*`, `:`. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-put-privileges.html | Elasticsearch API documentation} */ async putPrivileges (this: That, params: T.SecurityPutPrivilegesRequest | TB.SecurityPutPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putPrivileges (this: That, params: T.SecurityPutPrivilegesRequest | TB.SecurityPutPrivilegesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1677,15 +1780,15 @@ export default class Security { } /** - * The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The create or update roles API cannot update roles that are defined in roles files. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-role.html | Elasticsearch API documentation} + * Create or update roles. The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. The create or update roles API cannot update roles that are defined in roles files. File-based role management is not available in Elastic Serverless. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-put-role.html | Elasticsearch API documentation} */ async putRole (this: That, params: T.SecurityPutRoleRequest | TB.SecurityPutRoleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putRole (this: That, params: T.SecurityPutRoleRequest | TB.SecurityPutRoleRequest, options?: TransportRequestOptionsWithMeta): Promise> async putRole (this: That, params: T.SecurityPutRoleRequest | TB.SecurityPutRoleRequest, options?: TransportRequestOptions): Promise async putRole (this: That, params: T.SecurityPutRoleRequest | TB.SecurityPutRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedBody: string[] = ['applications', 'cluster', 'global', 'indices', 'metadata', 'run_as', 'description', 'transient_metadata'] + const acceptedBody: string[] = ['applications', 'cluster', 'global', 'indices', 'remote_indices', 'remote_cluster', 'metadata', 'run_as', 'description', 'transient_metadata'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -1721,8 +1824,8 @@ export default class Security { } /** - * Creates and updates role mappings. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-role-mapping.html | Elasticsearch API documentation} + * Create or update role mappings. Role mappings define which roles are assigned to each user. Each mapping has rules that identify users and a list of roles that are granted to those users. The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. NOTE: This API does not create roles. Rather, it maps users to existing roles. Roles can be created by using the create or update roles API or roles files. **Role templates** The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. For example, all users in the `cn=admin,dc=example,dc=com` LDAP group should be given the superuser role in Elasticsearch. The `roles` field is used for this purpose. For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. The `role_templates` field is used for this purpose. NOTE: To use role templates successfully, the relevant scripting feature must be enabled. Otherwise, all attempts to create a role mapping with role templates fail. All of the user fields that are available in the role mapping rules are also available in the role templates. Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-put-role-mapping.html | Elasticsearch API documentation} */ async putRoleMapping (this: That, params: T.SecurityPutRoleMappingRequest | TB.SecurityPutRoleMappingRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putRoleMapping (this: That, params: T.SecurityPutRoleMappingRequest | TB.SecurityPutRoleMappingRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1765,8 +1868,8 @@ export default class Security { } /** - * Adds and updates users in the native realm. These users are commonly referred to as native users. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-user.html | Elasticsearch API documentation} + * Create or update users. Add and update users in the native realm. A password is required for adding a new user but is optional when updating an existing user. To change a user's password without updating any other fields, use the change password API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-put-user.html | Elasticsearch API documentation} */ async putUser (this: That, params: T.SecurityPutUserRequest | TB.SecurityPutUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putUser (this: That, params: T.SecurityPutUserRequest | TB.SecurityPutUserRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1809,8 +1912,8 @@ export default class Security { } /** - * Query API keys. Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-query-api-key.html | Elasticsearch API documentation} + * Find API keys with a query. Get a paginated list of API keys and their information. You can optionally filter the results with a query. To use this API, you must have at least the `manage_own_api_key` or the `read_security` cluster privileges. If you have only the `manage_own_api_key` privilege, this API returns only the API keys that you own. If you have the `read_security`, `manage_api_key`, or greater privileges (including `manage_security`), this API returns all API keys regardless of ownership. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-query-api-key.html | Elasticsearch API documentation} */ async queryApiKeys (this: That, params?: T.SecurityQueryApiKeysRequest | TB.SecurityQueryApiKeysRequest, options?: TransportRequestOptionsWithOutMeta): Promise async queryApiKeys (this: That, params?: T.SecurityQueryApiKeysRequest | TB.SecurityQueryApiKeysRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1851,8 +1954,8 @@ export default class Security { } /** - * Retrieves roles in a paginated manner. You can optionally filter the results with a query. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-query-role.html | Elasticsearch API documentation} + * Find roles with a query. Get roles in a paginated manner. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. You can optionally filter the results with a query. Also, the results can be paginated and sorted. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-query-role.html | Elasticsearch API documentation} */ async queryRole (this: That, params?: T.SecurityQueryRoleRequest | TB.SecurityQueryRoleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async queryRole (this: That, params?: T.SecurityQueryRoleRequest | TB.SecurityQueryRoleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1893,8 +1996,8 @@ export default class Security { } /** - * Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-query-user.html | Elasticsearch API documentation} + * Find users with a query. Get information for users in a paginated manner. You can optionally filter the results with a query. NOTE: As opposed to the get user API, built-in users are excluded from the result. This API is only for native users. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-query-user.html | Elasticsearch API documentation} */ async queryUser (this: That, params?: T.SecurityQueryUserRequest | TB.SecurityQueryUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise async queryUser (this: That, params?: T.SecurityQueryUserRequest | TB.SecurityQueryUserRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1935,8 +2038,8 @@ export default class Security { } /** - * Submits a SAML Response message to Elasticsearch for consumption. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-authenticate.html | Elasticsearch API documentation} + * Authenticate SAML. Submit a SAML response message to Elasticsearch for consumption. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. The SAML message that is submitted can be: * A response to a SAML authentication request that was previously created using the SAML prepare authentication API. * An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. In either case, the SAML message needs to be a base64 encoded XML document with a root element of ``. After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-saml-authenticate.html | Elasticsearch API documentation} */ async samlAuthenticate (this: That, params: T.SecuritySamlAuthenticateRequest | TB.SecuritySamlAuthenticateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async samlAuthenticate (this: That, params: T.SecuritySamlAuthenticateRequest | TB.SecuritySamlAuthenticateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -1976,8 +2079,8 @@ export default class Security { } /** - * Verifies the logout response sent from the SAML IdP. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-complete-logout.html | Elasticsearch API documentation} + * Logout of SAML completely. Verifies the logout response sent from the SAML IdP. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. This API verifies the response by ensuring the content is relevant and validating its signature. An empty response is returned if the verification process is successful. The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. The caller of this API must prepare the request accordingly so that this API can handle either of them. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-saml-complete-logout.html | Elasticsearch API documentation} */ async samlCompleteLogout (this: That, params: T.SecuritySamlCompleteLogoutRequest | TB.SecuritySamlCompleteLogoutRequest, options?: TransportRequestOptionsWithOutMeta): Promise async samlCompleteLogout (this: That, params: T.SecuritySamlCompleteLogoutRequest | TB.SecuritySamlCompleteLogoutRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2017,8 +2120,8 @@ export default class Security { } /** - * Submits a SAML LogoutRequest message to Elasticsearch for consumption. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-invalidate.html | Elasticsearch API documentation} + * Invalidate SAML. Submit a SAML LogoutRequest message to Elasticsearch for consumption. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. The logout request comes from the SAML IdP during an IdP initiated Single Logout. The custom web application can use this API to have Elasticsearch process the `LogoutRequest`. After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. Thus the user can be redirected back to their IdP. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-saml-invalidate.html | Elasticsearch API documentation} */ async samlInvalidate (this: That, params: T.SecuritySamlInvalidateRequest | TB.SecuritySamlInvalidateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async samlInvalidate (this: That, params: T.SecuritySamlInvalidateRequest | TB.SecuritySamlInvalidateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2058,8 +2161,8 @@ export default class Security { } /** - * Submits a request to invalidate an access token and refresh token. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-logout.html | Elasticsearch API documentation} + * Logout of SAML. Submits a request to invalidate an access token and refresh token. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. This API invalidates the tokens that were generated for a user by the SAML authenticate API. If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-saml-logout.html | Elasticsearch API documentation} */ async samlLogout (this: That, params: T.SecuritySamlLogoutRequest | TB.SecuritySamlLogoutRequest, options?: TransportRequestOptionsWithOutMeta): Promise async samlLogout (this: That, params: T.SecuritySamlLogoutRequest | TB.SecuritySamlLogoutRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2099,8 +2202,8 @@ export default class Security { } /** - * Creates a SAML authentication request () as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-prepare-authentication.html | Elasticsearch API documentation} + * Prepare SAML authentication. Create a SAML authentication request (``) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. This API returns a URL pointing to the SAML Identity Provider. You can use the URL to redirect the browser of the user in order to continue the authentication process. The URL includes a single parameter named `SAMLRequest`, which contains a SAML Authentication request that is deflated and Base64 encoded. If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named `SigAlg` and `Signature`. These parameters contain the algorithm used for the signature and the signature value itself. It also returns a random string that uniquely identifies this SAML Authentication request. The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-saml-prepare-authentication.html | Elasticsearch API documentation} */ async samlPrepareAuthentication (this: That, params?: T.SecuritySamlPrepareAuthenticationRequest | TB.SecuritySamlPrepareAuthenticationRequest, options?: TransportRequestOptionsWithOutMeta): Promise async samlPrepareAuthentication (this: That, params?: T.SecuritySamlPrepareAuthenticationRequest | TB.SecuritySamlPrepareAuthenticationRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2141,8 +2244,8 @@ export default class Security { } /** - * Generate SAML metadata for a SAML 2.0 Service Provider. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-sp-metadata.html | Elasticsearch API documentation} + * Create SAML service provider metadata. Generate SAML metadata for a SAML 2.0 Service Provider. The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-saml-sp-metadata.html | Elasticsearch API documentation} */ async samlServiceProviderMetadata (this: That, params: T.SecuritySamlServiceProviderMetadataRequest | TB.SecuritySamlServiceProviderMetadataRequest, options?: TransportRequestOptionsWithOutMeta): Promise async samlServiceProviderMetadata (this: That, params: T.SecuritySamlServiceProviderMetadataRequest | TB.SecuritySamlServiceProviderMetadataRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2173,8 +2276,8 @@ export default class Security { } /** - * Get suggestions for user profiles that match specified search criteria. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-suggest-user-profile.html | Elasticsearch API documentation} + * Suggest a user profile. Get suggestions for user profiles that match specified search criteria. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-suggest-user-profile.html | Elasticsearch API documentation} */ async suggestUserProfiles (this: That, params?: T.SecuritySuggestUserProfilesRequest | TB.SecuritySuggestUserProfilesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async suggestUserProfiles (this: That, params?: T.SecuritySuggestUserProfilesRequest | TB.SecuritySuggestUserProfilesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2215,8 +2318,8 @@ export default class Security { } /** - * Update an API key. Updates attributes of an existing API key. Users can only update API keys that they created or that were granted to them. Use this API to update API keys created by the create API Key or grant API Key APIs. If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. This API supports updates to an API key’s access scope and metadata. The access scope of an API key is derived from the `role_descriptors` you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. The snapshot of the owner’s permissions is updated automatically on every call. If you don’t specify `role_descriptors` in the request, a call to this API might still change the API key’s access scope. This change can occur if the owner user’s permissions have changed since the API key was created or last modified. To update another user’s API key, use the `run_as` feature to submit a request on behalf of another user. IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. To update an API key, the owner user’s credentials are required. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-update-api-key.html | Elasticsearch API documentation} + * Update an API key. Update attributes of an existing API key. This API supports updates to an API key's access scope, expiration, and metadata. To use this API, you must have at least the `manage_own_api_key` cluster privilege. Users can only update API keys that they created or that were granted to them. To update another user’s API key, use the `run_as` feature to submit a request on behalf of another user. IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. Use this API to update API keys created by the create API key or grant API Key APIs. If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. The access scope of an API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request. The snapshot of the owner's permissions is updated automatically on every call. IMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change the API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-update-api-key.html | Elasticsearch API documentation} */ async updateApiKey (this: That, params: T.SecurityUpdateApiKeyRequest | TB.SecurityUpdateApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateApiKey (this: That, params: T.SecurityUpdateApiKeyRequest | TB.SecurityUpdateApiKeyRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2259,22 +2362,34 @@ export default class Security { } /** - * Updates attributes of an existing cross-cluster API key. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-update-cross-cluster-api-key.html | Elasticsearch API documentation} + * Update a cross-cluster API key. Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. To use this API, you must have at least the `manage_security` cluster privilege. Users can only update API keys that they created. To update another user's API key, use the `run_as` feature to submit a request on behalf of another user. IMPORTANT: It's not possible to use an API key as the authentication credential for this API. To update an API key, the owner user's credentials are required. It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. This API supports updates to an API key's access scope, metadata, and expiration. The owner user's information, such as the `username` and `realm`, is also updated automatically on every call. NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-update-cross-cluster-api-key.html | Elasticsearch API documentation} */ - async updateCrossClusterApiKey (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async updateCrossClusterApiKey (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async updateCrossClusterApiKey (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async updateCrossClusterApiKey (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async updateCrossClusterApiKey (this: That, params: T.SecurityUpdateCrossClusterApiKeyRequest | TB.SecurityUpdateCrossClusterApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async updateCrossClusterApiKey (this: That, params: T.SecurityUpdateCrossClusterApiKeyRequest | TB.SecurityUpdateCrossClusterApiKeyRequest, options?: TransportRequestOptionsWithMeta): Promise> + async updateCrossClusterApiKey (this: That, params: T.SecurityUpdateCrossClusterApiKeyRequest | TB.SecurityUpdateCrossClusterApiKeyRequest, options?: TransportRequestOptions): Promise + async updateCrossClusterApiKey (this: That, params: T.SecurityUpdateCrossClusterApiKeyRequest | TB.SecurityUpdateCrossClusterApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] + const acceptedBody: string[] = ['access', 'expiration', 'metadata'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -2291,22 +2406,35 @@ export default class Security { } /** - * Update settings for the security system index - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-update-settings.html | Elasticsearch API documentation} + * Update security index settings. Update the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified. This includes `index.auto_expand_replicas` and `index.number_of_replicas`. NOTE: If `index.auto_expand_replicas` is set, `index.number_of_replicas` will be ignored during updates. If a specific index is not in use on the system and settings are provided for it, the request will be rejected. This API does not yet support configuring the settings for indices before they are in use. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-update-settings.html | Elasticsearch API documentation} */ - async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async updateSettings (this: That, params?: T.SecurityUpdateSettingsRequest | TB.SecurityUpdateSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async updateSettings (this: That, params?: T.SecurityUpdateSettingsRequest | TB.SecurityUpdateSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise> + async updateSettings (this: That, params?: T.SecurityUpdateSettingsRequest | TB.SecurityUpdateSettingsRequest, options?: TransportRequestOptions): Promise + async updateSettings (this: That, params?: T.SecurityUpdateSettingsRequest | TB.SecurityUpdateSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] + const acceptedBody: string[] = ['security', 'security-profile', 'security-tokens'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -2320,8 +2448,8 @@ export default class Security { } /** - * Updates specific data for the user profile that's associated with the specified unique ID. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-update-user-profile-data.html | Elasticsearch API documentation} + * Update user profile data. Update specific data for the user profile that is associated with a unique ID. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. To use this API, you must have one of the following privileges: * The `manage_user_profile` cluster privilege. * The `update_profile_data` global privilege for the namespaces that are referenced in the request. This API updates the `labels` and `data` fields of an existing user profile document with JSON objects. New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. For both labels and data, content is namespaced by the top-level fields. The `update_profile_data` global privilege grants privileges for updating only the allowed namespaces. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-update-user-profile-data.html | Elasticsearch API documentation} */ async updateUserProfileData (this: That, params: T.SecurityUpdateUserProfileDataRequest | TB.SecurityUpdateUserProfileDataRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateUserProfileData (this: That, params: T.SecurityUpdateUserProfileDataRequest | TB.SecurityUpdateUserProfileDataRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/shutdown.ts b/src/api/api/shutdown.ts index cf83485f3..1c79b57c8 100644 --- a/src/api/api/shutdown.ts +++ b/src/api/api/shutdown.ts @@ -45,8 +45,8 @@ export default class Shutdown { } /** - * Removes a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/current | Elasticsearch API documentation} + * Cancel node shutdown preparations. Remove a node from the shutdown list so it can resume normal operations. You must explicitly clear the shutdown request when a node rejoins the cluster or when a node has permanently left the cluster. Shutdown requests are never removed automatically by Elasticsearch. NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. If the operator privileges feature is enabled, you must be an operator to use this API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-shutdown.html | Elasticsearch API documentation} */ async deleteNode (this: That, params: T.ShutdownDeleteNodeRequest | TB.ShutdownDeleteNodeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteNode (this: That, params: T.ShutdownDeleteNodeRequest | TB.ShutdownDeleteNodeRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Shutdown { } /** - * Retrieve status of a node or nodes that are currently marked as shutting down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/current | Elasticsearch API documentation} + * Get the shutdown status. Get information about nodes that are ready to be shut down, have shut down preparations still in progress, or have stalled. The API returns status information for each part of the shut down process. NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. If the operator privileges feature is enabled, you must be an operator to use this API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-shutdown.html | Elasticsearch API documentation} */ async getNode (this: That, params?: T.ShutdownGetNodeRequest | TB.ShutdownGetNodeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getNode (this: That, params?: T.ShutdownGetNodeRequest | TB.ShutdownGetNodeRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -117,8 +117,8 @@ export default class Shutdown { } /** - * Adds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/current | Elasticsearch API documentation} + * Prepare a node to be shut down. NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. If you specify a node that is offline, it will be prepared for shut down when it rejoins the cluster. If the operator privileges feature is enabled, you must be an operator to use this API. The API migrates ongoing tasks and index shards to other nodes as needed to prepare a node to be restarted or shut down and removed from the cluster. This ensures that Elasticsearch can be stopped safely with minimal disruption to the cluster. You must specify the type of shutdown: `restart`, `remove`, or `replace`. If a node is already being prepared for shutdown, you can use this API to change the shutdown type. IMPORTANT: This API does NOT terminate the Elasticsearch process. Monitor the node shutdown status to determine when it is safe to stop Elasticsearch. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-shutdown.html | Elasticsearch API documentation} */ async putNode (this: That, params: T.ShutdownPutNodeRequest | TB.ShutdownPutNodeRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putNode (this: That, params: T.ShutdownPutNodeRequest | TB.ShutdownPutNodeRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/simulate.ts b/src/api/api/simulate.ts index a5a76325c..457f98d67 100644 --- a/src/api/api/simulate.ts +++ b/src/api/api/simulate.ts @@ -45,22 +45,34 @@ export default class Simulate { } /** - * Simulates running ingest with example documents. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-ingest-api.html | Elasticsearch API documentation} + * Simulate data ingestion. Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. No data is indexed into Elasticsearch. Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. By default, the pipeline definitions that are currently in the system are used. However, you can supply substitute pipeline definitions in the body of the request. These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/simulate-ingest-api.html | Elasticsearch API documentation} */ - async ingest (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async ingest (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async ingest (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async ingest (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async ingest (this: That, params: T.SimulateIngestRequest | TB.SimulateIngestRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async ingest (this: That, params: T.SimulateIngestRequest | TB.SimulateIngestRequest, options?: TransportRequestOptionsWithMeta): Promise> + async ingest (this: That, params: T.SimulateIngestRequest | TB.SimulateIngestRequest, options?: TransportRequestOptions): Promise + async ingest (this: That, params: T.SimulateIngestRequest | TB.SimulateIngestRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] + const acceptedBody: string[] = ['docs', 'component_template_substitutions', 'index_template_substitutions', 'mapping_addition', 'pipeline_substitutions'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } diff --git a/src/api/api/slm.ts b/src/api/api/slm.ts index 16f0913c8..d86c62f50 100644 --- a/src/api/api/slm.ts +++ b/src/api/api/slm.ts @@ -45,8 +45,8 @@ export default class Slm { } /** - * Deletes an existing snapshot lifecycle policy. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-delete-policy.html | Elasticsearch API documentation} + * Delete a policy. Delete a snapshot lifecycle policy definition. This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/slm-api-delete-policy.html | Elasticsearch API documentation} */ async deleteLifecycle (this: That, params: T.SlmDeleteLifecycleRequest | TB.SlmDeleteLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteLifecycle (this: That, params: T.SlmDeleteLifecycleRequest | TB.SlmDeleteLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Slm { } /** - * Immediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-execute-lifecycle.html | Elasticsearch API documentation} + * Run a policy. Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/slm-api-execute-lifecycle.html | Elasticsearch API documentation} */ async executeLifecycle (this: That, params: T.SlmExecuteLifecycleRequest | TB.SlmExecuteLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async executeLifecycle (this: That, params: T.SlmExecuteLifecycleRequest | TB.SlmExecuteLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -109,8 +109,8 @@ export default class Slm { } /** - * Deletes any snapshots that are expired according to the policy's retention rules. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-execute-retention.html | Elasticsearch API documentation} + * Run a retention policy. Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. The retention policy is normally applied according to its schedule. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/slm-api-execute-retention.html | Elasticsearch API documentation} */ async executeRetention (this: That, params?: T.SlmExecuteRetentionRequest | TB.SlmExecuteRetentionRequest, options?: TransportRequestOptionsWithOutMeta): Promise async executeRetention (this: That, params?: T.SlmExecuteRetentionRequest | TB.SlmExecuteRetentionRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -139,8 +139,8 @@ export default class Slm { } /** - * Retrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-policy.html | Elasticsearch API documentation} + * Get policy information. Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/slm-api-get-policy.html | Elasticsearch API documentation} */ async getLifecycle (this: That, params?: T.SlmGetLifecycleRequest | TB.SlmGetLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getLifecycle (this: That, params?: T.SlmGetLifecycleRequest | TB.SlmGetLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -179,8 +179,8 @@ export default class Slm { } /** - * Returns global and policy-level statistics about actions taken by snapshot lifecycle management. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-stats.html | Elasticsearch API documentation} + * Get snapshot lifecycle management statistics. Get global and policy-level statistics about actions taken by snapshot lifecycle management. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/slm-api-get-stats.html | Elasticsearch API documentation} */ async getStats (this: That, params?: T.SlmGetStatsRequest | TB.SlmGetStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getStats (this: That, params?: T.SlmGetStatsRequest | TB.SlmGetStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -209,8 +209,8 @@ export default class Slm { } /** - * Retrieves the status of snapshot lifecycle management (SLM). - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-status.html | Elasticsearch API documentation} + * Get the snapshot lifecycle management status. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/slm-api-get-status.html | Elasticsearch API documentation} */ async getStatus (this: That, params?: T.SlmGetStatusRequest | TB.SlmGetStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getStatus (this: That, params?: T.SlmGetStatusRequest | TB.SlmGetStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -239,8 +239,8 @@ export default class Slm { } /** - * Creates or updates a snapshot lifecycle policy. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-put-policy.html | Elasticsearch API documentation} + * Create or update a policy. Create or update a snapshot lifecycle policy. If the policy already exists, this request increments the policy version. Only the latest version of a policy is stored. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/slm-api-put-policy.html | Elasticsearch API documentation} */ async putLifecycle (this: That, params: T.SlmPutLifecycleRequest | TB.SlmPutLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putLifecycle (this: That, params: T.SlmPutLifecycleRequest | TB.SlmPutLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -283,8 +283,8 @@ export default class Slm { } /** - * Turns on snapshot lifecycle management (SLM). - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-start.html | Elasticsearch API documentation} + * Start snapshot lifecycle management. Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. Manually starting SLM is necessary only if it has been stopped using the stop SLM API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/slm-api-start.html | Elasticsearch API documentation} */ async start (this: That, params?: T.SlmStartRequest | TB.SlmStartRequest, options?: TransportRequestOptionsWithOutMeta): Promise async start (this: That, params?: T.SlmStartRequest | TB.SlmStartRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -313,8 +313,8 @@ export default class Slm { } /** - * Turns off snapshot lifecycle management (SLM). - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-stop.html | Elasticsearch API documentation} + * Stop snapshot lifecycle management. Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. Stopping SLM does not stop any snapshots that are in progress. You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. Use the get snapshot lifecycle management status API to see if SLM is running. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/slm-api-stop.html | Elasticsearch API documentation} */ async stop (this: That, params?: T.SlmStopRequest | TB.SlmStopRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stop (this: That, params?: T.SlmStopRequest | TB.SlmStopRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/snapshot.ts b/src/api/api/snapshot.ts index cd0f53dcf..67475e2e8 100644 --- a/src/api/api/snapshot.ts +++ b/src/api/api/snapshot.ts @@ -45,8 +45,8 @@ export default class Snapshot { } /** - * Triggers the review of a snapshot repository’s contents and deletes any stale data not referenced by existing snapshots. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html | Elasticsearch API documentation} + * Clean up the snapshot repository. Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/clean-up-snapshot-repo-api.html | Elasticsearch API documentation} */ async cleanupRepository (this: That, params: T.SnapshotCleanupRepositoryRequest | TB.SnapshotCleanupRepositoryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async cleanupRepository (this: That, params: T.SnapshotCleanupRepositoryRequest | TB.SnapshotCleanupRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Snapshot { } /** - * Clones indices from one snapshot into another snapshot in the same repository. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Clone a snapshot. Clone part of all of a snapshot into another snapshot in the same repository. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/clone-snapshot-api.html | Elasticsearch API documentation} */ async clone (this: That, params: T.SnapshotCloneRequest | TB.SnapshotCloneRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clone (this: That, params: T.SnapshotCloneRequest | TB.SnapshotCloneRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -123,8 +123,8 @@ export default class Snapshot { } /** - * Creates a snapshot in a repository. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Create a snapshot. Take a snapshot of a cluster or of data streams and indices. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/create-snapshot-api.html | Elasticsearch API documentation} */ async create (this: That, params: T.SnapshotCreateRequest | TB.SnapshotCreateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async create (this: That, params: T.SnapshotCreateRequest | TB.SnapshotCreateRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -168,8 +168,8 @@ export default class Snapshot { } /** - * Creates a repository. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Create or update a snapshot repository. IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. To register a snapshot repository, the cluster's global metadata must be writeable. Ensure there are no cluster blocks (for example, `cluster.blocks.read_only` and `clsuter.blocks.read_only_allow_delete` settings) that prevent write access. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/modules-snapshots.html | Elasticsearch API documentation} */ async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest | TB.SnapshotCreateRepositoryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest | TB.SnapshotCreateRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -205,8 +205,8 @@ export default class Snapshot { } /** - * Deletes one or more snapshots. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Delete snapshots. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-snapshot-api.html | Elasticsearch API documentation} */ async delete (this: That, params: T.SnapshotDeleteRequest | TB.SnapshotDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise async delete (this: That, params: T.SnapshotDeleteRequest | TB.SnapshotDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -238,8 +238,8 @@ export default class Snapshot { } /** - * Deletes a repository. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Delete snapshot repositories. When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. The snapshots themselves are left untouched and in place. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-snapshot-repo-api.html | Elasticsearch API documentation} */ async deleteRepository (this: That, params: T.SnapshotDeleteRepositoryRequest | TB.SnapshotDeleteRepositoryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteRepository (this: That, params: T.SnapshotDeleteRepositoryRequest | TB.SnapshotDeleteRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -270,8 +270,8 @@ export default class Snapshot { } /** - * Returns information about a snapshot. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Get snapshot information. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-snapshot-api.html | Elasticsearch API documentation} */ async get (this: That, params: T.SnapshotGetRequest | TB.SnapshotGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async get (this: That, params: T.SnapshotGetRequest | TB.SnapshotGetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -303,8 +303,8 @@ export default class Snapshot { } /** - * Returns information about a repository. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Get snapshot repository information. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-snapshot-repo-api.html | Elasticsearch API documentation} */ async getRepository (this: That, params?: T.SnapshotGetRepositoryRequest | TB.SnapshotGetRepositoryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getRepository (this: That, params?: T.SnapshotGetRepositoryRequest | TB.SnapshotGetRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -343,40 +343,72 @@ export default class Snapshot { } /** - * Analyzes a repository for correctness and performance - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Analyze a snapshot repository. Analyze the performance characteristics and any incorrect behaviour found in a repository. The response exposes implementation details of the analysis which may change from version to version. The response body format is therefore not considered stable and may be different in newer versions. There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. Run your first analysis with the default parameter values to check for simple problems. If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a `blob_count` of at least `2000`, a `max_blob_size` of at least `2gb`, a `max_total_data_size` of at least `1tb`, and a `register_operation_count` of at least `100`. Always specify a generous timeout, possibly `1h` or longer, to allow time for each analysis to run to completion. Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. If so, this storage system is not suitable for use as a snapshot repository. You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. You can use this information to determine the performance of your storage system. If any operation fails or returns an incorrect result, the API returns an error. If the API returns an error, it may not have removed all the data it wrote to the repository. The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. You should verify that this location has been cleaned up correctly. If there is still leftover data at the specified location, you should manually remove it. If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. Some clients are configured to close their connection if no response is received within a certain timeout. An analysis takes a long time to complete so you might need to relax any such client-side timeouts. On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. The path to the leftover data is recorded in the Elasticsearch logs. You should verify that this location has been cleaned up correctly. If there is still leftover data at the specified location, you should manually remove it. If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. The analysis attempts to detect common bugs but it does not offer 100% coverage. Additionally, it does not test the following: * Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. * Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. * Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. You must ensure this load does not affect other users of these systems. Analyses respect the repository settings `max_snapshot_bytes_per_sec` and `max_restore_bytes_per_sec` if available and the cluster setting `indices.recovery.max_bytes_per_sec` which you can use to limit the bandwidth they consume. NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. This indicates it behaves incorrectly in ways that the former version did not detect. You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. NOTE: This API may not work correctly in a mixed-version cluster. *Implementation details* NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. The analysis comprises a number of blob-level tasks, as set by the `blob_count` parameter and a number of compare-and-exchange operations on linearizable registers, as set by the `register_operation_count` parameter. These tasks are distributed over the data and master-eligible nodes in the cluster for execution. For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. The size of the blob is chosen randomly, according to the `max_blob_size` and `max_total_data_size` parameters. If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. These reads are permitted to fail, but must not return partial data. If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. The executing node will use a variety of different methods to write the blob. For instance, where applicable, it will use both single-part and multi-part uploads. Similarly, the reading nodes will use a variety of different methods to read the data back again. For instance they may read the entire blob from start to end or may read only a subset of the data. For some blob-level tasks, the executing node will cancel the write before it is complete. In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. Some operations also verify the behavior on small blobs with sizes other than 8 bytes. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/repo-analysis-api.html | Elasticsearch API documentation} */ - async repositoryAnalyze (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async repositoryAnalyze (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async repositoryAnalyze (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async repositoryAnalyze (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { - const acceptedPath: string[] = ['repository'] + async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest | TB.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest | TB.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptionsWithMeta): Promise> + async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest | TB.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptions): Promise + async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest | TB.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['name'] const querystring: Record = {} const body = undefined - params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } const method = 'POST' - const path = `/_snapshot/${encodeURIComponent(params.repository.toString())}/_analyze` + const path = `/_snapshot/${encodeURIComponent(params.name.toString())}/_analyze` const meta: TransportRequestMetadata = { name: 'snapshot.repository_analyze', pathParts: { - repository: params.repository + name: params.name + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Verify the repository integrity. Verify the integrity of the contents of a snapshot repository. This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail. If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its `read_only` option to `true`, and use this API to verify its integrity. Until you do so: * It may not be possible to restore some snapshots from this repository. * Searchable snapshots may report errors when searched or may have unassigned shards. * Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored. * Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk. * Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents. If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. You must also identify what caused the damage and take action to prevent it from happening again. If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository. Avoid all operations which write to the repository while the verify repository integrity API is running. If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting. NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. NOTE: This API may not work correctly in a mixed-version cluster. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/verify-repo-integrity-api.html | Elasticsearch API documentation} + */ + async repositoryVerifyIntegrity (this: That, params: T.SnapshotRepositoryVerifyIntegrityRequest | TB.SnapshotRepositoryVerifyIntegrityRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async repositoryVerifyIntegrity (this: That, params: T.SnapshotRepositoryVerifyIntegrityRequest | TB.SnapshotRepositoryVerifyIntegrityRequest, options?: TransportRequestOptionsWithMeta): Promise> + async repositoryVerifyIntegrity (this: That, params: T.SnapshotRepositoryVerifyIntegrityRequest | TB.SnapshotRepositoryVerifyIntegrityRequest, options?: TransportRequestOptions): Promise + async repositoryVerifyIntegrity (this: That, params: T.SnapshotRepositoryVerifyIntegrityRequest | TB.SnapshotRepositoryVerifyIntegrityRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['name'] + const querystring: Record = {} + const body = undefined + + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = `/_snapshot/${encodeURIComponent(params.name.toString())}/_verify_integrity` + const meta: TransportRequestMetadata = { + name: 'snapshot.repository_verify_integrity', + pathParts: { + name: params.name } } return await this.transport.request({ path, method, querystring, body, meta }, options) } /** - * Restores a snapshot. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Restore a snapshot. Restore a snapshot of a cluster or data streams and indices. You can restore a snapshot only to a running cluster with an elected master node. The snapshot repository must be registered and available to the cluster. The snapshot and cluster versions must be compatible. To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: ``` GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream ``` If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/restore-snapshot-api.html | Elasticsearch API documentation} */ async restore (this: That, params: T.SnapshotRestoreRequest | TB.SnapshotRestoreRequest, options?: TransportRequestOptionsWithOutMeta): Promise async restore (this: That, params: T.SnapshotRestoreRequest | TB.SnapshotRestoreRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -420,8 +452,8 @@ export default class Snapshot { } /** - * Returns information about the status of a snapshot. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Get the snapshot status. Get a detailed description of the current state for each shard participating in the snapshot. Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. The API requires a read from the repository for each shard in each snapshot. For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). Depending on the latency of your storage, such requests can take an extremely long time to return results. These requests can also tax machine resources and, when using cloud storage, incur high processing costs. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-snapshot-status-api.html | Elasticsearch API documentation} */ async status (this: That, params?: T.SnapshotStatusRequest | TB.SnapshotStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async status (this: That, params?: T.SnapshotStatusRequest | TB.SnapshotStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -464,8 +496,8 @@ export default class Snapshot { } /** - * Verifies a repository. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Verify a snapshot repository. Check for common misconfigurations in a snapshot repository. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/verify-snapshot-repo-api.html | Elasticsearch API documentation} */ async verifyRepository (this: That, params: T.SnapshotVerifyRepositoryRequest | TB.SnapshotVerifyRepositoryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async verifyRepository (this: That, params: T.SnapshotVerifyRepositoryRequest | TB.SnapshotVerifyRepositoryRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/sql.ts b/src/api/api/sql.ts index fbd30e803..1a08d30cf 100644 --- a/src/api/api/sql.ts +++ b/src/api/api/sql.ts @@ -45,8 +45,8 @@ export default class Sql { } /** - * Clears the SQL cursor - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/clear-sql-cursor-api.html | Elasticsearch API documentation} + * Clear an SQL search cursor. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/clear-sql-cursor-api.html | Elasticsearch API documentation} */ async clearCursor (this: That, params: T.SqlClearCursorRequest | TB.SqlClearCursorRequest, options?: TransportRequestOptionsWithOutMeta): Promise async clearCursor (this: That, params: T.SqlClearCursorRequest | TB.SqlClearCursorRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -86,8 +86,8 @@ export default class Sql { } /** - * Deletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-async-sql-search-api.html | Elasticsearch API documentation} + * Delete an async SQL search. Delete an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it. If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: * Users with the `cancel_task` cluster privilege. * The user who first submitted the search. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-async-sql-search-api.html | Elasticsearch API documentation} */ async deleteAsync (this: That, params: T.SqlDeleteAsyncRequest | TB.SqlDeleteAsyncRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteAsync (this: That, params: T.SqlDeleteAsyncRequest | TB.SqlDeleteAsyncRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -118,8 +118,8 @@ export default class Sql { } /** - * Returns the current status and available results for an async SQL search or stored synchronous SQL search - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-sql-search-api.html | Elasticsearch API documentation} + * Get async SQL search results. Get the current status and available results for an async SQL search or stored synchronous SQL search. If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-async-sql-search-api.html | Elasticsearch API documentation} */ async getAsync (this: That, params: T.SqlGetAsyncRequest | TB.SqlGetAsyncRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getAsync (this: That, params: T.SqlGetAsyncRequest | TB.SqlGetAsyncRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -150,8 +150,8 @@ export default class Sql { } /** - * Returns the current status of an async SQL search or a stored synchronous SQL search - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-sql-search-status-api.html | Elasticsearch API documentation} + * Get the async SQL search status. Get the current status of an async SQL search or a stored synchronous SQL search. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-async-sql-search-status-api.html | Elasticsearch API documentation} */ async getAsyncStatus (this: That, params: T.SqlGetAsyncStatusRequest | TB.SqlGetAsyncStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getAsyncStatus (this: That, params: T.SqlGetAsyncStatusRequest | TB.SqlGetAsyncStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -182,15 +182,15 @@ export default class Sql { } /** - * Executes a SQL request - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-search-api.html | Elasticsearch API documentation} + * Get SQL search results. Run an SQL request. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/sql-search-api.html | Elasticsearch API documentation} */ async query (this: That, params?: T.SqlQueryRequest | TB.SqlQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise async query (this: That, params?: T.SqlQueryRequest | TB.SqlQueryRequest, options?: TransportRequestOptionsWithMeta): Promise> async query (this: That, params?: T.SqlQueryRequest | TB.SqlQueryRequest, options?: TransportRequestOptions): Promise async query (this: That, params?: T.SqlQueryRequest | TB.SqlQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedBody: string[] = ['catalog', 'columnar', 'cursor', 'fetch_size', 'filter', 'query', 'request_timeout', 'page_timeout', 'time_zone', 'field_multi_value_leniency', 'runtime_mappings', 'wait_for_completion_timeout', 'params', 'keep_alive', 'keep_on_completion', 'index_using_frozen'] + const acceptedBody: string[] = ['allow_partial_search_results', 'catalog', 'columnar', 'cursor', 'fetch_size', 'field_multi_value_leniency', 'filter', 'index_using_frozen', 'keep_alive', 'keep_on_completion', 'page_timeout', 'params', 'query', 'request_timeout', 'runtime_mappings', 'time_zone', 'wait_for_completion_timeout'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -224,8 +224,8 @@ export default class Sql { } /** - * Translates SQL into Elasticsearch queries - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-translate-api.html | Elasticsearch API documentation} + * Translate SQL into Elasticsearch queries. Translate an SQL search into a search API request containing Query DSL. It accepts the same request body parameters as the SQL search API, excluding `cursor`. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/sql-translate-api.html | Elasticsearch API documentation} */ async translate (this: That, params: T.SqlTranslateRequest | TB.SqlTranslateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async translate (this: That, params: T.SqlTranslateRequest | TB.SqlTranslateRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/ssl.ts b/src/api/api/ssl.ts index 9ace268c1..55ecd0563 100644 --- a/src/api/api/ssl.ts +++ b/src/api/api/ssl.ts @@ -45,8 +45,8 @@ export default class Ssl { } /** - * Retrieves information about the X.509 certificates used to encrypt communications in the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-ssl.html | Elasticsearch API documentation} + * Get SSL certificates. Get information about the X.509 certificates that are used to encrypt communications in the cluster. The API returns a list that includes certificates from all TLS contexts including: - Settings for transport and HTTP interfaces - TLS settings that are used within authentication realms - TLS settings for remote monitoring exporters The list includes certificates that are used for configuring trust, such as those configured in the `xpack.security.transport.ssl.truststore` and `xpack.security.transport.ssl.certificate_authorities` settings. It also includes certificates that are used for configuring server identity, such as `xpack.security.http.ssl.keystore` and `xpack.security.http.ssl.certificate settings`. The list does not include certificates that are sourced from the default SSL context of the Java Runtime Environment (JRE), even if those certificates are in use within Elasticsearch. NOTE: When a PKCS#11 token is configured as the truststore of the JRE, the API returns all the certificates that are included in the PKCS#11 token irrespective of whether these are used in the Elasticsearch TLS configuration. If Elasticsearch is configured to use a keystore or truststore, the API output includes all certificates in that store, even though some of the certificates might not be in active use within the cluster. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/security-api-ssl.html | Elasticsearch API documentation} */ async certificates (this: That, params?: T.SslCertificatesRequest | TB.SslCertificatesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async certificates (this: That, params?: T.SslCertificatesRequest | TB.SslCertificatesRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/synonyms.ts b/src/api/api/synonyms.ts index abbf98749..ff93fb174 100644 --- a/src/api/api/synonyms.ts +++ b/src/api/api/synonyms.ts @@ -45,8 +45,8 @@ export default class Synonyms { } /** - * Deletes a synonym set - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-synonyms-set.html | Elasticsearch API documentation} + * Delete a synonym set. You can only delete a synonyms set that is not in use by any index analyzer. Synonyms sets can be used in synonym graph token filters and synonym token filters. These synonym filters can be used as part of search analyzers. Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. To prevent that, synonyms sets that are used in analyzers can't be deleted. A delete request in this case will return a 400 response code. To remove a synonyms set, you must first remove all indices that contain analyzers using it. You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. Once finished, you can delete the index. When the synonyms set is not used in analyzers, you will be able to delete it. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-synonyms-set.html | Elasticsearch API documentation} */ async deleteSynonym (this: That, params: T.SynonymsDeleteSynonymRequest | TB.SynonymsDeleteSynonymRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteSynonym (this: That, params: T.SynonymsDeleteSynonymRequest | TB.SynonymsDeleteSynonymRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -77,8 +77,8 @@ export default class Synonyms { } /** - * Deletes a synonym rule in a synonym set - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-synonym-rule.html | Elasticsearch API documentation} + * Delete a synonym rule. Delete a synonym rule from a synonym set. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-synonym-rule.html | Elasticsearch API documentation} */ async deleteSynonymRule (this: That, params: T.SynonymsDeleteSynonymRuleRequest | TB.SynonymsDeleteSynonymRuleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteSynonymRule (this: That, params: T.SynonymsDeleteSynonymRuleRequest | TB.SynonymsDeleteSynonymRuleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -110,8 +110,8 @@ export default class Synonyms { } /** - * Retrieves a synonym set - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-synonyms-set.html | Elasticsearch API documentation} + * Get a synonym set. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-synonyms-set.html | Elasticsearch API documentation} */ async getSynonym (this: That, params: T.SynonymsGetSynonymRequest | TB.SynonymsGetSynonymRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getSynonym (this: That, params: T.SynonymsGetSynonymRequest | TB.SynonymsGetSynonymRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -142,8 +142,8 @@ export default class Synonyms { } /** - * Retrieves a synonym rule from a synonym set - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-synonym-rule.html | Elasticsearch API documentation} + * Get a synonym rule. Get a synonym rule from a synonym set. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-synonym-rule.html | Elasticsearch API documentation} */ async getSynonymRule (this: That, params: T.SynonymsGetSynonymRuleRequest | TB.SynonymsGetSynonymRuleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getSynonymRule (this: That, params: T.SynonymsGetSynonymRuleRequest | TB.SynonymsGetSynonymRuleRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -175,8 +175,8 @@ export default class Synonyms { } /** - * Retrieves a summary of all defined synonym sets - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/list-synonyms-sets.html | Elasticsearch API documentation} + * Get all synonym sets. Get a summary of all defined synonym sets. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-synonyms-set.html | Elasticsearch API documentation} */ async getSynonymsSets (this: That, params?: T.SynonymsGetSynonymsSetsRequest | TB.SynonymsGetSynonymsSetsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getSynonymsSets (this: That, params?: T.SynonymsGetSynonymsSetsRequest | TB.SynonymsGetSynonymsSetsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -205,8 +205,8 @@ export default class Synonyms { } /** - * Creates or updates a synonym set. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-synonyms-set.html | Elasticsearch API documentation} + * Create or update a synonym set. Synonyms sets are limited to a maximum of 10,000 synonym rules per set. If you need to manage more synonym rules, you can create multiple synonym sets. When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-synonyms-set.html | Elasticsearch API documentation} */ async putSynonym (this: That, params: T.SynonymsPutSynonymRequest | TB.SynonymsPutSynonymRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putSynonym (this: That, params: T.SynonymsPutSynonymRequest | TB.SynonymsPutSynonymRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -249,8 +249,8 @@ export default class Synonyms { } /** - * Creates or updates a synonym rule in a synonym set - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-synonym-rule.html | Elasticsearch API documentation} + * Create or update a synonym rule. Create or update a synonym rule in a synonym set. If any of the synonym rules included is invalid, the API returns an error. When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-synonym-rule.html | Elasticsearch API documentation} */ async putSynonymRule (this: That, params: T.SynonymsPutSynonymRuleRequest | TB.SynonymsPutSynonymRuleRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putSynonymRule (this: That, params: T.SynonymsPutSynonymRuleRequest | TB.SynonymsPutSynonymRuleRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/tasks.ts b/src/api/api/tasks.ts index 0cb901686..9da506247 100644 --- a/src/api/api/tasks.ts +++ b/src/api/api/tasks.ts @@ -45,8 +45,8 @@ export default class Tasks { } /** - * Cancels a task, if it can be cancelled through an API. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html | Elasticsearch API documentation} + * Cancel a task. WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible. A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. The get task information API will continue to list these cancelled tasks until they complete. The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the `?detailed` parameter to identify the other tasks the system is running. You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/tasks.html | Elasticsearch API documentation} */ async cancel (this: That, params?: T.TasksCancelRequest | TB.TasksCancelRequest, options?: TransportRequestOptionsWithOutMeta): Promise async cancel (this: That, params?: T.TasksCancelRequest | TB.TasksCancelRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -85,8 +85,8 @@ export default class Tasks { } /** - * Get task information. Returns information about the tasks currently executing in the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html | Elasticsearch API documentation} + * Get task information. Get information about a task currently running in the cluster. WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible. If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/tasks.html | Elasticsearch API documentation} */ async get (this: That, params: T.TasksGetRequest | TB.TasksGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise async get (this: That, params: T.TasksGetRequest | TB.TasksGetRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -117,8 +117,8 @@ export default class Tasks { } /** - * The task management API returns information about tasks currently executing on one or more nodes in the cluster. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html | Elasticsearch API documentation} + * Get all tasks. Get information about the tasks currently running on one or more nodes in the cluster. WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible. **Identifying running tasks** The `X-Opaque-Id header`, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. This enables you to track certain calls or associate certain tasks with the client that started them. For example: ``` curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" ``` The API returns the following result: ``` HTTP/1.1 200 OK X-Opaque-Id: 123456 content-type: application/json; charset=UTF-8 content-length: 831 { "tasks" : { "u5lcZHqcQhu-rUoFaqDphA:45" : { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 45, "type" : "transport", "action" : "cluster:monitor/tasks/lists", "start_time_in_millis" : 1513823752749, "running_time_in_nanos" : 293139, "cancellable" : false, "headers" : { "X-Opaque-Id" : "123456" }, "children" : [ { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 46, "type" : "direct", "action" : "cluster:monitor/tasks/lists[n]", "start_time_in_millis" : 1513823752750, "running_time_in_nanos" : 92133, "cancellable" : false, "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", "headers" : { "X-Opaque-Id" : "123456" } } ] } } } ``` In this example, `X-Opaque-Id: 123456` is the ID as a part of the response header. The `X-Opaque-Id` in the task `headers` is the ID for the task that was initiated by the REST request. The `X-Opaque-Id` in the children `headers` is the child task of the task that was initiated by the REST request. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/tasks.html | Elasticsearch API documentation} */ async list (this: That, params?: T.TasksListRequest | TB.TasksListRequest, options?: TransportRequestOptionsWithOutMeta): Promise async list (this: That, params?: T.TasksListRequest | TB.TasksListRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/terms_enum.ts b/src/api/api/terms_enum.ts index 1dd51ece7..a0c9649ca 100644 --- a/src/api/api/terms_enum.ts +++ b/src/api/api/terms_enum.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * The terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-terms-enum.html | Elasticsearch API documentation} + * Get terms in an index. Discover terms that match a partial string in an index. This API is designed for low-latency look-ups used in auto-complete scenarios. > info > The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/search-terms-enum.html | Elasticsearch API documentation} */ export default async function TermsEnumApi (this: That, params: T.TermsEnumRequest | TB.TermsEnumRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function TermsEnumApi (this: That, params: T.TermsEnumRequest | TB.TermsEnumRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/termvectors.ts b/src/api/api/termvectors.ts index 3e8c12034..b8c0cc4c3 100644 --- a/src/api/api/termvectors.ts +++ b/src/api/api/termvectors.ts @@ -39,15 +39,15 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Get term vector information. Returns information and statistics about terms in the fields of a particular document. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html | Elasticsearch API documentation} + * Get term vector information. Get information and statistics about terms in the fields of a particular document. You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. You can specify the fields you are interested in through the `fields` parameter or by adding the fields to the request body. For example: ``` GET /my-index-000001/_termvectors/1?fields=message ``` Fields can be specified using wildcards, similar to the multi match query. Term vectors are real-time by default, not near real-time. This can be changed by setting `realtime` parameter to `false`. You can request three types of values: _term information_, _term statistics_, and _field statistics_. By default, all term information and field statistics are returned for all fields but term statistics are excluded. **Term information** * term frequency in the field (always returned) * term positions (`positions: true`) * start and end offsets (`offsets: true`) * term payloads (`payloads: true`), as base64 encoded bytes If the requested information wasn't stored in the index, it will be computed on the fly if possible. Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. > warn > Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. **Behaviour** The term and field statistics are not accurate. Deleted documents are not taken into account. The information is only retrieved for the shard the requested document resides in. The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. Use `routing` only to hit a particular shard. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-termvectors.html | Elasticsearch API documentation} */ export default async function TermvectorsApi (this: That, params: T.TermvectorsRequest | TB.TermvectorsRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function TermvectorsApi (this: That, params: T.TermvectorsRequest | TB.TermvectorsRequest, options?: TransportRequestOptionsWithMeta): Promise> export default async function TermvectorsApi (this: That, params: T.TermvectorsRequest | TB.TermvectorsRequest, options?: TransportRequestOptions): Promise export default async function TermvectorsApi (this: That, params: T.TermvectorsRequest | TB.TermvectorsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'id'] - const acceptedBody: string[] = ['doc', 'filter', 'per_field_analyzer'] + const acceptedBody: string[] = ['doc', 'filter', 'per_field_analyzer', 'fields', 'field_statistics', 'offsets', 'payloads', 'positions', 'term_statistics', 'routing', 'version', 'version_type'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body diff --git a/src/api/api/text_structure.ts b/src/api/api/text_structure.ts index 972556a6d..05537c4b0 100644 --- a/src/api/api/text_structure.ts +++ b/src/api/api/text_structure.ts @@ -45,22 +45,22 @@ export default class TextStructure { } /** - * Finds the structure of a text field in an index. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/find-field-structure.html | Elasticsearch API documentation} + * Find the structure of a text field. Find the structure of a text field in an Elasticsearch index. This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. For example, if you have ingested data into a very simple index that has just `@timestamp` and message fields, you can use this API to see what common structure exists in the message field. The response from the API contains: * Sample messages. * Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. * Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. * Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. All this information can be calculated by the structure finder with no guidance. However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. If the structure finder produces unexpected results, specify the `explain` query parameter and an explanation will appear in the response. It helps determine why the returned structure was chosen. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/find-field-structure.html | Elasticsearch API documentation} */ - async findFieldStructure (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async findFieldStructure (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async findFieldStructure (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async findFieldStructure (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async findFieldStructure (this: That, params: T.TextStructureFindFieldStructureRequest | TB.TextStructureFindFieldStructureRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async findFieldStructure (this: That, params: T.TextStructureFindFieldStructureRequest | TB.TextStructureFindFieldStructureRequest, options?: TransportRequestOptionsWithMeta): Promise> + async findFieldStructure (this: That, params: T.TextStructureFindFieldStructureRequest | TB.TextStructureFindFieldStructureRequest, options?: TransportRequestOptions): Promise + async findFieldStructure (this: That, params: T.TextStructureFindFieldStructureRequest | TB.TextStructureFindFieldStructureRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const querystring: Record = {} const body = undefined - params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -74,22 +74,34 @@ export default class TextStructure { } /** - * Finds the structure of a list of messages. The messages must contain data that is suitable to be ingested into Elasticsearch. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/find-message-structure.html | Elasticsearch API documentation} + * Find the structure of text messages. Find the structure of a list of text messages. The messages must contain data that is suitable to be ingested into Elasticsearch. This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. The response from the API contains: * Sample messages. * Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. * Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. All this information can be calculated by the structure finder with no guidance. However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. If the structure finder produces unexpected results, specify the `explain` query parameter and an explanation will appear in the response. It helps determine why the returned structure was chosen. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/find-message-structure.html | Elasticsearch API documentation} */ - async findMessageStructure (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async findMessageStructure (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async findMessageStructure (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async findMessageStructure (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async findMessageStructure (this: That, params: T.TextStructureFindMessageStructureRequest | TB.TextStructureFindMessageStructureRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async findMessageStructure (this: That, params: T.TextStructureFindMessageStructureRequest | TB.TextStructureFindMessageStructureRequest, options?: TransportRequestOptionsWithMeta): Promise> + async findMessageStructure (this: That, params: T.TextStructureFindMessageStructureRequest | TB.TextStructureFindMessageStructureRequest, options?: TransportRequestOptions): Promise + async findMessageStructure (this: That, params: T.TextStructureFindMessageStructureRequest | TB.TextStructureFindMessageStructureRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] + const acceptedBody: string[] = ['messages'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -103,8 +115,8 @@ export default class TextStructure { } /** - * Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/find-structure.html | Elasticsearch API documentation} + * Find the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch. This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. Unlike other Elasticsearch endpoints, the data that is posted to this endpoint does not need to be UTF-8 encoded and in JSON format. It must, however, be text; binary text formats are not currently supported. The size is limited to the Elasticsearch HTTP receive buffer size, which defaults to 100 Mb. The response from the API contains: * A couple of messages from the beginning of the text. * Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. * Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. * Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. All this information can be calculated by the structure finder with no guidance. However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/find-structure.html | Elasticsearch API documentation} */ async findStructure (this: That, params: T.TextStructureFindStructureRequest | TB.TextStructureFindStructureRequest, options?: TransportRequestOptionsWithOutMeta): Promise async findStructure (this: That, params: T.TextStructureFindStructureRequest | TB.TextStructureFindStructureRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -137,8 +149,8 @@ export default class TextStructure { } /** - * Tests a Grok pattern on some text. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html | Elasticsearch API documentation} + * Test a Grok pattern. Test a Grok pattern on one or more lines of text. The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/test-grok-pattern.html | Elasticsearch API documentation} */ async testGrokPattern (this: That, params: T.TextStructureTestGrokPatternRequest | TB.TextStructureTestGrokPatternRequest, options?: TransportRequestOptionsWithOutMeta): Promise async testGrokPattern (this: That, params: T.TextStructureTestGrokPatternRequest | TB.TextStructureTestGrokPatternRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/transform.ts b/src/api/api/transform.ts index e1b9dc6bc..5e8a1fd4a 100644 --- a/src/api/api/transform.ts +++ b/src/api/api/transform.ts @@ -45,8 +45,8 @@ export default class Transform { } /** - * Delete a transform. Deletes a transform. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-transform.html | Elasticsearch API documentation} + * Delete a transform. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-transform.html | Elasticsearch API documentation} */ async deleteTransform (this: That, params: T.TransformDeleteTransformRequest | TB.TransformDeleteTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteTransform (this: That, params: T.TransformDeleteTransformRequest | TB.TransformDeleteTransformRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -78,7 +78,7 @@ export default class Transform { /** * Retrieves transform usage information for transform nodes. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-transform-node-stats.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-transform-node-stats.html | Elasticsearch API documentation} */ async getNodeStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async getNodeStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -106,8 +106,8 @@ export default class Transform { } /** - * Get transforms. Retrieves configuration information for transforms. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-transform.html | Elasticsearch API documentation} + * Get transforms. Get configuration information for transforms. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-transform.html | Elasticsearch API documentation} */ async getTransform (this: That, params?: T.TransformGetTransformRequest | TB.TransformGetTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getTransform (this: That, params?: T.TransformGetTransformRequest | TB.TransformGetTransformRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -146,8 +146,8 @@ export default class Transform { } /** - * Get transform stats. Retrieves usage information for transforms. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-transform-stats.html | Elasticsearch API documentation} + * Get transform stats. Get usage information for transforms. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-transform-stats.html | Elasticsearch API documentation} */ async getTransformStats (this: That, params: T.TransformGetTransformStatsRequest | TB.TransformGetTransformStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getTransformStats (this: That, params: T.TransformGetTransformStatsRequest | TB.TransformGetTransformStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -179,7 +179,7 @@ export default class Transform { /** * Preview a transform. Generates a preview of the results that you will get when you create a transform with the same configuration. It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also generates a list of mappings and settings for the destination index. These values are determined based on the field types of the source index and the transform aggregations. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/preview-transform.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/preview-transform.html | Elasticsearch API documentation} */ async previewTransform (this: That, params?: T.TransformPreviewTransformRequest | TB.TransformPreviewTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise> async previewTransform (this: That, params?: T.TransformPreviewTransformRequest | TB.TransformPreviewTransformRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> @@ -231,7 +231,7 @@ export default class Transform { /** * Create a transform. Creates a transform. A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a unique row per entity. You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If you choose to use the pivot method for your transform, the entities are defined by the set of `group_by` fields in the pivot object. If you choose to use the latest method, the entities are defined by the `unique_key` field values in the latest object. You must have `create_index`, `index`, and `read` privileges on the destination index and `read` and `view_index_metadata` privileges on the source indices. When Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the time of creation and uses those same roles. If those roles do not have the required privileges on the source and destination indices, the transform fails when it attempts unauthorized operations. NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any `.transform-internal*` indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do not give users any privileges on `.transform-internal*` indices. If you used transforms prior to 7.5, also do not give users any privileges on `.data-frame-internal*` indices. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-transform.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-transform.html | Elasticsearch API documentation} */ async putTransform (this: That, params: T.TransformPutTransformRequest | TB.TransformPutTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putTransform (this: That, params: T.TransformPutTransformRequest | TB.TransformPutTransformRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -274,8 +274,8 @@ export default class Transform { } /** - * Reset a transform. Resets a transform. Before you can reset it, you must stop it; alternatively, use the `force` query parameter. If the destination index was created by the transform, it is deleted. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/reset-transform.html | Elasticsearch API documentation} + * Reset a transform. Before you can reset it, you must stop it; alternatively, use the `force` query parameter. If the destination index was created by the transform, it is deleted. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/reset-transform.html | Elasticsearch API documentation} */ async resetTransform (this: That, params: T.TransformResetTransformRequest | TB.TransformResetTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise async resetTransform (this: That, params: T.TransformResetTransformRequest | TB.TransformResetTransformRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -306,8 +306,8 @@ export default class Transform { } /** - * Schedule a transform to start now. Instantly runs a transform to process data. If you _schedule_now a transform, it will process the new data instantly, without waiting for the configured frequency interval. After _schedule_now API is called, the transform will be processed again at now + frequency unless _schedule_now API is called again in the meantime. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/schedule-now-transform.html | Elasticsearch API documentation} + * Schedule a transform to start now. Instantly run a transform to process data. If you run this API, the transform will process the new data instantly, without waiting for the configured frequency interval. After the API is called, the transform will be processed again at `now + frequency` unless the API is called again in the meantime. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/schedule-now-transform.html | Elasticsearch API documentation} */ async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest | TB.TransformScheduleNowTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest | TB.TransformScheduleNowTransformRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -338,8 +338,8 @@ export default class Transform { } /** - * Start a transform. Starts a transform. When you start a transform, it creates the destination index if it does not already exist. The `number_of_shards` is set to `1` and the `auto_expand_replicas` is set to `0-1`. If it is a pivot transform, it deduces the mapping definitions for the destination index from the source indices and the transform aggregations. If fields in the destination index are derived from scripts (as in the case of `scripted_metric` or `bucket_script` aggregations), the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings in a pivot transform. When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you created the transform, they occur when you start the transform—with the exception of privilege checks. When Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the time of creation and uses those same roles. If those roles do not have the required privileges on the source and destination indices, the transform fails when it attempts unauthorized operations. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/start-transform.html | Elasticsearch API documentation} + * Start a transform. When you start a transform, it creates the destination index if it does not already exist. The `number_of_shards` is set to `1` and the `auto_expand_replicas` is set to `0-1`. If it is a pivot transform, it deduces the mapping definitions for the destination index from the source indices and the transform aggregations. If fields in the destination index are derived from scripts (as in the case of `scripted_metric` or `bucket_script` aggregations), the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings in a pivot transform. When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you created the transform, they occur when you start the transform—with the exception of privilege checks. When Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the time of creation and uses those same roles. If those roles do not have the required privileges on the source and destination indices, the transform fails when it attempts unauthorized operations. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/start-transform.html | Elasticsearch API documentation} */ async startTransform (this: That, params: T.TransformStartTransformRequest | TB.TransformStartTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise async startTransform (this: That, params: T.TransformStartTransformRequest | TB.TransformStartTransformRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -371,7 +371,7 @@ export default class Transform { /** * Stop transforms. Stops one or more transforms. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/stop-transform.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/stop-transform.html | Elasticsearch API documentation} */ async stopTransform (this: That, params: T.TransformStopTransformRequest | TB.TransformStopTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stopTransform (this: That, params: T.TransformStopTransformRequest | TB.TransformStopTransformRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -403,7 +403,7 @@ export default class Transform { /** * Update a transform. Updates certain properties of a transform. All updated properties except `description` do not take effect until after the transform starts the next checkpoint, thus there is data consistency in each checkpoint. To use this API, you must have `read` and `view_index_metadata` privileges for the source indices. You must also have `index` and `read` privileges for the destination index. When Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the time of update and runs with those privileges. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-transform.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-update-transform | Elasticsearch API documentation} */ async updateTransform (this: That, params: T.TransformUpdateTransformRequest | TB.TransformUpdateTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise async updateTransform (this: That, params: T.TransformUpdateTransformRequest | TB.TransformUpdateTransformRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -446,8 +446,8 @@ export default class Transform { } /** - * Upgrades all transforms. This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. It also cleans up the internal data structures that store the transform state and checkpoints. The upgrade does not affect the source and destination indices. The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/upgrade-transforms.html | Elasticsearch API documentation} + * Upgrade all transforms. Transforms are compatible across minor versions and between supported major versions. However, over time, the format of transform configuration information may change. This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. It also cleans up the internal data structures that store the transform state and checkpoints. The upgrade does not affect the source and destination indices. The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. Resolve the issue then re-run the process again. A summary is returned when the upgrade is finished. To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. You may want to perform a recent cluster backup prior to the upgrade. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-upgrade-transforms | Elasticsearch API documentation} */ async upgradeTransforms (this: That, params?: T.TransformUpgradeTransformsRequest | TB.TransformUpgradeTransformsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async upgradeTransforms (this: That, params?: T.TransformUpgradeTransformsRequest | TB.TransformUpgradeTransformsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/update.ts b/src/api/api/update.ts index 0dd6f4220..0ce7fb612 100644 --- a/src/api/api/update.ts +++ b/src/api/api/update.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Update a document. Updates a document by running a script or passing a partial document. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html | Elasticsearch API documentation} + * Update a document. Update a document by running a script or passing a partial document. If the Elasticsearch security features are enabled, you must have the `index` or `write` index privilege for the target index or index alias. The script can update, delete, or skip modifying the document. The API also supports passing a partial document, which is merged into the existing document. To fully replace an existing document, use the index API. This operation: * Gets the document (collocated with the shard) from the index. * Runs the specified script. * Indexes the result. The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. The `_source` field must be enabled to use this API. In addition to `_source`, you can access the following variables through the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing`, and `_now` (the current timestamp). + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-update.html | Elasticsearch API documentation} */ export default async function UpdateApi (this: That, params: T.UpdateRequest | TB.UpdateRequest, options?: TransportRequestOptionsWithOutMeta): Promise> export default async function UpdateApi (this: That, params: T.UpdateRequest | TB.UpdateRequest, options?: TransportRequestOptionsWithMeta): Promise, unknown>> diff --git a/src/api/api/update_by_query.ts b/src/api/api/update_by_query.ts index 64d5c95ef..373217bd0 100644 --- a/src/api/api/update_by_query.ts +++ b/src/api/api/update_by_query.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Update documents. Updates documents that match the specified query. If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html | Elasticsearch API documentation} + * Update documents. Updates documents that match the specified query. If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: * `read` * `index` or `write` You can specify the query criteria in the request URI or the request body using the same syntax as the search API. When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. When the versions match, the document is updated and the version number is incremented. If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. You can opt to count version conflicts instead of halting and returning by setting `conflicts` to `proceed`. Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than `max_docs` until it has successfully updated `max_docs` documents or it has gone through every document in the source query. NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. A bulk update request is performed for each batch of matching documents. Any query or update failures cause the update by query request to fail and the failures are shown in the response. Any update requests that completed successfully still stick, they are not rolled back. **Throttling update requests** To control the rate at which update by query issues batches of update operations, you can set `requests_per_second` to any positive decimal number. This pads each batch with a wait time to throttle the rate. Set `requests_per_second` to `-1` to turn off throttling. Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. By default the batch size is 1000, so if `requests_per_second` is set to `500`: ``` target_time = 1000 / 500 per second = 2 seconds wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds ``` Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. This is "bursty" instead of "smooth". **Slicing** Update by query supports sliced scroll to parallelize the update process. This can improve efficiency and provide a convenient way to break the request down into smaller parts. Setting `slices` to `auto` chooses a reasonable number for most data streams and indices. This setting will use one slice per shard, up to a certain limit. If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. Adding `slices` to `_update_by_query` just automates the manual process of creating sub-requests, which means it has some quirks: * You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. * Fetching the status of the task for the request with `slices` only contains the status of completed slices. * These sub-requests are individually addressable for things like cancellation and rethrottling. * Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. * Canceling the request with slices will cancel each sub-request. * Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. * Parameters like `requests_per_second` and `max_docs` on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being updated. * Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: * Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. * Update performance scales linearly across available resources with the number of slices. Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. **Update the document source** Update by query supports scripts to update the document source. As with the update API, you can set `ctx.op` to change the operation that is performed. Set `ctx.op = "noop"` if your script decides that it doesn't have to make any changes. The update by query operation skips updating the document and increments the `noop` counter. Set `ctx.op = "delete"` if your script decides that the document should be deleted. The update by query operation deletes the document and increments the `deleted` counter. Update by query supports only `index`, `noop`, and `delete`. Setting `ctx.op` to anything else is an error. Setting any other field in `ctx` is an error. This API enables you to only modify the source of matching documents; you cannot move them. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-update-by-query.html | Elasticsearch API documentation} */ export default async function UpdateByQueryApi (this: That, params: T.UpdateByQueryRequest | TB.UpdateByQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function UpdateByQueryApi (this: That, params: T.UpdateByQueryRequest | TB.UpdateByQueryRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/update_by_query_rethrottle.ts b/src/api/api/update_by_query_rethrottle.ts index 68f5cd9ed..086d6a873 100644 --- a/src/api/api/update_by_query_rethrottle.ts +++ b/src/api/api/update_by_query_rethrottle.ts @@ -39,8 +39,8 @@ import * as TB from '../typesWithBodyKey' interface That { transport: Transport } /** - * Changes the number of requests per second for a particular Update By Query operation. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html | Elasticsearch API documentation} + * Throttle an update by query operation. Change the number of requests per second for a particular update by query operation. Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/docs-update-by-query.html#docs-update-by-query-rethrottle | Elasticsearch API documentation} */ export default async function UpdateByQueryRethrottleApi (this: That, params: T.UpdateByQueryRethrottleRequest | TB.UpdateByQueryRethrottleRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function UpdateByQueryRethrottleApi (this: That, params: T.UpdateByQueryRethrottleRequest | TB.UpdateByQueryRethrottleRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/watcher.ts b/src/api/api/watcher.ts index 5b98a7593..beee37e2b 100644 --- a/src/api/api/watcher.ts +++ b/src/api/api/watcher.ts @@ -45,8 +45,8 @@ export default class Watcher { } /** - * Acknowledges a watch, manually throttling the execution of the watch's actions. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-ack-watch.html | Elasticsearch API documentation} + * Acknowledge a watch. Acknowledging a watch enables you to manually throttle the execution of the watch's actions. The acknowledgement state of an action is stored in the `status.actions..ack.state` structure. IMPORTANT: If the specified watch is currently being executed, this API will return an error The reason for this behavior is to prevent overwriting the watch status from a watch execution. Acknowledging an action throttles further executions of that action until its `ack.state` is reset to `awaits_successful_execution`. This happens when the condition of the watch is not met (the condition evaluates to false). + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-ack-watch | Elasticsearch API documentation} */ async ackWatch (this: That, params: T.WatcherAckWatchRequest | TB.WatcherAckWatchRequest, options?: TransportRequestOptionsWithOutMeta): Promise async ackWatch (this: That, params: T.WatcherAckWatchRequest | TB.WatcherAckWatchRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -85,8 +85,8 @@ export default class Watcher { } /** - * Activates a currently inactive watch. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-activate-watch.html | Elasticsearch API documentation} + * Activate a watch. A watch can be either active or inactive. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-activate-watch | Elasticsearch API documentation} */ async activateWatch (this: That, params: T.WatcherActivateWatchRequest | TB.WatcherActivateWatchRequest, options?: TransportRequestOptionsWithOutMeta): Promise async activateWatch (this: That, params: T.WatcherActivateWatchRequest | TB.WatcherActivateWatchRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -117,8 +117,8 @@ export default class Watcher { } /** - * Deactivates a currently active watch. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-deactivate-watch.html | Elasticsearch API documentation} + * Deactivate a watch. A watch can be either active or inactive. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-deactivate-watch | Elasticsearch API documentation} */ async deactivateWatch (this: That, params: T.WatcherDeactivateWatchRequest | TB.WatcherDeactivateWatchRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deactivateWatch (this: That, params: T.WatcherDeactivateWatchRequest | TB.WatcherDeactivateWatchRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -149,8 +149,8 @@ export default class Watcher { } /** - * Removes a watch from Watcher. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-delete-watch.html | Elasticsearch API documentation} + * Delete a watch. When the watch is removed, the document representing the watch in the `.watches` index is gone and it will never be run again. Deleting a watch does not delete any watch execution records related to this watch from the watch history. IMPORTANT: Deleting a watch must be done by using only this API. Do not delete the watch directly from the `.watches` index using the Elasticsearch delete document API When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the `.watches` index. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-delete-watch | Elasticsearch API documentation} */ async deleteWatch (this: That, params: T.WatcherDeleteWatchRequest | TB.WatcherDeleteWatchRequest, options?: TransportRequestOptionsWithOutMeta): Promise async deleteWatch (this: That, params: T.WatcherDeleteWatchRequest | TB.WatcherDeleteWatchRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -181,8 +181,8 @@ export default class Watcher { } /** - * This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes. For testing and debugging purposes, you also have fine-grained control on how the watch runs. You can execute the watch without executing all of its actions or alternatively by simulating them. You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after execution. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-execute-watch.html | Elasticsearch API documentation} + * Run a watch. This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes. For testing and debugging purposes, you also have fine-grained control on how the watch runs. You can run the watch without running all of its actions or alternatively by simulating them. You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs. You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline. This serves as great tool for testing and debugging your watches prior to adding them to Watcher. When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches. If your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch. When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-execute-watch | Elasticsearch API documentation} */ async executeWatch (this: That, params?: T.WatcherExecuteWatchRequest | TB.WatcherExecuteWatchRequest, options?: TransportRequestOptionsWithOutMeta): Promise async executeWatch (this: That, params?: T.WatcherExecuteWatchRequest | TB.WatcherExecuteWatchRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -233,13 +233,13 @@ export default class Watcher { } /** - * Retrieve settings for the watcher system index - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-get-settings.html | Elasticsearch API documentation} + * Get Watcher index settings. Get settings for the Watcher internal index (`.watches`). Only a subset of settings are shown, for example `index.auto_expand_replicas` and `index.number_of_replicas`. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-settings | Elasticsearch API documentation} */ - async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async getSettings (this: That, params?: T.WatcherGetSettingsRequest | TB.WatcherGetSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async getSettings (this: That, params?: T.WatcherGetSettingsRequest | TB.WatcherGetSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise> + async getSettings (this: That, params?: T.WatcherGetSettingsRequest | TB.WatcherGetSettingsRequest, options?: TransportRequestOptions): Promise + async getSettings (this: That, params?: T.WatcherGetSettingsRequest | TB.WatcherGetSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const querystring: Record = {} const body = undefined @@ -249,6 +249,7 @@ export default class Watcher { if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } @@ -262,8 +263,8 @@ export default class Watcher { } /** - * Retrieves a watch by its ID. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-get-watch.html | Elasticsearch API documentation} + * Get a watch. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-watch | Elasticsearch API documentation} */ async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -294,15 +295,15 @@ export default class Watcher { } /** - * Creates a new watch, or updates an existing one. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-put-watch.html | Elasticsearch API documentation} + * Create or update a watch. When a watch is registered, a new document that represents the watch is added to the `.watches` index and its trigger is immediately registered with the relevant trigger engine. Typically for the `schedule` trigger, the scheduler is the trigger engine. IMPORTANT: You must use Kibana or this API to create a watch. Do not add a watch directly to the `.watches` index by using the Elasticsearch index API. If Elasticsearch security features are enabled, do not give users write privileges on the `.watches` index. When you add a watch you can also define its initial active state by setting the *active* parameter. When Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges. If the user is able to read index `a`, but not index `b`, the same will apply when the watch runs. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-put-watch | Elasticsearch API documentation} */ async putWatch (this: That, params: T.WatcherPutWatchRequest | TB.WatcherPutWatchRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putWatch (this: That, params: T.WatcherPutWatchRequest | TB.WatcherPutWatchRequest, options?: TransportRequestOptionsWithMeta): Promise> async putWatch (this: That, params: T.WatcherPutWatchRequest | TB.WatcherPutWatchRequest, options?: TransportRequestOptions): Promise async putWatch (this: That, params: T.WatcherPutWatchRequest | TB.WatcherPutWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedBody: string[] = ['actions', 'condition', 'input', 'metadata', 'throttle_period', 'transform', 'trigger'] + const acceptedBody: string[] = ['actions', 'condition', 'input', 'metadata', 'throttle_period', 'throttle_period_in_millis', 'transform', 'trigger'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -338,8 +339,8 @@ export default class Watcher { } /** - * Retrieves stored watches. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-query-watches.html | Elasticsearch API documentation} + * Query watches. Get all registered watches in a paginated manner and optionally filter watches by a query. Note that only the `_id` and `metadata.*` fields are queryable or sortable. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-query-watches | Elasticsearch API documentation} */ async queryWatches (this: That, params?: T.WatcherQueryWatchesRequest | TB.WatcherQueryWatchesRequest, options?: TransportRequestOptionsWithOutMeta): Promise async queryWatches (this: That, params?: T.WatcherQueryWatchesRequest | TB.WatcherQueryWatchesRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -380,8 +381,8 @@ export default class Watcher { } /** - * Starts Watcher if it is not already running. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-start.html | Elasticsearch API documentation} + * Start the watch service. Start the Watcher service if it is not already running. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-start | Elasticsearch API documentation} */ async start (this: That, params?: T.WatcherStartRequest | TB.WatcherStartRequest, options?: TransportRequestOptionsWithOutMeta): Promise async start (this: That, params?: T.WatcherStartRequest | TB.WatcherStartRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -410,8 +411,8 @@ export default class Watcher { } /** - * Retrieves the current Watcher metrics. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-stats.html | Elasticsearch API documentation} + * Get Watcher statistics. This API always returns basic metrics. You retrieve more metrics by using the metric parameter. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stats | Elasticsearch API documentation} */ async stats (this: That, params?: T.WatcherStatsRequest | TB.WatcherStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stats (this: That, params?: T.WatcherStatsRequest | TB.WatcherStatsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -450,8 +451,8 @@ export default class Watcher { } /** - * Stops Watcher if it is running. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-stop.html | Elasticsearch API documentation} + * Stop the watch service. Stop the Watcher service if it is running. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stop | Elasticsearch API documentation} */ async stop (this: That, params?: T.WatcherStopRequest | TB.WatcherStopRequest, options?: TransportRequestOptionsWithOutMeta): Promise async stop (this: That, params?: T.WatcherStopRequest | TB.WatcherStopRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -480,22 +481,35 @@ export default class Watcher { } /** - * Update settings for the watcher system index - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-update-settings.html | Elasticsearch API documentation} + * Update Watcher index settings. Update settings for the Watcher internal index (`.watches`). Only a subset of settings can be modified. This includes `index.auto_expand_replicas`, `index.number_of_replicas`, `index.routing.allocation.exclude.*`, `index.routing.allocation.include.*` and `index.routing.allocation.require.*`. Modification of `index.routing.allocation.include._tier_preference` is an exception and is not allowed as the Watcher shards must always be in the `data_content` tier. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-update-settings | Elasticsearch API documentation} */ - async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async updateSettings (this: That, params?: T.WatcherUpdateSettingsRequest | TB.WatcherUpdateSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async updateSettings (this: That, params?: T.WatcherUpdateSettingsRequest | TB.WatcherUpdateSettingsRequest, options?: TransportRequestOptionsWithMeta): Promise> + async updateSettings (this: That, params?: T.WatcherUpdateSettingsRequest | TB.WatcherUpdateSettingsRequest, options?: TransportRequestOptions): Promise + async updateSettings (this: That, params?: T.WatcherUpdateSettingsRequest | TB.WatcherUpdateSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] + const acceptedBody: string[] = ['index.auto_expand_replicas', 'index.number_of_replicas'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } diff --git a/src/api/api/xpack.ts b/src/api/api/xpack.ts index 3472a080c..c454a6b3c 100644 --- a/src/api/api/xpack.ts +++ b/src/api/api/xpack.ts @@ -45,8 +45,8 @@ export default class Xpack { } /** - * Provides general information about the installed X-Pack features. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/info-api.html | Elasticsearch API documentation} + * Get information. The information provided by the API includes: * Build information including the build number and timestamp. * License information about the currently installed license. * Feature information for the features that are currently enabled and available under the current license. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/info-api.html | Elasticsearch API documentation} */ async info (this: That, params?: T.XpackInfoRequest | TB.XpackInfoRequest, options?: TransportRequestOptionsWithOutMeta): Promise async info (this: That, params?: T.XpackInfoRequest | TB.XpackInfoRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -75,8 +75,8 @@ export default class Xpack { } /** - * This API provides information about which features are currently enabled and available under the current license and some usage statistics. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/usage-api.html | Elasticsearch API documentation} + * Get usage information. Get information about the features that are currently enabled and available under the current license. The API also provides some usage statistics. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-xpack | Elasticsearch API documentation} */ async usage (this: That, params?: T.XpackUsageRequest | TB.XpackUsageRequest, options?: TransportRequestOptionsWithOutMeta): Promise async usage (this: That, params?: T.XpackUsageRequest | TB.XpackUsageRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/types.ts b/src/api/types.ts index 9c656edef..659ad3086 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -34,6 +34,8 @@ export interface BulkCreateOperation extends BulkWriteOperation { export interface BulkDeleteOperation extends BulkOperationBase { } +export type BulkFailureStoreStatus = 'not_applicable_or_unknown' | 'used' | 'not_enabled' | 'failed' + export interface BulkIndexOperation extends BulkWriteOperation { } @@ -58,6 +60,8 @@ export type BulkOperationType = 'index' | 'create' | 'update' | 'delete' export interface BulkRequest extends RequestBase { index?: IndexName + include_source_on_error?: boolean + list_executed_pipelines?: boolean pipeline?: string refresh?: Refresh routing?: Routing @@ -67,6 +71,7 @@ export interface BulkRequest ex timeout?: Duration wait_for_active_shards?: WaitForActiveShards require_alias?: boolean + require_data_stream?: boolean operations?: (BulkOperationContainer | BulkUpdateAction | TDocument)[] } @@ -81,6 +86,7 @@ export interface BulkResponseItem { _id?: string | null _index: string status: integer + failure_store?: BulkFailureStoreStatus error?: ErrorCause _primary_term?: long result?: string @@ -157,8 +163,14 @@ export interface CountResponse { export interface CreateRequest extends RequestBase { id: Id index: IndexName + if_primary_term?: long + if_seq_no?: SequenceNumber + include_source_on_error?: boolean + op_type?: OpType pipeline?: string refresh?: Refresh + require_alias?: boolean + require_data_stream?: boolean routing?: Routing timeout?: Duration version?: VersionNumber @@ -637,6 +649,7 @@ export interface IndexRequest extends RequestBase { index: IndexName if_primary_term?: long if_seq_no?: SequenceNumber + include_source_on_error?: boolean op_type?: OpType pipeline?: string refresh?: Refresh @@ -747,7 +760,7 @@ export interface MsearchMultisearchBody { knn?: KnnSearch | KnnSearch[] from?: integer highlight?: SearchHighlight - indices_boost?: Record[] + indices_boost?: Partial>[] min_score?: double post_filter?: QueryDslQueryContainer profile?: boolean @@ -884,9 +897,13 @@ export interface OpenPointInTimeRequest extends RequestBase { preference?: string routing?: Routing expand_wildcards?: ExpandWildcards + allow_partial_search_results?: boolean + max_concurrent_shard_requests?: integer + index_filter?: QueryDslQueryContainer } export interface OpenPointInTimeResponse { + _shards: ShardStatistics id: Id } @@ -1114,6 +1131,8 @@ export interface RenderSearchTemplateResponse { template_output: Record } +export type ScriptsPainlessExecutePainlessContext = 'painless_test' | 'filter' | 'score' | 'boolean_field' | 'date_field' | 'double_field' | 'geo_point_field' | 'ip_field' | 'keyword_field' | 'long_field' | 'composite_field' + export interface ScriptsPainlessExecutePainlessContextSetup { document: any index: IndexName @@ -1121,7 +1140,7 @@ export interface ScriptsPainlessExecutePainlessContextSetup { } export interface ScriptsPainlessExecuteRequest extends RequestBase { - context?: string + context?: ScriptsPainlessExecutePainlessContext context_setup?: ScriptsPainlessExecutePainlessContextSetup script?: Script | string } @@ -1180,7 +1199,7 @@ export interface SearchRequest extends RequestBase { from?: integer highlight?: SearchHighlight track_total_hits?: SearchTrackHits - indices_boost?: Record[] + indices_boost?: Partial>[] docvalue_fields?: (QueryDslFieldAndFormat | Field)[] knn?: KnnSearch | KnnSearch[] rank?: RankContainer @@ -1281,6 +1300,10 @@ export interface SearchAggregationProfileDebug { segments_counted?: integer segments_collected?: integer map_reducer?: string + brute_force_used?: integer + dynamic_pruning_attempted?: integer + dynamic_pruning_used?: integer + skipped_due_to_no_data?: integer } export interface SearchAggregationProfileDelegateDebugFilter { @@ -1333,6 +1356,39 @@ export interface SearchCompletionSuggester extends SearchSuggesterBase { export type SearchContext = string | GeoLocation +export interface SearchDfsKnnProfile { + vector_operations_count?: long + query: SearchKnnQueryProfileResult[] + rewrite_time: long + collector: SearchKnnCollectorResult[] +} + +export interface SearchDfsProfile { + statistics?: SearchDfsStatisticsProfile + knn?: SearchDfsKnnProfile[] +} + +export interface SearchDfsStatisticsBreakdown { + collection_statistics: long + collection_statistics_count: long + create_weight: long + create_weight_count: long + rewrite: long + rewrite_count: long + term_statistics: long + term_statistics_count: long +} + +export interface SearchDfsStatisticsProfile { + type: string + description: string + time?: Duration + time_in_nanos: DurationValue + breakdown: SearchDfsStatisticsBreakdown + debug?: Record + children?: SearchDfsStatisticsProfile[] +} + export interface SearchDirectGenerator { field: Field max_edits?: integer @@ -1440,10 +1496,10 @@ export interface SearchHit { fields?: Record highlight?: Record inner_hits?: Record - matched_queries?: string[] | Record + matched_queries?: string[] | Record _nested?: SearchNestedIdentity _ignored?: string[] - ignored_field_values?: Record + ignored_field_values?: Record _shard?: string _node?: string _routing?: string @@ -1472,7 +1528,7 @@ export interface SearchInnerHits { ignore_unmapped?: boolean script_fields?: Record seq_no_primary_term?: boolean - fields?: Fields + fields?: Field[] sort?: Sort _source?: SearchSourceConfig stored_fields?: Fields @@ -1484,6 +1540,47 @@ export interface SearchInnerHitsResult { hits: SearchHitsMetadata } +export interface SearchKnnCollectorResult { + name: string + reason: string + time?: Duration + time_in_nanos: DurationValue + children?: SearchKnnCollectorResult[] +} + +export interface SearchKnnQueryProfileBreakdown { + advance: long + advance_count: long + build_scorer: long + build_scorer_count: long + compute_max_score: long + compute_max_score_count: long + count_weight: long + count_weight_count: long + create_weight: long + create_weight_count: long + match: long + match_count: long + next_doc: long + next_doc_count: long + score: long + score_count: long + set_min_competitive_score: long + set_min_competitive_score_count: long + shallow_advance: long + shallow_advance_count: long +} + +export interface SearchKnnQueryProfileResult { + type: string + description: string + time?: Duration + time_in_nanos: DurationValue + breakdown: SearchKnnQueryProfileBreakdown + debug?: Record + children?: SearchKnnQueryProfileResult[] +} + export interface SearchLaplaceSmoothingModel { alpha: double } @@ -1574,6 +1671,8 @@ export interface SearchQueryBreakdown { score_count: long compute_max_score: long compute_max_score_count: long + count_weight: long + count_weight_count: long set_min_competitive_score: long set_min_competitive_score_count: long } @@ -1614,9 +1713,14 @@ export interface SearchSearchProfile { export interface SearchShardProfile { aggregations: SearchAggregationProfile[] + cluster: string + dfs?: SearchDfsProfile + fetch?: SearchFetchProfile id: string + index: IndexName + node_id: NodeId searches: SearchSearchProfile[] - fetch?: SearchFetchProfile + shard_id: long } export interface SearchSmoothingModelContainer { @@ -1746,16 +1850,29 @@ export interface SearchShardsRequest extends RequestBase { expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean local?: boolean + master_timeout?: Duration preference?: string routing?: Routing } export interface SearchShardsResponse { - nodes: Record + nodes: Record shards: NodeShard[][] indices: Record } +export interface SearchShardsSearchShardsNodeAttributes { + name: NodeName + ephemeral_id: Id + transport_address: TransportAddress + external_id: string + attributes: Record + roles: NodeRoles + version: VersionString + min_index_version: integer + max_index_version: integer +} + export interface SearchShardsShardStoreIndex { aliases?: Name[] filter?: QueryDslQueryContainer @@ -1834,20 +1951,20 @@ export interface TermvectorsFilter { export interface TermvectorsRequest extends RequestBase { index: IndexName id?: Id + preference?: string + realtime?: boolean + doc?: TDocument + filter?: TermvectorsFilter + per_field_analyzer?: Record fields?: Fields field_statistics?: boolean offsets?: boolean payloads?: boolean positions?: boolean - preference?: string - realtime?: boolean - routing?: Routing term_statistics?: boolean + routing?: Routing version?: VersionNumber version_type?: VersionType - doc?: TDocument - filter?: TermvectorsFilter - per_field_analyzer?: Record } export interface TermvectorsResponse { @@ -1884,6 +2001,7 @@ export interface UpdateRequest index: IndexName if_primary_term?: long if_seq_no?: SequenceNumber + include_source_on_error?: boolean lang?: string refresh?: Refresh require_alias?: boolean @@ -2006,7 +2124,6 @@ export interface BulkIndexByScrollFailure { id: Id index: IndexName status: integer - type: string } export interface BulkStats { @@ -2140,7 +2257,7 @@ export interface ErrorResponseBase { status: integer } -export type EsqlColumns = ArrayBuffer +export type EsqlResult = ArrayBuffer export type ExpandWildcard = 'all' | 'open' | 'closed' | 'hidden' | 'none' @@ -2243,6 +2360,8 @@ export interface GetStats { total: long } +export type GrokPattern = string + export type HealthStatus = 'green' | 'GREEN' | 'yellow' | 'YELLOW' | 'red' | 'RED' export type Host = string @@ -2317,6 +2436,7 @@ export interface KnnQuery extends QueryDslQueryBase { k?: integer filter?: QueryDslQueryContainer | QueryDslQueryContainer[] similarity?: float + rescore_vector?: RescoreVector } export interface KnnRetriever extends RetrieverBase { @@ -2326,6 +2446,7 @@ export interface KnnRetriever extends RetrieverBase { k: integer num_candidates: integer similarity?: float + rescore_vector?: RescoreVector } export interface KnnSearch { @@ -2338,6 +2459,7 @@ export interface KnnSearch { filter?: QueryDslQueryContainer | QueryDslQueryContainer[] similarity?: float inner_hits?: SearchInnerHits + rescore_vector?: RescoreVector } export interface LatLonGeoLocation { @@ -2397,8 +2519,6 @@ export interface NodeAttributes { id?: NodeId name: NodeName transport_address: TransportAddress - roles?: NodeRoles - external_id?: string } export type NodeId = string @@ -2520,6 +2640,10 @@ export interface RequestCacheStats { miss_count: long } +export interface RescoreVector { + oversample: float +} + export type Result = 'created' | 'updated' | 'deleted' | 'not_found' | 'noop' export interface Retries { @@ -2529,12 +2653,15 @@ export interface Retries { export interface RetrieverBase { filter?: QueryDslQueryContainer | QueryDslQueryContainer[] + min_score?: float } export interface RetrieverContainer { standard?: StandardRetriever knn?: KnnRetriever rrf?: RRFRetriever + text_similarity_reranker?: TextSimilarityReranker + rule?: RuleRetriever } export type Routing = string @@ -2544,6 +2671,13 @@ export interface RrfRank { rank_window_size?: long } +export interface RuleRetriever extends RetrieverBase { + ruleset_ids: Id[] + match_criteria: any + retriever: RetrieverContainer + rank_window_size?: integer +} + export type ScalarValue = long | double | string | boolean | null export interface ScoreSort { @@ -2662,7 +2796,7 @@ export interface ShardStatistics { } export interface ShardsOperationResponseBase { - _shards: ShardStatistics + _shards?: ShardStatistics } export interface SlicedScroll { @@ -2699,7 +2833,6 @@ export interface StandardRetriever extends RetrieverBase { search_after?: SortResults terminate_after?: integer sort?: Sort - min_score?: float collapse?: SearchFieldCollapse } @@ -2718,6 +2851,8 @@ export interface StoredScript { source: string } +export type StreamResult = ArrayBuffer + export type SuggestMode = 'missing' | 'popular' | 'always' export type SuggestionName = string @@ -2736,6 +2871,14 @@ export interface TextEmbedding { model_text: string } +export interface TextSimilarityReranker extends RetrieverBase { + retriever: RetrieverContainer + rank_window_size?: integer + inference_id?: string + inference_text?: string + field?: string +} + export type ThreadType = 'cpu' | 'wait' | 'block' | 'gpu' | 'mem' export type TimeOfDay = string @@ -2848,7 +2991,7 @@ export interface AggregationsAdjacencyMatrixBucketKeys extends AggregationsMulti export type AggregationsAdjacencyMatrixBucket = AggregationsAdjacencyMatrixBucketKeys & { [property: string]: AggregationsAggregate | string | long } -export type AggregationsAggregate = AggregationsCardinalityAggregate | AggregationsHdrPercentilesAggregate | AggregationsHdrPercentileRanksAggregate | AggregationsTDigestPercentilesAggregate | AggregationsTDigestPercentileRanksAggregate | AggregationsPercentilesBucketAggregate | AggregationsMedianAbsoluteDeviationAggregate | AggregationsMinAggregate | AggregationsMaxAggregate | AggregationsSumAggregate | AggregationsAvgAggregate | AggregationsWeightedAvgAggregate | AggregationsValueCountAggregate | AggregationsSimpleValueAggregate | AggregationsDerivativeAggregate | AggregationsBucketMetricValueAggregate | AggregationsStatsAggregate | AggregationsStatsBucketAggregate | AggregationsExtendedStatsAggregate | AggregationsExtendedStatsBucketAggregate | AggregationsGeoBoundsAggregate | AggregationsGeoCentroidAggregate | AggregationsHistogramAggregate | AggregationsDateHistogramAggregate | AggregationsAutoDateHistogramAggregate | AggregationsVariableWidthHistogramAggregate | AggregationsStringTermsAggregate | AggregationsLongTermsAggregate | AggregationsDoubleTermsAggregate | AggregationsUnmappedTermsAggregate | AggregationsLongRareTermsAggregate | AggregationsStringRareTermsAggregate | AggregationsUnmappedRareTermsAggregate | AggregationsMultiTermsAggregate | AggregationsMissingAggregate | AggregationsNestedAggregate | AggregationsReverseNestedAggregate | AggregationsGlobalAggregate | AggregationsFilterAggregate | AggregationsChildrenAggregate | AggregationsParentAggregate | AggregationsSamplerAggregate | AggregationsUnmappedSamplerAggregate | AggregationsGeoHashGridAggregate | AggregationsGeoTileGridAggregate | AggregationsGeoHexGridAggregate | AggregationsRangeAggregate | AggregationsDateRangeAggregate | AggregationsGeoDistanceAggregate | AggregationsIpRangeAggregate | AggregationsIpPrefixAggregate | AggregationsFiltersAggregate | AggregationsAdjacencyMatrixAggregate | AggregationsSignificantLongTermsAggregate | AggregationsSignificantStringTermsAggregate | AggregationsUnmappedSignificantTermsAggregate | AggregationsCompositeAggregate | AggregationsFrequentItemSetsAggregate | AggregationsScriptedMetricAggregate | AggregationsTopHitsAggregate | AggregationsInferenceAggregate | AggregationsStringStatsAggregate | AggregationsBoxPlotAggregate | AggregationsTopMetricsAggregate | AggregationsTTestAggregate | AggregationsRateAggregate | AggregationsCumulativeCardinalityAggregate | AggregationsMatrixStatsAggregate | AggregationsGeoLineAggregate +export type AggregationsAggregate = AggregationsCardinalityAggregate | AggregationsHdrPercentilesAggregate | AggregationsHdrPercentileRanksAggregate | AggregationsTDigestPercentilesAggregate | AggregationsTDigestPercentileRanksAggregate | AggregationsPercentilesBucketAggregate | AggregationsMedianAbsoluteDeviationAggregate | AggregationsMinAggregate | AggregationsMaxAggregate | AggregationsSumAggregate | AggregationsAvgAggregate | AggregationsWeightedAvgAggregate | AggregationsValueCountAggregate | AggregationsSimpleValueAggregate | AggregationsDerivativeAggregate | AggregationsBucketMetricValueAggregate | AggregationsStatsAggregate | AggregationsStatsBucketAggregate | AggregationsExtendedStatsAggregate | AggregationsExtendedStatsBucketAggregate | AggregationsGeoBoundsAggregate | AggregationsGeoCentroidAggregate | AggregationsHistogramAggregate | AggregationsDateHistogramAggregate | AggregationsAutoDateHistogramAggregate | AggregationsVariableWidthHistogramAggregate | AggregationsStringTermsAggregate | AggregationsLongTermsAggregate | AggregationsDoubleTermsAggregate | AggregationsUnmappedTermsAggregate | AggregationsLongRareTermsAggregate | AggregationsStringRareTermsAggregate | AggregationsUnmappedRareTermsAggregate | AggregationsMultiTermsAggregate | AggregationsMissingAggregate | AggregationsNestedAggregate | AggregationsReverseNestedAggregate | AggregationsGlobalAggregate | AggregationsFilterAggregate | AggregationsChildrenAggregate | AggregationsParentAggregate | AggregationsSamplerAggregate | AggregationsUnmappedSamplerAggregate | AggregationsGeoHashGridAggregate | AggregationsGeoTileGridAggregate | AggregationsGeoHexGridAggregate | AggregationsRangeAggregate | AggregationsDateRangeAggregate | AggregationsGeoDistanceAggregate | AggregationsIpRangeAggregate | AggregationsIpPrefixAggregate | AggregationsFiltersAggregate | AggregationsAdjacencyMatrixAggregate | AggregationsSignificantLongTermsAggregate | AggregationsSignificantStringTermsAggregate | AggregationsUnmappedSignificantTermsAggregate | AggregationsCompositeAggregate | AggregationsFrequentItemSetsAggregate | AggregationsTimeSeriesAggregate | AggregationsScriptedMetricAggregate | AggregationsTopHitsAggregate | AggregationsInferenceAggregate | AggregationsStringStatsAggregate | AggregationsBoxPlotAggregate | AggregationsTopMetricsAggregate | AggregationsTTestAggregate | AggregationsRateAggregate | AggregationsCumulativeCardinalityAggregate | AggregationsMatrixStatsAggregate | AggregationsGeoLineAggregate export interface AggregationsAggregateBase { meta?: Metadata @@ -2922,6 +3065,7 @@ export interface AggregationsAggregationContainer { rare_terms?: AggregationsRareTermsAggregation rate?: AggregationsRateAggregation reverse_nested?: AggregationsReverseNestedAggregation + random_sampler?: AggregationsRandomSamplerAggregation sampler?: AggregationsSamplerAggregation scripted_metric?: AggregationsScriptedMetricAggregation serial_diff?: AggregationsSerialDifferencingAggregation @@ -2933,6 +3077,7 @@ export interface AggregationsAggregationContainer { sum?: AggregationsSumAggregation sum_bucket?: AggregationsSumBucketAggregation terms?: AggregationsTermsAggregation + time_series?: AggregationsTimeSeriesAggregation top_hits?: AggregationsTopHitsAggregation t_test?: AggregationsTTestAggregation top_metrics?: AggregationsTopMetricsAggregation @@ -2942,9 +3087,9 @@ export interface AggregationsAggregationContainer { } export interface AggregationsAggregationRange { - from?: double + from?: double | null key?: string - to?: double + to?: double | null } export interface AggregationsArrayPercentilesItem { @@ -3808,6 +3953,12 @@ export interface AggregationsPipelineAggregationBase extends AggregationsBucketP gap_policy?: AggregationsGapPolicy } +export interface AggregationsRandomSamplerAggregation extends AggregationsBucketAggregationBase { + probability: double + seed?: integer + shard_seed?: integer +} + export interface AggregationsRangeAggregate extends AggregationsMultiBucketAggregateBase { } @@ -4129,6 +4280,20 @@ export interface AggregationsTestPopulation { filter?: QueryDslQueryContainer } +export interface AggregationsTimeSeriesAggregate extends AggregationsMultiBucketAggregateBase { +} + +export interface AggregationsTimeSeriesAggregation extends AggregationsBucketAggregationBase { + size?: integer + keyed?: boolean +} + +export interface AggregationsTimeSeriesBucketKeys extends AggregationsMultiBucketBase { + key: Record +} +export type AggregationsTimeSeriesBucket = AggregationsTimeSeriesBucketKeys +& { [property: string]: AggregationsAggregate | Record | long } + export interface AggregationsTopHitsAggregate extends AggregationsAggregateBase { hits: SearchHitsMetadata } @@ -4228,7 +4393,11 @@ export interface AggregationsWeightedAverageValue { export interface AggregationsWeightedAvgAggregate extends AggregationsSingleMetricAggregateBase { } -export type AnalysisAnalyzer = AnalysisCustomAnalyzer | AnalysisFingerprintAnalyzer | AnalysisKeywordAnalyzer | AnalysisLanguageAnalyzer | AnalysisNoriAnalyzer | AnalysisPatternAnalyzer | AnalysisSimpleAnalyzer | AnalysisStandardAnalyzer | AnalysisStopAnalyzer | AnalysisWhitespaceAnalyzer | AnalysisIcuAnalyzer | AnalysisKuromojiAnalyzer | AnalysisSnowballAnalyzer | AnalysisArabicAnalyzer | AnalysisArmenianAnalyzer | AnalysisBasqueAnalyzer | AnalysisBengaliAnalyzer | AnalysisBrazilianAnalyzer | AnalysisBulgarianAnalyzer | AnalysisCatalanAnalyzer | AnalysisChineseAnalyzer | AnalysisCjkAnalyzer | AnalysisCzechAnalyzer | AnalysisDanishAnalyzer | AnalysisDutchAnalyzer | AnalysisEnglishAnalyzer | AnalysisEstonianAnalyzer | AnalysisFinnishAnalyzer | AnalysisFrenchAnalyzer | AnalysisGalicianAnalyzer | AnalysisGermanAnalyzer | AnalysisGreekAnalyzer | AnalysisHindiAnalyzer | AnalysisHungarianAnalyzer | AnalysisIndonesianAnalyzer | AnalysisIrishAnalyzer | AnalysisItalianAnalyzer | AnalysisLatvianAnalyzer | AnalysisLithuanianAnalyzer | AnalysisNorwegianAnalyzer | AnalysisPersianAnalyzer | AnalysisPortugueseAnalyzer | AnalysisRomanianAnalyzer | AnalysisRussianAnalyzer | AnalysisSerbianAnalyzer | AnalysisSoraniAnalyzer | AnalysisSpanishAnalyzer | AnalysisSwedishAnalyzer | AnalysisTurkishAnalyzer | AnalysisThaiAnalyzer +export type AnalysisAnalyzer = AnalysisCustomAnalyzer | AnalysisFingerprintAnalyzer | AnalysisKeywordAnalyzer | AnalysisNoriAnalyzer | AnalysisPatternAnalyzer | AnalysisSimpleAnalyzer | AnalysisStandardAnalyzer | AnalysisStopAnalyzer | AnalysisWhitespaceAnalyzer | AnalysisIcuAnalyzer | AnalysisKuromojiAnalyzer | AnalysisSnowballAnalyzer | AnalysisArabicAnalyzer | AnalysisArmenianAnalyzer | AnalysisBasqueAnalyzer | AnalysisBengaliAnalyzer | AnalysisBrazilianAnalyzer | AnalysisBulgarianAnalyzer | AnalysisCatalanAnalyzer | AnalysisChineseAnalyzer | AnalysisCjkAnalyzer | AnalysisCzechAnalyzer | AnalysisDanishAnalyzer | AnalysisDutchAnalyzer | AnalysisEnglishAnalyzer | AnalysisEstonianAnalyzer | AnalysisFinnishAnalyzer | AnalysisFrenchAnalyzer | AnalysisGalicianAnalyzer | AnalysisGermanAnalyzer | AnalysisGreekAnalyzer | AnalysisHindiAnalyzer | AnalysisHungarianAnalyzer | AnalysisIndonesianAnalyzer | AnalysisIrishAnalyzer | AnalysisItalianAnalyzer | AnalysisLatvianAnalyzer | AnalysisLithuanianAnalyzer | AnalysisNorwegianAnalyzer | AnalysisPersianAnalyzer | AnalysisPortugueseAnalyzer | AnalysisRomanianAnalyzer | AnalysisRussianAnalyzer | AnalysisSerbianAnalyzer | AnalysisSoraniAnalyzer | AnalysisSpanishAnalyzer | AnalysisSwedishAnalyzer | AnalysisTurkishAnalyzer | AnalysisThaiAnalyzer + +export interface AnalysisApostropheTokenFilter extends AnalysisTokenFilterBase { + type: 'apostrophe' +} export interface AnalysisArabicAnalyzer { type: 'arabic' @@ -4237,6 +4406,10 @@ export interface AnalysisArabicAnalyzer { stem_exclusion?: string[] } +export interface AnalysisArabicNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'arabic_normalization' +} + export interface AnalysisArmenianAnalyzer { type: 'armenian' stopwords?: AnalysisStopWords @@ -4309,6 +4482,27 @@ export interface AnalysisCjkAnalyzer { stopwords_path?: string } +export type AnalysisCjkBigramIgnoredScript = 'han' | 'hangul' | 'hiragana' | 'katakana' + +export interface AnalysisCjkBigramTokenFilter extends AnalysisTokenFilterBase { + type: 'cjk_bigram' + ignored_scripts?: AnalysisCjkBigramIgnoredScript[] + output_unigrams?: boolean +} + +export interface AnalysisCjkWidthTokenFilter extends AnalysisTokenFilterBase { + type: 'cjk_width' +} + +export interface AnalysisClassicTokenFilter extends AnalysisTokenFilterBase { + type: 'classic' +} + +export interface AnalysisClassicTokenizer extends AnalysisTokenizerBase { + type: 'classic' + max_token_length?: integer +} + export interface AnalysisCommonGramsTokenFilter extends AnalysisTokenFilterBase { type: 'common_grams' common_words?: string[] @@ -4318,7 +4512,6 @@ export interface AnalysisCommonGramsTokenFilter extends AnalysisTokenFilterBase } export interface AnalysisCompoundWordTokenFilterBase extends AnalysisTokenFilterBase { - hyphenation_patterns_path?: string max_subword_size?: integer min_subword_size?: integer min_word_size?: integer @@ -4361,6 +4554,10 @@ export interface AnalysisDanishAnalyzer { stopwords_path?: string } +export interface AnalysisDecimalDigitTokenFilter extends AnalysisTokenFilterBase { + type: 'decimal_digit' +} + export type AnalysisDelimitedPayloadEncoding = 'int' | 'float' | 'identity' export interface AnalysisDelimitedPayloadTokenFilter extends AnalysisTokenFilterBase { @@ -4393,9 +4590,9 @@ export interface AnalysisEdgeNGramTokenFilter extends AnalysisTokenFilterBase { export interface AnalysisEdgeNGramTokenizer extends AnalysisTokenizerBase { type: 'edge_ngram' custom_token_chars?: string - max_gram: integer - min_gram: integer - token_chars: AnalysisTokenChar[] + max_gram?: integer + min_gram?: integer + token_chars?: AnalysisTokenChar[] } export interface AnalysisElisionTokenFilter extends AnalysisTokenFilterBase { @@ -4441,6 +4638,10 @@ export interface AnalysisFinnishAnalyzer { stem_exclusion?: string[] } +export interface AnalysisFlattenGraphTokenFilter extends AnalysisTokenFilterBase { + type: 'flatten_graph' +} + export interface AnalysisFrenchAnalyzer { type: 'french' stopwords?: AnalysisStopWords @@ -4462,6 +4663,10 @@ export interface AnalysisGermanAnalyzer { stem_exclusion?: string[] } +export interface AnalysisGermanNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'german_normalization' +} + export interface AnalysisGreekAnalyzer { type: 'greek' stopwords?: AnalysisStopWords @@ -4475,6 +4680,10 @@ export interface AnalysisHindiAnalyzer { stem_exclusion?: string[] } +export interface AnalysisHindiNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'hindi_normalization' +} + export interface AnalysisHtmlStripCharFilter extends AnalysisCharFilterBase { type: 'html_strip' escaped_tags?: string[] @@ -4492,11 +4701,16 @@ export interface AnalysisHunspellTokenFilter extends AnalysisTokenFilterBase { dedup?: boolean dictionary?: string locale: string + lang: string + language: string longest_only?: boolean } export interface AnalysisHyphenationDecompounderTokenFilter extends AnalysisCompoundWordTokenFilterBase { type: 'hyphenation_decompounder' + hyphenation_patterns_path: string + no_sub_matches?: boolean + no_overlapping_matches?: boolean } export interface AnalysisIcuAnalyzer { @@ -4562,6 +4776,10 @@ export interface AnalysisIcuTransformTokenFilter extends AnalysisTokenFilterBase id: string } +export interface AnalysisIndicNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'indic_normalization' +} + export interface AnalysisIndonesianAnalyzer { type: 'indonesian' stopwords?: AnalysisStopWords @@ -4583,6 +4801,11 @@ export interface AnalysisItalianAnalyzer { stem_exclusion?: string[] } +export interface AnalysisJaStopTokenFilter extends AnalysisTokenFilterBase { + type: 'ja_stop' + stopwords?: AnalysisStopWords +} + export interface AnalysisKStemTokenFilter extends AnalysisTokenFilterBase { type: 'kstem' } @@ -4592,7 +4815,7 @@ export type AnalysisKeepTypesMode = 'include' | 'exclude' export interface AnalysisKeepTypesTokenFilter extends AnalysisTokenFilterBase { type: 'keep_types' mode?: AnalysisKeepTypesMode - types?: string[] + types: string[] } export interface AnalysisKeepWordsTokenFilter extends AnalysisTokenFilterBase { @@ -4610,14 +4833,18 @@ export interface AnalysisKeywordAnalyzer { export interface AnalysisKeywordMarkerTokenFilter extends AnalysisTokenFilterBase { type: 'keyword_marker' ignore_case?: boolean - keywords?: string[] + keywords?: string | string[] keywords_path?: string keywords_pattern?: string } +export interface AnalysisKeywordRepeatTokenFilter extends AnalysisTokenFilterBase { + type: 'keyword_repeat' +} + export interface AnalysisKeywordTokenizer extends AnalysisTokenizerBase { type: 'keyword' - buffer_size: integer + buffer_size?: integer } export interface AnalysisKuromojiAnalyzer { @@ -4660,17 +4887,6 @@ export interface AnalysisKuromojiTokenizer extends AnalysisTokenizerBase { discard_compound_token?: boolean } -export type AnalysisLanguage = 'Arabic' | 'Armenian' | 'Basque' | 'Brazilian' | 'Bulgarian' | 'Catalan' | 'Chinese' | 'Cjk' | 'Czech' | 'Danish' | 'Dutch' | 'English' | 'Estonian' | 'Finnish' | 'French' | 'Galician' | 'German' | 'Greek' | 'Hindi' | 'Hungarian' | 'Indonesian' | 'Irish' | 'Italian' | 'Latvian' | 'Norwegian' | 'Persian' | 'Portuguese' | 'Romanian' | 'Russian' | 'Sorani' | 'Spanish' | 'Swedish' | 'Turkish' | 'Thai' - -export interface AnalysisLanguageAnalyzer { - type: 'language' - version?: VersionString - language: AnalysisLanguage - stem_exclusion: string[] - stopwords?: AnalysisStopWords - stopwords_path?: string -} - export interface AnalysisLatvianAnalyzer { type: 'latvian' stopwords?: AnalysisStopWords @@ -4707,9 +4923,11 @@ export interface AnalysisLowercaseNormalizer { export interface AnalysisLowercaseTokenFilter extends AnalysisTokenFilterBase { type: 'lowercase' - language?: string + language?: AnalysisLowercaseTokenFilterLanguages } +export type AnalysisLowercaseTokenFilterLanguages = 'greek' | 'irish' | 'turkish' + export interface AnalysisLowercaseTokenizer extends AnalysisTokenizerBase { type: 'lowercase' } @@ -4720,6 +4938,14 @@ export interface AnalysisMappingCharFilter extends AnalysisCharFilterBase { mappings_path?: string } +export interface AnalysisMinHashTokenFilter extends AnalysisTokenFilterBase { + type: 'min_hash' + bucket_count?: integer + hash_count?: integer + hash_set_size?: integer + with_rotation?: boolean +} + export interface AnalysisMultiplexerTokenFilter extends AnalysisTokenFilterBase { type: 'multiplexer' filters: string[] @@ -4736,9 +4962,9 @@ export interface AnalysisNGramTokenFilter extends AnalysisTokenFilterBase { export interface AnalysisNGramTokenizer extends AnalysisTokenizerBase { type: 'ngram' custom_token_chars?: string - max_gram: integer - min_gram: integer - token_chars: AnalysisTokenChar[] + max_gram?: integer + min_gram?: integer + token_chars?: AnalysisTokenChar[] } export interface AnalysisNoriAnalyzer { @@ -4807,7 +5033,6 @@ export interface AnalysisPatternReplaceCharFilter extends AnalysisCharFilterBase export interface AnalysisPatternReplaceTokenFilter extends AnalysisTokenFilterBase { type: 'pattern_replace' all?: boolean - flags?: string pattern: string replacement?: string } @@ -4825,6 +5050,10 @@ export interface AnalysisPersianAnalyzer { stopwords_path?: string } +export interface AnalysisPersianNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'persian_normalization' +} + export type AnalysisPhoneticEncoder = 'metaphone' | 'double_metaphone' | 'soundex' | 'refined_soundex' | 'caverphone1' | 'caverphone2' | 'cologne' | 'nysiis' | 'koelnerphonetik' | 'haasephonetik' | 'beider_morse' | 'daitch_mokotoff' export type AnalysisPhoneticLanguage = 'any' | 'common' | 'cyrillic' | 'english' | 'french' | 'german' | 'hebrew' | 'hungarian' | 'polish' | 'romanian' | 'russian' | 'spanish' @@ -4881,6 +5110,14 @@ export interface AnalysisRussianAnalyzer { stem_exclusion?: string[] } +export interface AnalysisScandinavianFoldingTokenFilter extends AnalysisTokenFilterBase { + type: 'scandinavian_folding' +} + +export interface AnalysisScandinavianNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'scandinavian_normalization' +} + export interface AnalysisSerbianAnalyzer { type: 'serbian' stopwords?: AnalysisStopWords @@ -4888,11 +5125,15 @@ export interface AnalysisSerbianAnalyzer { stem_exclusion?: string[] } +export interface AnalysisSerbianNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'serbian_normalization' +} + export interface AnalysisShingleTokenFilter extends AnalysisTokenFilterBase { type: 'shingle' filler_token?: string - max_shingle_size?: integer | string - min_shingle_size?: integer | string + max_shingle_size?: SpecUtilsStringified + min_shingle_size?: SpecUtilsStringified output_unigrams?: boolean output_unigrams_if_no_shingles?: boolean token_separator?: string @@ -4903,6 +5144,16 @@ export interface AnalysisSimpleAnalyzer { version?: VersionString } +export interface AnalysisSimplePatternSplitTokenizer extends AnalysisTokenizerBase { + type: 'simple_pattern_split' + pattern?: string +} + +export interface AnalysisSimplePatternTokenizer extends AnalysisTokenizerBase { + type: 'simple_pattern' + pattern?: string +} + export interface AnalysisSnowballAnalyzer { type: 'snowball' version?: VersionString @@ -4910,7 +5161,7 @@ export interface AnalysisSnowballAnalyzer { stopwords?: AnalysisStopWords } -export type AnalysisSnowballLanguage = 'Armenian' | 'Basque' | 'Catalan' | 'Danish' | 'Dutch' | 'English' | 'Finnish' | 'French' | 'German' | 'German2' | 'Hungarian' | 'Italian' | 'Kp' | 'Lovins' | 'Norwegian' | 'Porter' | 'Portuguese' | 'Romanian' | 'Russian' | 'Spanish' | 'Swedish' | 'Turkish' +export type AnalysisSnowballLanguage = 'Arabic' | 'Armenian' | 'Basque' | 'Catalan' | 'Danish' | 'Dutch' | 'English' | 'Estonian' | 'Finnish' | 'French' | 'German' | 'German2' | 'Hungarian' | 'Italian' | 'Irish' | 'Kp' | 'Lithuanian' | 'Lovins' | 'Norwegian' | 'Porter' | 'Portuguese' | 'Romanian' | 'Russian' | 'Serbian' | 'Spanish' | 'Swedish' | 'Turkish' export interface AnalysisSnowballTokenFilter extends AnalysisTokenFilterBase { type: 'snowball' @@ -4924,6 +5175,10 @@ export interface AnalysisSoraniAnalyzer { stem_exclusion?: string[] } +export interface AnalysisSoraniNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'sorani_normalization' +} + export interface AnalysisSpanishAnalyzer { type: 'spanish' stopwords?: AnalysisStopWords @@ -4969,7 +5224,9 @@ export interface AnalysisStopTokenFilter extends AnalysisTokenFilterBase { stopwords_path?: string } -export type AnalysisStopWords = string | string[] +export type AnalysisStopWordLanguage = '_arabic_' | '_armenian_' | '_basque_' | '_bengali_' | '_brazilian_' | '_bulgarian_' | '_catalan_' | '_cjk_' | '_czech_' | '_danish_' | '_dutch_' | '_english_' | '_estonian_' | '_finnish_' | '_french_' | '_galician_' | '_german_' | '_greek_' | '_hindi_' | '_hungarian_' | '_indonesian_' | '_irish_' | '_italian_' | '_latvian_' | '_lithuanian_' | '_norwegian_' | '_persian_' | '_portuguese_' | '_romanian_' | '_russian_' | '_serbian_' | '_sorani_' | '_spanish_' | '_swedish_' | '_thai_' | '_turkish_' | '_none_' + +export type AnalysisStopWords = AnalysisStopWordLanguage | string[] export interface AnalysisSwedishAnalyzer { type: 'swedish' @@ -4980,20 +5237,15 @@ export interface AnalysisSwedishAnalyzer { export type AnalysisSynonymFormat = 'solr' | 'wordnet' -export interface AnalysisSynonymGraphTokenFilter extends AnalysisTokenFilterBase { +export interface AnalysisSynonymGraphTokenFilter extends AnalysisSynonymTokenFilterBase { type: 'synonym_graph' - expand?: boolean - format?: AnalysisSynonymFormat - lenient?: boolean - synonyms?: string[] - synonyms_path?: string - synonyms_set?: string - tokenizer?: string - updateable?: boolean } -export interface AnalysisSynonymTokenFilter extends AnalysisTokenFilterBase { +export interface AnalysisSynonymTokenFilter extends AnalysisSynonymTokenFilterBase { type: 'synonym' +} + +export interface AnalysisSynonymTokenFilterBase extends AnalysisTokenFilterBase { expand?: boolean format?: AnalysisSynonymFormat lenient?: boolean @@ -5010,6 +5262,10 @@ export interface AnalysisThaiAnalyzer { stopwords_path?: string } +export interface AnalysisThaiTokenizer extends AnalysisTokenizerBase { + type: 'thai' +} + export type AnalysisTokenChar = 'letter' | 'digit' | 'whitespace' | 'punctuation' | 'symbol' | 'custom' export type AnalysisTokenFilter = string | AnalysisTokenFilterDefinition @@ -5018,7 +5274,7 @@ export interface AnalysisTokenFilterBase { version?: VersionString } -export type AnalysisTokenFilterDefinition = AnalysisAsciiFoldingTokenFilter | AnalysisCommonGramsTokenFilter | AnalysisConditionTokenFilter | AnalysisDelimitedPayloadTokenFilter | AnalysisEdgeNGramTokenFilter | AnalysisElisionTokenFilter | AnalysisFingerprintTokenFilter | AnalysisHunspellTokenFilter | AnalysisHyphenationDecompounderTokenFilter | AnalysisKeepTypesTokenFilter | AnalysisKeepWordsTokenFilter | AnalysisKeywordMarkerTokenFilter | AnalysisKStemTokenFilter | AnalysisLengthTokenFilter | AnalysisLimitTokenCountTokenFilter | AnalysisLowercaseTokenFilter | AnalysisMultiplexerTokenFilter | AnalysisNGramTokenFilter | AnalysisNoriPartOfSpeechTokenFilter | AnalysisPatternCaptureTokenFilter | AnalysisPatternReplaceTokenFilter | AnalysisPorterStemTokenFilter | AnalysisPredicateTokenFilter | AnalysisRemoveDuplicatesTokenFilter | AnalysisReverseTokenFilter | AnalysisShingleTokenFilter | AnalysisSnowballTokenFilter | AnalysisStemmerOverrideTokenFilter | AnalysisStemmerTokenFilter | AnalysisStopTokenFilter | AnalysisSynonymGraphTokenFilter | AnalysisSynonymTokenFilter | AnalysisTrimTokenFilter | AnalysisTruncateTokenFilter | AnalysisUniqueTokenFilter | AnalysisUppercaseTokenFilter | AnalysisWordDelimiterGraphTokenFilter | AnalysisWordDelimiterTokenFilter | AnalysisKuromojiStemmerTokenFilter | AnalysisKuromojiReadingFormTokenFilter | AnalysisKuromojiPartOfSpeechTokenFilter | AnalysisIcuCollationTokenFilter | AnalysisIcuFoldingTokenFilter | AnalysisIcuNormalizationTokenFilter | AnalysisIcuTransformTokenFilter | AnalysisPhoneticTokenFilter | AnalysisDictionaryDecompounderTokenFilter +export type AnalysisTokenFilterDefinition = AnalysisApostropheTokenFilter | AnalysisArabicNormalizationTokenFilter | AnalysisAsciiFoldingTokenFilter | AnalysisCjkBigramTokenFilter | AnalysisCjkWidthTokenFilter | AnalysisClassicTokenFilter | AnalysisCommonGramsTokenFilter | AnalysisConditionTokenFilter | AnalysisDecimalDigitTokenFilter | AnalysisDelimitedPayloadTokenFilter | AnalysisEdgeNGramTokenFilter | AnalysisElisionTokenFilter | AnalysisFingerprintTokenFilter | AnalysisFlattenGraphTokenFilter | AnalysisGermanNormalizationTokenFilter | AnalysisHindiNormalizationTokenFilter | AnalysisHunspellTokenFilter | AnalysisHyphenationDecompounderTokenFilter | AnalysisIndicNormalizationTokenFilter | AnalysisKeepTypesTokenFilter | AnalysisKeepWordsTokenFilter | AnalysisKeywordMarkerTokenFilter | AnalysisKeywordRepeatTokenFilter | AnalysisKStemTokenFilter | AnalysisLengthTokenFilter | AnalysisLimitTokenCountTokenFilter | AnalysisLowercaseTokenFilter | AnalysisMinHashTokenFilter | AnalysisMultiplexerTokenFilter | AnalysisNGramTokenFilter | AnalysisNoriPartOfSpeechTokenFilter | AnalysisPatternCaptureTokenFilter | AnalysisPatternReplaceTokenFilter | AnalysisPersianNormalizationTokenFilter | AnalysisPorterStemTokenFilter | AnalysisPredicateTokenFilter | AnalysisRemoveDuplicatesTokenFilter | AnalysisReverseTokenFilter | AnalysisScandinavianFoldingTokenFilter | AnalysisScandinavianNormalizationTokenFilter | AnalysisSerbianNormalizationTokenFilter | AnalysisShingleTokenFilter | AnalysisSnowballTokenFilter | AnalysisSoraniNormalizationTokenFilter | AnalysisStemmerOverrideTokenFilter | AnalysisStemmerTokenFilter | AnalysisStopTokenFilter | AnalysisSynonymGraphTokenFilter | AnalysisSynonymTokenFilter | AnalysisTrimTokenFilter | AnalysisTruncateTokenFilter | AnalysisUniqueTokenFilter | AnalysisUppercaseTokenFilter | AnalysisWordDelimiterGraphTokenFilter | AnalysisWordDelimiterTokenFilter | AnalysisJaStopTokenFilter | AnalysisKuromojiStemmerTokenFilter | AnalysisKuromojiReadingFormTokenFilter | AnalysisKuromojiPartOfSpeechTokenFilter | AnalysisIcuCollationTokenFilter | AnalysisIcuFoldingTokenFilter | AnalysisIcuNormalizationTokenFilter | AnalysisIcuTransformTokenFilter | AnalysisPhoneticTokenFilter | AnalysisDictionaryDecompounderTokenFilter export type AnalysisTokenizer = string | AnalysisTokenizerDefinition @@ -5026,7 +5282,7 @@ export interface AnalysisTokenizerBase { version?: VersionString } -export type AnalysisTokenizerDefinition = AnalysisCharGroupTokenizer | AnalysisEdgeNGramTokenizer | AnalysisKeywordTokenizer | AnalysisLetterTokenizer | AnalysisLowercaseTokenizer | AnalysisNGramTokenizer | AnalysisNoriTokenizer | AnalysisPathHierarchyTokenizer | AnalysisStandardTokenizer | AnalysisUaxEmailUrlTokenizer | AnalysisWhitespaceTokenizer | AnalysisKuromojiTokenizer | AnalysisPatternTokenizer | AnalysisIcuTokenizer +export type AnalysisTokenizerDefinition = AnalysisCharGroupTokenizer | AnalysisClassicTokenizer | AnalysisEdgeNGramTokenizer | AnalysisKeywordTokenizer | AnalysisLetterTokenizer | AnalysisLowercaseTokenizer | AnalysisNGramTokenizer | AnalysisPathHierarchyTokenizer | AnalysisPatternTokenizer | AnalysisSimplePatternTokenizer | AnalysisSimplePatternSplitTokenizer | AnalysisStandardTokenizer | AnalysisThaiTokenizer | AnalysisUaxEmailUrlTokenizer | AnalysisWhitespaceTokenizer | AnalysisIcuTokenizer | AnalysisKuromojiTokenizer | AnalysisNoriTokenizer export interface AnalysisTrimTokenFilter extends AnalysisTokenFilterBase { type: 'trim' @@ -5068,27 +5324,17 @@ export interface AnalysisWhitespaceTokenizer extends AnalysisTokenizerBase { max_token_length?: integer } -export interface AnalysisWordDelimiterGraphTokenFilter extends AnalysisTokenFilterBase { +export interface AnalysisWordDelimiterGraphTokenFilter extends AnalysisWordDelimiterTokenFilterBase { type: 'word_delimiter_graph' adjust_offsets?: boolean - catenate_all?: boolean - catenate_numbers?: boolean - catenate_words?: boolean - generate_number_parts?: boolean - generate_word_parts?: boolean ignore_keywords?: boolean - preserve_original?: SpecUtilsStringified - protected_words?: string[] - protected_words_path?: string - split_on_case_change?: boolean - split_on_numerics?: boolean - stem_english_possessive?: boolean - type_table?: string[] - type_table_path?: string } -export interface AnalysisWordDelimiterTokenFilter extends AnalysisTokenFilterBase { +export interface AnalysisWordDelimiterTokenFilter extends AnalysisWordDelimiterTokenFilterBase { type: 'word_delimiter' +} + +export interface AnalysisWordDelimiterTokenFilterBase extends AnalysisTokenFilterBase { catenate_all?: boolean catenate_numbers?: boolean catenate_words?: boolean @@ -5133,6 +5379,10 @@ export interface MappingBooleanProperty extends MappingDocValuesPropertyBase { fielddata?: IndicesNumericFielddata index?: boolean null_value?: boolean + ignore_malformed?: boolean + script?: Script | string + on_script_error?: MappingOnScriptError + time_series_dimension?: boolean type: 'boolean' } @@ -5151,6 +5401,10 @@ export interface MappingCompletionProperty extends MappingDocValuesPropertyBase type: 'completion' } +export interface MappingCompositeSubField { + type: MappingRuntimeFieldType +} + export interface MappingConstantKeywordProperty extends MappingPropertyBase { value?: any type: 'constant_keyword' @@ -5158,10 +5412,14 @@ export interface MappingConstantKeywordProperty extends MappingPropertyBase { export interface MappingCorePropertyBase extends MappingPropertyBase { copy_to?: Fields - similarity?: string store?: boolean } +export interface MappingCountedKeywordProperty extends MappingPropertyBase { + type: 'counted_keyword' + index?: boolean +} + export interface MappingDataStreamTimestamp { enabled: boolean } @@ -5171,6 +5429,8 @@ export interface MappingDateNanosProperty extends MappingDocValuesPropertyBase { format?: string ignore_malformed?: boolean index?: boolean + script?: Script | string + on_script_error?: MappingOnScriptError null_value?: DateTime precision_step?: integer type: 'date_nanos' @@ -5182,6 +5442,8 @@ export interface MappingDateProperty extends MappingDocValuesPropertyBase { format?: string ignore_malformed?: boolean index?: boolean + script?: Script | string + on_script_error?: MappingOnScriptError null_value?: DateTime precision_step?: integer locale?: string @@ -5193,22 +5455,28 @@ export interface MappingDateRangeProperty extends MappingRangePropertyBase { type: 'date_range' } +export type MappingDenseVectorElementType = 'bit' | 'byte' | 'float' + export interface MappingDenseVectorIndexOptions { - type: string - m?: integer - ef_construction?: integer confidence_interval?: float + ef_construction?: integer + m?: integer + type: MappingDenseVectorIndexOptionsType } +export type MappingDenseVectorIndexOptionsType = 'bbq_flat' | 'bbq_hnsw' | 'flat' | 'hnsw' | 'int4_flat' | 'int4_hnsw' | 'int8_flat' | 'int8_hnsw' + export interface MappingDenseVectorProperty extends MappingPropertyBase { type: 'dense_vector' - element_type?: string dims?: integer - similarity?: string + element_type?: MappingDenseVectorElementType index?: boolean index_options?: MappingDenseVectorIndexOptions + similarity?: MappingDenseVectorSimilarity } +export type MappingDenseVectorSimilarity = 'cosine' | 'dot_product' | 'l2_norm' | 'max_inner_product' + export interface MappingDocValuesPropertyBase extends MappingCorePropertyBase { doc_values?: boolean } @@ -5239,7 +5507,7 @@ export interface MappingDynamicProperty extends MappingDocValuesPropertyBase { index?: boolean index_options?: MappingIndexOptions index_phrases?: boolean - index_prefixes?: MappingTextIndexPrefixes + index_prefixes?: MappingTextIndexPrefixes | null norms?: boolean position_increment_gap?: integer search_analyzer?: string @@ -5252,7 +5520,7 @@ export interface MappingDynamicProperty extends MappingDocValuesPropertyBase { export interface MappingDynamicTemplate { mapping?: MappingProperty - runtime?: MappingProperty + runtime?: MappingRuntimeField match?: string | string[] path_match?: string | string[] unmatch?: string | string[] @@ -5276,7 +5544,7 @@ export interface MappingFieldNamesField { enabled: boolean } -export type MappingFieldType = 'none' | 'geo_point' | 'geo_shape' | 'ip' | 'binary' | 'keyword' | 'text' | 'search_as_you_type' | 'date' | 'date_nanos' | 'boolean' | 'completion' | 'nested' | 'object' | 'version' | 'murmur3' | 'token_count' | 'percolator' | 'integer' | 'long' | 'short' | 'byte' | 'float' | 'half_float' | 'scaled_float' | 'double' | 'integer_range' | 'float_range' | 'long_range' | 'double_range' | 'date_range' | 'ip_range' | 'alias' | 'join' | 'rank_feature' | 'rank_features' | 'flattened' | 'shape' | 'histogram' | 'constant_keyword' | 'aggregate_metric_double' | 'dense_vector' | 'semantic_text' | 'sparse_vector' | 'match_only_text' | 'icu_collation_keyword' +export type MappingFieldType = 'none' | 'geo_point' | 'geo_shape' | 'ip' | 'binary' | 'keyword' | 'text' | 'search_as_you_type' | 'date' | 'date_nanos' | 'boolean' | 'completion' | 'nested' | 'object' | 'passthrough' | 'version' | 'murmur3' | 'token_count' | 'percolator' | 'integer' | 'long' | 'short' | 'byte' | 'float' | 'half_float' | 'scaled_float' | 'double' | 'integer_range' | 'float_range' | 'long_range' | 'double_range' | 'date_range' | 'ip_range' | 'alias' | 'join' | 'rank_feature' | 'rank_features' | 'flattened' | 'shape' | 'histogram' | 'constant_keyword' | 'counted_keyword' | 'aggregate_metric_double' | 'dense_vector' | 'semantic_text' | 'sparse_vector' | 'match_only_text' | 'icu_collation_keyword' export interface MappingFlattenedProperty extends MappingPropertyBase { boost?: double @@ -5316,6 +5584,7 @@ export interface MappingGeoShapeProperty extends MappingDocValuesPropertyBase { coerce?: boolean ignore_malformed?: boolean ignore_z_value?: boolean + index?: boolean orientation?: MappingGeoOrientation strategy?: MappingGeoStrategy type: 'geo_shape' @@ -5399,6 +5668,7 @@ export interface MappingKeywordProperty extends MappingDocValuesPropertyBase { normalizer?: string norms?: boolean null_value?: string + similarity?: string | null split_queries_on_whitespace?: boolean time_series_dimension?: boolean type: 'keyword' @@ -5446,12 +5716,19 @@ export interface MappingNumberPropertyBase extends MappingDocValuesPropertyBase export interface MappingObjectProperty extends MappingCorePropertyBase { enabled?: boolean - subobjects?: boolean + subobjects?: MappingSubobjects type?: 'object' } export type MappingOnScriptError = 'fail' | 'continue' +export interface MappingPassthroughObjectProperty extends MappingCorePropertyBase { + type?: 'passthrough' + enabled?: boolean + priority?: integer + time_series_dimension?: boolean +} + export interface MappingPercolatorProperty extends MappingPropertyBase { type: 'percolator' } @@ -5463,7 +5740,7 @@ export interface MappingPointProperty extends MappingDocValuesPropertyBase { type: 'point' } -export type MappingProperty = MappingBinaryProperty | MappingBooleanProperty | MappingDynamicProperty | MappingJoinProperty | MappingKeywordProperty | MappingMatchOnlyTextProperty | MappingPercolatorProperty | MappingRankFeatureProperty | MappingRankFeaturesProperty | MappingSearchAsYouTypeProperty | MappingTextProperty | MappingVersionProperty | MappingWildcardProperty | MappingDateNanosProperty | MappingDateProperty | MappingAggregateMetricDoubleProperty | MappingDenseVectorProperty | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingSemanticTextProperty | MappingSparseVectorProperty | MappingCompletionProperty | MappingConstantKeywordProperty | MappingFieldAliasProperty | MappingHistogramProperty | MappingIpProperty | MappingMurmur3HashProperty | MappingTokenCountProperty | MappingGeoPointProperty | MappingGeoShapeProperty | MappingPointProperty | MappingShapeProperty | MappingByteNumberProperty | MappingDoubleNumberProperty | MappingFloatNumberProperty | MappingHalfFloatNumberProperty | MappingIntegerNumberProperty | MappingLongNumberProperty | MappingScaledFloatNumberProperty | MappingShortNumberProperty | MappingUnsignedLongNumberProperty | MappingDateRangeProperty | MappingDoubleRangeProperty | MappingFloatRangeProperty | MappingIntegerRangeProperty | MappingIpRangeProperty | MappingLongRangeProperty | MappingIcuCollationProperty +export type MappingProperty = MappingBinaryProperty | MappingBooleanProperty | MappingDynamicProperty | MappingJoinProperty | MappingKeywordProperty | MappingMatchOnlyTextProperty | MappingPercolatorProperty | MappingRankFeatureProperty | MappingRankFeaturesProperty | MappingSearchAsYouTypeProperty | MappingTextProperty | MappingVersionProperty | MappingWildcardProperty | MappingDateNanosProperty | MappingDateProperty | MappingAggregateMetricDoubleProperty | MappingDenseVectorProperty | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingPassthroughObjectProperty | MappingSemanticTextProperty | MappingSparseVectorProperty | MappingCompletionProperty | MappingConstantKeywordProperty | MappingCountedKeywordProperty | MappingFieldAliasProperty | MappingHistogramProperty | MappingIpProperty | MappingMurmur3HashProperty | MappingTokenCountProperty | MappingGeoPointProperty | MappingGeoShapeProperty | MappingPointProperty | MappingShapeProperty | MappingByteNumberProperty | MappingDoubleNumberProperty | MappingFloatNumberProperty | MappingHalfFloatNumberProperty | MappingIntegerNumberProperty | MappingLongNumberProperty | MappingScaledFloatNumberProperty | MappingShortNumberProperty | MappingUnsignedLongNumberProperty | MappingDateRangeProperty | MappingDoubleRangeProperty | MappingFloatRangeProperty | MappingIntegerRangeProperty | MappingIpRangeProperty | MappingLongRangeProperty | MappingIcuCollationProperty export interface MappingPropertyBase { meta?: Record @@ -5471,6 +5748,7 @@ export interface MappingPropertyBase { ignore_above?: integer dynamic?: MappingDynamicMapping fields?: Record + synthetic_source_keep?: MappingSyntheticSourceKeepEnum } export interface MappingRangePropertyBase extends MappingDocValuesPropertyBase { @@ -5494,6 +5772,7 @@ export interface MappingRoutingField { } export interface MappingRuntimeField { + fields?: Record fetch_fields?: (MappingRuntimeFieldFetchFields | Field)[] format?: string input_field?: Field @@ -5508,7 +5787,7 @@ export interface MappingRuntimeFieldFetchFields { format?: string } -export type MappingRuntimeFieldType = 'boolean' | 'composite' | 'date' | 'double' | 'geo_point' | 'ip' | 'keyword' | 'long' | 'lookup' +export type MappingRuntimeFieldType = 'boolean' | 'composite' | 'date' | 'double' | 'geo_point' | 'geo_shape' | 'ip' | 'keyword' | 'long' | 'lookup' export type MappingRuntimeFields = Record @@ -5526,6 +5805,7 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase norms?: boolean search_analyzer?: string search_quote_analyzer?: string + similarity?: string | null term_vector?: MappingTermVectorOption type: 'search_as_you_type' } @@ -5533,7 +5813,8 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase export interface MappingSemanticTextProperty { type: 'semantic_text' meta?: Record - inference_id: Id + inference_id?: Id + search_inference_id?: Id } export interface MappingShapeProperty extends MappingDocValuesPropertyBase { @@ -5568,6 +5849,8 @@ export interface MappingSparseVectorProperty extends MappingPropertyBase { type: 'sparse_vector' } +export type MappingSubobjects = boolean | 'true' | 'false' | 'auto' + export interface MappingSuggestContext { name: Name path?: Field @@ -5575,6 +5858,8 @@ export interface MappingSuggestContext { precision?: integer | string } +export type MappingSyntheticSourceKeepEnum = 'none' | 'arrays' | 'all' + export type MappingTermVectorOption = 'no' | 'yes' | 'with_offsets' | 'with_positions' | 'with_positions_offsets' | 'with_positions_offsets_payloads' | 'with_positions_payloads' export interface MappingTextIndexPrefixes { @@ -5591,11 +5876,12 @@ export interface MappingTextProperty extends MappingCorePropertyBase { index?: boolean index_options?: MappingIndexOptions index_phrases?: boolean - index_prefixes?: MappingTextIndexPrefixes + index_prefixes?: MappingTextIndexPrefixes | null norms?: boolean position_increment_gap?: integer search_analyzer?: string search_quote_analyzer?: string + similarity?: string | null term_vector?: MappingTermVectorOption type: 'text' } @@ -5616,7 +5902,7 @@ export interface MappingTypeMapping { date_detection?: boolean dynamic?: MappingDynamicMapping dynamic_date_formats?: string[] - dynamic_templates?: Record[] + dynamic_templates?: Partial>[] _field_names?: MappingFieldNamesField index_field?: MappingIndexField _meta?: Metadata @@ -5627,7 +5913,7 @@ export interface MappingTypeMapping { _source?: MappingSourceField runtime?: Record enabled?: boolean - subobjects?: boolean + subobjects?: MappingSubobjects _data_stream_timestamp?: MappingDataStreamTimestamp } @@ -5812,6 +6098,12 @@ export type QueryDslGeoDistanceQuery = QueryDslGeoDistanceQueryKeys export type QueryDslGeoExecution = 'memory' | 'indexed' +export interface QueryDslGeoGridQuery extends QueryDslQueryBase { + geogrid?: GeoTile + geohash?: GeoHash + geohex?: GeoHexCell +} + export interface QueryDslGeoPolygonPoints { points: GeoLocation[] } @@ -6107,6 +6399,7 @@ export interface QueryDslQueryContainer { fuzzy?: Partial> geo_bounding_box?: QueryDslGeoBoundingBoxQuery geo_distance?: QueryDslGeoDistanceQuery + geo_grid?: Partial> geo_polygon?: QueryDslGeoPolygonQuery geo_shape?: QueryDslGeoShapeQuery has_child?: QueryDslHasChildQuery @@ -6389,6 +6682,7 @@ export type QueryDslTermsQuery = QueryDslTermsQueryKeys export type QueryDslTermsQueryField = FieldValue[] | QueryDslTermsLookup export interface QueryDslTermsSetQuery extends QueryDslQueryBase { + minimum_should_match?: MinimumShouldMatch minimum_should_match_field?: Field minimum_should_match_script?: Script | string terms: string[] @@ -6493,6 +6787,7 @@ export type AsyncSearchGetResponse[] + indices_boost?: Partial>[] docvalue_fields?: (QueryDslFieldAndFormat | Field)[] knn?: KnnSearch | KnnSearch[] min_score?: double @@ -6582,6 +6875,8 @@ export interface AutoscalingAutoscalingPolicy { export interface AutoscalingDeleteAutoscalingPolicyRequest extends RequestBase { name: Name + master_timeout?: Duration + timeout?: Duration } export type AutoscalingDeleteAutoscalingPolicyResponse = AcknowledgedResponseBase @@ -6614,6 +6909,7 @@ export interface AutoscalingGetAutoscalingCapacityAutoscalingResources { } export interface AutoscalingGetAutoscalingCapacityRequest extends RequestBase { + master_timeout?: Duration } export interface AutoscalingGetAutoscalingCapacityResponse { @@ -6622,13 +6918,16 @@ export interface AutoscalingGetAutoscalingCapacityResponse { export interface AutoscalingGetAutoscalingPolicyRequest extends RequestBase { name: Name + master_timeout?: Duration } export type AutoscalingGetAutoscalingPolicyResponse = AutoscalingAutoscalingPolicy export interface AutoscalingPutAutoscalingPolicyRequest extends RequestBase { name: Name - policy?: AutoscalingAutoscalingPolicy + master_timeout?: Duration + timeout?: Duration + policy?: AutoscalingAutoscalingPolicy } export type AutoscalingPutAutoscalingPolicyResponse = AcknowledgedResponseBase @@ -6678,57 +6977,65 @@ export interface CatAliasesAliasesRecord { export interface CatAliasesRequest extends CatCatRequestBase { name?: Names + h?: Names + s?: Names expand_wildcards?: ExpandWildcards + local?: boolean + master_timeout?: Duration } export type CatAliasesResponse = CatAliasesAliasesRecord[] export interface CatAllocationAllocationRecord { - shards: string - s: string - 'shards.undesired': string | null - 'write_load.forecast': double | null - wlf: double | null - writeLoadForecast: double | null - 'disk.indices.forecast': ByteSize | null - dif: ByteSize | null - diskIndicesForecast: ByteSize | null - 'disk.indices': ByteSize | null - di: ByteSize | null - diskIndices: ByteSize | null - 'disk.used': ByteSize | null - du: ByteSize | null - diskUsed: ByteSize | null - 'disk.avail': ByteSize | null - da: ByteSize | null - diskAvail: ByteSize | null - 'disk.total': ByteSize | null - dt: ByteSize | null - diskTotal: ByteSize | null - 'disk.percent': Percentage | null - dp: Percentage | null - diskPercent: Percentage | null - host: Host | null - h: Host | null - ip: Ip | null - node: string - n: string - 'node.role': string | null - r: string | null - role: string | null - nodeRole: string | null + shards?: string + s?: string + 'shards.undesired'?: string | null + 'write_load.forecast'?: SpecUtilsStringified | null + wlf?: SpecUtilsStringified | null + writeLoadForecast?: SpecUtilsStringified | null + 'disk.indices.forecast'?: ByteSize | null + dif?: ByteSize | null + diskIndicesForecast?: ByteSize | null + 'disk.indices'?: ByteSize | null + di?: ByteSize | null + diskIndices?: ByteSize | null + 'disk.used'?: ByteSize | null + du?: ByteSize | null + diskUsed?: ByteSize | null + 'disk.avail'?: ByteSize | null + da?: ByteSize | null + diskAvail?: ByteSize | null + 'disk.total'?: ByteSize | null + dt?: ByteSize | null + diskTotal?: ByteSize | null + 'disk.percent'?: Percentage | null + dp?: Percentage | null + diskPercent?: Percentage | null + host?: Host | null + h?: Host | null + ip?: Ip | null + node?: string + n?: string + 'node.role'?: string | null + r?: string | null + role?: string | null + nodeRole?: string | null } export interface CatAllocationRequest extends CatCatRequestBase { node_id?: NodeIds bytes?: Bytes + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatAllocationResponse = CatAllocationAllocationRecord[] export interface CatComponentTemplatesComponentTemplate { name: string - version: string + version: string | null alias_count: string mapping_count: string settings_count: string @@ -6738,6 +7045,10 @@ export interface CatComponentTemplatesComponentTemplate { export interface CatComponentTemplatesRequest extends CatCatRequestBase { name?: string + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatComponentTemplatesResponse = CatComponentTemplatesComponentTemplate[] @@ -6758,6 +7069,8 @@ export interface CatCountCountRecord { export interface CatCountRequest extends CatCatRequestBase { index?: Indices + h?: Names + s?: Names } export type CatCountResponse = CatCountCountRecord[] @@ -6777,6 +7090,8 @@ export interface CatFielddataFielddataRecord { export interface CatFielddataRequest extends CatCatRequestBase { fields?: Fields bytes?: Bytes + h?: Names + s?: Names } export type CatFielddataResponse = CatFielddataFielddataRecord[] @@ -6815,6 +7130,10 @@ export interface CatHealthHealthRecord { i?: string 'shards.initializing'?: string shardsInitializing?: string + 'unassign.pri'?: string + up?: string + 'shards.unassigned.primary'?: string + shardsUnassignedPrimary?: string unassign?: string u?: string 'shards.unassigned'?: string @@ -6833,19 +7152,18 @@ export interface CatHealthHealthRecord { export interface CatHealthRequest extends CatCatRequestBase { time?: TimeUnit ts?: boolean + h?: Names + s?: Names } export type CatHealthResponse = CatHealthHealthRecord[] -export interface CatHelpHelpRecord { - endpoint: string +export interface CatHelpRequest { } -export interface CatHelpRequest extends CatCatRequestBase { +export interface CatHelpResponse { } -export type CatHelpResponse = CatHelpHelpRecord[] - export interface CatIndicesIndicesRecord { health?: string h?: string @@ -6878,6 +7196,7 @@ export interface CatIndicesIndicesRecord { ss?: string | null storeSize?: string | null 'pri.store.size'?: string | null + 'dataset.size'?: string | null 'completion.size'?: string cs?: string completionSize?: string @@ -7144,6 +7463,9 @@ export interface CatIndicesRequest extends CatCatRequestBase { include_unloaded_segments?: boolean pri?: boolean time?: TimeUnit + master_timeout?: Duration + h?: Names + s?: Names } export type CatIndicesResponse = CatIndicesIndicesRecord[] @@ -7158,6 +7480,10 @@ export interface CatMasterMasterRecord { } export interface CatMasterRequest extends CatCatRequestBase { + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatMasterResponse = CatMasterMasterRecord[] @@ -7212,7 +7538,7 @@ export interface CatMlDataFrameAnalyticsRequest extends CatCatRequestBase { bytes?: Bytes h?: CatCatDfaColumns s?: CatCatDfaColumns - time?: Duration + time?: TimeUnit } export type CatMlDataFrameAnalyticsResponse = CatMlDataFrameAnalyticsDataFrameAnalyticsRecord[] @@ -7458,6 +7784,7 @@ export interface CatMlTrainedModelsRequest extends CatCatRequestBase { s?: CatCatTrainedModelsColumns from?: integer size?: integer + time?: TimeUnit } export type CatMlTrainedModelsResponse = CatMlTrainedModelsTrainedModelsRecord[] @@ -7525,6 +7852,10 @@ export interface CatNodeattrsNodeAttributesRecord { } export interface CatNodeattrsRequest extends CatCatRequestBase { + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatNodeattrsResponse = CatNodeattrsNodeAttributesRecord[] @@ -7803,6 +8134,10 @@ export interface CatNodesRequest extends CatCatRequestBase { bytes?: Bytes full_id?: boolean | string include_unloaded_segments?: boolean + h?: Names + s?: Names + master_timeout?: Duration + time?: TimeUnit } export type CatNodesResponse = CatNodesNodesRecord[] @@ -7819,6 +8154,11 @@ export interface CatPendingTasksPendingTasksRecord { } export interface CatPendingTasksRequest extends CatCatRequestBase { + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration + time?: TimeUnit } export type CatPendingTasksResponse = CatPendingTasksPendingTasksRecord[] @@ -7838,6 +8178,11 @@ export interface CatPluginsPluginsRecord { } export interface CatPluginsRequest extends CatCatRequestBase { + h?: Names + s?: Names + include_bootstrap?: boolean + local?: boolean + master_timeout?: Duration } export type CatPluginsResponse = CatPluginsPluginsRecord[] @@ -7905,6 +8250,9 @@ export interface CatRecoveryRequest extends CatCatRequestBase { active_only?: boolean bytes?: Bytes detailed?: boolean + h?: Names + s?: Names + time?: TimeUnit } export type CatRecoveryResponse = CatRecoveryRecoveryRecord[] @@ -7917,6 +8265,10 @@ export interface CatRepositoriesRepositoriesRecord { } export interface CatRepositoriesRequest extends CatCatRequestBase { + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatRepositoriesResponse = CatRepositoriesRepositoriesRecord[] @@ -7924,6 +8276,10 @@ export type CatRepositoriesResponse = CatRepositoriesRepositoriesRecord[] export interface CatSegmentsRequest extends CatCatRequestBase { index?: Indices bytes?: Bytes + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatSegmentsResponse = CatSegmentsSegmentsRecord[] @@ -7973,6 +8329,10 @@ export interface CatSegmentsSegmentsRecord { export interface CatShardsRequest extends CatCatRequestBase { index?: Indices bytes?: Bytes + h?: Names + s?: Names + master_timeout?: Duration + time?: TimeUnit } export type CatShardsResponse = CatShardsShardsRecord[] @@ -7995,6 +8355,7 @@ export interface CatShardsShardsRecord { dc?: string | null store?: string | null sto?: string | null + dataset?: string | null ip?: string | null id?: string node?: string | null @@ -8194,6 +8555,10 @@ export interface CatShardsShardsRecord { export interface CatSnapshotsRequest extends CatCatRequestBase { repository?: Names ignore_unavailable?: boolean + h?: Names + s?: Names + master_timeout?: Duration + time?: TimeUnit } export type CatSnapshotsResponse = CatSnapshotsSnapshotsRecord[] @@ -8235,8 +8600,13 @@ export interface CatSnapshotsSnapshotsRecord { export interface CatTasksRequest extends CatCatRequestBase { actions?: string[] detailed?: boolean - node_id?: string[] + nodes?: string[] parent_task_id?: string + h?: Names + s?: Names + time?: TimeUnit + timeout?: Duration + wait_for_completion?: boolean } export type CatTasksResponse = CatTasksTasksRecord[] @@ -8278,6 +8648,10 @@ export interface CatTasksTasksRecord { export interface CatTemplatesRequest extends CatCatRequestBase { name?: Name + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatTemplatesResponse = CatTemplatesTemplatesRecord[] @@ -8298,7 +8672,11 @@ export interface CatTemplatesTemplatesRecord { export interface CatThreadPoolRequest extends CatCatRequestBase { thread_pool_patterns?: Names + h?: Names + s?: Names time?: TimeUnit + local?: boolean + master_timeout?: Duration } export type CatThreadPoolResponse = CatThreadPoolThreadPoolRecord[] @@ -8482,25 +8860,29 @@ export interface CcrShardStats { export interface CcrDeleteAutoFollowPatternRequest extends RequestBase { name: Name + master_timeout?: Duration } export type CcrDeleteAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrFollowRequest extends RequestBase { index: IndexName + master_timeout?: Duration wait_for_active_shards?: WaitForActiveShards - leader_index?: IndexName + data_stream_name?: string + leader_index: IndexName max_outstanding_read_requests?: long - max_outstanding_write_requests?: long - max_read_request_operation_count?: long - max_read_request_size?: string + max_outstanding_write_requests?: integer + max_read_request_operation_count?: integer + max_read_request_size?: ByteSize max_retry_delay?: Duration - max_write_buffer_count?: long - max_write_buffer_size?: string - max_write_request_operation_count?: long - max_write_request_size?: string + max_write_buffer_count?: integer + max_write_buffer_size?: ByteSize + max_write_request_operation_count?: integer + max_write_request_size?: ByteSize read_poll_timeout?: Duration - remote_cluster?: string + remote_cluster: string + settings?: IndicesIndexSettings } export interface CcrFollowResponse { @@ -8518,22 +8900,23 @@ export interface CcrFollowInfoFollowerIndex { } export interface CcrFollowInfoFollowerIndexParameters { - max_outstanding_read_requests: integer - max_outstanding_write_requests: integer - max_read_request_operation_count: integer - max_read_request_size: string - max_retry_delay: Duration - max_write_buffer_count: integer - max_write_buffer_size: string - max_write_request_operation_count: integer - max_write_request_size: string - read_poll_timeout: Duration + max_outstanding_read_requests?: long + max_outstanding_write_requests?: integer + max_read_request_operation_count?: integer + max_read_request_size?: ByteSize + max_retry_delay?: Duration + max_write_buffer_count?: integer + max_write_buffer_size?: ByteSize + max_write_request_operation_count?: integer + max_write_request_size?: ByteSize + read_poll_timeout?: Duration } export type CcrFollowInfoFollowerIndexStatus = 'active' | 'paused' export interface CcrFollowInfoRequest extends RequestBase { index: Indices + master_timeout?: Duration } export interface CcrFollowInfoResponse { @@ -8542,6 +8925,7 @@ export interface CcrFollowInfoResponse { export interface CcrFollowStatsRequest extends RequestBase { index: Indices + timeout?: Duration } export interface CcrFollowStatsResponse { @@ -8550,6 +8934,7 @@ export interface CcrFollowStatsResponse { export interface CcrForgetFollowerRequest extends RequestBase { index: IndexName + timeout?: Duration follower_cluster?: string follower_index?: IndexName follower_index_uuid?: Uuid @@ -8576,6 +8961,7 @@ export interface CcrGetAutoFollowPatternAutoFollowPatternSummary { export interface CcrGetAutoFollowPatternRequest extends RequestBase { name?: Name + master_timeout?: Duration } export interface CcrGetAutoFollowPatternResponse { @@ -8584,18 +8970,21 @@ export interface CcrGetAutoFollowPatternResponse { export interface CcrPauseAutoFollowPatternRequest extends RequestBase { name: Name + master_timeout?: Duration } export type CcrPauseAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrPauseFollowRequest extends RequestBase { index: IndexName + master_timeout?: Duration } export type CcrPauseFollowResponse = AcknowledgedResponseBase export interface CcrPutAutoFollowPatternRequest extends RequestBase { name: Name + master_timeout?: Duration remote_cluster: string follow_index_pattern?: IndexPattern leader_index_patterns?: IndexPatterns @@ -8617,12 +9006,14 @@ export type CcrPutAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrResumeAutoFollowPatternRequest extends RequestBase { name: Name + master_timeout?: Duration } export type CcrResumeAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrResumeFollowRequest extends RequestBase { index: IndexName + master_timeout?: Duration max_outstanding_read_requests?: long max_outstanding_write_requests?: long max_read_request_operation_count?: long @@ -8656,6 +9047,8 @@ export interface CcrStatsFollowStats { } export interface CcrStatsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export interface CcrStatsResponse { @@ -8665,6 +9058,7 @@ export interface CcrStatsResponse { export interface CcrUnfollowRequest extends RequestBase { index: IndexName + master_timeout?: Duration } export type CcrUnfollowResponse = AcknowledgedResponseBase @@ -8678,6 +9072,7 @@ export interface ClusterComponentTemplateNode { template: ClusterComponentTemplateSummary version?: VersionNumber _meta?: Metadata + deprecated?: boolean } export interface ClusterComponentTemplateSummary { @@ -8717,6 +9112,7 @@ export interface ClusterAllocationExplainClusterInfo { export interface ClusterAllocationExplainCurrentNode { id: Id name: Name + roles: NodeRoles attributes: Record transport_address: TransportAddress weight_ranking: integer @@ -8739,6 +9135,7 @@ export interface ClusterAllocationExplainNodeAllocationExplanation { node_decision: ClusterAllocationExplainDecision node_id: Id node_name: Name + roles: NodeRoles store?: ClusterAllocationExplainAllocationStore transport_address: TransportAddress weight_ranking: integer @@ -8753,6 +9150,7 @@ export interface ClusterAllocationExplainNodeDiskUsage { export interface ClusterAllocationExplainRequest extends RequestBase { include_disk_info?: boolean include_yes_decisions?: boolean + master_timeout?: Duration current_node?: string index?: IndexName primary?: boolean @@ -8815,6 +9213,7 @@ export interface ClusterDeleteComponentTemplateRequest extends RequestBase { export type ClusterDeleteComponentTemplateResponse = AcknowledgedResponseBase export interface ClusterDeleteVotingConfigExclusionsRequest extends RequestBase { + master_timeout?: Duration wait_for_removal?: boolean } @@ -8856,7 +9255,8 @@ export interface ClusterGetSettingsResponse { export interface ClusterHealthHealthResponseBody { active_primary_shards: integer active_shards: integer - active_shards_percent_as_number: Percentage + active_shards_percent?: string + active_shards_percent_as_number: double cluster_name: Name delayed_unassigned_shards: integer indices?: Record @@ -8870,6 +9270,7 @@ export interface ClusterHealthHealthResponseBody { task_max_waiting_in_queue?: Duration task_max_waiting_in_queue_millis: DurationValue timed_out: boolean + unassigned_primary_shards: integer unassigned_shards: integer } @@ -8883,6 +9284,7 @@ export interface ClusterHealthIndexHealthStats { shards?: Record status: HealthStatus unassigned_shards: integer + unassigned_primary_shards: integer } export interface ClusterHealthRequest extends RequestBase { @@ -8894,7 +9296,7 @@ export interface ClusterHealthRequest extends RequestBase { timeout?: Duration wait_for_active_shards?: WaitForActiveShards wait_for_events?: WaitForEvents - wait_for_nodes?: string | integer + wait_for_nodes?: ClusterHealthWaitForNodes wait_for_no_initializing_shards?: boolean wait_for_no_relocating_shards?: boolean wait_for_status?: HealthStatus @@ -8909,8 +9311,11 @@ export interface ClusterHealthShardHealthStats { relocating_shards: integer status: HealthStatus unassigned_shards: integer + unassigned_primary_shards: integer } +export type ClusterHealthWaitForNodes = string | integer + export interface ClusterInfoRequest extends RequestBase { target: ClusterInfoTargets } @@ -8944,6 +9349,7 @@ export interface ClusterPendingTasksResponse { export interface ClusterPostVotingConfigExclusionsRequest extends RequestBase { node_names?: Names node_ids?: Ids + master_timeout?: Duration timeout?: Duration } @@ -8986,6 +9392,7 @@ export interface ClusterRemoteInfoClusterRemoteProxyInfo { server_name: string num_proxy_sockets_connected: integer max_proxy_socket_connections: integer + cluster_credentials?: string } export interface ClusterRemoteInfoClusterRemoteSniffInfo { @@ -9090,6 +9497,39 @@ export interface ClusterStateRequest extends RequestBase { export type ClusterStateResponse = any +export interface ClusterStatsCCSStats { + clusters?: Record + _search: ClusterStatsCCSUsageStats + _esql?: ClusterStatsCCSUsageStats +} + +export interface ClusterStatsCCSUsageClusterStats { + total: integer + skipped: integer + took: ClusterStatsCCSUsageTimeValue +} + +export interface ClusterStatsCCSUsageStats { + total: integer + success: integer + skipped: integer + took: ClusterStatsCCSUsageTimeValue + took_mrt_true?: ClusterStatsCCSUsageTimeValue + took_mrt_false?: ClusterStatsCCSUsageTimeValue + remotes_per_search_max: integer + remotes_per_search_avg: double + failure_reasons: Record + features: Record + clients: Record + clusters: Record +} + +export interface ClusterStatsCCSUsageTimeValue { + max: DurationValue + avg: DurationValue + p90: DurationValue +} + export interface ClusterStatsCharFilterTypes { analyzer_types: ClusterStatsFieldTypes[] built_in_analyzers: ClusterStatsFieldTypes[] @@ -9313,9 +9753,27 @@ export interface ClusterStatsOperatingSystemMemoryInfo { used_percent: integer } +export interface ClusterStatsRemoteClusterInfo { + cluster_uuid: string + mode: string + skip_unavailable: boolean + transport_compress: string + status: HealthStatus + version: VersionString[] + nodes_count: integer + shards_count: integer + indices_count: integer + indices_total_size_in_bytes: long + indices_total_size?: string + max_heap_in_bytes: long + max_heap?: string + mem_total_in_bytes: long + mem_total?: string +} + export interface ClusterStatsRequest extends RequestBase { node_id?: NodeIds - flat_settings?: boolean + include_remotes?: boolean timeout?: Duration } @@ -9345,6 +9803,7 @@ export interface ClusterStatsStatsResponseBase extends NodesNodesResponseBase { nodes: ClusterStatsClusterNodes status: HealthStatus timestamp: long + ccs: ClusterStatsCCSStats } export interface ConnectorConnector { @@ -9469,7 +9928,7 @@ export interface ConnectorFeatureEnabled { export interface ConnectorFilteringAdvancedSnippet { created_at?: DateTime updated_at?: DateTime - value: Record + value: any } export interface ConnectorFilteringConfig { @@ -9670,12 +10129,36 @@ export interface ConnectorSyncJobCancelResponse { result: Result } +export interface ConnectorSyncJobCheckInRequest extends RequestBase { + connector_sync_job_id: Id +} + +export interface ConnectorSyncJobCheckInResponse { +} + +export interface ConnectorSyncJobClaimRequest extends RequestBase { + connector_sync_job_id: Id + sync_cursor?: any + worker_hostname: string +} + +export interface ConnectorSyncJobClaimResponse { +} + export interface ConnectorSyncJobDeleteRequest extends RequestBase { connector_sync_job_id: Id } export type ConnectorSyncJobDeleteResponse = AcknowledgedResponseBase +export interface ConnectorSyncJobErrorRequest extends RequestBase { + connector_sync_job_id: Id + error: string +} + +export interface ConnectorSyncJobErrorResponse { +} + export interface ConnectorSyncJobGetRequest extends RequestBase { connector_sync_job_id: Id } @@ -9705,6 +10188,19 @@ export interface ConnectorSyncJobPostResponse { id: Id } +export interface ConnectorSyncJobUpdateStatsRequest extends RequestBase { + connector_sync_job_id: Id + deleted_document_count: long + indexed_document_count: long + indexed_document_volume: long + last_seen?: Duration + metadata?: Metadata + total_document_count?: integer +} + +export interface ConnectorSyncJobUpdateStatsResponse { +} + export interface ConnectorUpdateActiveFilteringRequest extends RequestBase { connector_id: Id } @@ -9742,6 +10238,15 @@ export interface ConnectorUpdateErrorResponse { result: Result } +export interface ConnectorUpdateFeaturesRequest extends RequestBase { + connector_id: Id + features: ConnectorConnectorFeatures +} + +export interface ConnectorUpdateFeaturesResponse { + result: Result +} + export interface ConnectorUpdateFilteringRequest extends RequestBase { connector_id: Id filtering?: ConnectorFilteringConfig[] @@ -9875,28 +10380,32 @@ export interface EnrichSummary { export interface EnrichDeletePolicyRequest extends RequestBase { name: Name + master_timeout?: Duration } export type EnrichDeletePolicyResponse = AcknowledgedResponseBase -export type EnrichExecutePolicyEnrichPolicyPhase = 'SCHEDULED' | 'RUNNING' | 'COMPLETE' | 'FAILED' +export type EnrichExecutePolicyEnrichPolicyPhase = 'SCHEDULED' | 'RUNNING' | 'COMPLETE' | 'FAILED' | 'CANCELLED' export interface EnrichExecutePolicyExecuteEnrichPolicyStatus { phase: EnrichExecutePolicyEnrichPolicyPhase + step?: string } export interface EnrichExecutePolicyRequest extends RequestBase { name: Name + master_timeout?: Duration wait_for_completion?: boolean } export interface EnrichExecutePolicyResponse { status?: EnrichExecutePolicyExecuteEnrichPolicyStatus - task_id?: TaskId + task?: TaskId } export interface EnrichGetPolicyRequest extends RequestBase { name?: Names + master_timeout?: Duration } export interface EnrichGetPolicyResponse { @@ -9905,6 +10414,7 @@ export interface EnrichGetPolicyResponse { export interface EnrichPutPolicyRequest extends RequestBase { name: Name + master_timeout?: Duration geo_match?: EnrichPolicy match?: EnrichPolicy range?: EnrichPolicy @@ -9916,8 +10426,11 @@ export interface EnrichStatsCacheStats { node_id: Id count: integer hits: integer + hits_time_in_millis: DurationValue misses: integer + misses_time_in_millis: DurationValue evictions: integer + size_in_bytes: long } export interface EnrichStatsCoordinatorStats { @@ -9934,6 +10447,7 @@ export interface EnrichStatsExecutingPolicy { } export interface EnrichStatsRequest extends RequestBase { + master_timeout?: Duration } export interface EnrichStatsResponse { @@ -9955,6 +10469,7 @@ export interface EqlEqlSearchResponseBase { took?: DurationValue timed_out?: boolean hits: EqlEqlHits + shard_failures?: ShardFailure[] } export interface EqlHitsEvent { @@ -10012,10 +10527,13 @@ export interface EqlSearchRequest extends RequestBase { keep_alive?: Duration keep_on_completion?: boolean wait_for_completion_timeout?: Duration + allow_partial_search_results?: boolean + allow_partial_sequence_results?: boolean size?: uint fields?: QueryDslFieldAndFormat | Field | (QueryDslFieldAndFormat | Field)[] result_position?: EqlSearchResultPosition runtime_mappings?: MappingRuntimeFields + max_samples_per_key?: integer } export type EqlSearchResponse = EqlEqlSearchResponseBase @@ -10037,8 +10555,51 @@ export type EsqlTableValuesLongDouble = double | double[] export type EsqlTableValuesLongValue = long | long[] +export interface EsqlAsyncQueryRequest extends RequestBase { + delimiter?: string + drop_null_columns?: boolean + format?: EsqlQueryEsqlFormat + keep_alive?: Duration + keep_on_completion?: boolean + columnar?: boolean + filter?: QueryDslQueryContainer + locale?: string + params?: FieldValue[] + profile?: boolean + query: string + tables?: Record> + include_ccs_metadata?: boolean + wait_for_completion_timeout?: Duration +} + +export type EsqlAsyncQueryResponse = EsqlResult + +export interface EsqlAsyncQueryDeleteRequest extends RequestBase { + id: Id +} + +export type EsqlAsyncQueryDeleteResponse = AcknowledgedResponseBase + +export interface EsqlAsyncQueryGetRequest extends RequestBase { + id: Id + drop_null_columns?: boolean + keep_alive?: Duration + wait_for_completion_timeout?: Duration +} + +export type EsqlAsyncQueryGetResponse = EsqlResult + +export interface EsqlAsyncQueryStopRequest extends RequestBase { + id: Id + drop_null_columns?: boolean +} + +export type EsqlAsyncQueryStopResponse = EsqlResult + +export type EsqlQueryEsqlFormat = 'csv' | 'json' | 'tsv' | 'txt' | 'yaml' | 'cbor' | 'smile' | 'arrow' + export interface EsqlQueryRequest extends RequestBase { - format?: string + format?: EsqlQueryEsqlFormat delimiter?: string drop_null_columns?: boolean columnar?: boolean @@ -10048,9 +10609,10 @@ export interface EsqlQueryRequest extends RequestBase { profile?: boolean query: string tables?: Record> + include_ccs_metadata?: boolean } -export type EsqlQueryResponse = EsqlColumns +export type EsqlQueryResponse = EsqlResult export interface FeaturesFeature { name: string @@ -10058,6 +10620,7 @@ export interface FeaturesFeature { } export interface FeaturesGetFeaturesRequest extends RequestBase { + master_timeout?: Duration } export interface FeaturesGetFeaturesResponse { @@ -10065,6 +10628,7 @@ export interface FeaturesGetFeaturesResponse { } export interface FeaturesResetFeaturesRequest extends RequestBase { + master_timeout?: Duration } export interface FeaturesResetFeaturesResponse { @@ -10149,7 +10713,7 @@ export interface FleetSearchRequest extends RequestBase { from?: integer highlight?: SearchHighlight track_total_hits?: SearchTrackHits - indices_boost?: Record[] + indices_boost?: Partial>[] docvalue_fields?: (QueryDslFieldAndFormat | Field)[] min_score?: double post_filter?: QueryDslQueryContainer @@ -10300,7 +10864,7 @@ export interface IlmMigrateAction { export interface IlmPhase { actions?: IlmActions - min_age?: Duration | long + min_age?: Duration } export interface IlmPhases { @@ -10365,17 +10929,21 @@ export interface IlmExplainLifecycleLifecycleExplainManaged { age?: Duration failed_step?: Name failed_step_retry_count?: integer - index?: IndexName + index: IndexName index_creation_date?: DateTime index_creation_date_millis?: EpochTime is_auto_retryable_error?: boolean lifecycle_date?: DateTime lifecycle_date_millis?: EpochTime managed: true - phase: Name + phase?: Name phase_time?: DateTime phase_time_millis?: EpochTime - policy: Name + policy?: Name + previous_step_info?: Record + repository_name?: string + snapshot_name?: string + shrink_index_name?: string step?: Name step_info?: Record step_time?: DateTime @@ -10385,6 +10953,7 @@ export interface IlmExplainLifecycleLifecycleExplainManaged { } export interface IlmExplainLifecycleLifecycleExplainPhaseExecution { + phase_definition?: IlmPhase policy: Name version: VersionNumber modified_date_in_millis: EpochTime @@ -10400,7 +10969,6 @@ export interface IlmExplainLifecycleRequest extends RequestBase { only_errors?: boolean only_managed?: boolean master_timeout?: Duration - timeout?: Duration } export interface IlmExplainLifecycleResponse { @@ -10446,15 +11014,15 @@ export interface IlmMigrateToDataTiersResponse { export interface IlmMoveToStepRequest extends RequestBase { index: IndexName - current_step?: IlmMoveToStepStepKey - next_step?: IlmMoveToStepStepKey + current_step: IlmMoveToStepStepKey + next_step: IlmMoveToStepStepKey } export type IlmMoveToStepResponse = AcknowledgedResponseBase export interface IlmMoveToStepStepKey { - action: string - name: string + action?: string + name?: string phase: string } @@ -10549,6 +11117,7 @@ export interface IndicesDataStreamIndex { export interface IndicesDataStreamLifecycle { data_retention?: Duration downsampling?: IndicesDataStreamLifecycleDownsampling + enabled?: boolean } export interface IndicesDataStreamLifecycleDownsampling { @@ -10568,9 +11137,7 @@ export interface IndicesDataStreamLifecycleRolloverConditions { max_primary_shard_docs?: long } -export interface IndicesDataStreamLifecycleWithRollover { - data_retention?: Duration - downsampling?: IndicesDataStreamLifecycleDownsampling +export interface IndicesDataStreamLifecycleWithRollover extends IndicesDataStreamLifecycle { rollover?: IndicesDataStreamLifecycleRolloverConditions } @@ -10580,6 +11147,7 @@ export interface IndicesDataStreamTimestampField { export interface IndicesDataStreamVisibility { hidden?: boolean + allow_custom_routing?: boolean } export interface IndicesDownsampleConfig { @@ -10667,7 +11235,7 @@ export interface IndicesIndexSettingsKeys { routing_partition_size?: SpecUtilsStringified load_fixed_bitset_filters_eagerly?: boolean hidden?: boolean | string - auto_expand_replicas?: string + auto_expand_replicas?: SpecUtilsWithNullValue merge?: IndicesMerge search?: IndicesSettingsSearch refresh_interval?: Duration @@ -10729,6 +11297,7 @@ export interface IndicesIndexSettingsLifecycle { parse_origination_date?: boolean step?: IndicesIndexSettingsLifecycleStep rollover_alias?: string + prefer_ilm?: boolean | string } export interface IndicesIndexSettingsLifecycleStep { @@ -10758,6 +11327,8 @@ export interface IndicesIndexTemplate { _meta?: Metadata allow_auto_create?: boolean data_stream?: IndicesIndexTemplateDataStreamConfiguration + deprecated?: boolean + ignore_missing_component_templates?: Names } export interface IndicesIndexTemplateDataStreamConfiguration { @@ -10806,7 +11377,8 @@ export interface IndicesMappingLimitSettings { nested_objects?: IndicesMappingLimitSettingsNestedObjects field_name_length?: IndicesMappingLimitSettingsFieldNameLength dimension_fields?: IndicesMappingLimitSettingsDimensionFields - ignore_malformed?: boolean + source?: IndicesMappingLimitSettingsSourceFields + ignore_malformed?: boolean | string } export interface IndicesMappingLimitSettingsDepth { @@ -10829,9 +11401,13 @@ export interface IndicesMappingLimitSettingsNestedObjects { limit?: long } +export interface IndicesMappingLimitSettingsSourceFields { + mode: IndicesSourceMode +} + export interface IndicesMappingLimitSettingsTotalFields { - limit?: long - ignore_dynamic_beyond_limit?: boolean + limit?: long | string + ignore_dynamic_beyond_limit?: boolean | string } export interface IndicesMerge { @@ -10956,6 +11532,8 @@ export interface IndicesSoftDeletes { retention_lease?: IndicesRetentionLease } +export type IndicesSourceMode = 'disabled' | 'stored' | 'synthetic' + export interface IndicesStorage { type: IndicesStorageType allow_mmap?: boolean @@ -11075,6 +11653,12 @@ export interface IndicesAnalyzeTokenDetail { tokens: IndicesAnalyzeExplainAnalyzeToken[] } +export interface IndicesCancelMigrateReindexRequest extends RequestBase { + index: Indices +} + +export type IndicesCancelMigrateReindexResponse = AcknowledgedResponseBase + export interface IndicesClearCacheRequest extends RequestBase { index?: Indices allow_no_indices?: boolean @@ -11153,6 +11737,24 @@ export interface IndicesCreateDataStreamRequest extends RequestBase { export type IndicesCreateDataStreamResponse = AcknowledgedResponseBase +export interface IndicesCreateFromCreateFrom { + mappings_override?: MappingTypeMapping + settings_override?: IndicesIndexSettings + remove_index_blocks?: boolean +} + +export interface IndicesCreateFromRequest extends RequestBase { + source: IndexName + dest: IndexName + create_from?: IndicesCreateFromCreateFrom +} + +export interface IndicesCreateFromResponse { + acknowledged: boolean + index: IndexName + shards_acknowledged: boolean +} + export interface IndicesDataStreamsStatsDataStreamsStatsItem { backing_indices: integer data_stream: Name @@ -11272,6 +11874,8 @@ export type IndicesExistsAliasResponse = boolean export interface IndicesExistsIndexTemplateRequest extends RequestBase { name: Name + local?: boolean + flat_settings?: boolean master_timeout?: Duration } @@ -11341,9 +11945,6 @@ export interface IndicesFieldUsageStatsRequest extends RequestBase { expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean fields?: Fields - master_timeout?: Duration - timeout?: Duration - wait_for_active_shards?: WaitForActiveShards } export type IndicesFieldUsageStatsResponse = IndicesFieldUsageStatsFieldsUsageBody @@ -11427,7 +12028,7 @@ export type IndicesGetAliasResponse = Record + time_between_starts_in_millis?: DurationValue +} + export interface IndicesGetDataStreamRequest extends RequestBase { name?: DataStreamNames expand_wildcards?: ExpandWildcards include_defaults?: boolean master_timeout?: Duration + verbose?: boolean } export interface IndicesGetDataStreamResponse { @@ -11501,6 +12119,34 @@ export interface IndicesGetMappingRequest extends RequestBase { export type IndicesGetMappingResponse = Record +export interface IndicesGetMigrateReindexStatusRequest extends RequestBase { + index: Indices +} + +export interface IndicesGetMigrateReindexStatusResponse { + start_time?: DateTime + start_time_millis: EpochTime + complete: boolean + total_indices_in_data_stream: integer + total_indices_requiring_upgrade: integer + successes: integer + in_progress: IndicesGetMigrateReindexStatusStatusInProgress[] + pending: integer + errors: IndicesGetMigrateReindexStatusStatusError[] + exception?: string +} + +export interface IndicesGetMigrateReindexStatusStatusError { + index: string + message: string +} + +export interface IndicesGetMigrateReindexStatusStatusInProgress { + index: string + total_doc_count: long + reindexed_doc_count: long +} + export interface IndicesGetSettingsRequest extends RequestBase { index?: Indices name?: Names @@ -11524,6 +12170,23 @@ export interface IndicesGetTemplateRequest extends RequestBase { export type IndicesGetTemplateResponse = Record +export interface IndicesMigrateReindexMigrateReindex { + mode: IndicesMigrateReindexModeEnum + source: IndicesMigrateReindexSourceIndex +} + +export type IndicesMigrateReindexModeEnum = 'upgrade' + +export interface IndicesMigrateReindexRequest extends RequestBase { + reindex?: IndicesMigrateReindexMigrateReindex +} + +export type IndicesMigrateReindexResponse = AcknowledgedResponseBase + +export interface IndicesMigrateReindexSourceIndex { + index: IndexName +} + export interface IndicesMigrateToDataStreamRequest extends RequestBase { name: IndexName master_timeout?: Duration @@ -11591,6 +12254,7 @@ export interface IndicesPutDataLifecycleRequest extends RequestBase { timeout?: Duration data_retention?: Duration downsampling?: IndicesDataStreamLifecycleDownsampling + enabled?: boolean } export type IndicesPutDataLifecycleResponse = AcknowledgedResponseBase @@ -11632,7 +12296,7 @@ export interface IndicesPutMappingRequest extends RequestBase { date_detection?: boolean dynamic?: MappingDynamicMapping dynamic_date_formats?: string[] - dynamic_templates?: Record | Record[] + dynamic_templates?: Partial>[] _field_names?: MappingFieldNamesField _meta?: Metadata numeric_detection?: boolean @@ -11652,6 +12316,7 @@ export interface IndicesPutSettingsRequest extends RequestBase { ignore_unavailable?: boolean master_timeout?: Duration preserve_existing?: boolean + reopen?: boolean timeout?: Duration settings?: IndicesIndexSettings } @@ -11805,16 +12470,18 @@ export interface IndicesReloadSearchAnalyzersRequest extends RequestBase { allow_no_indices?: boolean expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean + resource?: string } export type IndicesReloadSearchAnalyzersResponse = IndicesReloadSearchAnalyzersReloadResult export interface IndicesResolveClusterRequest extends RequestBase { - name: Names + name?: Names allow_no_indices?: boolean expand_wildcards?: ExpandWildcards ignore_throttled?: boolean ignore_unavailable?: boolean + timeout?: Duration } export interface IndicesResolveClusterResolveClusterInfo { @@ -11830,6 +12497,8 @@ export type IndicesResolveClusterResponse = Record conditions?: IndicesRolloverRolloverConditions mappings?: MappingTypeMapping @@ -12003,6 +12673,8 @@ export interface IndicesShrinkResponse { export interface IndicesSimulateIndexTemplateRequest extends RequestBase { name: Name + create?: boolean + cause?: string master_timeout?: Duration include_defaults?: boolean } @@ -12020,6 +12692,7 @@ export interface IndicesSimulateTemplateOverlapping { export interface IndicesSimulateTemplateRequest extends RequestBase { name?: Name create?: boolean + cause?: string master_timeout?: Duration include_defaults?: boolean allow_auto_create?: boolean @@ -12301,10 +12974,166 @@ export interface IndicesValidateQueryResponse { error?: string } +export interface InferenceAdaptiveAllocations { + enabled?: boolean + max_number_of_allocations?: integer + min_number_of_allocations?: integer +} + +export interface InferenceAlibabaCloudServiceSettings { + api_key: string + host: string + rate_limit?: InferenceRateLimitSetting + service_id: string + workspace: string +} + +export type InferenceAlibabaCloudServiceType = 'alibabacloud-ai-search' + +export interface InferenceAlibabaCloudTaskSettings { + input_type?: string + return_token?: boolean +} + +export type InferenceAlibabaCloudTaskType = 'completion' | 'rerank' | 'space_embedding' | 'text_embedding' + +export interface InferenceAmazonBedrockServiceSettings { + access_key: string + model: string + provider?: string + region: string + rate_limit?: InferenceRateLimitSetting + secret_key: string +} + +export type InferenceAmazonBedrockServiceType = 'amazonbedrock' + +export interface InferenceAmazonBedrockTaskSettings { + max_new_tokens?: integer + temperature?: float + top_k?: float + top_p?: float +} + +export type InferenceAmazonBedrockTaskType = 'completion' | 'text_embedding' + +export interface InferenceAnthropicServiceSettings { + api_key: string + model_id: string + rate_limit?: InferenceRateLimitSetting +} + +export type InferenceAnthropicServiceType = 'anthropic' + +export interface InferenceAnthropicTaskSettings { + max_tokens: integer + temperature?: float + top_k?: integer + top_p?: float +} + +export type InferenceAnthropicTaskType = 'completion' + +export interface InferenceAzureAiStudioServiceSettings { + api_key: string + endpoint_type: string + target: string + provider: string + rate_limit?: InferenceRateLimitSetting +} + +export type InferenceAzureAiStudioServiceType = 'azureaistudio' + +export interface InferenceAzureAiStudioTaskSettings { + do_sample?: float + max_new_tokens?: integer + temperature?: float + top_p?: float + user?: string +} + +export type InferenceAzureAiStudioTaskType = 'completion' | 'text_embedding' + +export interface InferenceAzureOpenAIServiceSettings { + api_key?: string + api_version: string + deployment_id: string + entra_id?: string + rate_limit?: InferenceRateLimitSetting + resource_name: string +} + +export type InferenceAzureOpenAIServiceType = 'azureopenai' + +export interface InferenceAzureOpenAITaskSettings { + user?: string +} + +export type InferenceAzureOpenAITaskType = 'completion' | 'text_embedding' + +export type InferenceCohereEmbeddingType = 'byte' | 'float' | 'int8' + +export type InferenceCohereInputType = 'classification' | 'clustering' | 'ingest' | 'search' + +export interface InferenceCohereServiceSettings { + api_key: string + embedding_type?: InferenceCohereEmbeddingType + model_id?: string + rate_limit?: InferenceRateLimitSetting + similarity?: InferenceCohereSimilarityType +} + +export type InferenceCohereServiceType = 'cohere' + +export type InferenceCohereSimilarityType = 'cosine' | 'dot_product' | 'l2_norm' + +export interface InferenceCohereTaskSettings { + input_type?: InferenceCohereInputType + return_documents?: boolean + top_n?: integer + truncate?: InferenceCohereTruncateType +} + +export type InferenceCohereTaskType = 'completion' | 'rerank' | 'text_embedding' + +export type InferenceCohereTruncateType = 'END' | 'NONE' | 'START' + +export interface InferenceCompletionInferenceResult { + completion: InferenceCompletionResult[] +} + export interface InferenceCompletionResult { result: string } +export interface InferenceCompletionTool { + type: string + function: InferenceCompletionToolFunction +} + +export interface InferenceCompletionToolChoice { + type: string + function: InferenceCompletionToolChoiceFunction +} + +export interface InferenceCompletionToolChoiceFunction { + name: string +} + +export interface InferenceCompletionToolFunction { + description?: string + name: string + parameters?: any + strict?: boolean +} + +export type InferenceCompletionToolType = string | InferenceCompletionToolChoice + +export interface InferenceContentObject { + text: string + type: string +} + export interface InferenceDeleteInferenceEndpointResult extends AcknowledgedResponseBase { pipelines: string[] } @@ -12313,10 +13142,81 @@ export type InferenceDenseByteVector = byte[] export type InferenceDenseVector = float[] +export interface InferenceElasticsearchServiceSettings { + adaptive_allocations?: InferenceAdaptiveAllocations + deployment_id?: string + model_id: string + num_allocations?: integer + num_threads: integer +} + +export type InferenceElasticsearchServiceType = 'elasticsearch' + +export interface InferenceElasticsearchTaskSettings { + return_documents?: boolean +} + +export type InferenceElasticsearchTaskType = 'rerank' | 'sparse_embedding' | 'text_embedding' + +export interface InferenceElserServiceSettings { + adaptive_allocations?: InferenceAdaptiveAllocations + num_allocations: integer + num_threads: integer +} + +export type InferenceElserServiceType = 'elser' + +export type InferenceElserTaskType = 'sparse_embedding' + +export type InferenceGoogleAiServiceType = 'googleaistudio' + +export interface InferenceGoogleAiStudioServiceSettings { + api_key: string + model_id: string + rate_limit?: InferenceRateLimitSetting +} + +export type InferenceGoogleAiStudioTaskType = 'completion' | 'text_embedding' + +export interface InferenceGoogleVertexAIServiceSettings { + location: string + model_id: string + project_id: string + rate_limit?: InferenceRateLimitSetting + service_account_json: string +} + +export type InferenceGoogleVertexAIServiceType = 'googlevertexai' + +export interface InferenceGoogleVertexAITaskSettings { + auto_truncate?: boolean + top_n?: integer +} + +export type InferenceGoogleVertexAITaskType = 'rerank' | 'text_embedding' + +export interface InferenceHuggingFaceServiceSettings { + api_key: string + rate_limit?: InferenceRateLimitSetting + url: string +} + +export type InferenceHuggingFaceServiceType = 'hugging_face' + +export type InferenceHuggingFaceTaskType = 'text_embedding' + +export interface InferenceInferenceChunkingSettings { + max_chunk_size?: integer + overlap?: integer + sentence_overlap?: integer + strategy?: string +} + export interface InferenceInferenceEndpoint { + chunking_settings?: InferenceInferenceChunkingSettings service: string service_settings: InferenceServiceSettings - task_settings: InferenceTaskSettings + task_settings?: InferenceTaskSettings } export interface InferenceInferenceEndpointInfo extends InferenceInferenceEndpoint { @@ -12326,20 +13226,102 @@ export interface InferenceInferenceEndpointInfo extends InferenceInferenceEndpoi export interface InferenceInferenceResult { text_embedding_bytes?: InferenceTextEmbeddingByteResult[] + text_embedding_bits?: InferenceTextEmbeddingByteResult[] text_embedding?: InferenceTextEmbeddingResult[] sparse_embedding?: InferenceSparseEmbeddingResult[] completion?: InferenceCompletionResult[] rerank?: InferenceRankedDocument[] } +export interface InferenceJinaAIServiceSettings { + api_key: string + model_id?: string + rate_limit?: InferenceRateLimitSetting + similarity?: InferenceJinaAISimilarityType +} + +export type InferenceJinaAIServiceType = 'jinaai' + +export type InferenceJinaAISimilarityType = 'cosine' | 'dot_product' | 'l2_norm' + +export interface InferenceJinaAITaskSettings { + return_documents?: boolean + task?: InferenceJinaAITextEmbeddingTask + top_n?: integer +} + +export type InferenceJinaAITaskType = 'rerank' | 'text_embedding' + +export type InferenceJinaAITextEmbeddingTask = 'classification' | 'clustering' | 'ingest' | 'search' + +export interface InferenceMessage { + content?: InferenceMessageContent + role: string + tool_call_id?: Id + tool_calls?: InferenceToolCall[] +} + +export type InferenceMessageContent = string | InferenceContentObject[] + +export interface InferenceMistralServiceSettings { + api_key: string + max_input_tokens?: integer + model: string + rate_limit?: InferenceRateLimitSetting +} + +export type InferenceMistralServiceType = 'mistral' + +export type InferenceMistralTaskType = 'text_embedding' + +export interface InferenceOpenAIServiceSettings { + api_key: string + dimensions?: integer + model_id: string + organization_id?: string + rate_limit?: InferenceRateLimitSetting + url?: string +} + +export type InferenceOpenAIServiceType = 'openai' + +export interface InferenceOpenAITaskSettings { + user?: string +} + +export type InferenceOpenAITaskType = 'chat_completion' | 'completion' | 'text_embedding' + export interface InferenceRankedDocument { index: integer - score: float + relevance_score: float text?: string } +export interface InferenceRateLimitSetting { + requests_per_minute?: integer +} + +export interface InferenceRequestChatCompletion { + messages: InferenceMessage[] + model?: string + max_completion_tokens?: long + stop?: string[] + temperature?: float + tool_choice?: InferenceCompletionToolType + tools?: InferenceCompletionTool[] + top_p?: float +} + +export interface InferenceRerankedInferenceResult { + rerank: InferenceRankedDocument[] +} + export type InferenceServiceSettings = any +export interface InferenceSparseEmbeddingInferenceResult { + sparse_embedding: InferenceSparseEmbeddingResult[] +} + export interface InferenceSparseEmbeddingResult { embedding: InferenceSparseVector } @@ -12348,16 +13330,80 @@ export type InferenceSparseVector = Record export type InferenceTaskSettings = any -export type InferenceTaskType = 'sparse_embedding' | 'text_embedding' | 'rerank' | 'completion' +export type InferenceTaskType = 'sparse_embedding' | 'text_embedding' | 'rerank' | 'completion' | 'chat_completion' export interface InferenceTextEmbeddingByteResult { embedding: InferenceDenseByteVector } +export interface InferenceTextEmbeddingInferenceResult { + text_embedding_bytes?: InferenceTextEmbeddingByteResult[] + text_embedding?: InferenceTextEmbeddingResult[] +} + export interface InferenceTextEmbeddingResult { embedding: InferenceDenseVector } +export interface InferenceToolCall { + id: Id + function: InferenceToolCallFunction + type: string +} + +export interface InferenceToolCallFunction { + arguments: string + name: string +} + +export interface InferenceVoyageAIServiceSettings { + dimensions?: integer + model_id: string + rate_limit?: InferenceRateLimitSetting + embedding_type?: float +} + +export type InferenceVoyageAIServiceType = 'voyageai' + +export interface InferenceVoyageAITaskSettings { + input_type?: string + return_documents?: boolean + top_k?: integer + truncation?: boolean +} + +export type InferenceVoyageAITaskType = 'text_embedding' | 'rerank' + +export interface InferenceWatsonxServiceSettings { + api_key: string + api_version: string + model_id: string + project_id: string + rate_limit?: InferenceRateLimitSetting + url: string +} + +export type InferenceWatsonxServiceType = 'watsonxai' + +export type InferenceWatsonxTaskType = 'text_embedding' + +export interface InferenceChatCompletionUnifiedRequest extends RequestBase { + inference_id: Id + timeout?: Duration + chat_completion_request?: InferenceRequestChatCompletion +} + +export type InferenceChatCompletionUnifiedResponse = StreamResult + +export interface InferenceCompletionRequest extends RequestBase { + inference_id: Id + timeout?: Duration + input: string | string[] + task_settings?: InferenceTaskSettings +} + +export type InferenceCompletionResponse = InferenceCompletionInferenceResult + export interface InferenceDeleteRequest extends RequestBase { task_type?: InferenceTaskType inference_id: Id @@ -12395,9 +13441,223 @@ export interface InferencePutRequest extends RequestBase { export type InferencePutResponse = InferenceInferenceEndpointInfo +export interface InferencePutAlibabacloudRequest extends RequestBase { + task_type: InferenceAlibabaCloudTaskType + alibabacloud_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAlibabaCloudServiceType + service_settings: InferenceAlibabaCloudServiceSettings + task_settings?: InferenceAlibabaCloudTaskSettings +} + +export type InferencePutAlibabacloudResponse = InferenceInferenceEndpointInfo + +export interface InferencePutAmazonbedrockRequest extends RequestBase { + task_type: InferenceAmazonBedrockTaskType + amazonbedrock_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAmazonBedrockServiceType + service_settings: InferenceAmazonBedrockServiceSettings + task_settings?: InferenceAmazonBedrockTaskSettings +} + +export type InferencePutAmazonbedrockResponse = InferenceInferenceEndpointInfo + +export interface InferencePutAnthropicRequest extends RequestBase { + task_type: InferenceAnthropicTaskType + anthropic_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAnthropicServiceType + service_settings: InferenceAnthropicServiceSettings + task_settings?: InferenceAnthropicTaskSettings +} + +export type InferencePutAnthropicResponse = InferenceInferenceEndpointInfo + +export interface InferencePutAzureaistudioRequest extends RequestBase { + task_type: InferenceAzureAiStudioTaskType + azureaistudio_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAzureAiStudioServiceType + service_settings: InferenceAzureAiStudioServiceSettings + task_settings?: InferenceAzureAiStudioTaskSettings +} + +export type InferencePutAzureaistudioResponse = InferenceInferenceEndpointInfo + +export interface InferencePutAzureopenaiRequest extends RequestBase { + task_type: InferenceAzureOpenAITaskType + azureopenai_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAzureOpenAIServiceType + service_settings: InferenceAzureOpenAIServiceSettings + task_settings?: InferenceAzureOpenAITaskSettings +} + +export type InferencePutAzureopenaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutCohereRequest extends RequestBase { + task_type: InferenceCohereTaskType + cohere_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceCohereServiceType + service_settings: InferenceCohereServiceSettings + task_settings?: InferenceCohereTaskSettings +} + +export type InferencePutCohereResponse = InferenceInferenceEndpointInfo + +export interface InferencePutElasticsearchRequest extends RequestBase { + task_type: InferenceElasticsearchTaskType + elasticsearch_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceElasticsearchServiceType + service_settings: InferenceElasticsearchServiceSettings + task_settings?: InferenceElasticsearchTaskSettings +} + +export type InferencePutElasticsearchResponse = InferenceInferenceEndpointInfo + +export interface InferencePutElserRequest extends RequestBase { + task_type: InferenceElserTaskType + elser_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceElserServiceType + service_settings: InferenceElserServiceSettings +} + +export type InferencePutElserResponse = InferenceInferenceEndpointInfo + +export interface InferencePutGoogleaistudioRequest extends RequestBase { + task_type: InferenceGoogleAiStudioTaskType + googleaistudio_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceGoogleAiServiceType + service_settings: InferenceGoogleAiStudioServiceSettings +} + +export type InferencePutGoogleaistudioResponse = InferenceInferenceEndpointInfo + +export interface InferencePutGooglevertexaiRequest extends RequestBase { + task_type: InferenceGoogleVertexAITaskType + googlevertexai_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceGoogleVertexAIServiceType + service_settings: InferenceGoogleVertexAIServiceSettings + task_settings?: InferenceGoogleVertexAITaskSettings +} + +export type InferencePutGooglevertexaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutHuggingFaceRequest extends RequestBase { + task_type: InferenceHuggingFaceTaskType + huggingface_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceHuggingFaceServiceType + service_settings: InferenceHuggingFaceServiceSettings +} + +export type InferencePutHuggingFaceResponse = InferenceInferenceEndpointInfo + +export interface InferencePutJinaaiRequest extends RequestBase { + task_type: InferenceJinaAITaskType + jinaai_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceJinaAIServiceType + service_settings: InferenceJinaAIServiceSettings + task_settings?: InferenceJinaAITaskSettings +} + +export type InferencePutJinaaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutMistralRequest extends RequestBase { + task_type: InferenceMistralTaskType + mistral_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceMistralServiceType + service_settings: InferenceMistralServiceSettings +} + +export type InferencePutMistralResponse = InferenceInferenceEndpointInfo + +export interface InferencePutOpenaiRequest extends RequestBase { + task_type: InferenceOpenAITaskType + openai_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceOpenAIServiceType + service_settings: InferenceOpenAIServiceSettings + task_settings?: InferenceOpenAITaskSettings +} + +export type InferencePutOpenaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutVoyageaiRequest extends RequestBase { + task_type: InferenceVoyageAITaskType + voyageai_inference_id: Id + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceVoyageAIServiceType + service_settings: InferenceVoyageAIServiceSettings + task_settings?: InferenceVoyageAITaskSettings +} + +export type InferencePutVoyageaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutWatsonxRequest extends RequestBase { + task_type: InferenceWatsonxTaskType + watsonx_inference_id: Id + service: InferenceWatsonxServiceType + service_settings: InferenceWatsonxServiceSettings +} + +export type InferencePutWatsonxResponse = InferenceInferenceEndpointInfo + +export interface InferenceRerankRequest extends RequestBase { + inference_id: Id + timeout?: Duration + query: string + input: string | string[] + task_settings?: InferenceTaskSettings +} + +export type InferenceRerankResponse = InferenceRerankedInferenceResult + +export interface InferenceSparseEmbeddingRequest extends RequestBase { + inference_id: Id + timeout?: Duration + input: string | string[] + task_settings?: InferenceTaskSettings +} + +export type InferenceSparseEmbeddingResponse = InferenceSparseEmbeddingInferenceResult + +export interface InferenceStreamCompletionRequest extends RequestBase { + inference_id: Id + input: string | string[] + task_settings?: InferenceTaskSettings +} + +export type InferenceStreamCompletionResponse = StreamResult + +export interface InferenceTextEmbeddingRequest extends RequestBase { + inference_id: Id + timeout?: Duration + input: string | string[] + task_settings?: InferenceTaskSettings +} + +export type InferenceTextEmbeddingResponse = InferenceTextEmbeddingInferenceResult + +export interface InferenceUpdateRequest extends RequestBase { + inference_id: Id + task_type?: InferenceTaskType + inference_config?: InferenceInferenceEndpoint +} + +export type InferenceUpdateResponse = InferenceInferenceEndpointInfo + export interface IngestAppendProcessor extends IngestProcessorBase { field: Field - value: any[] + value: any | any[] allow_duplicates?: boolean } @@ -12426,6 +13686,20 @@ export interface IngestCircleProcessor extends IngestProcessorBase { target_field?: Field } +export interface IngestCommunityIDProcessor extends IngestProcessorBase { + source_ip?: Field + source_port?: Field + destination_ip?: Field + destination_port?: Field + iana_number?: Field + icmp_type?: Field + icmp_code?: Field + transport?: Field + target_field?: Field + seed?: integer + ignore_missing?: boolean +} + export interface IngestConvertProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean @@ -12433,7 +13707,7 @@ export interface IngestConvertProcessor extends IngestProcessorBase { type: IngestConvertType } -export type IngestConvertType = 'integer' | 'long' | 'float' | 'double' | 'string' | 'boolean' | 'auto' +export type IngestConvertType = 'integer' | 'long' | 'double' | 'float' | 'boolean' | 'ip' | 'string' | 'auto' export interface IngestCsvProcessor extends IngestProcessorBase { empty_value?: any @@ -12447,7 +13721,16 @@ export interface IngestCsvProcessor extends IngestProcessorBase { export interface IngestDatabaseConfiguration { name: Name - maxmind: IngestMaxmind + maxmind?: IngestMaxmind + ipinfo?: IngestIpinfo +} + +export interface IngestDatabaseConfigurationFull { + web?: IngestWeb + local?: IngestLocal + name: Name + maxmind?: IngestMaxmind + ipinfo?: IngestIpinfo } export interface IngestDateIndexNameProcessor extends IngestProcessorBase { @@ -12466,6 +13749,7 @@ export interface IngestDateProcessor extends IngestProcessorBase { locale?: string target_field?: Field timezone?: string + output_format?: string } export interface IngestDissectProcessor extends IngestProcessorBase { @@ -12475,8 +13759,27 @@ export interface IngestDissectProcessor extends IngestProcessorBase { pattern: string } +export interface IngestDocument { + _id?: Id + _index?: IndexName + _source: any +} + +export interface IngestDocumentSimulationKeys { + _id: Id + _index: IndexName + _ingest: IngestIngest + _routing?: string + _source: Record + _version?: SpecUtilsStringified + _version_type?: VersionType +} +export type IngestDocumentSimulation = IngestDocumentSimulationKeys +& { [property: string]: string | Id | IndexName | IngestIngest | Record | SpecUtilsStringified | VersionType } + export interface IngestDotExpanderProcessor extends IngestProcessorBase { field: Field + override?: boolean path?: string } @@ -12497,12 +13800,38 @@ export interface IngestFailProcessor extends IngestProcessorBase { message: string } +export type IngestFingerprintDigest = 'MD5' | 'SHA-1' | 'SHA-256' | 'SHA-512' | 'MurmurHash3' + +export interface IngestFingerprintProcessor extends IngestProcessorBase { + fields: Fields + target_field?: Field + salt?: string + method?: IngestFingerprintDigest + ignore_missing?: boolean +} + export interface IngestForeachProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean processor: IngestProcessorContainer } +export interface IngestGeoGridProcessor extends IngestProcessorBase { + field: string + tile_type: IngestGeoGridTileType + target_field?: Field + parent_field?: Field + children_field?: Field + non_children_field?: Field + precision_field?: Field + ignore_missing?: boolean + target_format?: IngestGeoGridTargetFormat +} + +export type IngestGeoGridTargetFormat = 'geojson' | 'wkt' + +export type IngestGeoGridTileType = 'geotile' | 'geohex' | 'geohash' + export interface IngestGeoIpProcessor extends IngestProcessorBase { database_file?: string field: Field @@ -12510,13 +13839,15 @@ export interface IngestGeoIpProcessor extends IngestProcessorBase { ignore_missing?: boolean properties?: string[] target_field?: Field + download_database_on_pipeline_creation?: boolean } export interface IngestGrokProcessor extends IngestProcessorBase { + ecs_compatibility?: string field: Field ignore_missing?: boolean pattern_definitions?: Record - patterns: string[] + patterns: GrokPattern[] trace_match?: boolean } @@ -12557,6 +13888,32 @@ export interface IngestInferenceProcessor extends IngestProcessorBase { target_field?: Field field_map?: Record inference_config?: IngestInferenceConfig + input_output?: IngestInputConfig | IngestInputConfig[] + ignore_missing?: boolean +} + +export interface IngestIngest { + _redact?: IngestRedact + timestamp: DateTime + pipeline?: Name +} + +export interface IngestInputConfig { + input_field: string + output_field: string +} + +export interface IngestIpLocationProcessor extends IngestProcessorBase { + database_file?: string + field: Field + first_only?: boolean + ignore_missing?: boolean + properties?: string[] + target_field?: Field + download_database_on_pipeline_creation?: boolean +} + +export interface IngestIpinfo { } export interface IngestJoinProcessor extends IngestProcessorBase { @@ -12589,6 +13946,10 @@ export interface IngestKeyValueProcessor extends IngestProcessorBase { value_split: string } +export interface IngestLocal { + type: string +} + export interface IngestLowercaseProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean @@ -12599,11 +13960,21 @@ export interface IngestMaxmind { account_id: Id } +export interface IngestNetworkDirectionProcessor extends IngestProcessorBase { + source_ip?: Field + destination_ip?: Field + target_field?: Field + internal_networks?: string[] + internal_networks_field?: Field + ignore_missing?: boolean +} + export interface IngestPipeline { description?: string on_failure?: IngestProcessorContainer[] processors?: IngestProcessorContainer[] version?: VersionNumber + deprecated?: boolean _meta?: Metadata } @@ -12618,6 +13989,18 @@ export interface IngestPipelineProcessor extends IngestProcessorBase { ignore_missing_pipeline?: boolean } +export interface IngestPipelineProcessorResult { + doc?: IngestDocumentSimulation + tag?: string + processor_type?: string + status?: IngestPipelineSimulationStatusOptions + description?: string + ignored_error?: ErrorCause + error?: ErrorCause +} + +export type IngestPipelineSimulationStatusOptions = 'success' | 'error' | 'error_ignored' | 'skipped' | 'dropped' + export interface IngestProcessorBase { description?: string if?: string @@ -12631,6 +14014,7 @@ export interface IngestProcessorContainer { attachment?: IngestAttachmentProcessor bytes?: IngestBytesProcessor circle?: IngestCircleProcessor + community_id?: IngestCommunityIDProcessor convert?: IngestConvertProcessor csv?: IngestCsvProcessor date?: IngestDateProcessor @@ -12640,7 +14024,10 @@ export interface IngestProcessorContainer { drop?: IngestDropProcessor enrich?: IngestEnrichProcessor fail?: IngestFailProcessor + fingerprint?: IngestFingerprintProcessor foreach?: IngestForeachProcessor + ip_location?: IngestIpLocationProcessor + geo_grid?: IngestGeoGridProcessor geoip?: IngestGeoIpProcessor grok?: IngestGrokProcessor gsub?: IngestGsubProcessor @@ -12650,7 +14037,10 @@ export interface IngestProcessorContainer { json?: IngestJsonProcessor kv?: IngestKeyValueProcessor lowercase?: IngestLowercaseProcessor + network_direction?: IngestNetworkDirectionProcessor pipeline?: IngestPipelineProcessor + redact?: IngestRedactProcessor + registered_domain?: IngestRegisteredDomainProcessor remove?: IngestRemoveProcessor rename?: IngestRenameProcessor reroute?: IngestRerouteProcessor @@ -12659,6 +14049,7 @@ export interface IngestProcessorContainer { set_security_user?: IngestSetSecurityUserProcessor sort?: IngestSortProcessor split?: IngestSplitProcessor + terminate?: IngestTerminateProcessor trim?: IngestTrimProcessor uppercase?: IngestUppercaseProcessor urldecode?: IngestUrlDecodeProcessor @@ -12666,6 +14057,27 @@ export interface IngestProcessorContainer { user_agent?: IngestUserAgentProcessor } +export interface IngestRedact { + _is_redacted: boolean +} + +export interface IngestRedactProcessor extends IngestProcessorBase { + field: Field + patterns: GrokPattern[] + pattern_definitions?: Record + prefix?: string + suffix?: string + ignore_missing?: boolean + skip_if_unlicensed?: boolean + trace_redact?: boolean +} + +export interface IngestRegisteredDomainProcessor extends IngestProcessorBase { + field: Field + target_field?: Field + ignore_missing?: boolean +} + export interface IngestRemoveProcessor extends IngestProcessorBase { field: Fields keep?: Fields @@ -12707,6 +14119,12 @@ export interface IngestSetSecurityUserProcessor extends IngestProcessorBase { export type IngestShapeType = 'geo_shape' | 'shape' +export interface IngestSimulateDocumentResult { + doc?: IngestDocumentSimulation + error?: ErrorCause + processor_results?: IngestPipelineProcessorResult[] +} + export interface IngestSortProcessor extends IngestProcessorBase { field: Field order?: SortOrder @@ -12721,6 +14139,9 @@ export interface IngestSplitProcessor extends IngestProcessorBase { target_field?: Field } +export interface IngestTerminateProcessor extends IngestProcessorBase { +} + export interface IngestTrimProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean @@ -12750,12 +14171,16 @@ export interface IngestUrlDecodeProcessor extends IngestProcessorBase { export interface IngestUserAgentProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean - options?: IngestUserAgentProperty[] regex_file?: string target_field?: Field + properties?: IngestUserAgentProperty[] + extract_device_type?: boolean } -export type IngestUserAgentProperty = 'NAME' | 'MAJOR' | 'MINOR' | 'PATCH' | 'OS' | 'OS_NAME' | 'OS_MAJOR' | 'OS_MINOR' | 'DEVICE' | 'BUILD' +export type IngestUserAgentProperty = 'name' | 'os' | 'device' | 'original' | 'version' + +export interface IngestWeb { +} export interface IngestDeleteGeoipDatabaseRequest extends RequestBase { id: Ids @@ -12765,6 +14190,14 @@ export interface IngestDeleteGeoipDatabaseRequest extends RequestBase { export type IngestDeleteGeoipDatabaseResponse = AcknowledgedResponseBase +export interface IngestDeleteIpLocationDatabaseRequest extends RequestBase { + id: Ids + master_timeout?: Duration + timeout?: Duration +} + +export type IngestDeleteIpLocationDatabaseResponse = AcknowledgedResponseBase + export interface IngestDeletePipelineRequest extends RequestBase { id: Id master_timeout?: Duration @@ -12808,13 +14241,29 @@ export interface IngestGetGeoipDatabaseDatabaseConfigurationMetadata { export interface IngestGetGeoipDatabaseRequest extends RequestBase { id?: Ids - master_timeout?: Duration } export interface IngestGetGeoipDatabaseResponse { databases: IngestGetGeoipDatabaseDatabaseConfigurationMetadata[] } +export interface IngestGetIpLocationDatabaseDatabaseConfigurationMetadata { + id: Id + version: VersionNumber + modified_date_millis?: EpochTime + modified_date?: EpochTime + database: IngestDatabaseConfigurationFull +} + +export interface IngestGetIpLocationDatabaseRequest extends RequestBase { + id?: Ids + master_timeout?: Duration +} + +export interface IngestGetIpLocationDatabaseResponse { + databases: IngestGetIpLocationDatabaseDatabaseConfigurationMetadata[] +} + export interface IngestGetPipelineRequest extends RequestBase { id?: Id master_timeout?: Duration @@ -12840,6 +14289,15 @@ export interface IngestPutGeoipDatabaseRequest extends RequestBase { export type IngestPutGeoipDatabaseResponse = AcknowledgedResponseBase +export interface IngestPutIpLocationDatabaseRequest extends RequestBase { + id: Id + master_timeout?: Duration + timeout?: Duration + configuration?: IngestDatabaseConfiguration +} + +export type IngestPutIpLocationDatabaseResponse = AcknowledgedResponseBase + export interface IngestPutPipelineRequest extends RequestBase { id: Id master_timeout?: Duration @@ -12850,58 +14308,20 @@ export interface IngestPutPipelineRequest extends RequestBase { on_failure?: IngestProcessorContainer[] processors?: IngestProcessorContainer[] version?: VersionNumber + deprecated?: boolean } export type IngestPutPipelineResponse = AcknowledgedResponseBase -export interface IngestSimulateDocument { - _id?: Id - _index?: IndexName - _source: any -} - -export interface IngestSimulateDocumentSimulationKeys { - _id: Id - _index: IndexName - _ingest: IngestSimulateIngest - _routing?: string - _source: Record - _version?: SpecUtilsStringified - _version_type?: VersionType -} -export type IngestSimulateDocumentSimulation = IngestSimulateDocumentSimulationKeys -& { [property: string]: string | Id | IndexName | IngestSimulateIngest | Record | SpecUtilsStringified | VersionType } - -export interface IngestSimulateIngest { - timestamp: DateTime - pipeline?: Name -} - -export interface IngestSimulatePipelineSimulation { - doc?: IngestSimulateDocumentSimulation - tag?: string - processor_type?: string - status?: WatcherActionStatusOptions - description?: string - ignored_error?: ErrorCause - error?: ErrorCause -} - export interface IngestSimulateRequest extends RequestBase { id?: Id verbose?: boolean - docs: IngestSimulateDocument[] + docs: IngestDocument[] pipeline?: IngestPipeline } export interface IngestSimulateResponse { - docs: IngestSimulateSimulateDocumentResult[] -} - -export interface IngestSimulateSimulateDocumentResult { - doc?: IngestSimulateDocumentSimulation - error?: ErrorCause - processor_results?: IngestSimulatePipelineSimulation[] + docs: IngestSimulateDocumentResult[] } export interface LicenseLicense { @@ -12922,6 +14342,8 @@ export type LicenseLicenseStatus = 'active' | 'valid' | 'invalid' | 'expired' export type LicenseLicenseType = 'missing' | 'trial' | 'basic' | 'standard' | 'dev' | 'silver' | 'gold' | 'platinum' | 'enterprise' export interface LicenseDeleteRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export type LicenseDeleteResponse = AcknowledgedResponseBase @@ -12971,6 +14393,8 @@ export interface LicensePostAcknowledgement { export interface LicensePostRequest extends RequestBase { acknowledge?: boolean + master_timeout?: Duration + timeout?: Duration license?: LicenseLicense licenses?: LicenseLicense[] } @@ -12983,6 +14407,8 @@ export interface LicensePostResponse { export interface LicensePostStartBasicRequest extends RequestBase { acknowledge?: boolean + master_timeout?: Duration + timeout?: Duration } export interface LicensePostStartBasicResponse { @@ -12996,6 +14422,7 @@ export interface LicensePostStartBasicResponse { export interface LicensePostStartTrialRequest extends RequestBase { acknowledge?: boolean type_query_string?: string + master_timeout?: Duration } export interface LicensePostStartTrialResponse { @@ -13008,10 +14435,10 @@ export interface LicensePostStartTrialResponse { export interface LogstashPipeline { description: string last_modified: DateTime - pipeline_metadata: LogstashPipelineMetadata - username: string pipeline: string + pipeline_metadata: LogstashPipelineMetadata pipeline_settings: LogstashPipelineSettings + username: string } export interface LogstashPipelineMetadata { @@ -13049,10 +14476,12 @@ export interface LogstashPutPipelineRequest extends RequestBase { export type LogstashPutPipelineResponse = boolean export interface MigrationDeprecationsDeprecation { - details: string + details?: string level: MigrationDeprecationsDeprecationLevel message: string url: string + resolve_during_rolling_upgrade: boolean + _meta?: Record } export type MigrationDeprecationsDeprecationLevel = 'none' | 'info' | 'warning' | 'critical' @@ -13064,8 +14493,11 @@ export interface MigrationDeprecationsRequest extends RequestBase { export interface MigrationDeprecationsResponse { cluster_settings: MigrationDeprecationsDeprecation[] index_settings: Record + data_streams: Record node_settings: MigrationDeprecationsDeprecation[] ml_settings: MigrationDeprecationsDeprecation[] + templates: Record + ilm_policies: Record } export interface MigrationGetFeatureUpgradeStatusMigrationFeature { @@ -13103,6 +14535,12 @@ export interface MigrationPostFeatureUpgradeResponse { features: MigrationPostFeatureUpgradeMigrationFeature[] } +export interface MlAdaptiveAllocationsSettings { + enabled: boolean + min_number_of_allocations?: integer + max_number_of_allocations?: integer +} + export interface MlAnalysisConfig { bucket_span?: Duration categorization_analyzer?: MlCategorizationAnalyzer @@ -13133,7 +14571,7 @@ export interface MlAnalysisConfigRead { export interface MlAnalysisLimits { categorization_examples_limit?: long - model_memory_limit?: string + model_memory_limit?: ByteSize } export interface MlAnalysisMemoryLimit { @@ -13168,20 +14606,21 @@ export interface MlAnomaly { } export interface MlAnomalyCause { - actual: double[] - by_field_name: Name - by_field_value: string - correlated_by_field_value: string - field_name: Field - function: string - function_description: string - influencers: MlInfluence[] - over_field_name: Name - over_field_value: string - partition_field_name: string - partition_field_value: string + actual?: double[] + by_field_name?: Name + by_field_value?: string + correlated_by_field_value?: string + field_name?: Field + function?: string + function_description?: string + geo_results?: MlGeoResults + influencers?: MlInfluence[] + over_field_name?: Name + over_field_value?: string + partition_field_name?: string + partition_field_value?: string probability: double - typical: double[] + typical?: double[] } export interface MlAnomalyExplanation { @@ -13253,7 +14692,7 @@ export type MlCategorizationStatus = 'ok' | 'warn' export interface MlCategory { category_id: ulong examples: string[] - grok_pattern?: string + grok_pattern?: GrokPattern job_id: Id max_matching_length: ulong partition_field_name?: string @@ -13282,6 +14721,14 @@ export interface MlClassificationInferenceOptions { top_classes_results_field?: string } +export interface MlCommonTokenizationConfig { + do_lower_case?: boolean + max_sequence_length?: integer + span?: integer + truncate?: MlTokenizationTruncate + with_special_tokens?: boolean +} + export type MlConditionOperator = 'gt' | 'gte' | 'lt' | 'lte' export type MlCustomSettings = any @@ -13371,15 +14818,16 @@ export type MlDatafeedState = 'started' | 'stopped' | 'starting' | 'stopping' export interface MlDatafeedStats { assignment_explanation?: string datafeed_id: Id - node?: MlDiscoveryNode + node?: MlDiscoveryNodeCompact state: MlDatafeedState - timing_stats: MlDatafeedTimingStats + timing_stats?: MlDatafeedTimingStats running_state?: MlDatafeedRunningState } export interface MlDatafeedTimingStats { bucket_count: long exponential_average_search_time_per_hour_ms: DurationValue + exponential_average_calculation_context?: MlExponentialAverageCalculationContext job_id: Id search_count: long total_search_time_ms: DurationValue @@ -13571,6 +15019,7 @@ export interface MlDataframeAnalyticsSummary { model_memory_limit?: string source: MlDataframeAnalyticsSource version?: VersionString + _meta?: Metadata } export interface MlDataframeEvaluationClassification { @@ -13642,9 +15091,7 @@ export interface MlDelayedDataCheckConfig { export type MlDeploymentAllocationState = 'started' | 'starting' | 'fully_allocated' -export type MlDeploymentAssignmentState = 'starting' | 'started' | 'stopping' | 'failed' - -export type MlDeploymentState = 'started' | 'starting' | 'stopping' +export type MlDeploymentAssignmentState = 'started' | 'starting' | 'stopping' | 'failed' export interface MlDetectionRule { actions?: MlRuleAction[] @@ -13678,21 +15125,50 @@ export interface MlDetectorRead { use_null?: boolean } -export interface MlDiscoveryNode { - attributes: Record +export interface MlDetectorUpdate { + detector_index: integer + description?: string + custom_rules?: MlDetectionRule[] +} + +export type MlDiscoveryNode = Partial> + +export interface MlDiscoveryNodeCompact { + name: Name ephemeral_id: Id id: Id - name: Name transport_address: TransportAddress + attributes: Record +} + +export interface MlDiscoveryNodeContent { + name?: Name + ephemeral_id: Id + transport_address: TransportAddress + external_id: string + attributes: Record + roles: string[] + version: VersionString + min_index_version: integer + max_index_version: integer } export type MlExcludeFrequent = 'all' | 'none' | 'by' | 'over' +export interface MlExponentialAverageCalculationContext { + incremental_metric_value_ms: DurationValue + latest_timestamp?: EpochTime + previous_exponential_average_ms?: DurationValue +} + +export type MlFeatureExtractor = MlQueryFeatureExtractor + export interface MlFillMaskInferenceOptions { mask_token?: string num_top_classes?: integer tokenization?: MlTokenizationConfigContainer results_field?: string + vocabulary: MlVocabulary } export interface MlFillMaskInferenceUpdateOptions { @@ -13715,8 +15191,8 @@ export interface MlFilterRef { export type MlFilterType = 'include' | 'exclude' export interface MlGeoResults { - actual_point: string - typical_point: string + actual_point?: string + typical_point?: string } export interface MlHyperparameter { @@ -13752,6 +15228,7 @@ export interface MlInferenceConfigCreateContainer { text_classification?: MlTextClassificationInferenceOptions zero_shot_classification?: MlZeroShotClassificationInferenceOptions fill_mask?: MlFillMaskInferenceOptions + learning_to_rank?: MlLearningToRankConfig ner?: MlNerInferenceOptions pass_through?: MlPassThroughInferenceOptions text_embedding?: MlTextEmbeddingInferenceOptions @@ -13880,7 +15357,7 @@ export interface MlJobStats { forecasts_stats: MlJobForecastStatistics job_id: string model_size_stats: MlModelSizeStats - node?: MlDiscoveryNode + node?: MlDiscoveryNodeCompact open_time?: DateTime state: MlJobState timing_stats: MlJobTimingStats @@ -13898,8 +15375,31 @@ export interface MlJobTimingStats { minimum_bucket_processing_time_ms?: DurationValue } +export interface MlLearningToRankConfig { + default_params?: Record + feature_extractors?: Record[] + num_top_feature_importance_values: integer +} + export type MlMemoryStatus = 'ok' | 'soft_limit' | 'hard_limit' +export interface MlModelPackageConfig { + create_time?: EpochTime + description?: string + inference_config?: Record + metadata?: Metadata + minimum_version?: string + model_repository?: string + model_type?: string + packaged_model_id: Id + platform_architecture?: string + prefix_strings?: MlTrainedModelPrefixStrings + size?: ByteSize + sha256?: string + tags?: string[] + vocabulary_file?: string +} + export interface MlModelPlotConfig { annotations_enabled?: boolean enabled?: boolean @@ -13914,6 +15414,7 @@ export interface MlModelSizeStats { model_bytes: ByteSize model_bytes_exceeded?: ByteSize model_bytes_memory_limit?: ByteSize + output_memory_allocator_bytes?: ByteSize peak_model_bytes?: ByteSize assignment_memory_basis?: string result_type: string @@ -13963,20 +15464,11 @@ export interface MlNerInferenceUpdateOptions { results_field?: string } -export interface MlNlpBertTokenizationConfig { - do_lower_case?: boolean - with_special_tokens?: boolean - max_sequence_length?: integer - truncate?: MlTokenizationTruncate - span?: integer +export interface MlNlpBertTokenizationConfig extends MlCommonTokenizationConfig { } -export interface MlNlpRobertaTokenizationConfig { +export interface MlNlpRobertaTokenizationConfig extends MlCommonTokenizationConfig { add_prefix_space?: boolean - with_special_tokens?: boolean - max_sequence_length?: integer - truncate?: MlTokenizationTruncate - span?: integer } export interface MlNlpTokenizationUpdateOptions { @@ -14000,7 +15492,7 @@ export interface MlOverallBucket { overall_score: double result_type: string timestamp: EpochTime - timestamp_string: DateTime + timestamp_string?: DateTime } export interface MlOverallBucketJob { @@ -14031,6 +15523,12 @@ export interface MlPerPartitionCategorization { export type MlPredictedValue = ScalarValue | ScalarValue[] +export interface MlQueryFeatureExtractor { + default_score?: float + feature_name: string + query: QueryDslQueryContainer +} + export interface MlQuestionAnsweringInferenceOptions { num_top_classes?: integer tokenization?: MlTokenizationConfigContainer @@ -14075,6 +15573,7 @@ export interface MlTextClassificationInferenceOptions { tokenization?: MlTokenizationConfigContainer results_field?: string classification_labels?: string[] + vocabulary?: MlVocabulary } export interface MlTextClassificationInferenceUpdateOptions { @@ -14088,6 +15587,7 @@ export interface MlTextEmbeddingInferenceOptions { embedding_size?: integer tokenization?: MlTokenizationConfigContainer results_field?: string + vocabulary: MlVocabulary } export interface MlTextEmbeddingInferenceUpdateOptions { @@ -14098,6 +15598,7 @@ export interface MlTextEmbeddingInferenceUpdateOptions { export interface MlTextExpansionInferenceOptions { tokenization?: MlTokenizationConfigContainer results_field?: string + vocabulary: MlVocabulary } export interface MlTextExpansionInferenceUpdateOptions { @@ -14112,8 +15613,10 @@ export interface MlTimingStats { export interface MlTokenizationConfigContainer { bert?: MlNlpBertTokenizationConfig + bert_ja?: MlNlpBertTokenizationConfig mpnet?: MlNlpBertTokenizationConfig roberta?: MlNlpRobertaTokenizationConfig + xlm_roberta?: MlXlmRobertaTokenizationConfig } export type MlTokenizationTruncate = 'first' | 'second' | 'none' @@ -14142,27 +15645,36 @@ export interface MlTotalFeatureImportanceStatistics { } export interface MlTrainedModelAssignment { + adaptive_allocations?: MlAdaptiveAllocationsSettings | null assignment_state: MlDeploymentAssignmentState max_assigned_allocations?: integer + reason?: string routing_table: Record start_time: DateTime task_parameters: MlTrainedModelAssignmentTaskParameters } +export interface MlTrainedModelAssignmentRoutingStateAndReason { + reason?: string + routing_state: MlRoutingState +} + export interface MlTrainedModelAssignmentRoutingTable { - reason: string + reason?: string routing_state: MlRoutingState current_allocations: integer target_allocations: integer } export interface MlTrainedModelAssignmentTaskParameters { - model_bytes: integer + model_bytes: ByteSize model_id: Id deployment_id: Id - cache_size: ByteSize + cache_size?: ByteSize number_of_allocations: integer priority: MlTrainingPriority + per_deployment_memory_bytes: ByteSize + per_allocation_memory_bytes: ByteSize queue_capacity: integer threads_per_allocation: integer } @@ -14185,7 +15697,9 @@ export interface MlTrainedModelConfig { license_level?: string metadata?: MlTrainedModelConfigMetadata model_size_bytes?: ByteSize + model_package?: MlModelPackageConfig location?: MlTrainedModelLocation + platform_architecture?: string prefix_strings?: MlTrainedModelPrefixStrings } @@ -14207,36 +15721,45 @@ export interface MlTrainedModelDeploymentAllocationStatus { } export interface MlTrainedModelDeploymentNodesStats { - average_inference_time_ms: DurationValue - error_count: integer - inference_count: integer - last_access: long - node: MlDiscoveryNode - number_of_allocations: integer - number_of_pending_requests: integer - rejection_execution_count: integer - routing_state: MlTrainedModelAssignmentRoutingTable - start_time: EpochTime - threads_per_allocation: integer - timeout_count: integer + average_inference_time_ms?: DurationValue + average_inference_time_ms_last_minute?: DurationValue + average_inference_time_ms_excluding_cache_hits?: DurationValue + error_count?: integer + inference_count?: long + inference_cache_hit_count?: long + inference_cache_hit_count_last_minute?: long + last_access?: EpochTime + node?: MlDiscoveryNode + number_of_allocations?: integer + number_of_pending_requests?: integer + peak_throughput_per_minute: long + rejected_execution_count?: integer + routing_state: MlTrainedModelAssignmentRoutingStateAndReason + start_time?: EpochTime + threads_per_allocation?: integer + throughput_last_minute: integer + timeout_count?: integer } export interface MlTrainedModelDeploymentStats { - allocation_status: MlTrainedModelDeploymentAllocationStatus + adaptive_allocations?: MlAdaptiveAllocationsSettings + allocation_status?: MlTrainedModelDeploymentAllocationStatus cache_size?: ByteSize deployment_id: Id - error_count: integer - inference_count: integer + error_count?: integer + inference_count?: integer model_id: Id nodes: MlTrainedModelDeploymentNodesStats[] - number_of_allocations: integer - queue_capacity: integer - rejected_execution_count: integer - reason: string + number_of_allocations?: integer + peak_throughput_per_minute: long + priority: MlTrainingPriority + queue_capacity?: integer + rejected_execution_count?: integer + reason?: string start_time: EpochTime - state: MlDeploymentState - threads_per_allocation: integer - timeout_count: integer + state?: MlDeploymentAssignmentState + threads_per_allocation?: integer + timeout_count?: integer } export interface MlTrainedModelEntities { @@ -14312,6 +15835,9 @@ export interface MlVocabulary { index: IndexName } +export interface MlXlmRobertaTokenizationConfig extends MlCommonTokenizationConfig { +} + export interface MlZeroShotClassificationInferenceOptions { tokenization?: MlTokenizationConfigContainer hypothesis_template?: string @@ -14430,6 +15956,7 @@ export type MlDeleteModelSnapshotResponse = AcknowledgedResponseBase export interface MlDeleteTrainedModelRequest extends RequestBase { model_id: Id force?: boolean + timeout?: Duration } export type MlDeleteTrainedModelResponse = AcknowledgedResponseBase @@ -14790,7 +16317,6 @@ export interface MlGetMemoryStatsMemory { export interface MlGetMemoryStatsRequest extends RequestBase { node_id?: Id - human?: boolean master_timeout?: Duration timeout?: Duration } @@ -14870,6 +16396,7 @@ export interface MlGetTrainedModelsRequest extends RequestBase { exclude_generated?: boolean from?: integer include?: MlInclude + include_model_definition?: boolean size?: integer tags?: string | string[] } @@ -14920,9 +16447,11 @@ export interface MlInfoDefaults { } export interface MlInfoLimits { - max_model_memory_limit?: string - effective_max_model_memory_limit: string - total_ml_memory: string + max_single_ml_node_processors?: integer + total_ml_processors?: integer + max_model_memory_limit?: ByteSize + effective_max_model_memory_limit?: ByteSize + total_ml_memory: ByteSize } export interface MlInfoNativeCode { @@ -14967,21 +16496,24 @@ export interface MlPostDataRequest extends RequestBase { } export interface MlPostDataResponse { - bucket_count: long - earliest_record_timestamp: long - empty_bucket_count: long + job_id: Id + processed_record_count: long + processed_field_count: long input_bytes: long input_field_count: long - input_record_count: long invalid_date_count: long - job_id: Id - last_data_time: integer - latest_record_timestamp: long missing_field_count: long out_of_order_timestamp_count: long - processed_field_count: long - processed_record_count: long + empty_bucket_count: long sparse_bucket_count: long + bucket_count: long + earliest_record_timestamp?: EpochTime + latest_record_timestamp?: EpochTime + last_data_time?: EpochTime + latest_empty_bucket_timestamp?: EpochTime + latest_sparse_bucket_timestamp?: EpochTime + input_record_count: long + log_time?: EpochTime } export interface MlPreviewDataFrameAnalyticsDataframePreviewConfig { @@ -15042,6 +16574,7 @@ export interface MlPutDataFrameAnalyticsRequest extends RequestBase { description?: string dest: MlDataframeAnalyticsDestination max_num_threads?: integer + _meta?: Metadata model_memory_limit?: string source: MlDataframeAnalyticsSource headers?: HttpHeaders @@ -15058,6 +16591,7 @@ export interface MlPutDataFrameAnalyticsResponse { dest: MlDataframeAnalyticsDestination id: Id max_num_threads: integer + _meta?: Metadata model_memory_limit: string source: MlDataframeAnalyticsSource version: VersionString @@ -15070,6 +16604,8 @@ export interface MlPutDatafeedRequest extends RequestBase { ignore_throttled?: boolean ignore_unavailable?: boolean aggregations?: Record + /** @alias aggregations */ + aggs?: Record chunking_config?: MlChunkingConfig delayed_data_check_config?: MlDelayedDataCheckConfig frequency?: Duration @@ -15119,6 +16655,10 @@ export interface MlPutFilterResponse { export interface MlPutJobRequest extends RequestBase { job_id: Id + allow_no_indices?: boolean + expand_wildcards?: ExpandWildcards + ignore_throttled?: boolean + ignore_unavailable?: boolean allow_lazy_open?: boolean analysis_config: MlAnalysisConfig analysis_limits?: MlAnalysisLimits @@ -15339,6 +16879,7 @@ export interface MlStartTrainedModelDeploymentRequest extends RequestBase { threads_per_allocation?: integer timeout?: Duration wait_for?: MlDeploymentAllocationState + adaptive_allocations?: MlAdaptiveAllocationsSettings } export interface MlStartTrainedModelDeploymentResponse { @@ -15469,7 +17010,7 @@ export interface MlUpdateJobRequest extends RequestBase { renormalization_window_days?: long results_retention_days?: long groups?: string[] - detectors?: MlDetector[] + detectors?: MlDetectorUpdate[] per_partition_categorization?: MlPerPartitionCategorization } @@ -15512,6 +17053,7 @@ export interface MlUpdateModelSnapshotResponse { export interface MlUpdateTrainedModelDeploymentRequest extends RequestBase { model_id: Id number_of_allocations?: integer + adaptive_allocations?: MlAdaptiveAllocationsSettings } export interface MlUpdateTrainedModelDeploymentResponse { @@ -15736,6 +17278,25 @@ export interface NodesHttp { current_open?: integer total_opened?: long clients?: NodesClient[] + routes: Record +} + +export interface NodesHttpRoute { + requests: NodesHttpRouteRequests + responses: NodesHttpRouteResponses +} + +export interface NodesHttpRouteRequests { + count: long + total_size_in_bytes: long + size_histogram: NodesSizeHttpHistogram[] +} + +export interface NodesHttpRouteResponses { + count: long + total_size_in_bytes: long + handling_time_histogram: NodesTimeHttpHistogram[] + size_histogram: NodesSizeHttpHistogram[] } export interface NodesIndexingPressure { @@ -15750,16 +17311,25 @@ export interface NodesIndexingPressureMemory { } export interface NodesIngest { - pipelines?: Record + pipelines?: Record total?: NodesIngestTotal } +export interface NodesIngestStats { + count: long + current: long + failed: long + processors: Record[] + time_in_millis: DurationValue + ingested_as_first_pipeline_in_bytes: long + produced_as_first_pipeline_in_bytes: long +} + export interface NodesIngestTotal { - count?: long - current?: long - failed?: long - processors?: Record[] - time_in_millis?: DurationValue + count: long + current: long + failed: long + time_in_millis: DurationValue } export interface NodesIoStatDevice { @@ -15834,13 +17404,11 @@ export interface NodesNodeBufferPool { used_in_bytes?: long } -export interface NodesNodeReloadError { +export interface NodesNodeReloadResult { name: Name reload_exception?: ErrorCause } -export type NodesNodeReloadResult = NodesStats | NodesNodeReloadError - export interface NodesNodesResponseBase { _nodes?: NodeStatistics } @@ -15964,6 +17532,12 @@ export interface NodesSerializedClusterStateDetail { compressed_size_in_bytes?: long } +export interface NodesSizeHttpHistogram { + count: long + ge_bytes?: long + lt_bytes?: long +} + export interface NodesStats { adaptive_selection?: Record breakers?: Record @@ -15998,6 +17572,12 @@ export interface NodesThreadCount { threads?: long } +export interface NodesTimeHttpHistogram { + count: long + ge_millis?: long + lt_millis?: long +} + export interface NodesTransport { inbound_handling_time_histogram?: NodesTransportHistogram[] outbound_handling_time_histogram?: NodesTransportHistogram[] @@ -16045,7 +17625,6 @@ export interface NodesHotThreadsRequest extends RequestBase { ignore_idle_threads?: boolean interval?: Duration snapshots?: long - master_timeout?: Duration threads?: long timeout?: Duration type?: ThreadType @@ -16177,7 +17756,7 @@ export interface NodesInfoNodeInfoPath { logs?: string home?: string repo?: string[] - data?: string[] + data?: string | string[] } export interface NodesInfoNodeInfoRepositories { @@ -16280,7 +17859,7 @@ export interface NodesInfoNodeInfoSettingsIngest { } export interface NodesInfoNodeInfoSettingsNetwork { - host?: Host + host?: Host | Host[] } export interface NodesInfoNodeInfoSettingsNode { @@ -16313,6 +17892,7 @@ export interface NodesInfoNodeInfoXpack { license?: NodesInfoNodeInfoXpackLicense security: NodesInfoNodeInfoXpackSecurity notification?: Record + ml?: NodesInfoNodeInfoXpackMl } export interface NodesInfoNodeInfoXpackLicense { @@ -16323,16 +17903,20 @@ export interface NodesInfoNodeInfoXpackLicenseType { type: string } +export interface NodesInfoNodeInfoXpackMl { + use_auto_machine_memory_percent?: boolean +} + export interface NodesInfoNodeInfoXpackSecurity { - http: NodesInfoNodeInfoXpackSecuritySsl + http?: NodesInfoNodeInfoXpackSecuritySsl enabled: string transport?: NodesInfoNodeInfoXpackSecuritySsl authc?: NodesInfoNodeInfoXpackSecurityAuthc } export interface NodesInfoNodeInfoXpackSecurityAuthc { - realms: NodesInfoNodeInfoXpackSecurityAuthcRealms - token: NodesInfoNodeInfoXpackSecurityAuthcToken + realms?: NodesInfoNodeInfoXpackSecurityAuthcRealms + token?: NodesInfoNodeInfoXpackSecurityAuthcToken } export interface NodesInfoNodeInfoXpackSecurityAuthcRealms { @@ -16402,7 +17986,6 @@ export interface NodesInfoRequest extends RequestBase { node_id?: NodeIds metric?: Metrics flat_settings?: boolean - master_timeout?: Duration timeout?: Duration } @@ -16436,7 +18019,6 @@ export interface NodesStatsRequest extends RequestBase { groups?: boolean include_segment_file_sizes?: boolean level?: Level - master_timeout?: Duration timeout?: Duration types?: string[] include_unloaded_segments?: boolean @@ -16527,6 +18109,7 @@ export interface QueryRulesListRulesetsQueryRulesetListItem { ruleset_id: Id rule_total_count: integer rule_criteria_types_counts: Record + rule_type_counts: Record } export interface QueryRulesListRulesetsRequest extends RequestBase { @@ -16561,6 +18144,21 @@ export interface QueryRulesPutRulesetResponse { result: Result } +export interface QueryRulesTestQueryRulesetMatchedRule { + ruleset_id: Id + rule_id: Id +} + +export interface QueryRulesTestRequest extends RequestBase { + ruleset_id: Id + match_criteria: Record +} + +export interface QueryRulesTestResponse { + total_matched_rules: integer + matched_rules: QueryRulesTestQueryRulesetMatchedRule[] +} + export interface RollupDateHistogramGrouping { delay?: Duration field: Field @@ -16756,10 +18354,15 @@ export interface SearchApplicationEventDataStream { name: IndexName } -export interface SearchApplicationSearchApplication { +export type SearchApplicationEventType = 'page_view' | 'search' | 'search_click' + +export interface SearchApplicationSearchApplication extends SearchApplicationSearchApplicationParameters { name: Name - indices: IndexName[] updated_at_millis: EpochTime +} + +export interface SearchApplicationSearchApplicationParameters { + indices: IndexName[] analytics_collection_name?: Name template?: SearchApplicationSearchApplicationTemplate } @@ -16800,20 +18403,25 @@ export interface SearchApplicationListRequest extends RequestBase { export interface SearchApplicationListResponse { count: long - results: SearchApplicationListSearchApplicationListItem[] + results: SearchApplicationSearchApplication[] } -export interface SearchApplicationListSearchApplicationListItem { - name: Name - indices: IndexName[] - updated_at_millis: EpochTime - analytics_collection_name?: Name +export interface SearchApplicationPostBehavioralAnalyticsEventRequest extends RequestBase { + collection_name: Name + event_type: SearchApplicationEventType + debug?: boolean + payload?: any +} + +export interface SearchApplicationPostBehavioralAnalyticsEventResponse { + accepted: boolean + event?: any } export interface SearchApplicationPutRequest extends RequestBase { name: Name create?: boolean - search_application?: SearchApplicationSearchApplication + search_application?: SearchApplicationSearchApplicationParameters } export interface SearchApplicationPutResponse { @@ -16830,6 +18438,14 @@ export interface SearchApplicationPutBehavioralAnalyticsRequest extends RequestB export type SearchApplicationPutBehavioralAnalyticsResponse = SearchApplicationPutBehavioralAnalyticsAnalyticsAcknowledgeResponseBase +export interface SearchApplicationRenderQueryRequest extends RequestBase { + name: Name + params?: Record +} + +export interface SearchApplicationRenderQueryResponse { +} + export interface SearchApplicationSearchRequest extends RequestBase { name: Name typed_keys?: boolean @@ -16869,8 +18485,6 @@ export interface SearchableSnapshotsClearCacheRequest extends RequestBase { expand_wildcards?: ExpandWildcards allow_no_indices?: boolean ignore_unavailable?: boolean - pretty?: boolean - human?: boolean } export type SearchableSnapshotsClearCacheResponse = any @@ -16907,22 +18521,32 @@ export interface SearchableSnapshotsStatsResponse { total: any } +export interface SecurityAccess { + replication?: SecurityReplicationAccess[] + search?: SecuritySearchAccess[] +} + export interface SecurityApiKey { - creation?: long - expiration?: long id: Id - invalidated?: boolean name: Name - realm?: string + type: SecurityApiKeyType + creation: EpochTime + expiration?: EpochTime + invalidated: boolean + invalidation?: EpochTime + username: Username + realm: string realm_type?: string - username?: Username - profile_uid?: string - metadata?: Metadata + metadata: Metadata role_descriptors?: Record limited_by?: Record[] + access?: SecurityAccess + profile_uid?: string _sort?: SortResults } +export type SecurityApiKeyType = 'rest' | 'cross_cluster' + export interface SecurityApplicationGlobalUserPrivileges { manage: SecurityManageUserPrivileges } @@ -16942,7 +18566,7 @@ export interface SecurityClusterNode { name: Name } -export type SecurityClusterPrivilege = 'all' | 'cancel_task' | 'create_snapshot' | 'cross_cluster_replication' | 'cross_cluster_search' | 'delegate_pki' | 'grant_api_key' | 'manage' | 'manage_api_key' | 'manage_autoscaling' | 'manage_behavioral_analytics' | 'manage_ccr' | 'manage_data_frame_transforms' | 'manage_data_stream_global_retention' | 'manage_enrich' | 'manage_ilm' | 'manage_index_templates' | 'manage_inference' | 'manage_ingest_pipelines' | 'manage_logstash_pipelines' | 'manage_ml' | 'manage_oidc' | 'manage_own_api_key' | 'manage_pipeline' | 'manage_rollup' | 'manage_saml' | 'manage_search_application' | 'manage_search_query_rules' | 'manage_search_synonyms' | 'manage_security' | 'manage_service_account' | 'manage_slm' | 'manage_token' | 'manage_transform' | 'manage_user_profile' | 'manage_watcher' | 'monitor' | 'monitor_data_frame_transforms' | 'monitor_data_stream_global_retention' | 'monitor_enrich' | 'monitor_inference' | 'monitor_ml' | 'monitor_rollup' | 'monitor_snapshot' | 'monitor_text_structure' | 'monitor_transform' | 'monitor_watcher' | 'none' | 'post_behavioral_analytics_event' | 'read_ccr' | 'read_fleet_secrets' | 'read_ilm' | 'read_pipeline' | 'read_security' | 'read_slm' | 'transport_client' | 'write_connector_secrets' | 'write_fleet_secrets' | string +export type SecurityClusterPrivilege = 'all' | 'cancel_task' | 'create_snapshot' | 'cross_cluster_replication' | 'cross_cluster_search' | 'delegate_pki' | 'grant_api_key' | 'manage' | 'manage_api_key' | 'manage_autoscaling' | 'manage_behavioral_analytics' | 'manage_ccr' | 'manage_data_frame_transforms' | 'manage_data_stream_global_retention' | 'manage_enrich' | 'manage_ilm' | 'manage_index_templates' | 'manage_inference' | 'manage_ingest_pipelines' | 'manage_logstash_pipelines' | 'manage_ml' | 'manage_oidc' | 'manage_own_api_key' | 'manage_pipeline' | 'manage_rollup' | 'manage_saml' | 'manage_search_application' | 'manage_search_query_rules' | 'manage_search_synonyms' | 'manage_security' | 'manage_service_account' | 'manage_slm' | 'manage_token' | 'manage_transform' | 'manage_user_profile' | 'manage_watcher' | 'monitor' | 'monitor_data_frame_transforms' | 'monitor_data_stream_global_retention' | 'monitor_enrich' | 'monitor_inference' | 'monitor_ml' | 'monitor_rollup' | 'monitor_snapshot' | 'monitor_stats' | 'monitor_text_structure' | 'monitor_transform' | 'monitor_watcher' | 'none' | 'post_behavioral_analytics_event' | 'read_ccr' | 'read_fleet_secrets' | 'read_ilm' | 'read_pipeline' | 'read_security' | 'read_slm' | 'transport_client' | 'write_connector_secrets' | 'write_fleet_secrets' | string export interface SecurityCreatedStatus { created: boolean @@ -16969,7 +18593,7 @@ export type SecurityIndexPrivilege = 'all' | 'auto_configure' | 'create' | 'crea export interface SecurityIndicesPrivileges { field_security?: SecurityFieldSecurity - names: Indices + names: IndexName[] privileges: SecurityIndexPrivilege[] query?: SecurityIndicesPrivilegesQuery allow_restricted_indices?: boolean @@ -16986,15 +18610,54 @@ export interface SecurityRealmInfo { type: string } +export type SecurityRemoteClusterPrivilege = 'monitor_enrich' | 'monitor_stats' + +export interface SecurityRemoteClusterPrivileges { + clusters: Names + privileges: SecurityRemoteClusterPrivilege[] +} + +export interface SecurityRemoteIndicesPrivileges { + clusters: Names + field_security?: SecurityFieldSecurity + names: IndexName[] + privileges: SecurityIndexPrivilege[] + query?: SecurityIndicesPrivilegesQuery + allow_restricted_indices?: boolean +} + +export interface SecurityRemoteUserIndicesPrivileges { + field_security?: SecurityFieldSecurity[] + names: IndexName | IndexName[] + privileges: SecurityIndexPrivilege[] + query?: SecurityIndicesPrivilegesQuery[] + allow_restricted_indices: boolean + clusters: string[] +} + +export interface SecurityReplicationAccess { + names: IndexName | IndexName[] + allow_restricted_indices?: boolean +} + +export interface SecurityRestriction { + workflows: SecurityRestrictionWorkflow[] +} + +export type SecurityRestrictionWorkflow = 'search_application_query' | string + export interface SecurityRoleDescriptor { cluster?: SecurityClusterPrivilege[] indices?: SecurityIndicesPrivileges[] index?: SecurityIndicesPrivileges[] + remote_indices?: SecurityRemoteIndicesPrivileges[] + remote_cluster?: SecurityRemoteClusterPrivileges[] global?: SecurityGlobalPrivilege[] | SecurityGlobalPrivilege applications?: SecurityApplicationPrivileges[] metadata?: Metadata run_as?: string[] description?: string + restriction?: SecurityRestriction transient_metadata?: Record } @@ -17002,11 +18665,14 @@ export interface SecurityRoleDescriptorRead { cluster: SecurityClusterPrivilege[] indices: SecurityIndicesPrivileges[] index: SecurityIndicesPrivileges[] + remote_indices?: SecurityRemoteIndicesPrivileges[] + remote_cluster?: SecurityRemoteClusterPrivileges[] global?: SecurityGlobalPrivilege[] | SecurityGlobalPrivilege applications?: SecurityApplicationPrivileges[] metadata?: Metadata run_as?: string[] description?: string + restriction?: SecurityRestriction transient_metadata?: Record } @@ -17044,6 +18710,17 @@ export interface SecurityRoleTemplateScript { options?: Record } +export interface SecuritySearchAccess { + field_security?: SecurityFieldSecurity + names: IndexName | IndexName[] + query?: SecurityIndicesPrivilegesQuery + allow_restricted_indices?: boolean +} + +export interface SecuritySecuritySettings { + index?: IndicesIndexSettings +} + export type SecurityTemplateFormat = 'string' | 'json' export interface SecurityUser { @@ -17058,7 +18735,7 @@ export interface SecurityUser { export interface SecurityUserIndicesPrivileges { field_security?: SecurityFieldSecurity[] - names: Indices + names: IndexName[] privileges: SecurityIndexPrivilege[] query?: SecurityIndicesPrivilegesQuery[] allow_restricted_indices: boolean @@ -17102,11 +18779,16 @@ export interface SecurityActivateUserProfileRequest extends RequestBase { export type SecurityActivateUserProfileResponse = SecurityUserProfileWithMetadata +export interface SecurityAuthenticateAuthenticateApiKey { + id: Id + name?: Name +} + export interface SecurityAuthenticateRequest extends RequestBase { } export interface SecurityAuthenticateResponse { - api_key?: SecurityApiKey + api_key?: SecurityAuthenticateAuthenticateApiKey authentication_realm: SecurityRealmInfo email?: string | null full_name?: Name | null @@ -17147,6 +18829,19 @@ export interface SecurityBulkPutRoleResponse { errors?: SecurityBulkError } +export interface SecurityBulkUpdateApiKeysRequest extends RequestBase { + expiration?: Duration + ids: string | string[] + metadata?: Metadata + role_descriptors?: Record +} + +export interface SecurityBulkUpdateApiKeysResponse { + errors?: SecurityBulkError + noops: string[] + updated: string[] +} + export interface SecurityChangePasswordRequest extends RequestBase { username?: Username refresh?: Refresh @@ -17218,9 +18913,24 @@ export interface SecurityCreateApiKeyRequest extends RequestBase { metadata?: Metadata } -export interface SecurityCreateApiKeyResponse { +export interface SecurityCreateApiKeyResponse { + api_key: string + expiration?: long + id: Id + name: Name + encoded: string +} + +export interface SecurityCreateCrossClusterApiKeyRequest extends RequestBase { + access: SecurityAccess + expiration?: Duration + metadata?: Metadata + name: Name +} + +export interface SecurityCreateCrossClusterApiKeyResponse { api_key: string - expiration?: long + expiration?: DurationValue id: Id name: Name encoded: string @@ -17243,6 +18953,37 @@ export interface SecurityCreateServiceTokenToken { value: string } +export interface SecurityDelegatePkiAuthentication { + username: string + roles: string[] + full_name: string | null + email: string | null + token?: Record + metadata: Metadata + enabled: boolean + authentication_realm: SecurityDelegatePkiAuthenticationRealm + lookup_realm: SecurityDelegatePkiAuthenticationRealm + authentication_type: string + api_key?: Record +} + +export interface SecurityDelegatePkiAuthenticationRealm { + name: string + type: string + domain?: string +} + +export interface SecurityDelegatePkiRequest extends RequestBase { + x509_certificate_chain: string[] +} + +export interface SecurityDelegatePkiResponse { + access_token: string + expires_in: long + type: string + authentication?: SecurityDelegatePkiAuthentication +} + export interface SecurityDeletePrivilegesFoundStatus { found: boolean } @@ -17367,8 +19108,9 @@ export interface SecurityGetBuiltinPrivilegesRequest extends RequestBase { } export interface SecurityGetBuiltinPrivilegesResponse { - cluster: string[] - index: Indices + cluster: SecurityClusterPrivilege[] + index: IndexName[] + remote_cluster: SecurityRemoteClusterPrivilege[] } export interface SecurityGetPrivilegesRequest extends RequestBase { @@ -17385,10 +19127,13 @@ export interface SecurityGetRoleRequest extends RequestBase { export type SecurityGetRoleResponse = Record export interface SecurityGetRoleRole { - cluster: string[] + cluster: SecurityClusterPrivilege[] indices: SecurityIndicesPrivileges[] + remote_indices?: SecurityRemoteIndicesPrivileges[] + remote_cluster?: SecurityRemoteClusterPrivileges[] metadata: Metadata - run_as: string[] + description?: string + run_as?: string[] transient_metadata?: Record applications: SecurityApplicationPrivileges[] role_templates?: SecurityRoleTemplate[] @@ -17433,6 +19178,16 @@ export interface SecurityGetServiceCredentialsResponse { nodes_credentials: SecurityGetServiceCredentialsNodesCredentials } +export interface SecurityGetSettingsRequest extends RequestBase { + master_timeout?: Duration +} + +export interface SecurityGetSettingsResponse { + security: SecuritySecuritySettings + 'security-profile': SecuritySecuritySettings + 'security-tokens': SecuritySecuritySettings +} + export type SecurityGetTokenAccessTokenGrantType = 'password' | 'client_credentials' | '_kerberos' | 'refresh_token' export interface SecurityGetTokenAuthenticatedUser extends SecurityUser { @@ -17487,8 +19242,10 @@ export interface SecurityGetUserPrivilegesRequest extends RequestBase { export interface SecurityGetUserPrivilegesResponse { applications: SecurityApplicationPrivileges[] cluster: string[] + remote_cluster?: SecurityRemoteClusterPrivileges[] global: SecurityGlobalPrivilege[] indices: SecurityUserIndicesPrivileges[] + remote_indices?: SecurityRemoteUserIndicesPrivileges[] run_as: string[] } @@ -17617,6 +19374,44 @@ export interface SecurityInvalidateTokenResponse { previously_invalidated_tokens: long } +export interface SecurityOidcAuthenticateRequest extends RequestBase { + nonce: string + realm?: string + redirect_uri: string + state: string +} + +export interface SecurityOidcAuthenticateResponse { + access_token: string + expires_in: integer + refresh_token: string + type: string +} + +export interface SecurityOidcLogoutRequest extends RequestBase { + token: string + refresh_token?: string +} + +export interface SecurityOidcLogoutResponse { + redirect: string +} + +export interface SecurityOidcPrepareAuthenticationRequest extends RequestBase { + iss?: string + login_hint?: string + nonce?: string + realm?: string + state?: string +} + +export interface SecurityOidcPrepareAuthenticationResponse { + nonce: string + realm: string + redirect: string + state: string +} + export interface SecurityPutPrivilegesActions { actions: string[] application?: string @@ -17638,6 +19433,8 @@ export interface SecurityPutRoleRequest extends RequestBase { cluster?: SecurityClusterPrivilege[] global?: Record indices?: SecurityIndicesPrivileges[] + remote_indices?: SecurityRemoteIndicesPrivileges[] + remote_cluster?: SecurityRemoteClusterPrivileges[] metadata?: Metadata run_as?: string[] description?: string @@ -17903,6 +19700,29 @@ export interface SecurityUpdateApiKeyResponse { updated: boolean } +export interface SecurityUpdateCrossClusterApiKeyRequest extends RequestBase { + id: Id + access: SecurityAccess + expiration?: Duration + metadata?: Metadata +} + +export interface SecurityUpdateCrossClusterApiKeyResponse { + updated: boolean +} + +export interface SecurityUpdateSettingsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration + security?: SecuritySecuritySettings + 'security-profile'?: SecuritySecuritySettings + 'security-tokens'?: SecuritySecuritySettings +} + +export interface SecurityUpdateSettingsResponse { + acknowledged: boolean +} + export interface SecurityUpdateUserProfileDataRequest extends RequestBase { uid: SecurityUserProfileId if_seq_no?: SequenceNumber @@ -17946,7 +19766,6 @@ export interface ShutdownGetNodePluginsStatus { export interface ShutdownGetNodeRequest extends RequestBase { node_id?: NodeIds master_timeout?: TimeUnit - timeout?: TimeUnit } export interface ShutdownGetNodeResponse { @@ -17973,6 +19792,36 @@ export interface ShutdownPutNodeRequest extends RequestBase { export type ShutdownPutNodeResponse = AcknowledgedResponseBase +export interface SimulateIngestIngestDocumentSimulationKeys { + _id: Id + _index: IndexName + _source: Record + _version: SpecUtilsStringified + executed_pipelines: string[] + ignored_fields?: Record[] + error?: ErrorCause +} +export type SimulateIngestIngestDocumentSimulation = SimulateIngestIngestDocumentSimulationKeys +& { [property: string]: string | Id | IndexName | Record | SpecUtilsStringified | string[] | Record[] | ErrorCause } + +export interface SimulateIngestRequest extends RequestBase { + index?: IndexName + pipeline?: PipelineName + docs: IngestDocument[] + component_template_substitutions?: Record + index_template_substitutions?: Record + mapping_addition?: MappingTypeMapping + pipeline_substitutions?: Record +} + +export interface SimulateIngestResponse { + docs: SimulateIngestSimulateIngestDocumentResult[] +} + +export interface SimulateIngestSimulateIngestDocumentResult { + doc?: SimulateIngestIngestDocumentSimulation +} + export interface SlmConfiguration { ignore_unavailable?: boolean indices?: Indices @@ -18040,12 +19889,16 @@ export interface SlmStatistics { export interface SlmDeleteLifecycleRequest extends RequestBase { policy_id: Name + master_timeout?: Duration + timeout?: Duration } export type SlmDeleteLifecycleResponse = AcknowledgedResponseBase export interface SlmExecuteLifecycleRequest extends RequestBase { policy_id: Name + master_timeout?: Duration + timeout?: Duration } export interface SlmExecuteLifecycleResponse { @@ -18053,17 +19906,23 @@ export interface SlmExecuteLifecycleResponse { } export interface SlmExecuteRetentionRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export type SlmExecuteRetentionResponse = AcknowledgedResponseBase export interface SlmGetLifecycleRequest extends RequestBase { policy_id?: Names + master_timeout?: Duration + timeout?: Duration } export type SlmGetLifecycleResponse = Record export interface SlmGetStatsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export interface SlmGetStatsResponse { @@ -18080,6 +19939,8 @@ export interface SlmGetStatsResponse { } export interface SlmGetStatusRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export interface SlmGetStatusResponse { @@ -18100,11 +19961,15 @@ export interface SlmPutLifecycleRequest extends RequestBase { export type SlmPutLifecycleResponse = AcknowledgedResponseBase export interface SlmStartRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export type SlmStartResponse = AcknowledgedResponseBase export interface SlmStopRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export type SlmStopResponse = AcknowledgedResponseBase @@ -18263,6 +20128,7 @@ export interface SnapshotSnapshotShardFailure { node_id?: Id reason: string shard_id: Id + index_uuid: Id status: string } @@ -18324,7 +20190,6 @@ export interface SnapshotCloneRequest extends RequestBase { snapshot: Name target_snapshot: Name master_timeout?: Duration - timeout?: Duration indices: string } @@ -18413,6 +20278,127 @@ export interface SnapshotGetRepositoryRequest extends RequestBase { export type SnapshotGetRepositoryResponse = Record +export interface SnapshotRepositoryAnalyzeBlobDetails { + name: string + overwritten: boolean + read_early: boolean + read_end: long + read_start: long + reads: SnapshotRepositoryAnalyzeReadBlobDetails + size: ByteSize + size_bytes: long +} + +export interface SnapshotRepositoryAnalyzeDetailsInfo { + blob: SnapshotRepositoryAnalyzeBlobDetails + overwrite_elapsed?: Duration + overwrite_elapsed_nanos?: DurationValue + write_elapsed: Duration + write_elapsed_nanos: DurationValue + write_throttled: Duration + write_throttled_nanos: DurationValue + writer_node: SnapshotRepositoryAnalyzeSnapshotNodeInfo +} + +export interface SnapshotRepositoryAnalyzeReadBlobDetails { + before_write_complete?: boolean + elapsed?: Duration + elapsed_nanos?: DurationValue + first_byte_time?: Duration + first_byte_time_nanos: DurationValue + found: boolean + node: SnapshotRepositoryAnalyzeSnapshotNodeInfo + throttled?: Duration + throttled_nanos?: DurationValue +} + +export interface SnapshotRepositoryAnalyzeReadSummaryInfo { + count: integer + max_wait: Duration + max_wait_nanos: DurationValue + total_elapsed: Duration + total_elapsed_nanos: DurationValue + total_size: ByteSize + total_size_bytes: long + total_throttled: Duration + total_throttled_nanos: DurationValue + total_wait: Duration + total_wait_nanos: DurationValue +} + +export interface SnapshotRepositoryAnalyzeRequest extends RequestBase { + name: Name + blob_count?: integer + concurrency?: integer + detailed?: boolean + early_read_node_count?: integer + max_blob_size?: ByteSize + max_total_data_size?: ByteSize + rare_action_probability?: double + rarely_abort_writes?: boolean + read_node_count?: integer + register_operation_count?: integer + seed?: integer + timeout?: Duration +} + +export interface SnapshotRepositoryAnalyzeResponse { + blob_count: integer + blob_path: string + concurrency: integer + coordinating_node: SnapshotRepositoryAnalyzeSnapshotNodeInfo + delete_elapsed: Duration + delete_elapsed_nanos: DurationValue + details: SnapshotRepositoryAnalyzeDetailsInfo + early_read_node_count: integer + issues_detected: string[] + listing_elapsed: Duration + listing_elapsed_nanos: DurationValue + max_blob_size: ByteSize + max_blob_size_bytes: long + max_total_data_size: ByteSize + max_total_data_size_bytes: long + rare_action_probability: double + read_node_count: integer + repository: string + seed: long + summary: SnapshotRepositoryAnalyzeSummaryInfo +} + +export interface SnapshotRepositoryAnalyzeSnapshotNodeInfo { + id: Id + name: Name +} + +export interface SnapshotRepositoryAnalyzeSummaryInfo { + read: SnapshotRepositoryAnalyzeReadSummaryInfo + write: SnapshotRepositoryAnalyzeWriteSummaryInfo +} + +export interface SnapshotRepositoryAnalyzeWriteSummaryInfo { + count: integer + total_elapsed: Duration + total_elapsed_nanos: DurationValue + total_size: ByteSize + total_size_bytes: long + total_throttled: Duration + total_throttled_nanos: long +} + +export interface SnapshotRepositoryVerifyIntegrityRequest extends RequestBase { + name: Names + meta_thread_pool_concurrency?: integer + blob_thread_pool_concurrency?: integer + snapshot_verification_concurrency?: integer + index_verification_concurrency?: integer + index_snapshot_verification_concurrency?: integer + max_failed_shard_snapshots?: integer + verify_blob_contents?: boolean + max_bytes_per_sec?: string +} + +export type SnapshotRepositoryVerifyIntegrityResponse = any + export interface SnapshotRestoreRequest extends RequestBase { repository: Name snapshot: Name @@ -18431,7 +20417,8 @@ export interface SnapshotRestoreRequest extends RequestBase { } export interface SnapshotRestoreResponse { - snapshot: SnapshotRestoreSnapshotRestore + accepted?: boolean + snapshot?: SnapshotRestoreSnapshotRestore } export interface SnapshotRestoreSnapshotRestore { @@ -18508,43 +20495,46 @@ export interface SqlGetAsyncStatusRequest extends RequestBase { } export interface SqlGetAsyncStatusResponse { + expiration_time_in_millis: EpochTime id: string is_running: boolean is_partial: boolean start_time_in_millis: EpochTime - expiration_time_in_millis: EpochTime completion_status?: uint } export interface SqlQueryRequest extends RequestBase { - format?: string + format?: SqlQuerySqlFormat + allow_partial_search_results?: boolean catalog?: string columnar?: boolean cursor?: string fetch_size?: integer + field_multi_value_leniency?: boolean filter?: QueryDslQueryContainer + index_using_frozen?: boolean + keep_alive?: Duration + keep_on_completion?: boolean + page_timeout?: Duration + params?: Record query?: string request_timeout?: Duration - page_timeout?: Duration - time_zone?: TimeZone - field_multi_value_leniency?: boolean runtime_mappings?: MappingRuntimeFields + time_zone?: TimeZone wait_for_completion_timeout?: Duration - params?: Record - keep_alive?: Duration - keep_on_completion?: boolean - index_using_frozen?: boolean } export interface SqlQueryResponse { + columns?: SqlColumn[] + cursor?: string id?: Id is_running?: boolean is_partial?: boolean - columns?: SqlColumn[] - cursor?: string rows: SqlRow[] } +export type SqlQuerySqlFormat = 'csv' | 'json' | 'tsv' | 'txt' | 'yaml' | 'cbor' | 'smile' + export interface SqlTranslateRequest extends RequestBase { fetch_size?: integer filter?: QueryDslQueryContainer @@ -18726,19 +20716,20 @@ export interface TasksListRequest extends RequestBase { actions?: string | string[] detailed?: boolean group_by?: TasksGroupBy - node_id?: string[] + nodes?: NodeIds parent_task_id?: Id - master_timeout?: Duration timeout?: Duration wait_for_completion?: boolean } export type TasksListResponse = TasksTaskListResponseBase -export interface TextStructureFindStructureFieldStat { +export type TextStructureEcsCompatibilityType = 'disabled' | 'v1' + +export interface TextStructureFieldStat { count: integer cardinality: integer - top_hits: TextStructureFindStructureTopHit[] + top_hits: TextStructureTopHit[] mean_value?: integer median_value?: integer max_value?: integer @@ -18747,6 +20738,81 @@ export interface TextStructureFindStructureFieldStat { latest?: string } +export type TextStructureFormatType = 'delimited' | 'ndjson' | 'semi_structured_text' | 'xml' + +export interface TextStructureTopHit { + count: long + value: any +} + +export interface TextStructureFindFieldStructureRequest extends RequestBase { + column_names?: string + delimiter?: string + documents_to_sample?: uint + ecs_compatibility?: TextStructureEcsCompatibilityType + explain?: boolean + field: Field + format?: TextStructureFormatType + grok_pattern?: GrokPattern + index: IndexName + quote?: string + should_trim_fields?: boolean + timeout?: Duration + timestamp_field?: Field + timestamp_format?: string +} + +export interface TextStructureFindFieldStructureResponse { + charset: string + ecs_compatibility?: TextStructureEcsCompatibilityType + field_stats: Record + format: TextStructureFormatType + grok_pattern?: GrokPattern + java_timestamp_formats?: string[] + joda_timestamp_formats?: string[] + ingest_pipeline: IngestPipelineConfig + mappings: MappingTypeMapping + multiline_start_pattern?: string + need_client_timezone: boolean + num_lines_analyzed: integer + num_messages_analyzed: integer + sample_start: string + timestamp_field?: Field +} + +export interface TextStructureFindMessageStructureRequest extends RequestBase { + column_names?: string + delimiter?: string + ecs_compatibility?: TextStructureEcsCompatibilityType + explain?: boolean + format?: TextStructureFormatType + grok_pattern?: GrokPattern + quote?: string + should_trim_fields?: boolean + timeout?: Duration + timestamp_field?: Field + timestamp_format?: string + messages: string[] +} + +export interface TextStructureFindMessageStructureResponse { + charset: string + ecs_compatibility?: TextStructureEcsCompatibilityType + field_stats: Record + format: TextStructureFormatType + grok_pattern?: GrokPattern + java_timestamp_formats?: string[] + joda_timestamp_formats?: string[] + ingest_pipeline: IngestPipelineConfig + mappings: MappingTypeMapping + multiline_start_pattern?: string + need_client_timezone: boolean + num_lines_analyzed: integer + num_messages_analyzed: integer + sample_start: string + timestamp_field?: Field +} + export interface TextStructureFindStructureRequest { charset?: string column_names?: string @@ -18754,7 +20820,7 @@ export interface TextStructureFindStructureRequest { ecs_compatibility?: string explain?: boolean format?: string - grok_pattern?: string + grok_pattern?: GrokPattern has_header_row?: boolean line_merge_size_limit?: uint lines_to_sample?: uint @@ -18771,7 +20837,7 @@ export interface TextStructureFindStructureResponse { has_header_row?: boolean has_byte_order_marker: boolean format: string - field_stats: Record + field_stats: Record sample_start: string num_messages_analyzed: integer mappings: MappingTypeMapping @@ -18781,7 +20847,7 @@ export interface TextStructureFindStructureResponse { num_lines_analyzed: integer column_names?: string[] explanation?: string[] - grok_pattern?: string + grok_pattern?: GrokPattern multiline_start_pattern?: string exclude_lines_pattern?: string java_timestamp_formats?: string[] @@ -18791,11 +20857,6 @@ export interface TextStructureFindStructureResponse { ingest_pipeline: IngestPipelineConfig } -export interface TextStructureFindStructureTopHit { - count: long - value: any -} - export interface TextStructureTestGrokPatternMatchedField { match: string offset: integer @@ -18809,7 +20870,7 @@ export interface TextStructureTestGrokPatternMatchedText { export interface TextStructureTestGrokPatternRequest extends RequestBase { ecs_compatibility?: string - grok_pattern: string + grok_pattern: GrokPattern text: string[] } @@ -18898,6 +20959,7 @@ export interface TransformGetTransformResponse { export interface TransformGetTransformTransformSummary { authorization?: MlTransformAuthorization create_time?: EpochTime + create_time_string?: DateTime description?: string dest: ReindexDestination frequency?: Duration @@ -18923,11 +20985,12 @@ export interface TransformGetTransformStatsCheckpointStats { export interface TransformGetTransformStatsCheckpointing { changes_last_detected_at?: long - changes_last_detected_at_date_time?: DateTime + changes_last_detected_at_string?: DateTime last: TransformGetTransformStatsCheckpointStats next?: TransformGetTransformStatsCheckpointStats operations_behind?: long last_search_time?: long + last_search_time_string?: DateTime } export interface TransformGetTransformStatsRequest extends RequestBase { @@ -18943,6 +21006,15 @@ export interface TransformGetTransformStatsResponse { transforms: TransformGetTransformStatsTransformStats[] } +export interface TransformGetTransformStatsTransformHealthIssue { + type: string + issue: string + details?: string + count: integer + first_occurrence?: EpochTime + first_occurence_string?: DateTime +} + export interface TransformGetTransformStatsTransformIndexerStats { delete_time_in_ms?: EpochTime documents_indexed: long @@ -18983,6 +21055,7 @@ export interface TransformGetTransformStatsTransformStats { export interface TransformGetTransformStatsTransformStatsHealth { status: HealthStatus + issues?: TransformGetTransformStatsTransformHealthIssue[] } export interface TransformPreviewTransformRequest extends RequestBase { @@ -19025,6 +21098,7 @@ export type TransformPutTransformResponse = AcknowledgedResponseBase export interface TransformResetTransformRequest extends RequestBase { transform_id: Id force?: boolean + timeout?: Duration } export type TransformResetTransformResponse = AcknowledgedResponseBase @@ -19195,15 +21269,15 @@ export type WatcherDay = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursd export interface WatcherEmail { id?: Id - bcc?: string[] + bcc?: string | string[] body?: WatcherEmailBody - cc?: string[] + cc?: string | string[] from?: string priority?: WatcherEmailPriority - reply_to?: string[] + reply_to?: string | string[] sent_date?: DateTime subject: string - to: string[] + to: string | string[] attachments?: Record } @@ -19444,6 +21518,7 @@ export interface WatcherReportingEmailAttachment { export type WatcherResponseContentType = 'json' | 'yaml' | 'text' export interface WatcherScheduleContainer { + timezone?: string cron?: WatcherCronExpression daily?: WatcherDailySchedule hourly?: WatcherHourlySchedule @@ -19678,6 +21753,14 @@ export interface WatcherExecuteWatchWatchRecord { status?: WatcherWatchStatus } +export interface WatcherGetSettingsRequest extends RequestBase { + master_timeout?: Duration +} + +export interface WatcherGetSettingsResponse { + index: IndicesIndexSettings +} + export interface WatcherGetWatchRequest extends RequestBase { id: Name } @@ -19702,7 +21785,8 @@ export interface WatcherPutWatchRequest extends RequestBase { condition?: WatcherConditionContainer input?: WatcherInputContainer metadata?: Metadata - throttle_period?: string + throttle_period?: Duration + throttle_period_in_millis?: DurationValue transform?: TransformContainer trigger?: WatcherTriggerContainer } @@ -19729,6 +21813,7 @@ export interface WatcherQueryWatchesResponse { } export interface WatcherStartRequest extends RequestBase { + master_timeout?: Duration } export type WatcherStartResponse = AcknowledgedResponseBase @@ -19771,10 +21856,22 @@ export interface WatcherStatsWatcherNodeStats { export type WatcherStatsWatcherState = 'stopped' | 'starting' | 'started' | 'stopping' export interface WatcherStopRequest extends RequestBase { + master_timeout?: Duration } export type WatcherStopResponse = AcknowledgedResponseBase +export interface WatcherUpdateSettingsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration + 'index.auto_expand_replicas'?: string + 'index.number_of_replicas'?: integer +} + +export interface WatcherUpdateSettingsResponse { + acknowledged: boolean +} + export interface XpackInfoBuildInformation { date: DateTime hash: string @@ -19791,17 +21888,17 @@ export interface XpackInfoFeatures { aggregate_metric: XpackInfoFeature analytics: XpackInfoFeature ccr: XpackInfoFeature - data_frame?: XpackInfoFeature - data_science?: XpackInfoFeature data_streams: XpackInfoFeature data_tiers: XpackInfoFeature enrich: XpackInfoFeature + enterprise_search: XpackInfoFeature eql: XpackInfoFeature - flattened?: XpackInfoFeature + esql: XpackInfoFeature frozen_indices: XpackInfoFeature graph: XpackInfoFeature ilm: XpackInfoFeature logstash: XpackInfoFeature + logsdb: XpackInfoFeature ml: XpackInfoFeature monitoring: XpackInfoFeature rollup: XpackInfoFeature @@ -19812,7 +21909,7 @@ export interface XpackInfoFeatures { spatial: XpackInfoFeature sql: XpackInfoFeature transform: XpackInfoFeature - vectors?: XpackInfoFeature + universal_profiling: XpackInfoFeature voting_only: XpackInfoFeature watcher: XpackInfoFeature archive: XpackInfoFeature @@ -19832,7 +21929,7 @@ export interface XpackInfoNativeCodeInformation { } export interface XpackInfoRequest extends RequestBase { - categories?: string[] + categories?: XpackInfoXPackCategory[] accept_enterprise?: boolean human?: boolean } @@ -19844,6 +21941,8 @@ export interface XpackInfoResponse { tagline: string } +export type XpackInfoXPackCategory = 'build' | 'features' | 'license' + export interface XpackUsageAnalytics extends XpackUsageBase { stats: XpackUsageAnalyticsStatistics } @@ -19981,7 +22080,7 @@ export interface XpackUsageIlm { export interface XpackUsageIlmPolicyStatistics { indices_managed: integer - phases: IlmPhases + phases: XpackUsagePhases } export interface XpackUsageInvocations { @@ -20093,6 +22192,19 @@ export interface XpackUsageMonitoring extends XpackUsageBase { enabled_exporters: Record } +export interface XpackUsagePhase { + actions: string[] + min_age: DurationValue +} + +export interface XpackUsagePhases { + cold?: XpackUsagePhase + delete?: XpackUsagePhase + frozen?: XpackUsagePhase + hot?: XpackUsagePhase + warm?: XpackUsagePhase +} + export interface XpackUsageQuery { count?: integer failed?: integer @@ -20294,11 +22406,7 @@ export interface SpecUtilsCommonQueryParameters { export interface SpecUtilsCommonCatQueryParameters { format?: string - h?: Names help?: boolean - local?: boolean - master_timeout?: Duration - s?: Names v?: boolean } diff --git a/src/api/typesWithBodyKey.ts b/src/api/typesWithBodyKey.ts index 655ba221f..a7af9e018 100644 --- a/src/api/typesWithBodyKey.ts +++ b/src/api/typesWithBodyKey.ts @@ -34,6 +34,8 @@ export interface BulkCreateOperation extends BulkWriteOperation { export interface BulkDeleteOperation extends BulkOperationBase { } +export type BulkFailureStoreStatus = 'not_applicable_or_unknown' | 'used' | 'not_enabled' | 'failed' + export interface BulkIndexOperation extends BulkWriteOperation { } @@ -58,6 +60,8 @@ export type BulkOperationType = 'index' | 'create' | 'update' | 'delete' export interface BulkRequest extends RequestBase { index?: IndexName + include_source_on_error?: boolean + list_executed_pipelines?: boolean pipeline?: string refresh?: Refresh routing?: Routing @@ -67,6 +71,7 @@ export interface BulkRequest ex timeout?: Duration wait_for_active_shards?: WaitForActiveShards require_alias?: boolean + require_data_stream?: boolean /** @deprecated The use of the 'body' key has been deprecated, use 'operations' instead. */ body?: (BulkOperationContainer | BulkUpdateAction | TDocument)[] } @@ -82,6 +87,7 @@ export interface BulkResponseItem { _id?: string | null _index: string status: integer + failure_store?: BulkFailureStoreStatus error?: ErrorCause _primary_term?: long result?: string @@ -168,8 +174,14 @@ export interface CountResponse { export interface CreateRequest extends RequestBase { id: Id index: IndexName + if_primary_term?: long + if_seq_no?: SequenceNumber + include_source_on_error?: boolean + op_type?: OpType pipeline?: string refresh?: Refresh + require_alias?: boolean + require_data_stream?: boolean routing?: Routing timeout?: Duration version?: VersionNumber @@ -658,6 +670,7 @@ export interface IndexRequest extends RequestBase { index: IndexName if_primary_term?: long if_seq_no?: SequenceNumber + include_source_on_error?: boolean op_type?: OpType pipeline?: string refresh?: Refresh @@ -775,7 +788,7 @@ export interface MsearchMultisearchBody { knn?: KnnSearch | KnnSearch[] from?: integer highlight?: SearchHighlight - indices_boost?: Record[] + indices_boost?: Partial>[] min_score?: double post_filter?: QueryDslQueryContainer profile?: boolean @@ -917,9 +930,16 @@ export interface OpenPointInTimeRequest extends RequestBase { preference?: string routing?: Routing expand_wildcards?: ExpandWildcards + allow_partial_search_results?: boolean + max_concurrent_shard_requests?: integer + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + index_filter?: QueryDslQueryContainer + } } export interface OpenPointInTimeResponse { + _shards: ShardStatistics id: Id } @@ -1149,6 +1169,7 @@ export interface RenderSearchTemplateRequest extends RequestBase { id?: Id /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { + id?: Id file?: string params?: Record source?: string @@ -1159,6 +1180,8 @@ export interface RenderSearchTemplateResponse { template_output: Record } +export type ScriptsPainlessExecutePainlessContext = 'painless_test' | 'filter' | 'score' | 'boolean_field' | 'date_field' | 'double_field' | 'geo_point_field' | 'ip_field' | 'keyword_field' | 'long_field' | 'composite_field' + export interface ScriptsPainlessExecutePainlessContextSetup { document: any index: IndexName @@ -1168,7 +1191,7 @@ export interface ScriptsPainlessExecutePainlessContextSetup { export interface ScriptsPainlessExecuteRequest extends RequestBase { /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { - context?: string + context?: ScriptsPainlessExecutePainlessContext context_setup?: ScriptsPainlessExecutePainlessContextSetup script?: Script | string } @@ -1234,7 +1257,7 @@ export interface SearchRequest extends RequestBase { from?: integer highlight?: SearchHighlight track_total_hits?: SearchTrackHits - indices_boost?: Record[] + indices_boost?: Partial>[] docvalue_fields?: (QueryDslFieldAndFormat | Field)[] knn?: KnnSearch | KnnSearch[] rank?: RankContainer @@ -1336,6 +1359,10 @@ export interface SearchAggregationProfileDebug { segments_counted?: integer segments_collected?: integer map_reducer?: string + brute_force_used?: integer + dynamic_pruning_attempted?: integer + dynamic_pruning_used?: integer + skipped_due_to_no_data?: integer } export interface SearchAggregationProfileDelegateDebugFilter { @@ -1388,6 +1415,39 @@ export interface SearchCompletionSuggester extends SearchSuggesterBase { export type SearchContext = string | GeoLocation +export interface SearchDfsKnnProfile { + vector_operations_count?: long + query: SearchKnnQueryProfileResult[] + rewrite_time: long + collector: SearchKnnCollectorResult[] +} + +export interface SearchDfsProfile { + statistics?: SearchDfsStatisticsProfile + knn?: SearchDfsKnnProfile[] +} + +export interface SearchDfsStatisticsBreakdown { + collection_statistics: long + collection_statistics_count: long + create_weight: long + create_weight_count: long + rewrite: long + rewrite_count: long + term_statistics: long + term_statistics_count: long +} + +export interface SearchDfsStatisticsProfile { + type: string + description: string + time?: Duration + time_in_nanos: DurationValue + breakdown: SearchDfsStatisticsBreakdown + debug?: Record + children?: SearchDfsStatisticsProfile[] +} + export interface SearchDirectGenerator { field: Field max_edits?: integer @@ -1495,10 +1555,10 @@ export interface SearchHit { fields?: Record highlight?: Record inner_hits?: Record - matched_queries?: string[] | Record + matched_queries?: string[] | Record _nested?: SearchNestedIdentity _ignored?: string[] - ignored_field_values?: Record + ignored_field_values?: Record _shard?: string _node?: string _routing?: string @@ -1527,7 +1587,7 @@ export interface SearchInnerHits { ignore_unmapped?: boolean script_fields?: Record seq_no_primary_term?: boolean - fields?: Fields + fields?: Field[] sort?: Sort _source?: SearchSourceConfig stored_fields?: Fields @@ -1539,6 +1599,47 @@ export interface SearchInnerHitsResult { hits: SearchHitsMetadata } +export interface SearchKnnCollectorResult { + name: string + reason: string + time?: Duration + time_in_nanos: DurationValue + children?: SearchKnnCollectorResult[] +} + +export interface SearchKnnQueryProfileBreakdown { + advance: long + advance_count: long + build_scorer: long + build_scorer_count: long + compute_max_score: long + compute_max_score_count: long + count_weight: long + count_weight_count: long + create_weight: long + create_weight_count: long + match: long + match_count: long + next_doc: long + next_doc_count: long + score: long + score_count: long + set_min_competitive_score: long + set_min_competitive_score_count: long + shallow_advance: long + shallow_advance_count: long +} + +export interface SearchKnnQueryProfileResult { + type: string + description: string + time?: Duration + time_in_nanos: DurationValue + breakdown: SearchKnnQueryProfileBreakdown + debug?: Record + children?: SearchKnnQueryProfileResult[] +} + export interface SearchLaplaceSmoothingModel { alpha: double } @@ -1629,6 +1730,8 @@ export interface SearchQueryBreakdown { score_count: long compute_max_score: long compute_max_score_count: long + count_weight: long + count_weight_count: long set_min_competitive_score: long set_min_competitive_score_count: long } @@ -1669,9 +1772,14 @@ export interface SearchSearchProfile { export interface SearchShardProfile { aggregations: SearchAggregationProfile[] + cluster: string + dfs?: SearchDfsProfile + fetch?: SearchFetchProfile id: string + index: IndexName + node_id: NodeId searches: SearchSearchProfile[] - fetch?: SearchFetchProfile + shard_id: long } export interface SearchSmoothingModelContainer { @@ -1804,16 +1912,29 @@ export interface SearchShardsRequest extends RequestBase { expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean local?: boolean + master_timeout?: Duration preference?: string routing?: Routing } export interface SearchShardsResponse { - nodes: Record + nodes: Record shards: NodeShard[][] indices: Record } +export interface SearchShardsSearchShardsNodeAttributes { + name: NodeName + ephemeral_id: Id + transport_address: TransportAddress + external_id: string + attributes: Record + roles: NodeRoles + version: VersionString + min_index_version: integer + max_index_version: integer +} + export interface SearchShardsShardStoreIndex { aliases?: Name[] filter?: QueryDslQueryContainer @@ -1898,22 +2019,22 @@ export interface TermvectorsFilter { export interface TermvectorsRequest extends RequestBase { index: IndexName id?: Id - fields?: Fields - field_statistics?: boolean - offsets?: boolean - payloads?: boolean - positions?: boolean preference?: string realtime?: boolean - routing?: Routing - term_statistics?: boolean - version?: VersionNumber - version_type?: VersionType /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { doc?: TDocument filter?: TermvectorsFilter per_field_analyzer?: Record + fields?: Fields + field_statistics?: boolean + offsets?: boolean + payloads?: boolean + positions?: boolean + term_statistics?: boolean + routing?: Routing + version?: VersionNumber + version_type?: VersionType } } @@ -1951,6 +2072,7 @@ export interface UpdateRequest index: IndexName if_primary_term?: long if_seq_no?: SequenceNumber + include_source_on_error?: boolean lang?: string refresh?: Refresh require_alias?: boolean @@ -2079,7 +2201,6 @@ export interface BulkIndexByScrollFailure { id: Id index: IndexName status: integer - type: string } export interface BulkStats { @@ -2213,7 +2334,7 @@ export interface ErrorResponseBase { status: integer } -export type EsqlColumns = ArrayBuffer +export type EsqlResult = ArrayBuffer export type ExpandWildcard = 'all' | 'open' | 'closed' | 'hidden' | 'none' @@ -2316,6 +2437,8 @@ export interface GetStats { total: long } +export type GrokPattern = string + export type HealthStatus = 'green' | 'GREEN' | 'yellow' | 'YELLOW' | 'red' | 'RED' export type Host = string @@ -2390,6 +2513,7 @@ export interface KnnQuery extends QueryDslQueryBase { k?: integer filter?: QueryDslQueryContainer | QueryDslQueryContainer[] similarity?: float + rescore_vector?: RescoreVector } export interface KnnRetriever extends RetrieverBase { @@ -2399,6 +2523,7 @@ export interface KnnRetriever extends RetrieverBase { k: integer num_candidates: integer similarity?: float + rescore_vector?: RescoreVector } export interface KnnSearch { @@ -2411,6 +2536,7 @@ export interface KnnSearch { filter?: QueryDslQueryContainer | QueryDslQueryContainer[] similarity?: float inner_hits?: SearchInnerHits + rescore_vector?: RescoreVector } export interface LatLonGeoLocation { @@ -2470,8 +2596,6 @@ export interface NodeAttributes { id?: NodeId name: NodeName transport_address: TransportAddress - roles?: NodeRoles - external_id?: string } export type NodeId = string @@ -2593,6 +2717,10 @@ export interface RequestCacheStats { miss_count: long } +export interface RescoreVector { + oversample: float +} + export type Result = 'created' | 'updated' | 'deleted' | 'not_found' | 'noop' export interface Retries { @@ -2602,12 +2730,15 @@ export interface Retries { export interface RetrieverBase { filter?: QueryDslQueryContainer | QueryDslQueryContainer[] + min_score?: float } export interface RetrieverContainer { standard?: StandardRetriever knn?: KnnRetriever rrf?: RRFRetriever + text_similarity_reranker?: TextSimilarityReranker + rule?: RuleRetriever } export type Routing = string @@ -2617,6 +2748,13 @@ export interface RrfRank { rank_window_size?: long } +export interface RuleRetriever extends RetrieverBase { + ruleset_ids: Id[] + match_criteria: any + retriever: RetrieverContainer + rank_window_size?: integer +} + export type ScalarValue = long | double | string | boolean | null export interface ScoreSort { @@ -2735,7 +2873,7 @@ export interface ShardStatistics { } export interface ShardsOperationResponseBase { - _shards: ShardStatistics + _shards?: ShardStatistics } export interface SlicedScroll { @@ -2772,7 +2910,6 @@ export interface StandardRetriever extends RetrieverBase { search_after?: SortResults terminate_after?: integer sort?: Sort - min_score?: float collapse?: SearchFieldCollapse } @@ -2791,6 +2928,8 @@ export interface StoredScript { source: string } +export type StreamResult = ArrayBuffer + export type SuggestMode = 'missing' | 'popular' | 'always' export type SuggestionName = string @@ -2809,6 +2948,14 @@ export interface TextEmbedding { model_text: string } +export interface TextSimilarityReranker extends RetrieverBase { + retriever: RetrieverContainer + rank_window_size?: integer + inference_id?: string + inference_text?: string + field?: string +} + export type ThreadType = 'cpu' | 'wait' | 'block' | 'gpu' | 'mem' export type TimeOfDay = string @@ -2921,7 +3068,7 @@ export interface AggregationsAdjacencyMatrixBucketKeys extends AggregationsMulti export type AggregationsAdjacencyMatrixBucket = AggregationsAdjacencyMatrixBucketKeys & { [property: string]: AggregationsAggregate | string | long } -export type AggregationsAggregate = AggregationsCardinalityAggregate | AggregationsHdrPercentilesAggregate | AggregationsHdrPercentileRanksAggregate | AggregationsTDigestPercentilesAggregate | AggregationsTDigestPercentileRanksAggregate | AggregationsPercentilesBucketAggregate | AggregationsMedianAbsoluteDeviationAggregate | AggregationsMinAggregate | AggregationsMaxAggregate | AggregationsSumAggregate | AggregationsAvgAggregate | AggregationsWeightedAvgAggregate | AggregationsValueCountAggregate | AggregationsSimpleValueAggregate | AggregationsDerivativeAggregate | AggregationsBucketMetricValueAggregate | AggregationsStatsAggregate | AggregationsStatsBucketAggregate | AggregationsExtendedStatsAggregate | AggregationsExtendedStatsBucketAggregate | AggregationsGeoBoundsAggregate | AggregationsGeoCentroidAggregate | AggregationsHistogramAggregate | AggregationsDateHistogramAggregate | AggregationsAutoDateHistogramAggregate | AggregationsVariableWidthHistogramAggregate | AggregationsStringTermsAggregate | AggregationsLongTermsAggregate | AggregationsDoubleTermsAggregate | AggregationsUnmappedTermsAggregate | AggregationsLongRareTermsAggregate | AggregationsStringRareTermsAggregate | AggregationsUnmappedRareTermsAggregate | AggregationsMultiTermsAggregate | AggregationsMissingAggregate | AggregationsNestedAggregate | AggregationsReverseNestedAggregate | AggregationsGlobalAggregate | AggregationsFilterAggregate | AggregationsChildrenAggregate | AggregationsParentAggregate | AggregationsSamplerAggregate | AggregationsUnmappedSamplerAggregate | AggregationsGeoHashGridAggregate | AggregationsGeoTileGridAggregate | AggregationsGeoHexGridAggregate | AggregationsRangeAggregate | AggregationsDateRangeAggregate | AggregationsGeoDistanceAggregate | AggregationsIpRangeAggregate | AggregationsIpPrefixAggregate | AggregationsFiltersAggregate | AggregationsAdjacencyMatrixAggregate | AggregationsSignificantLongTermsAggregate | AggregationsSignificantStringTermsAggregate | AggregationsUnmappedSignificantTermsAggregate | AggregationsCompositeAggregate | AggregationsFrequentItemSetsAggregate | AggregationsScriptedMetricAggregate | AggregationsTopHitsAggregate | AggregationsInferenceAggregate | AggregationsStringStatsAggregate | AggregationsBoxPlotAggregate | AggregationsTopMetricsAggregate | AggregationsTTestAggregate | AggregationsRateAggregate | AggregationsCumulativeCardinalityAggregate | AggregationsMatrixStatsAggregate | AggregationsGeoLineAggregate +export type AggregationsAggregate = AggregationsCardinalityAggregate | AggregationsHdrPercentilesAggregate | AggregationsHdrPercentileRanksAggregate | AggregationsTDigestPercentilesAggregate | AggregationsTDigestPercentileRanksAggregate | AggregationsPercentilesBucketAggregate | AggregationsMedianAbsoluteDeviationAggregate | AggregationsMinAggregate | AggregationsMaxAggregate | AggregationsSumAggregate | AggregationsAvgAggregate | AggregationsWeightedAvgAggregate | AggregationsValueCountAggregate | AggregationsSimpleValueAggregate | AggregationsDerivativeAggregate | AggregationsBucketMetricValueAggregate | AggregationsStatsAggregate | AggregationsStatsBucketAggregate | AggregationsExtendedStatsAggregate | AggregationsExtendedStatsBucketAggregate | AggregationsGeoBoundsAggregate | AggregationsGeoCentroidAggregate | AggregationsHistogramAggregate | AggregationsDateHistogramAggregate | AggregationsAutoDateHistogramAggregate | AggregationsVariableWidthHistogramAggregate | AggregationsStringTermsAggregate | AggregationsLongTermsAggregate | AggregationsDoubleTermsAggregate | AggregationsUnmappedTermsAggregate | AggregationsLongRareTermsAggregate | AggregationsStringRareTermsAggregate | AggregationsUnmappedRareTermsAggregate | AggregationsMultiTermsAggregate | AggregationsMissingAggregate | AggregationsNestedAggregate | AggregationsReverseNestedAggregate | AggregationsGlobalAggregate | AggregationsFilterAggregate | AggregationsChildrenAggregate | AggregationsParentAggregate | AggregationsSamplerAggregate | AggregationsUnmappedSamplerAggregate | AggregationsGeoHashGridAggregate | AggregationsGeoTileGridAggregate | AggregationsGeoHexGridAggregate | AggregationsRangeAggregate | AggregationsDateRangeAggregate | AggregationsGeoDistanceAggregate | AggregationsIpRangeAggregate | AggregationsIpPrefixAggregate | AggregationsFiltersAggregate | AggregationsAdjacencyMatrixAggregate | AggregationsSignificantLongTermsAggregate | AggregationsSignificantStringTermsAggregate | AggregationsUnmappedSignificantTermsAggregate | AggregationsCompositeAggregate | AggregationsFrequentItemSetsAggregate | AggregationsTimeSeriesAggregate | AggregationsScriptedMetricAggregate | AggregationsTopHitsAggregate | AggregationsInferenceAggregate | AggregationsStringStatsAggregate | AggregationsBoxPlotAggregate | AggregationsTopMetricsAggregate | AggregationsTTestAggregate | AggregationsRateAggregate | AggregationsCumulativeCardinalityAggregate | AggregationsMatrixStatsAggregate | AggregationsGeoLineAggregate export interface AggregationsAggregateBase { meta?: Metadata @@ -2995,6 +3142,7 @@ export interface AggregationsAggregationContainer { rare_terms?: AggregationsRareTermsAggregation rate?: AggregationsRateAggregation reverse_nested?: AggregationsReverseNestedAggregation + random_sampler?: AggregationsRandomSamplerAggregation sampler?: AggregationsSamplerAggregation scripted_metric?: AggregationsScriptedMetricAggregation serial_diff?: AggregationsSerialDifferencingAggregation @@ -3006,6 +3154,7 @@ export interface AggregationsAggregationContainer { sum?: AggregationsSumAggregation sum_bucket?: AggregationsSumBucketAggregation terms?: AggregationsTermsAggregation + time_series?: AggregationsTimeSeriesAggregation top_hits?: AggregationsTopHitsAggregation t_test?: AggregationsTTestAggregation top_metrics?: AggregationsTopMetricsAggregation @@ -3015,9 +3164,9 @@ export interface AggregationsAggregationContainer { } export interface AggregationsAggregationRange { - from?: double + from?: double | null key?: string - to?: double + to?: double | null } export interface AggregationsArrayPercentilesItem { @@ -3881,6 +4030,12 @@ export interface AggregationsPipelineAggregationBase extends AggregationsBucketP gap_policy?: AggregationsGapPolicy } +export interface AggregationsRandomSamplerAggregation extends AggregationsBucketAggregationBase { + probability: double + seed?: integer + shard_seed?: integer +} + export interface AggregationsRangeAggregate extends AggregationsMultiBucketAggregateBase { } @@ -4202,6 +4357,20 @@ export interface AggregationsTestPopulation { filter?: QueryDslQueryContainer } +export interface AggregationsTimeSeriesAggregate extends AggregationsMultiBucketAggregateBase { +} + +export interface AggregationsTimeSeriesAggregation extends AggregationsBucketAggregationBase { + size?: integer + keyed?: boolean +} + +export interface AggregationsTimeSeriesBucketKeys extends AggregationsMultiBucketBase { + key: Record +} +export type AggregationsTimeSeriesBucket = AggregationsTimeSeriesBucketKeys +& { [property: string]: AggregationsAggregate | Record | long } + export interface AggregationsTopHitsAggregate extends AggregationsAggregateBase { hits: SearchHitsMetadata } @@ -4301,7 +4470,11 @@ export interface AggregationsWeightedAverageValue { export interface AggregationsWeightedAvgAggregate extends AggregationsSingleMetricAggregateBase { } -export type AnalysisAnalyzer = AnalysisCustomAnalyzer | AnalysisFingerprintAnalyzer | AnalysisKeywordAnalyzer | AnalysisLanguageAnalyzer | AnalysisNoriAnalyzer | AnalysisPatternAnalyzer | AnalysisSimpleAnalyzer | AnalysisStandardAnalyzer | AnalysisStopAnalyzer | AnalysisWhitespaceAnalyzer | AnalysisIcuAnalyzer | AnalysisKuromojiAnalyzer | AnalysisSnowballAnalyzer | AnalysisArabicAnalyzer | AnalysisArmenianAnalyzer | AnalysisBasqueAnalyzer | AnalysisBengaliAnalyzer | AnalysisBrazilianAnalyzer | AnalysisBulgarianAnalyzer | AnalysisCatalanAnalyzer | AnalysisChineseAnalyzer | AnalysisCjkAnalyzer | AnalysisCzechAnalyzer | AnalysisDanishAnalyzer | AnalysisDutchAnalyzer | AnalysisEnglishAnalyzer | AnalysisEstonianAnalyzer | AnalysisFinnishAnalyzer | AnalysisFrenchAnalyzer | AnalysisGalicianAnalyzer | AnalysisGermanAnalyzer | AnalysisGreekAnalyzer | AnalysisHindiAnalyzer | AnalysisHungarianAnalyzer | AnalysisIndonesianAnalyzer | AnalysisIrishAnalyzer | AnalysisItalianAnalyzer | AnalysisLatvianAnalyzer | AnalysisLithuanianAnalyzer | AnalysisNorwegianAnalyzer | AnalysisPersianAnalyzer | AnalysisPortugueseAnalyzer | AnalysisRomanianAnalyzer | AnalysisRussianAnalyzer | AnalysisSerbianAnalyzer | AnalysisSoraniAnalyzer | AnalysisSpanishAnalyzer | AnalysisSwedishAnalyzer | AnalysisTurkishAnalyzer | AnalysisThaiAnalyzer +export type AnalysisAnalyzer = AnalysisCustomAnalyzer | AnalysisFingerprintAnalyzer | AnalysisKeywordAnalyzer | AnalysisNoriAnalyzer | AnalysisPatternAnalyzer | AnalysisSimpleAnalyzer | AnalysisStandardAnalyzer | AnalysisStopAnalyzer | AnalysisWhitespaceAnalyzer | AnalysisIcuAnalyzer | AnalysisKuromojiAnalyzer | AnalysisSnowballAnalyzer | AnalysisArabicAnalyzer | AnalysisArmenianAnalyzer | AnalysisBasqueAnalyzer | AnalysisBengaliAnalyzer | AnalysisBrazilianAnalyzer | AnalysisBulgarianAnalyzer | AnalysisCatalanAnalyzer | AnalysisChineseAnalyzer | AnalysisCjkAnalyzer | AnalysisCzechAnalyzer | AnalysisDanishAnalyzer | AnalysisDutchAnalyzer | AnalysisEnglishAnalyzer | AnalysisEstonianAnalyzer | AnalysisFinnishAnalyzer | AnalysisFrenchAnalyzer | AnalysisGalicianAnalyzer | AnalysisGermanAnalyzer | AnalysisGreekAnalyzer | AnalysisHindiAnalyzer | AnalysisHungarianAnalyzer | AnalysisIndonesianAnalyzer | AnalysisIrishAnalyzer | AnalysisItalianAnalyzer | AnalysisLatvianAnalyzer | AnalysisLithuanianAnalyzer | AnalysisNorwegianAnalyzer | AnalysisPersianAnalyzer | AnalysisPortugueseAnalyzer | AnalysisRomanianAnalyzer | AnalysisRussianAnalyzer | AnalysisSerbianAnalyzer | AnalysisSoraniAnalyzer | AnalysisSpanishAnalyzer | AnalysisSwedishAnalyzer | AnalysisTurkishAnalyzer | AnalysisThaiAnalyzer + +export interface AnalysisApostropheTokenFilter extends AnalysisTokenFilterBase { + type: 'apostrophe' +} export interface AnalysisArabicAnalyzer { type: 'arabic' @@ -4310,6 +4483,10 @@ export interface AnalysisArabicAnalyzer { stem_exclusion?: string[] } +export interface AnalysisArabicNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'arabic_normalization' +} + export interface AnalysisArmenianAnalyzer { type: 'armenian' stopwords?: AnalysisStopWords @@ -4382,6 +4559,27 @@ export interface AnalysisCjkAnalyzer { stopwords_path?: string } +export type AnalysisCjkBigramIgnoredScript = 'han' | 'hangul' | 'hiragana' | 'katakana' + +export interface AnalysisCjkBigramTokenFilter extends AnalysisTokenFilterBase { + type: 'cjk_bigram' + ignored_scripts?: AnalysisCjkBigramIgnoredScript[] + output_unigrams?: boolean +} + +export interface AnalysisCjkWidthTokenFilter extends AnalysisTokenFilterBase { + type: 'cjk_width' +} + +export interface AnalysisClassicTokenFilter extends AnalysisTokenFilterBase { + type: 'classic' +} + +export interface AnalysisClassicTokenizer extends AnalysisTokenizerBase { + type: 'classic' + max_token_length?: integer +} + export interface AnalysisCommonGramsTokenFilter extends AnalysisTokenFilterBase { type: 'common_grams' common_words?: string[] @@ -4391,7 +4589,6 @@ export interface AnalysisCommonGramsTokenFilter extends AnalysisTokenFilterBase } export interface AnalysisCompoundWordTokenFilterBase extends AnalysisTokenFilterBase { - hyphenation_patterns_path?: string max_subword_size?: integer min_subword_size?: integer min_word_size?: integer @@ -4434,6 +4631,10 @@ export interface AnalysisDanishAnalyzer { stopwords_path?: string } +export interface AnalysisDecimalDigitTokenFilter extends AnalysisTokenFilterBase { + type: 'decimal_digit' +} + export type AnalysisDelimitedPayloadEncoding = 'int' | 'float' | 'identity' export interface AnalysisDelimitedPayloadTokenFilter extends AnalysisTokenFilterBase { @@ -4466,9 +4667,9 @@ export interface AnalysisEdgeNGramTokenFilter extends AnalysisTokenFilterBase { export interface AnalysisEdgeNGramTokenizer extends AnalysisTokenizerBase { type: 'edge_ngram' custom_token_chars?: string - max_gram: integer - min_gram: integer - token_chars: AnalysisTokenChar[] + max_gram?: integer + min_gram?: integer + token_chars?: AnalysisTokenChar[] } export interface AnalysisElisionTokenFilter extends AnalysisTokenFilterBase { @@ -4514,6 +4715,10 @@ export interface AnalysisFinnishAnalyzer { stem_exclusion?: string[] } +export interface AnalysisFlattenGraphTokenFilter extends AnalysisTokenFilterBase { + type: 'flatten_graph' +} + export interface AnalysisFrenchAnalyzer { type: 'french' stopwords?: AnalysisStopWords @@ -4535,6 +4740,10 @@ export interface AnalysisGermanAnalyzer { stem_exclusion?: string[] } +export interface AnalysisGermanNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'german_normalization' +} + export interface AnalysisGreekAnalyzer { type: 'greek' stopwords?: AnalysisStopWords @@ -4548,6 +4757,10 @@ export interface AnalysisHindiAnalyzer { stem_exclusion?: string[] } +export interface AnalysisHindiNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'hindi_normalization' +} + export interface AnalysisHtmlStripCharFilter extends AnalysisCharFilterBase { type: 'html_strip' escaped_tags?: string[] @@ -4565,11 +4778,16 @@ export interface AnalysisHunspellTokenFilter extends AnalysisTokenFilterBase { dedup?: boolean dictionary?: string locale: string + lang: string + language: string longest_only?: boolean } export interface AnalysisHyphenationDecompounderTokenFilter extends AnalysisCompoundWordTokenFilterBase { type: 'hyphenation_decompounder' + hyphenation_patterns_path: string + no_sub_matches?: boolean + no_overlapping_matches?: boolean } export interface AnalysisIcuAnalyzer { @@ -4635,6 +4853,10 @@ export interface AnalysisIcuTransformTokenFilter extends AnalysisTokenFilterBase id: string } +export interface AnalysisIndicNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'indic_normalization' +} + export interface AnalysisIndonesianAnalyzer { type: 'indonesian' stopwords?: AnalysisStopWords @@ -4656,6 +4878,11 @@ export interface AnalysisItalianAnalyzer { stem_exclusion?: string[] } +export interface AnalysisJaStopTokenFilter extends AnalysisTokenFilterBase { + type: 'ja_stop' + stopwords?: AnalysisStopWords +} + export interface AnalysisKStemTokenFilter extends AnalysisTokenFilterBase { type: 'kstem' } @@ -4665,7 +4892,7 @@ export type AnalysisKeepTypesMode = 'include' | 'exclude' export interface AnalysisKeepTypesTokenFilter extends AnalysisTokenFilterBase { type: 'keep_types' mode?: AnalysisKeepTypesMode - types?: string[] + types: string[] } export interface AnalysisKeepWordsTokenFilter extends AnalysisTokenFilterBase { @@ -4683,14 +4910,18 @@ export interface AnalysisKeywordAnalyzer { export interface AnalysisKeywordMarkerTokenFilter extends AnalysisTokenFilterBase { type: 'keyword_marker' ignore_case?: boolean - keywords?: string[] + keywords?: string | string[] keywords_path?: string keywords_pattern?: string } +export interface AnalysisKeywordRepeatTokenFilter extends AnalysisTokenFilterBase { + type: 'keyword_repeat' +} + export interface AnalysisKeywordTokenizer extends AnalysisTokenizerBase { type: 'keyword' - buffer_size: integer + buffer_size?: integer } export interface AnalysisKuromojiAnalyzer { @@ -4733,17 +4964,6 @@ export interface AnalysisKuromojiTokenizer extends AnalysisTokenizerBase { discard_compound_token?: boolean } -export type AnalysisLanguage = 'Arabic' | 'Armenian' | 'Basque' | 'Brazilian' | 'Bulgarian' | 'Catalan' | 'Chinese' | 'Cjk' | 'Czech' | 'Danish' | 'Dutch' | 'English' | 'Estonian' | 'Finnish' | 'French' | 'Galician' | 'German' | 'Greek' | 'Hindi' | 'Hungarian' | 'Indonesian' | 'Irish' | 'Italian' | 'Latvian' | 'Norwegian' | 'Persian' | 'Portuguese' | 'Romanian' | 'Russian' | 'Sorani' | 'Spanish' | 'Swedish' | 'Turkish' | 'Thai' - -export interface AnalysisLanguageAnalyzer { - type: 'language' - version?: VersionString - language: AnalysisLanguage - stem_exclusion: string[] - stopwords?: AnalysisStopWords - stopwords_path?: string -} - export interface AnalysisLatvianAnalyzer { type: 'latvian' stopwords?: AnalysisStopWords @@ -4780,9 +5000,11 @@ export interface AnalysisLowercaseNormalizer { export interface AnalysisLowercaseTokenFilter extends AnalysisTokenFilterBase { type: 'lowercase' - language?: string + language?: AnalysisLowercaseTokenFilterLanguages } +export type AnalysisLowercaseTokenFilterLanguages = 'greek' | 'irish' | 'turkish' + export interface AnalysisLowercaseTokenizer extends AnalysisTokenizerBase { type: 'lowercase' } @@ -4793,6 +5015,14 @@ export interface AnalysisMappingCharFilter extends AnalysisCharFilterBase { mappings_path?: string } +export interface AnalysisMinHashTokenFilter extends AnalysisTokenFilterBase { + type: 'min_hash' + bucket_count?: integer + hash_count?: integer + hash_set_size?: integer + with_rotation?: boolean +} + export interface AnalysisMultiplexerTokenFilter extends AnalysisTokenFilterBase { type: 'multiplexer' filters: string[] @@ -4809,9 +5039,9 @@ export interface AnalysisNGramTokenFilter extends AnalysisTokenFilterBase { export interface AnalysisNGramTokenizer extends AnalysisTokenizerBase { type: 'ngram' custom_token_chars?: string - max_gram: integer - min_gram: integer - token_chars: AnalysisTokenChar[] + max_gram?: integer + min_gram?: integer + token_chars?: AnalysisTokenChar[] } export interface AnalysisNoriAnalyzer { @@ -4880,7 +5110,6 @@ export interface AnalysisPatternReplaceCharFilter extends AnalysisCharFilterBase export interface AnalysisPatternReplaceTokenFilter extends AnalysisTokenFilterBase { type: 'pattern_replace' all?: boolean - flags?: string pattern: string replacement?: string } @@ -4898,6 +5127,10 @@ export interface AnalysisPersianAnalyzer { stopwords_path?: string } +export interface AnalysisPersianNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'persian_normalization' +} + export type AnalysisPhoneticEncoder = 'metaphone' | 'double_metaphone' | 'soundex' | 'refined_soundex' | 'caverphone1' | 'caverphone2' | 'cologne' | 'nysiis' | 'koelnerphonetik' | 'haasephonetik' | 'beider_morse' | 'daitch_mokotoff' export type AnalysisPhoneticLanguage = 'any' | 'common' | 'cyrillic' | 'english' | 'french' | 'german' | 'hebrew' | 'hungarian' | 'polish' | 'romanian' | 'russian' | 'spanish' @@ -4954,6 +5187,14 @@ export interface AnalysisRussianAnalyzer { stem_exclusion?: string[] } +export interface AnalysisScandinavianFoldingTokenFilter extends AnalysisTokenFilterBase { + type: 'scandinavian_folding' +} + +export interface AnalysisScandinavianNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'scandinavian_normalization' +} + export interface AnalysisSerbianAnalyzer { type: 'serbian' stopwords?: AnalysisStopWords @@ -4961,11 +5202,15 @@ export interface AnalysisSerbianAnalyzer { stem_exclusion?: string[] } +export interface AnalysisSerbianNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'serbian_normalization' +} + export interface AnalysisShingleTokenFilter extends AnalysisTokenFilterBase { type: 'shingle' filler_token?: string - max_shingle_size?: integer | string - min_shingle_size?: integer | string + max_shingle_size?: SpecUtilsStringified + min_shingle_size?: SpecUtilsStringified output_unigrams?: boolean output_unigrams_if_no_shingles?: boolean token_separator?: string @@ -4976,6 +5221,16 @@ export interface AnalysisSimpleAnalyzer { version?: VersionString } +export interface AnalysisSimplePatternSplitTokenizer extends AnalysisTokenizerBase { + type: 'simple_pattern_split' + pattern?: string +} + +export interface AnalysisSimplePatternTokenizer extends AnalysisTokenizerBase { + type: 'simple_pattern' + pattern?: string +} + export interface AnalysisSnowballAnalyzer { type: 'snowball' version?: VersionString @@ -4983,7 +5238,7 @@ export interface AnalysisSnowballAnalyzer { stopwords?: AnalysisStopWords } -export type AnalysisSnowballLanguage = 'Armenian' | 'Basque' | 'Catalan' | 'Danish' | 'Dutch' | 'English' | 'Finnish' | 'French' | 'German' | 'German2' | 'Hungarian' | 'Italian' | 'Kp' | 'Lovins' | 'Norwegian' | 'Porter' | 'Portuguese' | 'Romanian' | 'Russian' | 'Spanish' | 'Swedish' | 'Turkish' +export type AnalysisSnowballLanguage = 'Arabic' | 'Armenian' | 'Basque' | 'Catalan' | 'Danish' | 'Dutch' | 'English' | 'Estonian' | 'Finnish' | 'French' | 'German' | 'German2' | 'Hungarian' | 'Italian' | 'Irish' | 'Kp' | 'Lithuanian' | 'Lovins' | 'Norwegian' | 'Porter' | 'Portuguese' | 'Romanian' | 'Russian' | 'Serbian' | 'Spanish' | 'Swedish' | 'Turkish' export interface AnalysisSnowballTokenFilter extends AnalysisTokenFilterBase { type: 'snowball' @@ -4997,6 +5252,10 @@ export interface AnalysisSoraniAnalyzer { stem_exclusion?: string[] } +export interface AnalysisSoraniNormalizationTokenFilter extends AnalysisTokenFilterBase { + type: 'sorani_normalization' +} + export interface AnalysisSpanishAnalyzer { type: 'spanish' stopwords?: AnalysisStopWords @@ -5042,7 +5301,9 @@ export interface AnalysisStopTokenFilter extends AnalysisTokenFilterBase { stopwords_path?: string } -export type AnalysisStopWords = string | string[] +export type AnalysisStopWordLanguage = '_arabic_' | '_armenian_' | '_basque_' | '_bengali_' | '_brazilian_' | '_bulgarian_' | '_catalan_' | '_cjk_' | '_czech_' | '_danish_' | '_dutch_' | '_english_' | '_estonian_' | '_finnish_' | '_french_' | '_galician_' | '_german_' | '_greek_' | '_hindi_' | '_hungarian_' | '_indonesian_' | '_irish_' | '_italian_' | '_latvian_' | '_lithuanian_' | '_norwegian_' | '_persian_' | '_portuguese_' | '_romanian_' | '_russian_' | '_serbian_' | '_sorani_' | '_spanish_' | '_swedish_' | '_thai_' | '_turkish_' | '_none_' + +export type AnalysisStopWords = AnalysisStopWordLanguage | string[] export interface AnalysisSwedishAnalyzer { type: 'swedish' @@ -5053,20 +5314,15 @@ export interface AnalysisSwedishAnalyzer { export type AnalysisSynonymFormat = 'solr' | 'wordnet' -export interface AnalysisSynonymGraphTokenFilter extends AnalysisTokenFilterBase { +export interface AnalysisSynonymGraphTokenFilter extends AnalysisSynonymTokenFilterBase { type: 'synonym_graph' - expand?: boolean - format?: AnalysisSynonymFormat - lenient?: boolean - synonyms?: string[] - synonyms_path?: string - synonyms_set?: string - tokenizer?: string - updateable?: boolean } -export interface AnalysisSynonymTokenFilter extends AnalysisTokenFilterBase { +export interface AnalysisSynonymTokenFilter extends AnalysisSynonymTokenFilterBase { type: 'synonym' +} + +export interface AnalysisSynonymTokenFilterBase extends AnalysisTokenFilterBase { expand?: boolean format?: AnalysisSynonymFormat lenient?: boolean @@ -5083,6 +5339,10 @@ export interface AnalysisThaiAnalyzer { stopwords_path?: string } +export interface AnalysisThaiTokenizer extends AnalysisTokenizerBase { + type: 'thai' +} + export type AnalysisTokenChar = 'letter' | 'digit' | 'whitespace' | 'punctuation' | 'symbol' | 'custom' export type AnalysisTokenFilter = string | AnalysisTokenFilterDefinition @@ -5091,7 +5351,7 @@ export interface AnalysisTokenFilterBase { version?: VersionString } -export type AnalysisTokenFilterDefinition = AnalysisAsciiFoldingTokenFilter | AnalysisCommonGramsTokenFilter | AnalysisConditionTokenFilter | AnalysisDelimitedPayloadTokenFilter | AnalysisEdgeNGramTokenFilter | AnalysisElisionTokenFilter | AnalysisFingerprintTokenFilter | AnalysisHunspellTokenFilter | AnalysisHyphenationDecompounderTokenFilter | AnalysisKeepTypesTokenFilter | AnalysisKeepWordsTokenFilter | AnalysisKeywordMarkerTokenFilter | AnalysisKStemTokenFilter | AnalysisLengthTokenFilter | AnalysisLimitTokenCountTokenFilter | AnalysisLowercaseTokenFilter | AnalysisMultiplexerTokenFilter | AnalysisNGramTokenFilter | AnalysisNoriPartOfSpeechTokenFilter | AnalysisPatternCaptureTokenFilter | AnalysisPatternReplaceTokenFilter | AnalysisPorterStemTokenFilter | AnalysisPredicateTokenFilter | AnalysisRemoveDuplicatesTokenFilter | AnalysisReverseTokenFilter | AnalysisShingleTokenFilter | AnalysisSnowballTokenFilter | AnalysisStemmerOverrideTokenFilter | AnalysisStemmerTokenFilter | AnalysisStopTokenFilter | AnalysisSynonymGraphTokenFilter | AnalysisSynonymTokenFilter | AnalysisTrimTokenFilter | AnalysisTruncateTokenFilter | AnalysisUniqueTokenFilter | AnalysisUppercaseTokenFilter | AnalysisWordDelimiterGraphTokenFilter | AnalysisWordDelimiterTokenFilter | AnalysisKuromojiStemmerTokenFilter | AnalysisKuromojiReadingFormTokenFilter | AnalysisKuromojiPartOfSpeechTokenFilter | AnalysisIcuCollationTokenFilter | AnalysisIcuFoldingTokenFilter | AnalysisIcuNormalizationTokenFilter | AnalysisIcuTransformTokenFilter | AnalysisPhoneticTokenFilter | AnalysisDictionaryDecompounderTokenFilter +export type AnalysisTokenFilterDefinition = AnalysisApostropheTokenFilter | AnalysisArabicNormalizationTokenFilter | AnalysisAsciiFoldingTokenFilter | AnalysisCjkBigramTokenFilter | AnalysisCjkWidthTokenFilter | AnalysisClassicTokenFilter | AnalysisCommonGramsTokenFilter | AnalysisConditionTokenFilter | AnalysisDecimalDigitTokenFilter | AnalysisDelimitedPayloadTokenFilter | AnalysisEdgeNGramTokenFilter | AnalysisElisionTokenFilter | AnalysisFingerprintTokenFilter | AnalysisFlattenGraphTokenFilter | AnalysisGermanNormalizationTokenFilter | AnalysisHindiNormalizationTokenFilter | AnalysisHunspellTokenFilter | AnalysisHyphenationDecompounderTokenFilter | AnalysisIndicNormalizationTokenFilter | AnalysisKeepTypesTokenFilter | AnalysisKeepWordsTokenFilter | AnalysisKeywordMarkerTokenFilter | AnalysisKeywordRepeatTokenFilter | AnalysisKStemTokenFilter | AnalysisLengthTokenFilter | AnalysisLimitTokenCountTokenFilter | AnalysisLowercaseTokenFilter | AnalysisMinHashTokenFilter | AnalysisMultiplexerTokenFilter | AnalysisNGramTokenFilter | AnalysisNoriPartOfSpeechTokenFilter | AnalysisPatternCaptureTokenFilter | AnalysisPatternReplaceTokenFilter | AnalysisPersianNormalizationTokenFilter | AnalysisPorterStemTokenFilter | AnalysisPredicateTokenFilter | AnalysisRemoveDuplicatesTokenFilter | AnalysisReverseTokenFilter | AnalysisScandinavianFoldingTokenFilter | AnalysisScandinavianNormalizationTokenFilter | AnalysisSerbianNormalizationTokenFilter | AnalysisShingleTokenFilter | AnalysisSnowballTokenFilter | AnalysisSoraniNormalizationTokenFilter | AnalysisStemmerOverrideTokenFilter | AnalysisStemmerTokenFilter | AnalysisStopTokenFilter | AnalysisSynonymGraphTokenFilter | AnalysisSynonymTokenFilter | AnalysisTrimTokenFilter | AnalysisTruncateTokenFilter | AnalysisUniqueTokenFilter | AnalysisUppercaseTokenFilter | AnalysisWordDelimiterGraphTokenFilter | AnalysisWordDelimiterTokenFilter | AnalysisJaStopTokenFilter | AnalysisKuromojiStemmerTokenFilter | AnalysisKuromojiReadingFormTokenFilter | AnalysisKuromojiPartOfSpeechTokenFilter | AnalysisIcuCollationTokenFilter | AnalysisIcuFoldingTokenFilter | AnalysisIcuNormalizationTokenFilter | AnalysisIcuTransformTokenFilter | AnalysisPhoneticTokenFilter | AnalysisDictionaryDecompounderTokenFilter export type AnalysisTokenizer = string | AnalysisTokenizerDefinition @@ -5099,7 +5359,7 @@ export interface AnalysisTokenizerBase { version?: VersionString } -export type AnalysisTokenizerDefinition = AnalysisCharGroupTokenizer | AnalysisEdgeNGramTokenizer | AnalysisKeywordTokenizer | AnalysisLetterTokenizer | AnalysisLowercaseTokenizer | AnalysisNGramTokenizer | AnalysisNoriTokenizer | AnalysisPathHierarchyTokenizer | AnalysisStandardTokenizer | AnalysisUaxEmailUrlTokenizer | AnalysisWhitespaceTokenizer | AnalysisKuromojiTokenizer | AnalysisPatternTokenizer | AnalysisIcuTokenizer +export type AnalysisTokenizerDefinition = AnalysisCharGroupTokenizer | AnalysisClassicTokenizer | AnalysisEdgeNGramTokenizer | AnalysisKeywordTokenizer | AnalysisLetterTokenizer | AnalysisLowercaseTokenizer | AnalysisNGramTokenizer | AnalysisPathHierarchyTokenizer | AnalysisPatternTokenizer | AnalysisSimplePatternTokenizer | AnalysisSimplePatternSplitTokenizer | AnalysisStandardTokenizer | AnalysisThaiTokenizer | AnalysisUaxEmailUrlTokenizer | AnalysisWhitespaceTokenizer | AnalysisIcuTokenizer | AnalysisKuromojiTokenizer | AnalysisNoriTokenizer export interface AnalysisTrimTokenFilter extends AnalysisTokenFilterBase { type: 'trim' @@ -5141,27 +5401,17 @@ export interface AnalysisWhitespaceTokenizer extends AnalysisTokenizerBase { max_token_length?: integer } -export interface AnalysisWordDelimiterGraphTokenFilter extends AnalysisTokenFilterBase { +export interface AnalysisWordDelimiterGraphTokenFilter extends AnalysisWordDelimiterTokenFilterBase { type: 'word_delimiter_graph' adjust_offsets?: boolean - catenate_all?: boolean - catenate_numbers?: boolean - catenate_words?: boolean - generate_number_parts?: boolean - generate_word_parts?: boolean ignore_keywords?: boolean - preserve_original?: SpecUtilsStringified - protected_words?: string[] - protected_words_path?: string - split_on_case_change?: boolean - split_on_numerics?: boolean - stem_english_possessive?: boolean - type_table?: string[] - type_table_path?: string } -export interface AnalysisWordDelimiterTokenFilter extends AnalysisTokenFilterBase { +export interface AnalysisWordDelimiterTokenFilter extends AnalysisWordDelimiterTokenFilterBase { type: 'word_delimiter' +} + +export interface AnalysisWordDelimiterTokenFilterBase extends AnalysisTokenFilterBase { catenate_all?: boolean catenate_numbers?: boolean catenate_words?: boolean @@ -5206,6 +5456,10 @@ export interface MappingBooleanProperty extends MappingDocValuesPropertyBase { fielddata?: IndicesNumericFielddata index?: boolean null_value?: boolean + ignore_malformed?: boolean + script?: Script | string + on_script_error?: MappingOnScriptError + time_series_dimension?: boolean type: 'boolean' } @@ -5224,6 +5478,10 @@ export interface MappingCompletionProperty extends MappingDocValuesPropertyBase type: 'completion' } +export interface MappingCompositeSubField { + type: MappingRuntimeFieldType +} + export interface MappingConstantKeywordProperty extends MappingPropertyBase { value?: any type: 'constant_keyword' @@ -5231,10 +5489,14 @@ export interface MappingConstantKeywordProperty extends MappingPropertyBase { export interface MappingCorePropertyBase extends MappingPropertyBase { copy_to?: Fields - similarity?: string store?: boolean } +export interface MappingCountedKeywordProperty extends MappingPropertyBase { + type: 'counted_keyword' + index?: boolean +} + export interface MappingDataStreamTimestamp { enabled: boolean } @@ -5244,6 +5506,8 @@ export interface MappingDateNanosProperty extends MappingDocValuesPropertyBase { format?: string ignore_malformed?: boolean index?: boolean + script?: Script | string + on_script_error?: MappingOnScriptError null_value?: DateTime precision_step?: integer type: 'date_nanos' @@ -5255,6 +5519,8 @@ export interface MappingDateProperty extends MappingDocValuesPropertyBase { format?: string ignore_malformed?: boolean index?: boolean + script?: Script | string + on_script_error?: MappingOnScriptError null_value?: DateTime precision_step?: integer locale?: string @@ -5266,22 +5532,28 @@ export interface MappingDateRangeProperty extends MappingRangePropertyBase { type: 'date_range' } +export type MappingDenseVectorElementType = 'bit' | 'byte' | 'float' + export interface MappingDenseVectorIndexOptions { - type: string - m?: integer - ef_construction?: integer confidence_interval?: float + ef_construction?: integer + m?: integer + type: MappingDenseVectorIndexOptionsType } +export type MappingDenseVectorIndexOptionsType = 'bbq_flat' | 'bbq_hnsw' | 'flat' | 'hnsw' | 'int4_flat' | 'int4_hnsw' | 'int8_flat' | 'int8_hnsw' + export interface MappingDenseVectorProperty extends MappingPropertyBase { type: 'dense_vector' - element_type?: string dims?: integer - similarity?: string + element_type?: MappingDenseVectorElementType index?: boolean index_options?: MappingDenseVectorIndexOptions + similarity?: MappingDenseVectorSimilarity } +export type MappingDenseVectorSimilarity = 'cosine' | 'dot_product' | 'l2_norm' | 'max_inner_product' + export interface MappingDocValuesPropertyBase extends MappingCorePropertyBase { doc_values?: boolean } @@ -5312,7 +5584,7 @@ export interface MappingDynamicProperty extends MappingDocValuesPropertyBase { index?: boolean index_options?: MappingIndexOptions index_phrases?: boolean - index_prefixes?: MappingTextIndexPrefixes + index_prefixes?: MappingTextIndexPrefixes | null norms?: boolean position_increment_gap?: integer search_analyzer?: string @@ -5325,7 +5597,7 @@ export interface MappingDynamicProperty extends MappingDocValuesPropertyBase { export interface MappingDynamicTemplate { mapping?: MappingProperty - runtime?: MappingProperty + runtime?: MappingRuntimeField match?: string | string[] path_match?: string | string[] unmatch?: string | string[] @@ -5349,7 +5621,7 @@ export interface MappingFieldNamesField { enabled: boolean } -export type MappingFieldType = 'none' | 'geo_point' | 'geo_shape' | 'ip' | 'binary' | 'keyword' | 'text' | 'search_as_you_type' | 'date' | 'date_nanos' | 'boolean' | 'completion' | 'nested' | 'object' | 'version' | 'murmur3' | 'token_count' | 'percolator' | 'integer' | 'long' | 'short' | 'byte' | 'float' | 'half_float' | 'scaled_float' | 'double' | 'integer_range' | 'float_range' | 'long_range' | 'double_range' | 'date_range' | 'ip_range' | 'alias' | 'join' | 'rank_feature' | 'rank_features' | 'flattened' | 'shape' | 'histogram' | 'constant_keyword' | 'aggregate_metric_double' | 'dense_vector' | 'semantic_text' | 'sparse_vector' | 'match_only_text' | 'icu_collation_keyword' +export type MappingFieldType = 'none' | 'geo_point' | 'geo_shape' | 'ip' | 'binary' | 'keyword' | 'text' | 'search_as_you_type' | 'date' | 'date_nanos' | 'boolean' | 'completion' | 'nested' | 'object' | 'passthrough' | 'version' | 'murmur3' | 'token_count' | 'percolator' | 'integer' | 'long' | 'short' | 'byte' | 'float' | 'half_float' | 'scaled_float' | 'double' | 'integer_range' | 'float_range' | 'long_range' | 'double_range' | 'date_range' | 'ip_range' | 'alias' | 'join' | 'rank_feature' | 'rank_features' | 'flattened' | 'shape' | 'histogram' | 'constant_keyword' | 'counted_keyword' | 'aggregate_metric_double' | 'dense_vector' | 'semantic_text' | 'sparse_vector' | 'match_only_text' | 'icu_collation_keyword' export interface MappingFlattenedProperty extends MappingPropertyBase { boost?: double @@ -5389,6 +5661,7 @@ export interface MappingGeoShapeProperty extends MappingDocValuesPropertyBase { coerce?: boolean ignore_malformed?: boolean ignore_z_value?: boolean + index?: boolean orientation?: MappingGeoOrientation strategy?: MappingGeoStrategy type: 'geo_shape' @@ -5472,6 +5745,7 @@ export interface MappingKeywordProperty extends MappingDocValuesPropertyBase { normalizer?: string norms?: boolean null_value?: string + similarity?: string | null split_queries_on_whitespace?: boolean time_series_dimension?: boolean type: 'keyword' @@ -5519,12 +5793,19 @@ export interface MappingNumberPropertyBase extends MappingDocValuesPropertyBase export interface MappingObjectProperty extends MappingCorePropertyBase { enabled?: boolean - subobjects?: boolean + subobjects?: MappingSubobjects type?: 'object' } export type MappingOnScriptError = 'fail' | 'continue' +export interface MappingPassthroughObjectProperty extends MappingCorePropertyBase { + type?: 'passthrough' + enabled?: boolean + priority?: integer + time_series_dimension?: boolean +} + export interface MappingPercolatorProperty extends MappingPropertyBase { type: 'percolator' } @@ -5536,7 +5817,7 @@ export interface MappingPointProperty extends MappingDocValuesPropertyBase { type: 'point' } -export type MappingProperty = MappingBinaryProperty | MappingBooleanProperty | MappingDynamicProperty | MappingJoinProperty | MappingKeywordProperty | MappingMatchOnlyTextProperty | MappingPercolatorProperty | MappingRankFeatureProperty | MappingRankFeaturesProperty | MappingSearchAsYouTypeProperty | MappingTextProperty | MappingVersionProperty | MappingWildcardProperty | MappingDateNanosProperty | MappingDateProperty | MappingAggregateMetricDoubleProperty | MappingDenseVectorProperty | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingSemanticTextProperty | MappingSparseVectorProperty | MappingCompletionProperty | MappingConstantKeywordProperty | MappingFieldAliasProperty | MappingHistogramProperty | MappingIpProperty | MappingMurmur3HashProperty | MappingTokenCountProperty | MappingGeoPointProperty | MappingGeoShapeProperty | MappingPointProperty | MappingShapeProperty | MappingByteNumberProperty | MappingDoubleNumberProperty | MappingFloatNumberProperty | MappingHalfFloatNumberProperty | MappingIntegerNumberProperty | MappingLongNumberProperty | MappingScaledFloatNumberProperty | MappingShortNumberProperty | MappingUnsignedLongNumberProperty | MappingDateRangeProperty | MappingDoubleRangeProperty | MappingFloatRangeProperty | MappingIntegerRangeProperty | MappingIpRangeProperty | MappingLongRangeProperty | MappingIcuCollationProperty +export type MappingProperty = MappingBinaryProperty | MappingBooleanProperty | MappingDynamicProperty | MappingJoinProperty | MappingKeywordProperty | MappingMatchOnlyTextProperty | MappingPercolatorProperty | MappingRankFeatureProperty | MappingRankFeaturesProperty | MappingSearchAsYouTypeProperty | MappingTextProperty | MappingVersionProperty | MappingWildcardProperty | MappingDateNanosProperty | MappingDateProperty | MappingAggregateMetricDoubleProperty | MappingDenseVectorProperty | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingPassthroughObjectProperty | MappingSemanticTextProperty | MappingSparseVectorProperty | MappingCompletionProperty | MappingConstantKeywordProperty | MappingCountedKeywordProperty | MappingFieldAliasProperty | MappingHistogramProperty | MappingIpProperty | MappingMurmur3HashProperty | MappingTokenCountProperty | MappingGeoPointProperty | MappingGeoShapeProperty | MappingPointProperty | MappingShapeProperty | MappingByteNumberProperty | MappingDoubleNumberProperty | MappingFloatNumberProperty | MappingHalfFloatNumberProperty | MappingIntegerNumberProperty | MappingLongNumberProperty | MappingScaledFloatNumberProperty | MappingShortNumberProperty | MappingUnsignedLongNumberProperty | MappingDateRangeProperty | MappingDoubleRangeProperty | MappingFloatRangeProperty | MappingIntegerRangeProperty | MappingIpRangeProperty | MappingLongRangeProperty | MappingIcuCollationProperty export interface MappingPropertyBase { meta?: Record @@ -5544,6 +5825,7 @@ export interface MappingPropertyBase { ignore_above?: integer dynamic?: MappingDynamicMapping fields?: Record + synthetic_source_keep?: MappingSyntheticSourceKeepEnum } export interface MappingRangePropertyBase extends MappingDocValuesPropertyBase { @@ -5567,6 +5849,7 @@ export interface MappingRoutingField { } export interface MappingRuntimeField { + fields?: Record fetch_fields?: (MappingRuntimeFieldFetchFields | Field)[] format?: string input_field?: Field @@ -5581,7 +5864,7 @@ export interface MappingRuntimeFieldFetchFields { format?: string } -export type MappingRuntimeFieldType = 'boolean' | 'composite' | 'date' | 'double' | 'geo_point' | 'ip' | 'keyword' | 'long' | 'lookup' +export type MappingRuntimeFieldType = 'boolean' | 'composite' | 'date' | 'double' | 'geo_point' | 'geo_shape' | 'ip' | 'keyword' | 'long' | 'lookup' export type MappingRuntimeFields = Record @@ -5599,6 +5882,7 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase norms?: boolean search_analyzer?: string search_quote_analyzer?: string + similarity?: string | null term_vector?: MappingTermVectorOption type: 'search_as_you_type' } @@ -5606,7 +5890,8 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase export interface MappingSemanticTextProperty { type: 'semantic_text' meta?: Record - inference_id: Id + inference_id?: Id + search_inference_id?: Id } export interface MappingShapeProperty extends MappingDocValuesPropertyBase { @@ -5641,6 +5926,8 @@ export interface MappingSparseVectorProperty extends MappingPropertyBase { type: 'sparse_vector' } +export type MappingSubobjects = boolean | 'true' | 'false' | 'auto' + export interface MappingSuggestContext { name: Name path?: Field @@ -5648,6 +5935,8 @@ export interface MappingSuggestContext { precision?: integer | string } +export type MappingSyntheticSourceKeepEnum = 'none' | 'arrays' | 'all' + export type MappingTermVectorOption = 'no' | 'yes' | 'with_offsets' | 'with_positions' | 'with_positions_offsets' | 'with_positions_offsets_payloads' | 'with_positions_payloads' export interface MappingTextIndexPrefixes { @@ -5664,11 +5953,12 @@ export interface MappingTextProperty extends MappingCorePropertyBase { index?: boolean index_options?: MappingIndexOptions index_phrases?: boolean - index_prefixes?: MappingTextIndexPrefixes + index_prefixes?: MappingTextIndexPrefixes | null norms?: boolean position_increment_gap?: integer search_analyzer?: string search_quote_analyzer?: string + similarity?: string | null term_vector?: MappingTermVectorOption type: 'text' } @@ -5689,7 +5979,7 @@ export interface MappingTypeMapping { date_detection?: boolean dynamic?: MappingDynamicMapping dynamic_date_formats?: string[] - dynamic_templates?: Record[] + dynamic_templates?: Partial>[] _field_names?: MappingFieldNamesField index_field?: MappingIndexField _meta?: Metadata @@ -5700,7 +5990,7 @@ export interface MappingTypeMapping { _source?: MappingSourceField runtime?: Record enabled?: boolean - subobjects?: boolean + subobjects?: MappingSubobjects _data_stream_timestamp?: MappingDataStreamTimestamp } @@ -5885,6 +6175,12 @@ export type QueryDslGeoDistanceQuery = QueryDslGeoDistanceQueryKeys export type QueryDslGeoExecution = 'memory' | 'indexed' +export interface QueryDslGeoGridQuery extends QueryDslQueryBase { + geogrid?: GeoTile + geohash?: GeoHash + geohex?: GeoHexCell +} + export interface QueryDslGeoPolygonPoints { points: GeoLocation[] } @@ -6180,6 +6476,7 @@ export interface QueryDslQueryContainer { fuzzy?: Partial> geo_bounding_box?: QueryDslGeoBoundingBoxQuery geo_distance?: QueryDslGeoDistanceQuery + geo_grid?: Partial> geo_polygon?: QueryDslGeoPolygonQuery geo_shape?: QueryDslGeoShapeQuery has_child?: QueryDslHasChildQuery @@ -6462,6 +6759,7 @@ export type QueryDslTermsQuery = QueryDslTermsQueryKeys export type QueryDslTermsQueryField = FieldValue[] | QueryDslTermsLookup export interface QueryDslTermsSetQuery extends QueryDslQueryBase { + minimum_should_match?: MinimumShouldMatch minimum_should_match_field?: Field minimum_should_match_script?: Script | string terms: string[] @@ -6566,6 +6864,7 @@ export type AsyncSearchGetResponse[] + indices_boost?: Partial>[] docvalue_fields?: (QueryDslFieldAndFormat | Field)[] knn?: KnnSearch | KnnSearch[] min_score?: double @@ -6658,6 +6955,8 @@ export interface AutoscalingAutoscalingPolicy { export interface AutoscalingDeleteAutoscalingPolicyRequest extends RequestBase { name: Name + master_timeout?: Duration + timeout?: Duration } export type AutoscalingDeleteAutoscalingPolicyResponse = AcknowledgedResponseBase @@ -6690,6 +6989,7 @@ export interface AutoscalingGetAutoscalingCapacityAutoscalingResources { } export interface AutoscalingGetAutoscalingCapacityRequest extends RequestBase { + master_timeout?: Duration } export interface AutoscalingGetAutoscalingCapacityResponse { @@ -6698,12 +6998,15 @@ export interface AutoscalingGetAutoscalingCapacityResponse { export interface AutoscalingGetAutoscalingPolicyRequest extends RequestBase { name: Name + master_timeout?: Duration } export type AutoscalingGetAutoscalingPolicyResponse = AutoscalingAutoscalingPolicy export interface AutoscalingPutAutoscalingPolicyRequest extends RequestBase { name: Name + master_timeout?: Duration + timeout?: Duration /** @deprecated The use of the 'body' key has been deprecated, use 'policy' instead. */ body?: AutoscalingAutoscalingPolicy } @@ -6755,57 +7058,65 @@ export interface CatAliasesAliasesRecord { export interface CatAliasesRequest extends CatCatRequestBase { name?: Names + h?: Names + s?: Names expand_wildcards?: ExpandWildcards + local?: boolean + master_timeout?: Duration } export type CatAliasesResponse = CatAliasesAliasesRecord[] export interface CatAllocationAllocationRecord { - shards: string - s: string - 'shards.undesired': string | null - 'write_load.forecast': double | null - wlf: double | null - writeLoadForecast: double | null - 'disk.indices.forecast': ByteSize | null - dif: ByteSize | null - diskIndicesForecast: ByteSize | null - 'disk.indices': ByteSize | null - di: ByteSize | null - diskIndices: ByteSize | null - 'disk.used': ByteSize | null - du: ByteSize | null - diskUsed: ByteSize | null - 'disk.avail': ByteSize | null - da: ByteSize | null - diskAvail: ByteSize | null - 'disk.total': ByteSize | null - dt: ByteSize | null - diskTotal: ByteSize | null - 'disk.percent': Percentage | null - dp: Percentage | null - diskPercent: Percentage | null - host: Host | null - h: Host | null - ip: Ip | null - node: string - n: string - 'node.role': string | null - r: string | null - role: string | null - nodeRole: string | null + shards?: string + s?: string + 'shards.undesired'?: string | null + 'write_load.forecast'?: SpecUtilsStringified | null + wlf?: SpecUtilsStringified | null + writeLoadForecast?: SpecUtilsStringified | null + 'disk.indices.forecast'?: ByteSize | null + dif?: ByteSize | null + diskIndicesForecast?: ByteSize | null + 'disk.indices'?: ByteSize | null + di?: ByteSize | null + diskIndices?: ByteSize | null + 'disk.used'?: ByteSize | null + du?: ByteSize | null + diskUsed?: ByteSize | null + 'disk.avail'?: ByteSize | null + da?: ByteSize | null + diskAvail?: ByteSize | null + 'disk.total'?: ByteSize | null + dt?: ByteSize | null + diskTotal?: ByteSize | null + 'disk.percent'?: Percentage | null + dp?: Percentage | null + diskPercent?: Percentage | null + host?: Host | null + h?: Host | null + ip?: Ip | null + node?: string + n?: string + 'node.role'?: string | null + r?: string | null + role?: string | null + nodeRole?: string | null } export interface CatAllocationRequest extends CatCatRequestBase { node_id?: NodeIds bytes?: Bytes + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatAllocationResponse = CatAllocationAllocationRecord[] export interface CatComponentTemplatesComponentTemplate { name: string - version: string + version: string | null alias_count: string mapping_count: string settings_count: string @@ -6815,6 +7126,10 @@ export interface CatComponentTemplatesComponentTemplate { export interface CatComponentTemplatesRequest extends CatCatRequestBase { name?: string + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatComponentTemplatesResponse = CatComponentTemplatesComponentTemplate[] @@ -6835,6 +7150,8 @@ export interface CatCountCountRecord { export interface CatCountRequest extends CatCatRequestBase { index?: Indices + h?: Names + s?: Names } export type CatCountResponse = CatCountCountRecord[] @@ -6854,6 +7171,8 @@ export interface CatFielddataFielddataRecord { export interface CatFielddataRequest extends CatCatRequestBase { fields?: Fields bytes?: Bytes + h?: Names + s?: Names } export type CatFielddataResponse = CatFielddataFielddataRecord[] @@ -6892,6 +7211,10 @@ export interface CatHealthHealthRecord { i?: string 'shards.initializing'?: string shardsInitializing?: string + 'unassign.pri'?: string + up?: string + 'shards.unassigned.primary'?: string + shardsUnassignedPrimary?: string unassign?: string u?: string 'shards.unassigned'?: string @@ -6910,19 +7233,18 @@ export interface CatHealthHealthRecord { export interface CatHealthRequest extends CatCatRequestBase { time?: TimeUnit ts?: boolean + h?: Names + s?: Names } export type CatHealthResponse = CatHealthHealthRecord[] -export interface CatHelpHelpRecord { - endpoint: string +export interface CatHelpRequest { } -export interface CatHelpRequest extends CatCatRequestBase { +export interface CatHelpResponse { } -export type CatHelpResponse = CatHelpHelpRecord[] - export interface CatIndicesIndicesRecord { health?: string h?: string @@ -6955,6 +7277,7 @@ export interface CatIndicesIndicesRecord { ss?: string | null storeSize?: string | null 'pri.store.size'?: string | null + 'dataset.size'?: string | null 'completion.size'?: string cs?: string completionSize?: string @@ -7221,6 +7544,9 @@ export interface CatIndicesRequest extends CatCatRequestBase { include_unloaded_segments?: boolean pri?: boolean time?: TimeUnit + master_timeout?: Duration + h?: Names + s?: Names } export type CatIndicesResponse = CatIndicesIndicesRecord[] @@ -7235,6 +7561,10 @@ export interface CatMasterMasterRecord { } export interface CatMasterRequest extends CatCatRequestBase { + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatMasterResponse = CatMasterMasterRecord[] @@ -7289,7 +7619,7 @@ export interface CatMlDataFrameAnalyticsRequest extends CatCatRequestBase { bytes?: Bytes h?: CatCatDfaColumns s?: CatCatDfaColumns - time?: Duration + time?: TimeUnit } export type CatMlDataFrameAnalyticsResponse = CatMlDataFrameAnalyticsDataFrameAnalyticsRecord[] @@ -7535,6 +7865,7 @@ export interface CatMlTrainedModelsRequest extends CatCatRequestBase { s?: CatCatTrainedModelsColumns from?: integer size?: integer + time?: TimeUnit } export type CatMlTrainedModelsResponse = CatMlTrainedModelsTrainedModelsRecord[] @@ -7602,6 +7933,10 @@ export interface CatNodeattrsNodeAttributesRecord { } export interface CatNodeattrsRequest extends CatCatRequestBase { + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatNodeattrsResponse = CatNodeattrsNodeAttributesRecord[] @@ -7880,6 +8215,10 @@ export interface CatNodesRequest extends CatCatRequestBase { bytes?: Bytes full_id?: boolean | string include_unloaded_segments?: boolean + h?: Names + s?: Names + master_timeout?: Duration + time?: TimeUnit } export type CatNodesResponse = CatNodesNodesRecord[] @@ -7896,6 +8235,11 @@ export interface CatPendingTasksPendingTasksRecord { } export interface CatPendingTasksRequest extends CatCatRequestBase { + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration + time?: TimeUnit } export type CatPendingTasksResponse = CatPendingTasksPendingTasksRecord[] @@ -7915,6 +8259,11 @@ export interface CatPluginsPluginsRecord { } export interface CatPluginsRequest extends CatCatRequestBase { + h?: Names + s?: Names + include_bootstrap?: boolean + local?: boolean + master_timeout?: Duration } export type CatPluginsResponse = CatPluginsPluginsRecord[] @@ -7982,6 +8331,9 @@ export interface CatRecoveryRequest extends CatCatRequestBase { active_only?: boolean bytes?: Bytes detailed?: boolean + h?: Names + s?: Names + time?: TimeUnit } export type CatRecoveryResponse = CatRecoveryRecoveryRecord[] @@ -7994,6 +8346,10 @@ export interface CatRepositoriesRepositoriesRecord { } export interface CatRepositoriesRequest extends CatCatRequestBase { + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatRepositoriesResponse = CatRepositoriesRepositoriesRecord[] @@ -8001,6 +8357,10 @@ export type CatRepositoriesResponse = CatRepositoriesRepositoriesRecord[] export interface CatSegmentsRequest extends CatCatRequestBase { index?: Indices bytes?: Bytes + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatSegmentsResponse = CatSegmentsSegmentsRecord[] @@ -8050,6 +8410,10 @@ export interface CatSegmentsSegmentsRecord { export interface CatShardsRequest extends CatCatRequestBase { index?: Indices bytes?: Bytes + h?: Names + s?: Names + master_timeout?: Duration + time?: TimeUnit } export type CatShardsResponse = CatShardsShardsRecord[] @@ -8072,6 +8436,7 @@ export interface CatShardsShardsRecord { dc?: string | null store?: string | null sto?: string | null + dataset?: string | null ip?: string | null id?: string node?: string | null @@ -8271,6 +8636,10 @@ export interface CatShardsShardsRecord { export interface CatSnapshotsRequest extends CatCatRequestBase { repository?: Names ignore_unavailable?: boolean + h?: Names + s?: Names + master_timeout?: Duration + time?: TimeUnit } export type CatSnapshotsResponse = CatSnapshotsSnapshotsRecord[] @@ -8312,8 +8681,13 @@ export interface CatSnapshotsSnapshotsRecord { export interface CatTasksRequest extends CatCatRequestBase { actions?: string[] detailed?: boolean - node_id?: string[] + nodes?: string[] parent_task_id?: string + h?: Names + s?: Names + time?: TimeUnit + timeout?: Duration + wait_for_completion?: boolean } export type CatTasksResponse = CatTasksTasksRecord[] @@ -8355,6 +8729,10 @@ export interface CatTasksTasksRecord { export interface CatTemplatesRequest extends CatCatRequestBase { name?: Name + h?: Names + s?: Names + local?: boolean + master_timeout?: Duration } export type CatTemplatesResponse = CatTemplatesTemplatesRecord[] @@ -8375,7 +8753,11 @@ export interface CatTemplatesTemplatesRecord { export interface CatThreadPoolRequest extends CatCatRequestBase { thread_pool_patterns?: Names + h?: Names + s?: Names time?: TimeUnit + local?: boolean + master_timeout?: Duration } export type CatThreadPoolResponse = CatThreadPoolThreadPoolRecord[] @@ -8559,27 +8941,31 @@ export interface CcrShardStats { export interface CcrDeleteAutoFollowPatternRequest extends RequestBase { name: Name + master_timeout?: Duration } export type CcrDeleteAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrFollowRequest extends RequestBase { index: IndexName + master_timeout?: Duration wait_for_active_shards?: WaitForActiveShards /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { - leader_index?: IndexName + data_stream_name?: string + leader_index: IndexName max_outstanding_read_requests?: long - max_outstanding_write_requests?: long - max_read_request_operation_count?: long - max_read_request_size?: string + max_outstanding_write_requests?: integer + max_read_request_operation_count?: integer + max_read_request_size?: ByteSize max_retry_delay?: Duration - max_write_buffer_count?: long - max_write_buffer_size?: string - max_write_request_operation_count?: long - max_write_request_size?: string + max_write_buffer_count?: integer + max_write_buffer_size?: ByteSize + max_write_request_operation_count?: integer + max_write_request_size?: ByteSize read_poll_timeout?: Duration - remote_cluster?: string + remote_cluster: string + settings?: IndicesIndexSettings } } @@ -8598,22 +8984,23 @@ export interface CcrFollowInfoFollowerIndex { } export interface CcrFollowInfoFollowerIndexParameters { - max_outstanding_read_requests: integer - max_outstanding_write_requests: integer - max_read_request_operation_count: integer - max_read_request_size: string - max_retry_delay: Duration - max_write_buffer_count: integer - max_write_buffer_size: string - max_write_request_operation_count: integer - max_write_request_size: string - read_poll_timeout: Duration + max_outstanding_read_requests?: long + max_outstanding_write_requests?: integer + max_read_request_operation_count?: integer + max_read_request_size?: ByteSize + max_retry_delay?: Duration + max_write_buffer_count?: integer + max_write_buffer_size?: ByteSize + max_write_request_operation_count?: integer + max_write_request_size?: ByteSize + read_poll_timeout?: Duration } export type CcrFollowInfoFollowerIndexStatus = 'active' | 'paused' export interface CcrFollowInfoRequest extends RequestBase { index: Indices + master_timeout?: Duration } export interface CcrFollowInfoResponse { @@ -8622,6 +9009,7 @@ export interface CcrFollowInfoResponse { export interface CcrFollowStatsRequest extends RequestBase { index: Indices + timeout?: Duration } export interface CcrFollowStatsResponse { @@ -8630,6 +9018,7 @@ export interface CcrFollowStatsResponse { export interface CcrForgetFollowerRequest extends RequestBase { index: IndexName + timeout?: Duration /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { follower_cluster?: string @@ -8659,6 +9048,7 @@ export interface CcrGetAutoFollowPatternAutoFollowPatternSummary { export interface CcrGetAutoFollowPatternRequest extends RequestBase { name?: Name + master_timeout?: Duration } export interface CcrGetAutoFollowPatternResponse { @@ -8667,18 +9057,21 @@ export interface CcrGetAutoFollowPatternResponse { export interface CcrPauseAutoFollowPatternRequest extends RequestBase { name: Name + master_timeout?: Duration } export type CcrPauseAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrPauseFollowRequest extends RequestBase { index: IndexName + master_timeout?: Duration } export type CcrPauseFollowResponse = AcknowledgedResponseBase export interface CcrPutAutoFollowPatternRequest extends RequestBase { name: Name + master_timeout?: Duration /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { remote_cluster: string @@ -8703,12 +9096,14 @@ export type CcrPutAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrResumeAutoFollowPatternRequest extends RequestBase { name: Name + master_timeout?: Duration } export type CcrResumeAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrResumeFollowRequest extends RequestBase { index: IndexName + master_timeout?: Duration /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { max_outstanding_read_requests?: long @@ -8745,6 +9140,8 @@ export interface CcrStatsFollowStats { } export interface CcrStatsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export interface CcrStatsResponse { @@ -8754,6 +9151,7 @@ export interface CcrStatsResponse { export interface CcrUnfollowRequest extends RequestBase { index: IndexName + master_timeout?: Duration } export type CcrUnfollowResponse = AcknowledgedResponseBase @@ -8767,6 +9165,7 @@ export interface ClusterComponentTemplateNode { template: ClusterComponentTemplateSummary version?: VersionNumber _meta?: Metadata + deprecated?: boolean } export interface ClusterComponentTemplateSummary { @@ -8806,6 +9205,7 @@ export interface ClusterAllocationExplainClusterInfo { export interface ClusterAllocationExplainCurrentNode { id: Id name: Name + roles: NodeRoles attributes: Record transport_address: TransportAddress weight_ranking: integer @@ -8828,6 +9228,7 @@ export interface ClusterAllocationExplainNodeAllocationExplanation { node_decision: ClusterAllocationExplainDecision node_id: Id node_name: Name + roles: NodeRoles store?: ClusterAllocationExplainAllocationStore transport_address: TransportAddress weight_ranking: integer @@ -8842,6 +9243,7 @@ export interface ClusterAllocationExplainNodeDiskUsage { export interface ClusterAllocationExplainRequest extends RequestBase { include_disk_info?: boolean include_yes_decisions?: boolean + master_timeout?: Duration /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { current_node?: string @@ -8907,6 +9309,7 @@ export interface ClusterDeleteComponentTemplateRequest extends RequestBase { export type ClusterDeleteComponentTemplateResponse = AcknowledgedResponseBase export interface ClusterDeleteVotingConfigExclusionsRequest extends RequestBase { + master_timeout?: Duration wait_for_removal?: boolean } @@ -8948,7 +9351,8 @@ export interface ClusterGetSettingsResponse { export interface ClusterHealthHealthResponseBody { active_primary_shards: integer active_shards: integer - active_shards_percent_as_number: Percentage + active_shards_percent?: string + active_shards_percent_as_number: double cluster_name: Name delayed_unassigned_shards: integer indices?: Record @@ -8962,6 +9366,7 @@ export interface ClusterHealthHealthResponseBody { task_max_waiting_in_queue?: Duration task_max_waiting_in_queue_millis: DurationValue timed_out: boolean + unassigned_primary_shards: integer unassigned_shards: integer } @@ -8975,6 +9380,7 @@ export interface ClusterHealthIndexHealthStats { shards?: Record status: HealthStatus unassigned_shards: integer + unassigned_primary_shards: integer } export interface ClusterHealthRequest extends RequestBase { @@ -8986,7 +9392,7 @@ export interface ClusterHealthRequest extends RequestBase { timeout?: Duration wait_for_active_shards?: WaitForActiveShards wait_for_events?: WaitForEvents - wait_for_nodes?: string | integer + wait_for_nodes?: ClusterHealthWaitForNodes wait_for_no_initializing_shards?: boolean wait_for_no_relocating_shards?: boolean wait_for_status?: HealthStatus @@ -9001,8 +9407,11 @@ export interface ClusterHealthShardHealthStats { relocating_shards: integer status: HealthStatus unassigned_shards: integer + unassigned_primary_shards: integer } +export type ClusterHealthWaitForNodes = string | integer + export interface ClusterInfoRequest extends RequestBase { target: ClusterInfoTargets } @@ -9036,6 +9445,7 @@ export interface ClusterPendingTasksResponse { export interface ClusterPostVotingConfigExclusionsRequest extends RequestBase { node_names?: Names node_ids?: Ids + master_timeout?: Duration timeout?: Duration } @@ -9084,6 +9494,7 @@ export interface ClusterRemoteInfoClusterRemoteProxyInfo { server_name: string num_proxy_sockets_connected: integer max_proxy_socket_connections: integer + cluster_credentials?: string } export interface ClusterRemoteInfoClusterRemoteSniffInfo { @@ -9191,6 +9602,39 @@ export interface ClusterStateRequest extends RequestBase { export type ClusterStateResponse = any +export interface ClusterStatsCCSStats { + clusters?: Record + _search: ClusterStatsCCSUsageStats + _esql?: ClusterStatsCCSUsageStats +} + +export interface ClusterStatsCCSUsageClusterStats { + total: integer + skipped: integer + took: ClusterStatsCCSUsageTimeValue +} + +export interface ClusterStatsCCSUsageStats { + total: integer + success: integer + skipped: integer + took: ClusterStatsCCSUsageTimeValue + took_mrt_true?: ClusterStatsCCSUsageTimeValue + took_mrt_false?: ClusterStatsCCSUsageTimeValue + remotes_per_search_max: integer + remotes_per_search_avg: double + failure_reasons: Record + features: Record + clients: Record + clusters: Record +} + +export interface ClusterStatsCCSUsageTimeValue { + max: DurationValue + avg: DurationValue + p90: DurationValue +} + export interface ClusterStatsCharFilterTypes { analyzer_types: ClusterStatsFieldTypes[] built_in_analyzers: ClusterStatsFieldTypes[] @@ -9414,9 +9858,27 @@ export interface ClusterStatsOperatingSystemMemoryInfo { used_percent: integer } +export interface ClusterStatsRemoteClusterInfo { + cluster_uuid: string + mode: string + skip_unavailable: boolean + transport_compress: string + status: HealthStatus + version: VersionString[] + nodes_count: integer + shards_count: integer + indices_count: integer + indices_total_size_in_bytes: long + indices_total_size?: string + max_heap_in_bytes: long + max_heap?: string + mem_total_in_bytes: long + mem_total?: string +} + export interface ClusterStatsRequest extends RequestBase { node_id?: NodeIds - flat_settings?: boolean + include_remotes?: boolean timeout?: Duration } @@ -9446,6 +9908,7 @@ export interface ClusterStatsStatsResponseBase extends NodesNodesResponseBase { nodes: ClusterStatsClusterNodes status: HealthStatus timestamp: long + ccs: ClusterStatsCCSStats } export interface ConnectorConnector { @@ -9570,7 +10033,7 @@ export interface ConnectorFeatureEnabled { export interface ConnectorFilteringAdvancedSnippet { created_at?: DateTime updated_at?: DateTime - value: Record + value: any } export interface ConnectorFilteringConfig { @@ -9780,12 +10243,42 @@ export interface ConnectorSyncJobCancelResponse { result: Result } +export interface ConnectorSyncJobCheckInRequest extends RequestBase { + connector_sync_job_id: Id +} + +export interface ConnectorSyncJobCheckInResponse { +} + +export interface ConnectorSyncJobClaimRequest extends RequestBase { + connector_sync_job_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + sync_cursor?: any + worker_hostname: string + } +} + +export interface ConnectorSyncJobClaimResponse { +} + export interface ConnectorSyncJobDeleteRequest extends RequestBase { connector_sync_job_id: Id } export type ConnectorSyncJobDeleteResponse = AcknowledgedResponseBase +export interface ConnectorSyncJobErrorRequest extends RequestBase { + connector_sync_job_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + error: string + } +} + +export interface ConnectorSyncJobErrorResponse { +} + export interface ConnectorSyncJobGetRequest extends RequestBase { connector_sync_job_id: Id } @@ -9818,6 +10311,22 @@ export interface ConnectorSyncJobPostResponse { id: Id } +export interface ConnectorSyncJobUpdateStatsRequest extends RequestBase { + connector_sync_job_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + deleted_document_count: long + indexed_document_count: long + indexed_document_volume: long + last_seen?: Duration + metadata?: Metadata + total_document_count?: integer + } +} + +export interface ConnectorSyncJobUpdateStatsResponse { +} + export interface ConnectorUpdateActiveFilteringRequest extends RequestBase { connector_id: Id } @@ -9864,6 +10373,18 @@ export interface ConnectorUpdateErrorResponse { result: Result } +export interface ConnectorUpdateFeaturesRequest extends RequestBase { + connector_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + features: ConnectorConnectorFeatures + } +} + +export interface ConnectorUpdateFeaturesResponse { + result: Result +} + export interface ConnectorUpdateFilteringRequest extends RequestBase { connector_id: Id /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ @@ -10024,28 +10545,32 @@ export interface EnrichSummary { export interface EnrichDeletePolicyRequest extends RequestBase { name: Name + master_timeout?: Duration } export type EnrichDeletePolicyResponse = AcknowledgedResponseBase -export type EnrichExecutePolicyEnrichPolicyPhase = 'SCHEDULED' | 'RUNNING' | 'COMPLETE' | 'FAILED' +export type EnrichExecutePolicyEnrichPolicyPhase = 'SCHEDULED' | 'RUNNING' | 'COMPLETE' | 'FAILED' | 'CANCELLED' export interface EnrichExecutePolicyExecuteEnrichPolicyStatus { phase: EnrichExecutePolicyEnrichPolicyPhase + step?: string } export interface EnrichExecutePolicyRequest extends RequestBase { name: Name + master_timeout?: Duration wait_for_completion?: boolean } export interface EnrichExecutePolicyResponse { status?: EnrichExecutePolicyExecuteEnrichPolicyStatus - task_id?: TaskId + task?: TaskId } export interface EnrichGetPolicyRequest extends RequestBase { name?: Names + master_timeout?: Duration } export interface EnrichGetPolicyResponse { @@ -10054,6 +10579,7 @@ export interface EnrichGetPolicyResponse { export interface EnrichPutPolicyRequest extends RequestBase { name: Name + master_timeout?: Duration /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { geo_match?: EnrichPolicy @@ -10068,8 +10594,11 @@ export interface EnrichStatsCacheStats { node_id: Id count: integer hits: integer + hits_time_in_millis: DurationValue misses: integer + misses_time_in_millis: DurationValue evictions: integer + size_in_bytes: long } export interface EnrichStatsCoordinatorStats { @@ -10086,6 +10615,7 @@ export interface EnrichStatsExecutingPolicy { } export interface EnrichStatsRequest extends RequestBase { + master_timeout?: Duration } export interface EnrichStatsResponse { @@ -10107,6 +10637,7 @@ export interface EqlEqlSearchResponseBase { took?: DurationValue timed_out?: boolean hits: EqlEqlHits + shard_failures?: ShardFailure[] } export interface EqlHitsEvent { @@ -10166,10 +10697,13 @@ export interface EqlSearchRequest extends RequestBase { keep_alive?: Duration keep_on_completion?: boolean wait_for_completion_timeout?: Duration + allow_partial_search_results?: boolean + allow_partial_sequence_results?: boolean size?: uint fields?: QueryDslFieldAndFormat | Field | (QueryDslFieldAndFormat | Field)[] result_position?: EqlSearchResultPosition runtime_mappings?: MappingRuntimeFields + max_samples_per_key?: integer } } @@ -10192,8 +10726,54 @@ export type EsqlTableValuesLongDouble = double | double[] export type EsqlTableValuesLongValue = long | long[] +export interface EsqlAsyncQueryRequest extends RequestBase { + delimiter?: string + drop_null_columns?: boolean + format?: EsqlQueryEsqlFormat + keep_alive?: Duration + keep_on_completion?: boolean + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + columnar?: boolean + filter?: QueryDslQueryContainer + locale?: string + params?: FieldValue[] + profile?: boolean + query: string + tables?: Record> + include_ccs_metadata?: boolean + wait_for_completion_timeout?: Duration + } +} + +export type EsqlAsyncQueryResponse = EsqlResult + +export interface EsqlAsyncQueryDeleteRequest extends RequestBase { + id: Id +} + +export type EsqlAsyncQueryDeleteResponse = AcknowledgedResponseBase + +export interface EsqlAsyncQueryGetRequest extends RequestBase { + id: Id + drop_null_columns?: boolean + keep_alive?: Duration + wait_for_completion_timeout?: Duration +} + +export type EsqlAsyncQueryGetResponse = EsqlResult + +export interface EsqlAsyncQueryStopRequest extends RequestBase { + id: Id + drop_null_columns?: boolean +} + +export type EsqlAsyncQueryStopResponse = EsqlResult + +export type EsqlQueryEsqlFormat = 'csv' | 'json' | 'tsv' | 'txt' | 'yaml' | 'cbor' | 'smile' | 'arrow' + export interface EsqlQueryRequest extends RequestBase { - format?: string + format?: EsqlQueryEsqlFormat delimiter?: string drop_null_columns?: boolean /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ @@ -10205,10 +10785,11 @@ export interface EsqlQueryRequest extends RequestBase { profile?: boolean query: string tables?: Record> + include_ccs_metadata?: boolean } } -export type EsqlQueryResponse = EsqlColumns +export type EsqlQueryResponse = EsqlResult export interface FeaturesFeature { name: string @@ -10216,6 +10797,7 @@ export interface FeaturesFeature { } export interface FeaturesGetFeaturesRequest extends RequestBase { + master_timeout?: Duration } export interface FeaturesGetFeaturesResponse { @@ -10223,6 +10805,7 @@ export interface FeaturesGetFeaturesResponse { } export interface FeaturesResetFeaturesRequest extends RequestBase { + master_timeout?: Duration } export interface FeaturesResetFeaturesResponse { @@ -10310,7 +10893,7 @@ export interface FleetSearchRequest extends RequestBase { from?: integer highlight?: SearchHighlight track_total_hits?: SearchTrackHits - indices_boost?: Record[] + indices_boost?: Partial>[] docvalue_fields?: (QueryDslFieldAndFormat | Field)[] min_score?: double post_filter?: QueryDslQueryContainer @@ -10465,7 +11048,7 @@ export interface IlmMigrateAction { export interface IlmPhase { actions?: IlmActions - min_age?: Duration | long + min_age?: Duration } export interface IlmPhases { @@ -10530,17 +11113,21 @@ export interface IlmExplainLifecycleLifecycleExplainManaged { age?: Duration failed_step?: Name failed_step_retry_count?: integer - index?: IndexName + index: IndexName index_creation_date?: DateTime index_creation_date_millis?: EpochTime is_auto_retryable_error?: boolean lifecycle_date?: DateTime lifecycle_date_millis?: EpochTime managed: true - phase: Name + phase?: Name phase_time?: DateTime phase_time_millis?: EpochTime - policy: Name + policy?: Name + previous_step_info?: Record + repository_name?: string + snapshot_name?: string + shrink_index_name?: string step?: Name step_info?: Record step_time?: DateTime @@ -10550,6 +11137,7 @@ export interface IlmExplainLifecycleLifecycleExplainManaged { } export interface IlmExplainLifecycleLifecycleExplainPhaseExecution { + phase_definition?: IlmPhase policy: Name version: VersionNumber modified_date_in_millis: EpochTime @@ -10565,7 +11153,6 @@ export interface IlmExplainLifecycleRequest extends RequestBase { only_errors?: boolean only_managed?: boolean master_timeout?: Duration - timeout?: Duration } export interface IlmExplainLifecycleResponse { @@ -10616,16 +11203,16 @@ export interface IlmMoveToStepRequest extends RequestBase { index: IndexName /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { - current_step?: IlmMoveToStepStepKey - next_step?: IlmMoveToStepStepKey + current_step: IlmMoveToStepStepKey + next_step: IlmMoveToStepStepKey } } export type IlmMoveToStepResponse = AcknowledgedResponseBase export interface IlmMoveToStepStepKey { - action: string - name: string + action?: string + name?: string phase: string } @@ -10723,6 +11310,7 @@ export interface IndicesDataStreamIndex { export interface IndicesDataStreamLifecycle { data_retention?: Duration downsampling?: IndicesDataStreamLifecycleDownsampling + enabled?: boolean } export interface IndicesDataStreamLifecycleDownsampling { @@ -10742,9 +11330,7 @@ export interface IndicesDataStreamLifecycleRolloverConditions { max_primary_shard_docs?: long } -export interface IndicesDataStreamLifecycleWithRollover { - data_retention?: Duration - downsampling?: IndicesDataStreamLifecycleDownsampling +export interface IndicesDataStreamLifecycleWithRollover extends IndicesDataStreamLifecycle { rollover?: IndicesDataStreamLifecycleRolloverConditions } @@ -10754,6 +11340,7 @@ export interface IndicesDataStreamTimestampField { export interface IndicesDataStreamVisibility { hidden?: boolean + allow_custom_routing?: boolean } export interface IndicesDownsampleConfig { @@ -10841,7 +11428,7 @@ export interface IndicesIndexSettingsKeys { routing_partition_size?: SpecUtilsStringified load_fixed_bitset_filters_eagerly?: boolean hidden?: boolean | string - auto_expand_replicas?: string + auto_expand_replicas?: SpecUtilsWithNullValue merge?: IndicesMerge search?: IndicesSettingsSearch refresh_interval?: Duration @@ -10903,6 +11490,7 @@ export interface IndicesIndexSettingsLifecycle { parse_origination_date?: boolean step?: IndicesIndexSettingsLifecycleStep rollover_alias?: string + prefer_ilm?: boolean | string } export interface IndicesIndexSettingsLifecycleStep { @@ -10932,6 +11520,8 @@ export interface IndicesIndexTemplate { _meta?: Metadata allow_auto_create?: boolean data_stream?: IndicesIndexTemplateDataStreamConfiguration + deprecated?: boolean + ignore_missing_component_templates?: Names } export interface IndicesIndexTemplateDataStreamConfiguration { @@ -10980,7 +11570,8 @@ export interface IndicesMappingLimitSettings { nested_objects?: IndicesMappingLimitSettingsNestedObjects field_name_length?: IndicesMappingLimitSettingsFieldNameLength dimension_fields?: IndicesMappingLimitSettingsDimensionFields - ignore_malformed?: boolean + source?: IndicesMappingLimitSettingsSourceFields + ignore_malformed?: boolean | string } export interface IndicesMappingLimitSettingsDepth { @@ -11003,9 +11594,13 @@ export interface IndicesMappingLimitSettingsNestedObjects { limit?: long } +export interface IndicesMappingLimitSettingsSourceFields { + mode: IndicesSourceMode +} + export interface IndicesMappingLimitSettingsTotalFields { - limit?: long - ignore_dynamic_beyond_limit?: boolean + limit?: long | string + ignore_dynamic_beyond_limit?: boolean | string } export interface IndicesMerge { @@ -11130,6 +11725,8 @@ export interface IndicesSoftDeletes { retention_lease?: IndicesRetentionLease } +export type IndicesSourceMode = 'disabled' | 'stored' | 'synthetic' + export interface IndicesStorage { type: IndicesStorageType allow_mmap?: boolean @@ -11252,6 +11849,12 @@ export interface IndicesAnalyzeTokenDetail { tokens: IndicesAnalyzeExplainAnalyzeToken[] } +export interface IndicesCancelMigrateReindexRequest extends RequestBase { + index: Indices +} + +export type IndicesCancelMigrateReindexResponse = AcknowledgedResponseBase + export interface IndicesClearCacheRequest extends RequestBase { index?: Indices allow_no_indices?: boolean @@ -11336,7 +11939,26 @@ export interface IndicesCreateDataStreamRequest extends RequestBase { export type IndicesCreateDataStreamResponse = AcknowledgedResponseBase -export interface IndicesDataStreamsStatsDataStreamsStatsItem { +export interface IndicesCreateFromCreateFrom { + mappings_override?: MappingTypeMapping + settings_override?: IndicesIndexSettings + remove_index_blocks?: boolean +} + +export interface IndicesCreateFromRequest extends RequestBase { + source: IndexName + dest: IndexName + /** @deprecated The use of the 'body' key has been deprecated, use 'create_from' instead. */ + body?: IndicesCreateFromCreateFrom +} + +export interface IndicesCreateFromResponse { + acknowledged: boolean + index: IndexName + shards_acknowledged: boolean +} + +export interface IndicesDataStreamsStatsDataStreamsStatsItem { backing_indices: integer data_stream: Name maximum_timestamp: EpochTime @@ -11456,6 +12078,8 @@ export type IndicesExistsAliasResponse = boolean export interface IndicesExistsIndexTemplateRequest extends RequestBase { name: Name + local?: boolean + flat_settings?: boolean master_timeout?: Duration } @@ -11525,9 +12149,6 @@ export interface IndicesFieldUsageStatsRequest extends RequestBase { expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean fields?: Fields - master_timeout?: Duration - timeout?: Duration - wait_for_active_shards?: WaitForActiveShards } export type IndicesFieldUsageStatsResponse = IndicesFieldUsageStatsFieldsUsageBody @@ -11611,7 +12232,7 @@ export type IndicesGetAliasResponse = Record + time_between_starts_in_millis?: DurationValue +} + export interface IndicesGetDataStreamRequest extends RequestBase { name?: DataStreamNames expand_wildcards?: ExpandWildcards include_defaults?: boolean master_timeout?: Duration + verbose?: boolean } export interface IndicesGetDataStreamResponse { @@ -11685,6 +12323,34 @@ export interface IndicesGetMappingRequest extends RequestBase { export type IndicesGetMappingResponse = Record +export interface IndicesGetMigrateReindexStatusRequest extends RequestBase { + index: Indices +} + +export interface IndicesGetMigrateReindexStatusResponse { + start_time?: DateTime + start_time_millis: EpochTime + complete: boolean + total_indices_in_data_stream: integer + total_indices_requiring_upgrade: integer + successes: integer + in_progress: IndicesGetMigrateReindexStatusStatusInProgress[] + pending: integer + errors: IndicesGetMigrateReindexStatusStatusError[] + exception?: string +} + +export interface IndicesGetMigrateReindexStatusStatusError { + index: string + message: string +} + +export interface IndicesGetMigrateReindexStatusStatusInProgress { + index: string + total_doc_count: long + reindexed_doc_count: long +} + export interface IndicesGetSettingsRequest extends RequestBase { index?: Indices name?: Names @@ -11708,6 +12374,24 @@ export interface IndicesGetTemplateRequest extends RequestBase { export type IndicesGetTemplateResponse = Record +export interface IndicesMigrateReindexMigrateReindex { + mode: IndicesMigrateReindexModeEnum + source: IndicesMigrateReindexSourceIndex +} + +export type IndicesMigrateReindexModeEnum = 'upgrade' + +export interface IndicesMigrateReindexRequest extends RequestBase { + /** @deprecated The use of the 'body' key has been deprecated, use 'reindex' instead. */ + body?: IndicesMigrateReindexMigrateReindex +} + +export type IndicesMigrateReindexResponse = AcknowledgedResponseBase + +export interface IndicesMigrateReindexSourceIndex { + index: IndexName +} + export interface IndicesMigrateToDataStreamRequest extends RequestBase { name: IndexName master_timeout?: Duration @@ -11783,6 +12467,7 @@ export interface IndicesPutDataLifecycleRequest extends RequestBase { body?: { data_retention?: Duration downsampling?: IndicesDataStreamLifecycleDownsampling + enabled?: boolean } } @@ -11830,7 +12515,7 @@ export interface IndicesPutMappingRequest extends RequestBase { date_detection?: boolean dynamic?: MappingDynamicMapping dynamic_date_formats?: string[] - dynamic_templates?: Record | Record[] + dynamic_templates?: Partial>[] _field_names?: MappingFieldNamesField _meta?: Metadata numeric_detection?: boolean @@ -11851,6 +12536,7 @@ export interface IndicesPutSettingsRequest extends RequestBase { ignore_unavailable?: boolean master_timeout?: Duration preserve_existing?: boolean + reopen?: boolean timeout?: Duration /** @deprecated The use of the 'body' key has been deprecated, use 'settings' instead. */ body?: IndicesIndexSettings @@ -12008,16 +12694,18 @@ export interface IndicesReloadSearchAnalyzersRequest extends RequestBase { allow_no_indices?: boolean expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean + resource?: string } export type IndicesReloadSearchAnalyzersResponse = IndicesReloadSearchAnalyzersReloadResult export interface IndicesResolveClusterRequest extends RequestBase { - name: Names + name?: Names allow_no_indices?: boolean expand_wildcards?: ExpandWildcards ignore_throttled?: boolean ignore_unavailable?: boolean + timeout?: Duration } export interface IndicesResolveClusterResolveClusterInfo { @@ -12033,6 +12721,8 @@ export type IndicesResolveClusterResponse = Record @@ -12212,6 +12903,8 @@ export interface IndicesShrinkResponse { export interface IndicesSimulateIndexTemplateRequest extends RequestBase { name: Name + create?: boolean + cause?: string master_timeout?: Duration include_defaults?: boolean } @@ -12229,6 +12922,7 @@ export interface IndicesSimulateTemplateOverlapping { export interface IndicesSimulateTemplateRequest extends RequestBase { name?: Name create?: boolean + cause?: string master_timeout?: Duration include_defaults?: boolean /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ @@ -12522,10 +13216,166 @@ export interface IndicesValidateQueryResponse { error?: string } +export interface InferenceAdaptiveAllocations { + enabled?: boolean + max_number_of_allocations?: integer + min_number_of_allocations?: integer +} + +export interface InferenceAlibabaCloudServiceSettings { + api_key: string + host: string + rate_limit?: InferenceRateLimitSetting + service_id: string + workspace: string +} + +export type InferenceAlibabaCloudServiceType = 'alibabacloud-ai-search' + +export interface InferenceAlibabaCloudTaskSettings { + input_type?: string + return_token?: boolean +} + +export type InferenceAlibabaCloudTaskType = 'completion' | 'rerank' | 'space_embedding' | 'text_embedding' + +export interface InferenceAmazonBedrockServiceSettings { + access_key: string + model: string + provider?: string + region: string + rate_limit?: InferenceRateLimitSetting + secret_key: string +} + +export type InferenceAmazonBedrockServiceType = 'amazonbedrock' + +export interface InferenceAmazonBedrockTaskSettings { + max_new_tokens?: integer + temperature?: float + top_k?: float + top_p?: float +} + +export type InferenceAmazonBedrockTaskType = 'completion' | 'text_embedding' + +export interface InferenceAnthropicServiceSettings { + api_key: string + model_id: string + rate_limit?: InferenceRateLimitSetting +} + +export type InferenceAnthropicServiceType = 'anthropic' + +export interface InferenceAnthropicTaskSettings { + max_tokens: integer + temperature?: float + top_k?: integer + top_p?: float +} + +export type InferenceAnthropicTaskType = 'completion' + +export interface InferenceAzureAiStudioServiceSettings { + api_key: string + endpoint_type: string + target: string + provider: string + rate_limit?: InferenceRateLimitSetting +} + +export type InferenceAzureAiStudioServiceType = 'azureaistudio' + +export interface InferenceAzureAiStudioTaskSettings { + do_sample?: float + max_new_tokens?: integer + temperature?: float + top_p?: float + user?: string +} + +export type InferenceAzureAiStudioTaskType = 'completion' | 'text_embedding' + +export interface InferenceAzureOpenAIServiceSettings { + api_key?: string + api_version: string + deployment_id: string + entra_id?: string + rate_limit?: InferenceRateLimitSetting + resource_name: string +} + +export type InferenceAzureOpenAIServiceType = 'azureopenai' + +export interface InferenceAzureOpenAITaskSettings { + user?: string +} + +export type InferenceAzureOpenAITaskType = 'completion' | 'text_embedding' + +export type InferenceCohereEmbeddingType = 'byte' | 'float' | 'int8' + +export type InferenceCohereInputType = 'classification' | 'clustering' | 'ingest' | 'search' + +export interface InferenceCohereServiceSettings { + api_key: string + embedding_type?: InferenceCohereEmbeddingType + model_id?: string + rate_limit?: InferenceRateLimitSetting + similarity?: InferenceCohereSimilarityType +} + +export type InferenceCohereServiceType = 'cohere' + +export type InferenceCohereSimilarityType = 'cosine' | 'dot_product' | 'l2_norm' + +export interface InferenceCohereTaskSettings { + input_type?: InferenceCohereInputType + return_documents?: boolean + top_n?: integer + truncate?: InferenceCohereTruncateType +} + +export type InferenceCohereTaskType = 'completion' | 'rerank' | 'text_embedding' + +export type InferenceCohereTruncateType = 'END' | 'NONE' | 'START' + +export interface InferenceCompletionInferenceResult { + completion: InferenceCompletionResult[] +} + export interface InferenceCompletionResult { result: string } +export interface InferenceCompletionTool { + type: string + function: InferenceCompletionToolFunction +} + +export interface InferenceCompletionToolChoice { + type: string + function: InferenceCompletionToolChoiceFunction +} + +export interface InferenceCompletionToolChoiceFunction { + name: string +} + +export interface InferenceCompletionToolFunction { + description?: string + name: string + parameters?: any + strict?: boolean +} + +export type InferenceCompletionToolType = string | InferenceCompletionToolChoice + +export interface InferenceContentObject { + text: string + type: string +} + export interface InferenceDeleteInferenceEndpointResult extends AcknowledgedResponseBase { pipelines: string[] } @@ -12534,10 +13384,81 @@ export type InferenceDenseByteVector = byte[] export type InferenceDenseVector = float[] +export interface InferenceElasticsearchServiceSettings { + adaptive_allocations?: InferenceAdaptiveAllocations + deployment_id?: string + model_id: string + num_allocations?: integer + num_threads: integer +} + +export type InferenceElasticsearchServiceType = 'elasticsearch' + +export interface InferenceElasticsearchTaskSettings { + return_documents?: boolean +} + +export type InferenceElasticsearchTaskType = 'rerank' | 'sparse_embedding' | 'text_embedding' + +export interface InferenceElserServiceSettings { + adaptive_allocations?: InferenceAdaptiveAllocations + num_allocations: integer + num_threads: integer +} + +export type InferenceElserServiceType = 'elser' + +export type InferenceElserTaskType = 'sparse_embedding' + +export type InferenceGoogleAiServiceType = 'googleaistudio' + +export interface InferenceGoogleAiStudioServiceSettings { + api_key: string + model_id: string + rate_limit?: InferenceRateLimitSetting +} + +export type InferenceGoogleAiStudioTaskType = 'completion' | 'text_embedding' + +export interface InferenceGoogleVertexAIServiceSettings { + location: string + model_id: string + project_id: string + rate_limit?: InferenceRateLimitSetting + service_account_json: string +} + +export type InferenceGoogleVertexAIServiceType = 'googlevertexai' + +export interface InferenceGoogleVertexAITaskSettings { + auto_truncate?: boolean + top_n?: integer +} + +export type InferenceGoogleVertexAITaskType = 'rerank' | 'text_embedding' + +export interface InferenceHuggingFaceServiceSettings { + api_key: string + rate_limit?: InferenceRateLimitSetting + url: string +} + +export type InferenceHuggingFaceServiceType = 'hugging_face' + +export type InferenceHuggingFaceTaskType = 'text_embedding' + +export interface InferenceInferenceChunkingSettings { + max_chunk_size?: integer + overlap?: integer + sentence_overlap?: integer + strategy?: string +} + export interface InferenceInferenceEndpoint { + chunking_settings?: InferenceInferenceChunkingSettings service: string service_settings: InferenceServiceSettings - task_settings: InferenceTaskSettings + task_settings?: InferenceTaskSettings } export interface InferenceInferenceEndpointInfo extends InferenceInferenceEndpoint { @@ -12547,20 +13468,102 @@ export interface InferenceInferenceEndpointInfo extends InferenceInferenceEndpoi export interface InferenceInferenceResult { text_embedding_bytes?: InferenceTextEmbeddingByteResult[] + text_embedding_bits?: InferenceTextEmbeddingByteResult[] text_embedding?: InferenceTextEmbeddingResult[] sparse_embedding?: InferenceSparseEmbeddingResult[] completion?: InferenceCompletionResult[] rerank?: InferenceRankedDocument[] } +export interface InferenceJinaAIServiceSettings { + api_key: string + model_id?: string + rate_limit?: InferenceRateLimitSetting + similarity?: InferenceJinaAISimilarityType +} + +export type InferenceJinaAIServiceType = 'jinaai' + +export type InferenceJinaAISimilarityType = 'cosine' | 'dot_product' | 'l2_norm' + +export interface InferenceJinaAITaskSettings { + return_documents?: boolean + task?: InferenceJinaAITextEmbeddingTask + top_n?: integer +} + +export type InferenceJinaAITaskType = 'rerank' | 'text_embedding' + +export type InferenceJinaAITextEmbeddingTask = 'classification' | 'clustering' | 'ingest' | 'search' + +export interface InferenceMessage { + content?: InferenceMessageContent + role: string + tool_call_id?: Id + tool_calls?: InferenceToolCall[] +} + +export type InferenceMessageContent = string | InferenceContentObject[] + +export interface InferenceMistralServiceSettings { + api_key: string + max_input_tokens?: integer + model: string + rate_limit?: InferenceRateLimitSetting +} + +export type InferenceMistralServiceType = 'mistral' + +export type InferenceMistralTaskType = 'text_embedding' + +export interface InferenceOpenAIServiceSettings { + api_key: string + dimensions?: integer + model_id: string + organization_id?: string + rate_limit?: InferenceRateLimitSetting + url?: string +} + +export type InferenceOpenAIServiceType = 'openai' + +export interface InferenceOpenAITaskSettings { + user?: string +} + +export type InferenceOpenAITaskType = 'chat_completion' | 'completion' | 'text_embedding' + export interface InferenceRankedDocument { index: integer - score: float + relevance_score: float text?: string } +export interface InferenceRateLimitSetting { + requests_per_minute?: integer +} + +export interface InferenceRequestChatCompletion { + messages: InferenceMessage[] + model?: string + max_completion_tokens?: long + stop?: string[] + temperature?: float + tool_choice?: InferenceCompletionToolType + tools?: InferenceCompletionTool[] + top_p?: float +} + +export interface InferenceRerankedInferenceResult { + rerank: InferenceRankedDocument[] +} + export type InferenceServiceSettings = any +export interface InferenceSparseEmbeddingInferenceResult { + sparse_embedding: InferenceSparseEmbeddingResult[] +} + export interface InferenceSparseEmbeddingResult { embedding: InferenceSparseVector } @@ -12569,16 +13572,84 @@ export type InferenceSparseVector = Record export type InferenceTaskSettings = any -export type InferenceTaskType = 'sparse_embedding' | 'text_embedding' | 'rerank' | 'completion' +export type InferenceTaskType = 'sparse_embedding' | 'text_embedding' | 'rerank' | 'completion' | 'chat_completion' export interface InferenceTextEmbeddingByteResult { embedding: InferenceDenseByteVector } +export interface InferenceTextEmbeddingInferenceResult { + text_embedding_bytes?: InferenceTextEmbeddingByteResult[] + text_embedding?: InferenceTextEmbeddingResult[] +} + export interface InferenceTextEmbeddingResult { embedding: InferenceDenseVector } +export interface InferenceToolCall { + id: Id + function: InferenceToolCallFunction + type: string +} + +export interface InferenceToolCallFunction { + arguments: string + name: string +} + +export interface InferenceVoyageAIServiceSettings { + dimensions?: integer + model_id: string + rate_limit?: InferenceRateLimitSetting + embedding_type?: float +} + +export type InferenceVoyageAIServiceType = 'voyageai' + +export interface InferenceVoyageAITaskSettings { + input_type?: string + return_documents?: boolean + top_k?: integer + truncation?: boolean +} + +export type InferenceVoyageAITaskType = 'text_embedding' | 'rerank' + +export interface InferenceWatsonxServiceSettings { + api_key: string + api_version: string + model_id: string + project_id: string + rate_limit?: InferenceRateLimitSetting + url: string +} + +export type InferenceWatsonxServiceType = 'watsonxai' + +export type InferenceWatsonxTaskType = 'text_embedding' + +export interface InferenceChatCompletionUnifiedRequest extends RequestBase { + inference_id: Id + timeout?: Duration + /** @deprecated The use of the 'body' key has been deprecated, use 'chat_completion_request' instead. */ + body?: InferenceRequestChatCompletion +} + +export type InferenceChatCompletionUnifiedResponse = StreamResult + +export interface InferenceCompletionRequest extends RequestBase { + inference_id: Id + timeout?: Duration + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + input: string | string[] + task_settings?: InferenceTaskSettings + } +} + +export type InferenceCompletionResponse = InferenceCompletionInferenceResult + export interface InferenceDeleteRequest extends RequestBase { task_type?: InferenceTaskType inference_id: Id @@ -12620,21 +13691,296 @@ export interface InferencePutRequest extends RequestBase { export type InferencePutResponse = InferenceInferenceEndpointInfo -export interface IngestAppendProcessor extends IngestProcessorBase { - field: Field - value: any[] - allow_duplicates?: boolean +export interface InferencePutAlibabacloudRequest extends RequestBase { + task_type: InferenceAlibabaCloudTaskType + alibabacloud_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAlibabaCloudServiceType + service_settings: InferenceAlibabaCloudServiceSettings + task_settings?: InferenceAlibabaCloudTaskSettings + } } -export interface IngestAttachmentProcessor extends IngestProcessorBase { - field: Field - ignore_missing?: boolean - indexed_chars?: long - indexed_chars_field?: Field - properties?: string[] - target_field?: Field - remove_binary?: boolean - resource_name?: string +export type InferencePutAlibabacloudResponse = InferenceInferenceEndpointInfo + +export interface InferencePutAmazonbedrockRequest extends RequestBase { + task_type: InferenceAmazonBedrockTaskType + amazonbedrock_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAmazonBedrockServiceType + service_settings: InferenceAmazonBedrockServiceSettings + task_settings?: InferenceAmazonBedrockTaskSettings + } +} + +export type InferencePutAmazonbedrockResponse = InferenceInferenceEndpointInfo + +export interface InferencePutAnthropicRequest extends RequestBase { + task_type: InferenceAnthropicTaskType + anthropic_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAnthropicServiceType + service_settings: InferenceAnthropicServiceSettings + task_settings?: InferenceAnthropicTaskSettings + } +} + +export type InferencePutAnthropicResponse = InferenceInferenceEndpointInfo + +export interface InferencePutAzureaistudioRequest extends RequestBase { + task_type: InferenceAzureAiStudioTaskType + azureaistudio_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAzureAiStudioServiceType + service_settings: InferenceAzureAiStudioServiceSettings + task_settings?: InferenceAzureAiStudioTaskSettings + } +} + +export type InferencePutAzureaistudioResponse = InferenceInferenceEndpointInfo + +export interface InferencePutAzureopenaiRequest extends RequestBase { + task_type: InferenceAzureOpenAITaskType + azureopenai_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAzureOpenAIServiceType + service_settings: InferenceAzureOpenAIServiceSettings + task_settings?: InferenceAzureOpenAITaskSettings + } +} + +export type InferencePutAzureopenaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutCohereRequest extends RequestBase { + task_type: InferenceCohereTaskType + cohere_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceCohereServiceType + service_settings: InferenceCohereServiceSettings + task_settings?: InferenceCohereTaskSettings + } +} + +export type InferencePutCohereResponse = InferenceInferenceEndpointInfo + +export interface InferencePutElasticsearchRequest extends RequestBase { + task_type: InferenceElasticsearchTaskType + elasticsearch_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceElasticsearchServiceType + service_settings: InferenceElasticsearchServiceSettings + task_settings?: InferenceElasticsearchTaskSettings + } +} + +export type InferencePutElasticsearchResponse = InferenceInferenceEndpointInfo + +export interface InferencePutElserRequest extends RequestBase { + task_type: InferenceElserTaskType + elser_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceElserServiceType + service_settings: InferenceElserServiceSettings + } +} + +export type InferencePutElserResponse = InferenceInferenceEndpointInfo + +export interface InferencePutGoogleaistudioRequest extends RequestBase { + task_type: InferenceGoogleAiStudioTaskType + googleaistudio_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceGoogleAiServiceType + service_settings: InferenceGoogleAiStudioServiceSettings + } +} + +export type InferencePutGoogleaistudioResponse = InferenceInferenceEndpointInfo + +export interface InferencePutGooglevertexaiRequest extends RequestBase { + task_type: InferenceGoogleVertexAITaskType + googlevertexai_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceGoogleVertexAIServiceType + service_settings: InferenceGoogleVertexAIServiceSettings + task_settings?: InferenceGoogleVertexAITaskSettings + } +} + +export type InferencePutGooglevertexaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutHuggingFaceRequest extends RequestBase { + task_type: InferenceHuggingFaceTaskType + huggingface_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceHuggingFaceServiceType + service_settings: InferenceHuggingFaceServiceSettings + } +} + +export type InferencePutHuggingFaceResponse = InferenceInferenceEndpointInfo + +export interface InferencePutJinaaiRequest extends RequestBase { + task_type: InferenceJinaAITaskType + jinaai_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceJinaAIServiceType + service_settings: InferenceJinaAIServiceSettings + task_settings?: InferenceJinaAITaskSettings + } +} + +export type InferencePutJinaaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutMistralRequest extends RequestBase { + task_type: InferenceMistralTaskType + mistral_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceMistralServiceType + service_settings: InferenceMistralServiceSettings + } +} + +export type InferencePutMistralResponse = InferenceInferenceEndpointInfo + +export interface InferencePutOpenaiRequest extends RequestBase { + task_type: InferenceOpenAITaskType + openai_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceOpenAIServiceType + service_settings: InferenceOpenAIServiceSettings + task_settings?: InferenceOpenAITaskSettings + } +} + +export type InferencePutOpenaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutVoyageaiRequest extends RequestBase { + task_type: InferenceVoyageAITaskType + voyageai_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceVoyageAIServiceType + service_settings: InferenceVoyageAIServiceSettings + task_settings?: InferenceVoyageAITaskSettings + } +} + +export type InferencePutVoyageaiResponse = InferenceInferenceEndpointInfo + +export interface InferencePutWatsonxRequest extends RequestBase { + task_type: InferenceWatsonxTaskType + watsonx_inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + service: InferenceWatsonxServiceType + service_settings: InferenceWatsonxServiceSettings + } +} + +export type InferencePutWatsonxResponse = InferenceInferenceEndpointInfo + +export interface InferenceRerankRequest extends RequestBase { + inference_id: Id + timeout?: Duration + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + query: string + input: string | string[] + task_settings?: InferenceTaskSettings + } +} + +export type InferenceRerankResponse = InferenceRerankedInferenceResult + +export interface InferenceSparseEmbeddingRequest extends RequestBase { + inference_id: Id + timeout?: Duration + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + input: string | string[] + task_settings?: InferenceTaskSettings + } +} + +export type InferenceSparseEmbeddingResponse = InferenceSparseEmbeddingInferenceResult + +export interface InferenceStreamCompletionRequest extends RequestBase { + inference_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + input: string | string[] + task_settings?: InferenceTaskSettings + } +} + +export type InferenceStreamCompletionResponse = StreamResult + +export interface InferenceTextEmbeddingRequest extends RequestBase { + inference_id: Id + timeout?: Duration + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + input: string | string[] + task_settings?: InferenceTaskSettings + } +} + +export type InferenceTextEmbeddingResponse = InferenceTextEmbeddingInferenceResult + +export interface InferenceUpdateRequest extends RequestBase { + inference_id: Id + task_type?: InferenceTaskType + /** @deprecated The use of the 'body' key has been deprecated, use 'inference_config' instead. */ + body?: InferenceInferenceEndpoint +} + +export type InferenceUpdateResponse = InferenceInferenceEndpointInfo + +export interface IngestAppendProcessor extends IngestProcessorBase { + field: Field + value: any | any[] + allow_duplicates?: boolean +} + +export interface IngestAttachmentProcessor extends IngestProcessorBase { + field: Field + ignore_missing?: boolean + indexed_chars?: long + indexed_chars_field?: Field + properties?: string[] + target_field?: Field + remove_binary?: boolean + resource_name?: string } export interface IngestBytesProcessor extends IngestProcessorBase { @@ -12651,6 +13997,20 @@ export interface IngestCircleProcessor extends IngestProcessorBase { target_field?: Field } +export interface IngestCommunityIDProcessor extends IngestProcessorBase { + source_ip?: Field + source_port?: Field + destination_ip?: Field + destination_port?: Field + iana_number?: Field + icmp_type?: Field + icmp_code?: Field + transport?: Field + target_field?: Field + seed?: integer + ignore_missing?: boolean +} + export interface IngestConvertProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean @@ -12658,7 +14018,7 @@ export interface IngestConvertProcessor extends IngestProcessorBase { type: IngestConvertType } -export type IngestConvertType = 'integer' | 'long' | 'float' | 'double' | 'string' | 'boolean' | 'auto' +export type IngestConvertType = 'integer' | 'long' | 'double' | 'float' | 'boolean' | 'ip' | 'string' | 'auto' export interface IngestCsvProcessor extends IngestProcessorBase { empty_value?: any @@ -12672,7 +14032,16 @@ export interface IngestCsvProcessor extends IngestProcessorBase { export interface IngestDatabaseConfiguration { name: Name - maxmind: IngestMaxmind + maxmind?: IngestMaxmind + ipinfo?: IngestIpinfo +} + +export interface IngestDatabaseConfigurationFull { + web?: IngestWeb + local?: IngestLocal + name: Name + maxmind?: IngestMaxmind + ipinfo?: IngestIpinfo } export interface IngestDateIndexNameProcessor extends IngestProcessorBase { @@ -12691,6 +14060,7 @@ export interface IngestDateProcessor extends IngestProcessorBase { locale?: string target_field?: Field timezone?: string + output_format?: string } export interface IngestDissectProcessor extends IngestProcessorBase { @@ -12700,8 +14070,27 @@ export interface IngestDissectProcessor extends IngestProcessorBase { pattern: string } +export interface IngestDocument { + _id?: Id + _index?: IndexName + _source: any +} + +export interface IngestDocumentSimulationKeys { + _id: Id + _index: IndexName + _ingest: IngestIngest + _routing?: string + _source: Record + _version?: SpecUtilsStringified + _version_type?: VersionType +} +export type IngestDocumentSimulation = IngestDocumentSimulationKeys +& { [property: string]: string | Id | IndexName | IngestIngest | Record | SpecUtilsStringified | VersionType } + export interface IngestDotExpanderProcessor extends IngestProcessorBase { field: Field + override?: boolean path?: string } @@ -12722,12 +14111,38 @@ export interface IngestFailProcessor extends IngestProcessorBase { message: string } +export type IngestFingerprintDigest = 'MD5' | 'SHA-1' | 'SHA-256' | 'SHA-512' | 'MurmurHash3' + +export interface IngestFingerprintProcessor extends IngestProcessorBase { + fields: Fields + target_field?: Field + salt?: string + method?: IngestFingerprintDigest + ignore_missing?: boolean +} + export interface IngestForeachProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean processor: IngestProcessorContainer } +export interface IngestGeoGridProcessor extends IngestProcessorBase { + field: string + tile_type: IngestGeoGridTileType + target_field?: Field + parent_field?: Field + children_field?: Field + non_children_field?: Field + precision_field?: Field + ignore_missing?: boolean + target_format?: IngestGeoGridTargetFormat +} + +export type IngestGeoGridTargetFormat = 'geojson' | 'wkt' + +export type IngestGeoGridTileType = 'geotile' | 'geohex' | 'geohash' + export interface IngestGeoIpProcessor extends IngestProcessorBase { database_file?: string field: Field @@ -12735,13 +14150,15 @@ export interface IngestGeoIpProcessor extends IngestProcessorBase { ignore_missing?: boolean properties?: string[] target_field?: Field + download_database_on_pipeline_creation?: boolean } export interface IngestGrokProcessor extends IngestProcessorBase { + ecs_compatibility?: string field: Field ignore_missing?: boolean pattern_definitions?: Record - patterns: string[] + patterns: GrokPattern[] trace_match?: boolean } @@ -12782,6 +14199,32 @@ export interface IngestInferenceProcessor extends IngestProcessorBase { target_field?: Field field_map?: Record inference_config?: IngestInferenceConfig + input_output?: IngestInputConfig | IngestInputConfig[] + ignore_missing?: boolean +} + +export interface IngestIngest { + _redact?: IngestRedact + timestamp: DateTime + pipeline?: Name +} + +export interface IngestInputConfig { + input_field: string + output_field: string +} + +export interface IngestIpLocationProcessor extends IngestProcessorBase { + database_file?: string + field: Field + first_only?: boolean + ignore_missing?: boolean + properties?: string[] + target_field?: Field + download_database_on_pipeline_creation?: boolean +} + +export interface IngestIpinfo { } export interface IngestJoinProcessor extends IngestProcessorBase { @@ -12814,6 +14257,10 @@ export interface IngestKeyValueProcessor extends IngestProcessorBase { value_split: string } +export interface IngestLocal { + type: string +} + export interface IngestLowercaseProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean @@ -12824,11 +14271,21 @@ export interface IngestMaxmind { account_id: Id } +export interface IngestNetworkDirectionProcessor extends IngestProcessorBase { + source_ip?: Field + destination_ip?: Field + target_field?: Field + internal_networks?: string[] + internal_networks_field?: Field + ignore_missing?: boolean +} + export interface IngestPipeline { description?: string on_failure?: IngestProcessorContainer[] processors?: IngestProcessorContainer[] version?: VersionNumber + deprecated?: boolean _meta?: Metadata } @@ -12843,6 +14300,18 @@ export interface IngestPipelineProcessor extends IngestProcessorBase { ignore_missing_pipeline?: boolean } +export interface IngestPipelineProcessorResult { + doc?: IngestDocumentSimulation + tag?: string + processor_type?: string + status?: IngestPipelineSimulationStatusOptions + description?: string + ignored_error?: ErrorCause + error?: ErrorCause +} + +export type IngestPipelineSimulationStatusOptions = 'success' | 'error' | 'error_ignored' | 'skipped' | 'dropped' + export interface IngestProcessorBase { description?: string if?: string @@ -12856,6 +14325,7 @@ export interface IngestProcessorContainer { attachment?: IngestAttachmentProcessor bytes?: IngestBytesProcessor circle?: IngestCircleProcessor + community_id?: IngestCommunityIDProcessor convert?: IngestConvertProcessor csv?: IngestCsvProcessor date?: IngestDateProcessor @@ -12865,7 +14335,10 @@ export interface IngestProcessorContainer { drop?: IngestDropProcessor enrich?: IngestEnrichProcessor fail?: IngestFailProcessor + fingerprint?: IngestFingerprintProcessor foreach?: IngestForeachProcessor + ip_location?: IngestIpLocationProcessor + geo_grid?: IngestGeoGridProcessor geoip?: IngestGeoIpProcessor grok?: IngestGrokProcessor gsub?: IngestGsubProcessor @@ -12875,7 +14348,10 @@ export interface IngestProcessorContainer { json?: IngestJsonProcessor kv?: IngestKeyValueProcessor lowercase?: IngestLowercaseProcessor + network_direction?: IngestNetworkDirectionProcessor pipeline?: IngestPipelineProcessor + redact?: IngestRedactProcessor + registered_domain?: IngestRegisteredDomainProcessor remove?: IngestRemoveProcessor rename?: IngestRenameProcessor reroute?: IngestRerouteProcessor @@ -12884,6 +14360,7 @@ export interface IngestProcessorContainer { set_security_user?: IngestSetSecurityUserProcessor sort?: IngestSortProcessor split?: IngestSplitProcessor + terminate?: IngestTerminateProcessor trim?: IngestTrimProcessor uppercase?: IngestUppercaseProcessor urldecode?: IngestUrlDecodeProcessor @@ -12891,6 +14368,27 @@ export interface IngestProcessorContainer { user_agent?: IngestUserAgentProcessor } +export interface IngestRedact { + _is_redacted: boolean +} + +export interface IngestRedactProcessor extends IngestProcessorBase { + field: Field + patterns: GrokPattern[] + pattern_definitions?: Record + prefix?: string + suffix?: string + ignore_missing?: boolean + skip_if_unlicensed?: boolean + trace_redact?: boolean +} + +export interface IngestRegisteredDomainProcessor extends IngestProcessorBase { + field: Field + target_field?: Field + ignore_missing?: boolean +} + export interface IngestRemoveProcessor extends IngestProcessorBase { field: Fields keep?: Fields @@ -12932,6 +14430,12 @@ export interface IngestSetSecurityUserProcessor extends IngestProcessorBase { export type IngestShapeType = 'geo_shape' | 'shape' +export interface IngestSimulateDocumentResult { + doc?: IngestDocumentSimulation + error?: ErrorCause + processor_results?: IngestPipelineProcessorResult[] +} + export interface IngestSortProcessor extends IngestProcessorBase { field: Field order?: SortOrder @@ -12946,6 +14450,9 @@ export interface IngestSplitProcessor extends IngestProcessorBase { target_field?: Field } +export interface IngestTerminateProcessor extends IngestProcessorBase { +} + export interface IngestTrimProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean @@ -12975,12 +14482,16 @@ export interface IngestUrlDecodeProcessor extends IngestProcessorBase { export interface IngestUserAgentProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean - options?: IngestUserAgentProperty[] regex_file?: string target_field?: Field + properties?: IngestUserAgentProperty[] + extract_device_type?: boolean } -export type IngestUserAgentProperty = 'NAME' | 'MAJOR' | 'MINOR' | 'PATCH' | 'OS' | 'OS_NAME' | 'OS_MAJOR' | 'OS_MINOR' | 'DEVICE' | 'BUILD' +export type IngestUserAgentProperty = 'name' | 'os' | 'device' | 'original' | 'version' + +export interface IngestWeb { +} export interface IngestDeleteGeoipDatabaseRequest extends RequestBase { id: Ids @@ -12990,6 +14501,14 @@ export interface IngestDeleteGeoipDatabaseRequest extends RequestBase { export type IngestDeleteGeoipDatabaseResponse = AcknowledgedResponseBase +export interface IngestDeleteIpLocationDatabaseRequest extends RequestBase { + id: Ids + master_timeout?: Duration + timeout?: Duration +} + +export type IngestDeleteIpLocationDatabaseResponse = AcknowledgedResponseBase + export interface IngestDeletePipelineRequest extends RequestBase { id: Id master_timeout?: Duration @@ -13033,13 +14552,29 @@ export interface IngestGetGeoipDatabaseDatabaseConfigurationMetadata { export interface IngestGetGeoipDatabaseRequest extends RequestBase { id?: Ids - master_timeout?: Duration } export interface IngestGetGeoipDatabaseResponse { databases: IngestGetGeoipDatabaseDatabaseConfigurationMetadata[] } +export interface IngestGetIpLocationDatabaseDatabaseConfigurationMetadata { + id: Id + version: VersionNumber + modified_date_millis?: EpochTime + modified_date?: EpochTime + database: IngestDatabaseConfigurationFull +} + +export interface IngestGetIpLocationDatabaseRequest extends RequestBase { + id?: Ids + master_timeout?: Duration +} + +export interface IngestGetIpLocationDatabaseResponse { + databases: IngestGetIpLocationDatabaseDatabaseConfigurationMetadata[] +} + export interface IngestGetPipelineRequest extends RequestBase { id?: Id master_timeout?: Duration @@ -13068,6 +14603,16 @@ export interface IngestPutGeoipDatabaseRequest extends RequestBase { export type IngestPutGeoipDatabaseResponse = AcknowledgedResponseBase +export interface IngestPutIpLocationDatabaseRequest extends RequestBase { + id: Id + master_timeout?: Duration + timeout?: Duration + /** @deprecated The use of the 'body' key has been deprecated, use 'configuration' instead. */ + body?: IngestDatabaseConfiguration +} + +export type IngestPutIpLocationDatabaseResponse = AcknowledgedResponseBase + export interface IngestPutPipelineRequest extends RequestBase { id: Id master_timeout?: Duration @@ -13080,62 +14625,24 @@ export interface IngestPutPipelineRequest extends RequestBase { on_failure?: IngestProcessorContainer[] processors?: IngestProcessorContainer[] version?: VersionNumber + deprecated?: boolean } } export type IngestPutPipelineResponse = AcknowledgedResponseBase -export interface IngestSimulateDocument { - _id?: Id - _index?: IndexName - _source: any -} - -export interface IngestSimulateDocumentSimulationKeys { - _id: Id - _index: IndexName - _ingest: IngestSimulateIngest - _routing?: string - _source: Record - _version?: SpecUtilsStringified - _version_type?: VersionType -} -export type IngestSimulateDocumentSimulation = IngestSimulateDocumentSimulationKeys -& { [property: string]: string | Id | IndexName | IngestSimulateIngest | Record | SpecUtilsStringified | VersionType } - -export interface IngestSimulateIngest { - timestamp: DateTime - pipeline?: Name -} - -export interface IngestSimulatePipelineSimulation { - doc?: IngestSimulateDocumentSimulation - tag?: string - processor_type?: string - status?: WatcherActionStatusOptions - description?: string - ignored_error?: ErrorCause - error?: ErrorCause -} - export interface IngestSimulateRequest extends RequestBase { id?: Id verbose?: boolean /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { - docs: IngestSimulateDocument[] + docs: IngestDocument[] pipeline?: IngestPipeline } } export interface IngestSimulateResponse { - docs: IngestSimulateSimulateDocumentResult[] -} - -export interface IngestSimulateSimulateDocumentResult { - doc?: IngestSimulateDocumentSimulation - error?: ErrorCause - processor_results?: IngestSimulatePipelineSimulation[] + docs: IngestSimulateDocumentResult[] } export interface LicenseLicense { @@ -13156,6 +14663,8 @@ export type LicenseLicenseStatus = 'active' | 'valid' | 'invalid' | 'expired' export type LicenseLicenseType = 'missing' | 'trial' | 'basic' | 'standard' | 'dev' | 'silver' | 'gold' | 'platinum' | 'enterprise' export interface LicenseDeleteRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export type LicenseDeleteResponse = AcknowledgedResponseBase @@ -13205,6 +14714,8 @@ export interface LicensePostAcknowledgement { export interface LicensePostRequest extends RequestBase { acknowledge?: boolean + master_timeout?: Duration + timeout?: Duration /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { license?: LicenseLicense @@ -13220,6 +14731,8 @@ export interface LicensePostResponse { export interface LicensePostStartBasicRequest extends RequestBase { acknowledge?: boolean + master_timeout?: Duration + timeout?: Duration } export interface LicensePostStartBasicResponse { @@ -13233,6 +14746,7 @@ export interface LicensePostStartBasicResponse { export interface LicensePostStartTrialRequest extends RequestBase { acknowledge?: boolean type_query_string?: string + master_timeout?: Duration } export interface LicensePostStartTrialResponse { @@ -13245,10 +14759,10 @@ export interface LicensePostStartTrialResponse { export interface LogstashPipeline { description: string last_modified: DateTime - pipeline_metadata: LogstashPipelineMetadata - username: string pipeline: string + pipeline_metadata: LogstashPipelineMetadata pipeline_settings: LogstashPipelineSettings + username: string } export interface LogstashPipelineMetadata { @@ -13287,10 +14801,12 @@ export interface LogstashPutPipelineRequest extends RequestBase { export type LogstashPutPipelineResponse = boolean export interface MigrationDeprecationsDeprecation { - details: string + details?: string level: MigrationDeprecationsDeprecationLevel message: string url: string + resolve_during_rolling_upgrade: boolean + _meta?: Record } export type MigrationDeprecationsDeprecationLevel = 'none' | 'info' | 'warning' | 'critical' @@ -13302,8 +14818,11 @@ export interface MigrationDeprecationsRequest extends RequestBase { export interface MigrationDeprecationsResponse { cluster_settings: MigrationDeprecationsDeprecation[] index_settings: Record + data_streams: Record node_settings: MigrationDeprecationsDeprecation[] ml_settings: MigrationDeprecationsDeprecation[] + templates: Record + ilm_policies: Record } export interface MigrationGetFeatureUpgradeStatusMigrationFeature { @@ -13341,6 +14860,12 @@ export interface MigrationPostFeatureUpgradeResponse { features: MigrationPostFeatureUpgradeMigrationFeature[] } +export interface MlAdaptiveAllocationsSettings { + enabled: boolean + min_number_of_allocations?: integer + max_number_of_allocations?: integer +} + export interface MlAnalysisConfig { bucket_span?: Duration categorization_analyzer?: MlCategorizationAnalyzer @@ -13371,7 +14896,7 @@ export interface MlAnalysisConfigRead { export interface MlAnalysisLimits { categorization_examples_limit?: long - model_memory_limit?: string + model_memory_limit?: ByteSize } export interface MlAnalysisMemoryLimit { @@ -13406,20 +14931,21 @@ export interface MlAnomaly { } export interface MlAnomalyCause { - actual: double[] - by_field_name: Name - by_field_value: string - correlated_by_field_value: string - field_name: Field - function: string - function_description: string - influencers: MlInfluence[] - over_field_name: Name - over_field_value: string - partition_field_name: string - partition_field_value: string + actual?: double[] + by_field_name?: Name + by_field_value?: string + correlated_by_field_value?: string + field_name?: Field + function?: string + function_description?: string + geo_results?: MlGeoResults + influencers?: MlInfluence[] + over_field_name?: Name + over_field_value?: string + partition_field_name?: string + partition_field_value?: string probability: double - typical: double[] + typical?: double[] } export interface MlAnomalyExplanation { @@ -13491,7 +15017,7 @@ export type MlCategorizationStatus = 'ok' | 'warn' export interface MlCategory { category_id: ulong examples: string[] - grok_pattern?: string + grok_pattern?: GrokPattern job_id: Id max_matching_length: ulong partition_field_name?: string @@ -13520,6 +15046,14 @@ export interface MlClassificationInferenceOptions { top_classes_results_field?: string } +export interface MlCommonTokenizationConfig { + do_lower_case?: boolean + max_sequence_length?: integer + span?: integer + truncate?: MlTokenizationTruncate + with_special_tokens?: boolean +} + export type MlConditionOperator = 'gt' | 'gte' | 'lt' | 'lte' export type MlCustomSettings = any @@ -13609,15 +15143,16 @@ export type MlDatafeedState = 'started' | 'stopped' | 'starting' | 'stopping' export interface MlDatafeedStats { assignment_explanation?: string datafeed_id: Id - node?: MlDiscoveryNode + node?: MlDiscoveryNodeCompact state: MlDatafeedState - timing_stats: MlDatafeedTimingStats + timing_stats?: MlDatafeedTimingStats running_state?: MlDatafeedRunningState } export interface MlDatafeedTimingStats { bucket_count: long exponential_average_search_time_per_hour_ms: DurationValue + exponential_average_calculation_context?: MlExponentialAverageCalculationContext job_id: Id search_count: long total_search_time_ms: DurationValue @@ -13809,6 +15344,7 @@ export interface MlDataframeAnalyticsSummary { model_memory_limit?: string source: MlDataframeAnalyticsSource version?: VersionString + _meta?: Metadata } export interface MlDataframeEvaluationClassification { @@ -13880,9 +15416,7 @@ export interface MlDelayedDataCheckConfig { export type MlDeploymentAllocationState = 'started' | 'starting' | 'fully_allocated' -export type MlDeploymentAssignmentState = 'starting' | 'started' | 'stopping' | 'failed' - -export type MlDeploymentState = 'started' | 'starting' | 'stopping' +export type MlDeploymentAssignmentState = 'started' | 'starting' | 'stopping' | 'failed' export interface MlDetectionRule { actions?: MlRuleAction[] @@ -13916,21 +15450,50 @@ export interface MlDetectorRead { use_null?: boolean } -export interface MlDiscoveryNode { - attributes: Record +export interface MlDetectorUpdate { + detector_index: integer + description?: string + custom_rules?: MlDetectionRule[] +} + +export type MlDiscoveryNode = Partial> + +export interface MlDiscoveryNodeCompact { + name: Name ephemeral_id: Id id: Id - name: Name transport_address: TransportAddress + attributes: Record +} + +export interface MlDiscoveryNodeContent { + name?: Name + ephemeral_id: Id + transport_address: TransportAddress + external_id: string + attributes: Record + roles: string[] + version: VersionString + min_index_version: integer + max_index_version: integer } export type MlExcludeFrequent = 'all' | 'none' | 'by' | 'over' +export interface MlExponentialAverageCalculationContext { + incremental_metric_value_ms: DurationValue + latest_timestamp?: EpochTime + previous_exponential_average_ms?: DurationValue +} + +export type MlFeatureExtractor = MlQueryFeatureExtractor + export interface MlFillMaskInferenceOptions { mask_token?: string num_top_classes?: integer tokenization?: MlTokenizationConfigContainer results_field?: string + vocabulary: MlVocabulary } export interface MlFillMaskInferenceUpdateOptions { @@ -13953,8 +15516,8 @@ export interface MlFilterRef { export type MlFilterType = 'include' | 'exclude' export interface MlGeoResults { - actual_point: string - typical_point: string + actual_point?: string + typical_point?: string } export interface MlHyperparameter { @@ -13990,6 +15553,7 @@ export interface MlInferenceConfigCreateContainer { text_classification?: MlTextClassificationInferenceOptions zero_shot_classification?: MlZeroShotClassificationInferenceOptions fill_mask?: MlFillMaskInferenceOptions + learning_to_rank?: MlLearningToRankConfig ner?: MlNerInferenceOptions pass_through?: MlPassThroughInferenceOptions text_embedding?: MlTextEmbeddingInferenceOptions @@ -14118,7 +15682,7 @@ export interface MlJobStats { forecasts_stats: MlJobForecastStatistics job_id: string model_size_stats: MlModelSizeStats - node?: MlDiscoveryNode + node?: MlDiscoveryNodeCompact open_time?: DateTime state: MlJobState timing_stats: MlJobTimingStats @@ -14136,8 +15700,31 @@ export interface MlJobTimingStats { minimum_bucket_processing_time_ms?: DurationValue } +export interface MlLearningToRankConfig { + default_params?: Record + feature_extractors?: Record[] + num_top_feature_importance_values: integer +} + export type MlMemoryStatus = 'ok' | 'soft_limit' | 'hard_limit' +export interface MlModelPackageConfig { + create_time?: EpochTime + description?: string + inference_config?: Record + metadata?: Metadata + minimum_version?: string + model_repository?: string + model_type?: string + packaged_model_id: Id + platform_architecture?: string + prefix_strings?: MlTrainedModelPrefixStrings + size?: ByteSize + sha256?: string + tags?: string[] + vocabulary_file?: string +} + export interface MlModelPlotConfig { annotations_enabled?: boolean enabled?: boolean @@ -14152,6 +15739,7 @@ export interface MlModelSizeStats { model_bytes: ByteSize model_bytes_exceeded?: ByteSize model_bytes_memory_limit?: ByteSize + output_memory_allocator_bytes?: ByteSize peak_model_bytes?: ByteSize assignment_memory_basis?: string result_type: string @@ -14201,20 +15789,11 @@ export interface MlNerInferenceUpdateOptions { results_field?: string } -export interface MlNlpBertTokenizationConfig { - do_lower_case?: boolean - with_special_tokens?: boolean - max_sequence_length?: integer - truncate?: MlTokenizationTruncate - span?: integer +export interface MlNlpBertTokenizationConfig extends MlCommonTokenizationConfig { } -export interface MlNlpRobertaTokenizationConfig { +export interface MlNlpRobertaTokenizationConfig extends MlCommonTokenizationConfig { add_prefix_space?: boolean - with_special_tokens?: boolean - max_sequence_length?: integer - truncate?: MlTokenizationTruncate - span?: integer } export interface MlNlpTokenizationUpdateOptions { @@ -14238,7 +15817,7 @@ export interface MlOverallBucket { overall_score: double result_type: string timestamp: EpochTime - timestamp_string: DateTime + timestamp_string?: DateTime } export interface MlOverallBucketJob { @@ -14269,6 +15848,12 @@ export interface MlPerPartitionCategorization { export type MlPredictedValue = ScalarValue | ScalarValue[] +export interface MlQueryFeatureExtractor { + default_score?: float + feature_name: string + query: QueryDslQueryContainer +} + export interface MlQuestionAnsweringInferenceOptions { num_top_classes?: integer tokenization?: MlTokenizationConfigContainer @@ -14313,6 +15898,7 @@ export interface MlTextClassificationInferenceOptions { tokenization?: MlTokenizationConfigContainer results_field?: string classification_labels?: string[] + vocabulary?: MlVocabulary } export interface MlTextClassificationInferenceUpdateOptions { @@ -14326,6 +15912,7 @@ export interface MlTextEmbeddingInferenceOptions { embedding_size?: integer tokenization?: MlTokenizationConfigContainer results_field?: string + vocabulary: MlVocabulary } export interface MlTextEmbeddingInferenceUpdateOptions { @@ -14336,6 +15923,7 @@ export interface MlTextEmbeddingInferenceUpdateOptions { export interface MlTextExpansionInferenceOptions { tokenization?: MlTokenizationConfigContainer results_field?: string + vocabulary: MlVocabulary } export interface MlTextExpansionInferenceUpdateOptions { @@ -14350,8 +15938,10 @@ export interface MlTimingStats { export interface MlTokenizationConfigContainer { bert?: MlNlpBertTokenizationConfig + bert_ja?: MlNlpBertTokenizationConfig mpnet?: MlNlpBertTokenizationConfig roberta?: MlNlpRobertaTokenizationConfig + xlm_roberta?: MlXlmRobertaTokenizationConfig } export type MlTokenizationTruncate = 'first' | 'second' | 'none' @@ -14380,27 +15970,36 @@ export interface MlTotalFeatureImportanceStatistics { } export interface MlTrainedModelAssignment { + adaptive_allocations?: MlAdaptiveAllocationsSettings | null assignment_state: MlDeploymentAssignmentState max_assigned_allocations?: integer + reason?: string routing_table: Record start_time: DateTime task_parameters: MlTrainedModelAssignmentTaskParameters } +export interface MlTrainedModelAssignmentRoutingStateAndReason { + reason?: string + routing_state: MlRoutingState +} + export interface MlTrainedModelAssignmentRoutingTable { - reason: string + reason?: string routing_state: MlRoutingState current_allocations: integer target_allocations: integer } export interface MlTrainedModelAssignmentTaskParameters { - model_bytes: integer + model_bytes: ByteSize model_id: Id deployment_id: Id - cache_size: ByteSize + cache_size?: ByteSize number_of_allocations: integer priority: MlTrainingPriority + per_deployment_memory_bytes: ByteSize + per_allocation_memory_bytes: ByteSize queue_capacity: integer threads_per_allocation: integer } @@ -14423,7 +16022,9 @@ export interface MlTrainedModelConfig { license_level?: string metadata?: MlTrainedModelConfigMetadata model_size_bytes?: ByteSize + model_package?: MlModelPackageConfig location?: MlTrainedModelLocation + platform_architecture?: string prefix_strings?: MlTrainedModelPrefixStrings } @@ -14445,36 +16046,45 @@ export interface MlTrainedModelDeploymentAllocationStatus { } export interface MlTrainedModelDeploymentNodesStats { - average_inference_time_ms: DurationValue - error_count: integer - inference_count: integer - last_access: long - node: MlDiscoveryNode - number_of_allocations: integer - number_of_pending_requests: integer - rejection_execution_count: integer - routing_state: MlTrainedModelAssignmentRoutingTable - start_time: EpochTime - threads_per_allocation: integer - timeout_count: integer + average_inference_time_ms?: DurationValue + average_inference_time_ms_last_minute?: DurationValue + average_inference_time_ms_excluding_cache_hits?: DurationValue + error_count?: integer + inference_count?: long + inference_cache_hit_count?: long + inference_cache_hit_count_last_minute?: long + last_access?: EpochTime + node?: MlDiscoveryNode + number_of_allocations?: integer + number_of_pending_requests?: integer + peak_throughput_per_minute: long + rejected_execution_count?: integer + routing_state: MlTrainedModelAssignmentRoutingStateAndReason + start_time?: EpochTime + threads_per_allocation?: integer + throughput_last_minute: integer + timeout_count?: integer } export interface MlTrainedModelDeploymentStats { - allocation_status: MlTrainedModelDeploymentAllocationStatus + adaptive_allocations?: MlAdaptiveAllocationsSettings + allocation_status?: MlTrainedModelDeploymentAllocationStatus cache_size?: ByteSize deployment_id: Id - error_count: integer - inference_count: integer + error_count?: integer + inference_count?: integer model_id: Id nodes: MlTrainedModelDeploymentNodesStats[] - number_of_allocations: integer - queue_capacity: integer - rejected_execution_count: integer - reason: string + number_of_allocations?: integer + peak_throughput_per_minute: long + priority: MlTrainingPriority + queue_capacity?: integer + rejected_execution_count?: integer + reason?: string start_time: EpochTime - state: MlDeploymentState - threads_per_allocation: integer - timeout_count: integer + state?: MlDeploymentAssignmentState + threads_per_allocation?: integer + timeout_count?: integer } export interface MlTrainedModelEntities { @@ -14550,6 +16160,9 @@ export interface MlVocabulary { index: IndexName } +export interface MlXlmRobertaTokenizationConfig extends MlCommonTokenizationConfig { +} + export interface MlZeroShotClassificationInferenceOptions { tokenization?: MlTokenizationConfigContainer hypothesis_template?: string @@ -14674,6 +16287,7 @@ export type MlDeleteModelSnapshotResponse = AcknowledgedResponseBase export interface MlDeleteTrainedModelRequest extends RequestBase { model_id: Id force?: boolean + timeout?: Duration } export type MlDeleteTrainedModelResponse = AcknowledgedResponseBase @@ -15061,7 +16675,6 @@ export interface MlGetMemoryStatsMemory { export interface MlGetMemoryStatsRequest extends RequestBase { node_id?: Id - human?: boolean master_timeout?: Duration timeout?: Duration } @@ -15150,6 +16763,7 @@ export interface MlGetTrainedModelsRequest extends RequestBase { exclude_generated?: boolean from?: integer include?: MlInclude + include_model_definition?: boolean size?: integer tags?: string | string[] } @@ -15203,9 +16817,11 @@ export interface MlInfoDefaults { } export interface MlInfoLimits { - max_model_memory_limit?: string - effective_max_model_memory_limit: string - total_ml_memory: string + max_single_ml_node_processors?: integer + total_ml_processors?: integer + max_model_memory_limit?: ByteSize + effective_max_model_memory_limit?: ByteSize + total_ml_memory: ByteSize } export interface MlInfoNativeCode { @@ -15257,21 +16873,24 @@ export interface MlPostDataRequest extends RequestBase { } export interface MlPostDataResponse { - bucket_count: long - earliest_record_timestamp: long - empty_bucket_count: long + job_id: Id + processed_record_count: long + processed_field_count: long input_bytes: long input_field_count: long - input_record_count: long invalid_date_count: long - job_id: Id - last_data_time: integer - latest_record_timestamp: long missing_field_count: long out_of_order_timestamp_count: long - processed_field_count: long - processed_record_count: long + empty_bucket_count: long sparse_bucket_count: long + bucket_count: long + earliest_record_timestamp?: EpochTime + latest_record_timestamp?: EpochTime + last_data_time?: EpochTime + latest_empty_bucket_timestamp?: EpochTime + latest_sparse_bucket_timestamp?: EpochTime + input_record_count: long + log_time?: EpochTime } export interface MlPreviewDataFrameAnalyticsDataframePreviewConfig { @@ -15343,6 +16962,7 @@ export interface MlPutDataFrameAnalyticsRequest extends RequestBase { description?: string dest: MlDataframeAnalyticsDestination max_num_threads?: integer + _meta?: Metadata model_memory_limit?: string source: MlDataframeAnalyticsSource headers?: HttpHeaders @@ -15360,6 +16980,7 @@ export interface MlPutDataFrameAnalyticsResponse { dest: MlDataframeAnalyticsDestination id: Id max_num_threads: integer + _meta?: Metadata model_memory_limit: string source: MlDataframeAnalyticsSource version: VersionString @@ -15374,6 +16995,8 @@ export interface MlPutDatafeedRequest extends RequestBase { /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { aggregations?: Record + /** @alias aggregations */ + aggs?: Record chunking_config?: MlChunkingConfig delayed_data_check_config?: MlDelayedDataCheckConfig frequency?: Duration @@ -15427,6 +17050,10 @@ export interface MlPutFilterResponse { export interface MlPutJobRequest extends RequestBase { job_id: Id + allow_no_indices?: boolean + expand_wildcards?: ExpandWildcards + ignore_throttled?: boolean + ignore_unavailable?: boolean /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { allow_lazy_open?: boolean @@ -15438,6 +17065,7 @@ export interface MlPutJobRequest extends RequestBase { data_description: MlDataDescription datafeed_config?: MlDatafeedConfig description?: string + job_id?: Id groups?: string[] model_plot_config?: MlModelPlotConfig model_snapshot_retention_days?: long @@ -15665,6 +17293,10 @@ export interface MlStartTrainedModelDeploymentRequest extends RequestBase { threads_per_allocation?: integer timeout?: Duration wait_for?: MlDeploymentAllocationState + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + adaptive_allocations?: MlAdaptiveAllocationsSettings + } } export interface MlStartTrainedModelDeploymentResponse { @@ -15809,7 +17441,7 @@ export interface MlUpdateJobRequest extends RequestBase { renormalization_window_days?: long results_retention_days?: long groups?: string[] - detectors?: MlDetector[] + detectors?: MlDetectorUpdate[] per_partition_categorization?: MlPerPartitionCategorization } } @@ -15858,6 +17490,7 @@ export interface MlUpdateTrainedModelDeploymentRequest extends RequestBase { /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { number_of_allocations?: integer + adaptive_allocations?: MlAdaptiveAllocationsSettings } } @@ -16088,6 +17721,25 @@ export interface NodesHttp { current_open?: integer total_opened?: long clients?: NodesClient[] + routes: Record +} + +export interface NodesHttpRoute { + requests: NodesHttpRouteRequests + responses: NodesHttpRouteResponses +} + +export interface NodesHttpRouteRequests { + count: long + total_size_in_bytes: long + size_histogram: NodesSizeHttpHistogram[] +} + +export interface NodesHttpRouteResponses { + count: long + total_size_in_bytes: long + handling_time_histogram: NodesTimeHttpHistogram[] + size_histogram: NodesSizeHttpHistogram[] } export interface NodesIndexingPressure { @@ -16102,16 +17754,25 @@ export interface NodesIndexingPressureMemory { } export interface NodesIngest { - pipelines?: Record + pipelines?: Record total?: NodesIngestTotal } +export interface NodesIngestStats { + count: long + current: long + failed: long + processors: Record[] + time_in_millis: DurationValue + ingested_as_first_pipeline_in_bytes: long + produced_as_first_pipeline_in_bytes: long +} + export interface NodesIngestTotal { - count?: long - current?: long - failed?: long - processors?: Record[] - time_in_millis?: DurationValue + count: long + current: long + failed: long + time_in_millis: DurationValue } export interface NodesIoStatDevice { @@ -16186,13 +17847,11 @@ export interface NodesNodeBufferPool { used_in_bytes?: long } -export interface NodesNodeReloadError { +export interface NodesNodeReloadResult { name: Name reload_exception?: ErrorCause } -export type NodesNodeReloadResult = NodesStats | NodesNodeReloadError - export interface NodesNodesResponseBase { _nodes?: NodeStatistics } @@ -16316,6 +17975,12 @@ export interface NodesSerializedClusterStateDetail { compressed_size_in_bytes?: long } +export interface NodesSizeHttpHistogram { + count: long + ge_bytes?: long + lt_bytes?: long +} + export interface NodesStats { adaptive_selection?: Record breakers?: Record @@ -16350,6 +18015,12 @@ export interface NodesThreadCount { threads?: long } +export interface NodesTimeHttpHistogram { + count: long + ge_millis?: long + lt_millis?: long +} + export interface NodesTransport { inbound_handling_time_histogram?: NodesTransportHistogram[] outbound_handling_time_histogram?: NodesTransportHistogram[] @@ -16397,7 +18068,6 @@ export interface NodesHotThreadsRequest extends RequestBase { ignore_idle_threads?: boolean interval?: Duration snapshots?: long - master_timeout?: Duration threads?: long timeout?: Duration type?: ThreadType @@ -16529,7 +18199,7 @@ export interface NodesInfoNodeInfoPath { logs?: string home?: string repo?: string[] - data?: string[] + data?: string | string[] } export interface NodesInfoNodeInfoRepositories { @@ -16632,7 +18302,7 @@ export interface NodesInfoNodeInfoSettingsIngest { } export interface NodesInfoNodeInfoSettingsNetwork { - host?: Host + host?: Host | Host[] } export interface NodesInfoNodeInfoSettingsNode { @@ -16665,6 +18335,7 @@ export interface NodesInfoNodeInfoXpack { license?: NodesInfoNodeInfoXpackLicense security: NodesInfoNodeInfoXpackSecurity notification?: Record + ml?: NodesInfoNodeInfoXpackMl } export interface NodesInfoNodeInfoXpackLicense { @@ -16675,16 +18346,20 @@ export interface NodesInfoNodeInfoXpackLicenseType { type: string } +export interface NodesInfoNodeInfoXpackMl { + use_auto_machine_memory_percent?: boolean +} + export interface NodesInfoNodeInfoXpackSecurity { - http: NodesInfoNodeInfoXpackSecuritySsl + http?: NodesInfoNodeInfoXpackSecuritySsl enabled: string transport?: NodesInfoNodeInfoXpackSecuritySsl authc?: NodesInfoNodeInfoXpackSecurityAuthc } export interface NodesInfoNodeInfoXpackSecurityAuthc { - realms: NodesInfoNodeInfoXpackSecurityAuthcRealms - token: NodesInfoNodeInfoXpackSecurityAuthcToken + realms?: NodesInfoNodeInfoXpackSecurityAuthcRealms + token?: NodesInfoNodeInfoXpackSecurityAuthcToken } export interface NodesInfoNodeInfoXpackSecurityAuthcRealms { @@ -16754,7 +18429,6 @@ export interface NodesInfoRequest extends RequestBase { node_id?: NodeIds metric?: Metrics flat_settings?: boolean - master_timeout?: Duration timeout?: Duration } @@ -16791,7 +18465,6 @@ export interface NodesStatsRequest extends RequestBase { groups?: boolean include_segment_file_sizes?: boolean level?: Level - master_timeout?: Duration timeout?: Duration types?: string[] include_unloaded_segments?: boolean @@ -16882,6 +18555,7 @@ export interface QueryRulesListRulesetsQueryRulesetListItem { ruleset_id: Id rule_total_count: integer rule_criteria_types_counts: Record + rule_type_counts: Record } export interface QueryRulesListRulesetsRequest extends RequestBase { @@ -16922,6 +18596,24 @@ export interface QueryRulesPutRulesetResponse { result: Result } +export interface QueryRulesTestQueryRulesetMatchedRule { + ruleset_id: Id + rule_id: Id +} + +export interface QueryRulesTestRequest extends RequestBase { + ruleset_id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + match_criteria: Record + } +} + +export interface QueryRulesTestResponse { + total_matched_rules: integer + matched_rules: QueryRulesTestQueryRulesetMatchedRule[] +} + export interface RollupDateHistogramGrouping { delay?: Duration field: Field @@ -17123,10 +18815,15 @@ export interface SearchApplicationEventDataStream { name: IndexName } -export interface SearchApplicationSearchApplication { +export type SearchApplicationEventType = 'page_view' | 'search' | 'search_click' + +export interface SearchApplicationSearchApplication extends SearchApplicationSearchApplicationParameters { name: Name - indices: IndexName[] updated_at_millis: EpochTime +} + +export interface SearchApplicationSearchApplicationParameters { + indices: IndexName[] analytics_collection_name?: Name template?: SearchApplicationSearchApplicationTemplate } @@ -17167,21 +18864,27 @@ export interface SearchApplicationListRequest extends RequestBase { export interface SearchApplicationListResponse { count: long - results: SearchApplicationListSearchApplicationListItem[] + results: SearchApplicationSearchApplication[] } -export interface SearchApplicationListSearchApplicationListItem { - name: Name - indices: IndexName[] - updated_at_millis: EpochTime - analytics_collection_name?: Name +export interface SearchApplicationPostBehavioralAnalyticsEventRequest extends RequestBase { + collection_name: Name + event_type: SearchApplicationEventType + debug?: boolean + /** @deprecated The use of the 'body' key has been deprecated, use 'payload' instead. */ + body?: any +} + +export interface SearchApplicationPostBehavioralAnalyticsEventResponse { + accepted: boolean + event?: any } export interface SearchApplicationPutRequest extends RequestBase { name: Name create?: boolean /** @deprecated The use of the 'body' key has been deprecated, use 'search_application' instead. */ - body?: SearchApplicationSearchApplication + body?: SearchApplicationSearchApplicationParameters } export interface SearchApplicationPutResponse { @@ -17198,6 +18901,17 @@ export interface SearchApplicationPutBehavioralAnalyticsRequest extends RequestB export type SearchApplicationPutBehavioralAnalyticsResponse = SearchApplicationPutBehavioralAnalyticsAnalyticsAcknowledgeResponseBase +export interface SearchApplicationRenderQueryRequest extends RequestBase { + name: Name + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + params?: Record + } +} + +export interface SearchApplicationRenderQueryResponse { +} + export interface SearchApplicationSearchRequest extends RequestBase { name: Name typed_keys?: boolean @@ -17240,8 +18954,6 @@ export interface SearchableSnapshotsClearCacheRequest extends RequestBase { expand_wildcards?: ExpandWildcards allow_no_indices?: boolean ignore_unavailable?: boolean - pretty?: boolean - human?: boolean } export type SearchableSnapshotsClearCacheResponse = any @@ -17281,22 +18993,32 @@ export interface SearchableSnapshotsStatsResponse { total: any } +export interface SecurityAccess { + replication?: SecurityReplicationAccess[] + search?: SecuritySearchAccess[] +} + export interface SecurityApiKey { - creation?: long - expiration?: long id: Id - invalidated?: boolean name: Name - realm?: string + type: SecurityApiKeyType + creation: EpochTime + expiration?: EpochTime + invalidated: boolean + invalidation?: EpochTime + username: Username + realm: string realm_type?: string - username?: Username - profile_uid?: string - metadata?: Metadata + metadata: Metadata role_descriptors?: Record limited_by?: Record[] + access?: SecurityAccess + profile_uid?: string _sort?: SortResults } +export type SecurityApiKeyType = 'rest' | 'cross_cluster' + export interface SecurityApplicationGlobalUserPrivileges { manage: SecurityManageUserPrivileges } @@ -17316,7 +19038,7 @@ export interface SecurityClusterNode { name: Name } -export type SecurityClusterPrivilege = 'all' | 'cancel_task' | 'create_snapshot' | 'cross_cluster_replication' | 'cross_cluster_search' | 'delegate_pki' | 'grant_api_key' | 'manage' | 'manage_api_key' | 'manage_autoscaling' | 'manage_behavioral_analytics' | 'manage_ccr' | 'manage_data_frame_transforms' | 'manage_data_stream_global_retention' | 'manage_enrich' | 'manage_ilm' | 'manage_index_templates' | 'manage_inference' | 'manage_ingest_pipelines' | 'manage_logstash_pipelines' | 'manage_ml' | 'manage_oidc' | 'manage_own_api_key' | 'manage_pipeline' | 'manage_rollup' | 'manage_saml' | 'manage_search_application' | 'manage_search_query_rules' | 'manage_search_synonyms' | 'manage_security' | 'manage_service_account' | 'manage_slm' | 'manage_token' | 'manage_transform' | 'manage_user_profile' | 'manage_watcher' | 'monitor' | 'monitor_data_frame_transforms' | 'monitor_data_stream_global_retention' | 'monitor_enrich' | 'monitor_inference' | 'monitor_ml' | 'monitor_rollup' | 'monitor_snapshot' | 'monitor_text_structure' | 'monitor_transform' | 'monitor_watcher' | 'none' | 'post_behavioral_analytics_event' | 'read_ccr' | 'read_fleet_secrets' | 'read_ilm' | 'read_pipeline' | 'read_security' | 'read_slm' | 'transport_client' | 'write_connector_secrets' | 'write_fleet_secrets' | string +export type SecurityClusterPrivilege = 'all' | 'cancel_task' | 'create_snapshot' | 'cross_cluster_replication' | 'cross_cluster_search' | 'delegate_pki' | 'grant_api_key' | 'manage' | 'manage_api_key' | 'manage_autoscaling' | 'manage_behavioral_analytics' | 'manage_ccr' | 'manage_data_frame_transforms' | 'manage_data_stream_global_retention' | 'manage_enrich' | 'manage_ilm' | 'manage_index_templates' | 'manage_inference' | 'manage_ingest_pipelines' | 'manage_logstash_pipelines' | 'manage_ml' | 'manage_oidc' | 'manage_own_api_key' | 'manage_pipeline' | 'manage_rollup' | 'manage_saml' | 'manage_search_application' | 'manage_search_query_rules' | 'manage_search_synonyms' | 'manage_security' | 'manage_service_account' | 'manage_slm' | 'manage_token' | 'manage_transform' | 'manage_user_profile' | 'manage_watcher' | 'monitor' | 'monitor_data_frame_transforms' | 'monitor_data_stream_global_retention' | 'monitor_enrich' | 'monitor_inference' | 'monitor_ml' | 'monitor_rollup' | 'monitor_snapshot' | 'monitor_stats' | 'monitor_text_structure' | 'monitor_transform' | 'monitor_watcher' | 'none' | 'post_behavioral_analytics_event' | 'read_ccr' | 'read_fleet_secrets' | 'read_ilm' | 'read_pipeline' | 'read_security' | 'read_slm' | 'transport_client' | 'write_connector_secrets' | 'write_fleet_secrets' | string export interface SecurityCreatedStatus { created: boolean @@ -17343,7 +19065,7 @@ export type SecurityIndexPrivilege = 'all' | 'auto_configure' | 'create' | 'crea export interface SecurityIndicesPrivileges { field_security?: SecurityFieldSecurity - names: Indices + names: IndexName[] privileges: SecurityIndexPrivilege[] query?: SecurityIndicesPrivilegesQuery allow_restricted_indices?: boolean @@ -17360,15 +19082,54 @@ export interface SecurityRealmInfo { type: string } +export type SecurityRemoteClusterPrivilege = 'monitor_enrich' | 'monitor_stats' + +export interface SecurityRemoteClusterPrivileges { + clusters: Names + privileges: SecurityRemoteClusterPrivilege[] +} + +export interface SecurityRemoteIndicesPrivileges { + clusters: Names + field_security?: SecurityFieldSecurity + names: IndexName[] + privileges: SecurityIndexPrivilege[] + query?: SecurityIndicesPrivilegesQuery + allow_restricted_indices?: boolean +} + +export interface SecurityRemoteUserIndicesPrivileges { + field_security?: SecurityFieldSecurity[] + names: IndexName | IndexName[] + privileges: SecurityIndexPrivilege[] + query?: SecurityIndicesPrivilegesQuery[] + allow_restricted_indices: boolean + clusters: string[] +} + +export interface SecurityReplicationAccess { + names: IndexName | IndexName[] + allow_restricted_indices?: boolean +} + +export interface SecurityRestriction { + workflows: SecurityRestrictionWorkflow[] +} + +export type SecurityRestrictionWorkflow = 'search_application_query' | string + export interface SecurityRoleDescriptor { cluster?: SecurityClusterPrivilege[] indices?: SecurityIndicesPrivileges[] index?: SecurityIndicesPrivileges[] + remote_indices?: SecurityRemoteIndicesPrivileges[] + remote_cluster?: SecurityRemoteClusterPrivileges[] global?: SecurityGlobalPrivilege[] | SecurityGlobalPrivilege applications?: SecurityApplicationPrivileges[] metadata?: Metadata run_as?: string[] description?: string + restriction?: SecurityRestriction transient_metadata?: Record } @@ -17376,11 +19137,14 @@ export interface SecurityRoleDescriptorRead { cluster: SecurityClusterPrivilege[] indices: SecurityIndicesPrivileges[] index: SecurityIndicesPrivileges[] + remote_indices?: SecurityRemoteIndicesPrivileges[] + remote_cluster?: SecurityRemoteClusterPrivileges[] global?: SecurityGlobalPrivilege[] | SecurityGlobalPrivilege applications?: SecurityApplicationPrivileges[] metadata?: Metadata run_as?: string[] description?: string + restriction?: SecurityRestriction transient_metadata?: Record } @@ -17418,6 +19182,17 @@ export interface SecurityRoleTemplateScript { options?: Record } +export interface SecuritySearchAccess { + field_security?: SecurityFieldSecurity + names: IndexName | IndexName[] + query?: SecurityIndicesPrivilegesQuery + allow_restricted_indices?: boolean +} + +export interface SecuritySecuritySettings { + index?: IndicesIndexSettings +} + export type SecurityTemplateFormat = 'string' | 'json' export interface SecurityUser { @@ -17432,7 +19207,7 @@ export interface SecurityUser { export interface SecurityUserIndicesPrivileges { field_security?: SecurityFieldSecurity[] - names: Indices + names: IndexName[] privileges: SecurityIndexPrivilege[] query?: SecurityIndicesPrivilegesQuery[] allow_restricted_indices: boolean @@ -17479,11 +19254,16 @@ export interface SecurityActivateUserProfileRequest extends RequestBase { export type SecurityActivateUserProfileResponse = SecurityUserProfileWithMetadata +export interface SecurityAuthenticateAuthenticateApiKey { + id: Id + name?: Name +} + export interface SecurityAuthenticateRequest extends RequestBase { } export interface SecurityAuthenticateResponse { - api_key?: SecurityApiKey + api_key?: SecurityAuthenticateAuthenticateApiKey authentication_realm: SecurityRealmInfo email?: string | null full_name?: Name | null @@ -17530,6 +19310,22 @@ export interface SecurityBulkPutRoleResponse { errors?: SecurityBulkError } +export interface SecurityBulkUpdateApiKeysRequest extends RequestBase { + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + expiration?: Duration + ids: string | string[] + metadata?: Metadata + role_descriptors?: Record + } +} + +export interface SecurityBulkUpdateApiKeysResponse { + errors?: SecurityBulkError + noops: string[] + updated: string[] +} + export interface SecurityChangePasswordRequest extends RequestBase { username?: Username refresh?: Refresh @@ -17615,6 +19411,24 @@ export interface SecurityCreateApiKeyResponse { encoded: string } +export interface SecurityCreateCrossClusterApiKeyRequest extends RequestBase { + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + access: SecurityAccess + expiration?: Duration + metadata?: Metadata + name: Name + } +} + +export interface SecurityCreateCrossClusterApiKeyResponse { + api_key: string + expiration?: DurationValue + id: Id + name: Name + encoded: string +} + export interface SecurityCreateServiceTokenRequest extends RequestBase { namespace: Namespace service: Service @@ -17632,6 +19446,40 @@ export interface SecurityCreateServiceTokenToken { value: string } +export interface SecurityDelegatePkiAuthentication { + username: string + roles: string[] + full_name: string | null + email: string | null + token?: Record + metadata: Metadata + enabled: boolean + authentication_realm: SecurityDelegatePkiAuthenticationRealm + lookup_realm: SecurityDelegatePkiAuthenticationRealm + authentication_type: string + api_key?: Record +} + +export interface SecurityDelegatePkiAuthenticationRealm { + name: string + type: string + domain?: string +} + +export interface SecurityDelegatePkiRequest extends RequestBase { + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + x509_certificate_chain: string[] + } +} + +export interface SecurityDelegatePkiResponse { + access_token: string + expires_in: long + type: string + authentication?: SecurityDelegatePkiAuthentication +} + export interface SecurityDeletePrivilegesFoundStatus { found: boolean } @@ -17756,8 +19604,9 @@ export interface SecurityGetBuiltinPrivilegesRequest extends RequestBase { } export interface SecurityGetBuiltinPrivilegesResponse { - cluster: string[] - index: Indices + cluster: SecurityClusterPrivilege[] + index: IndexName[] + remote_cluster: SecurityRemoteClusterPrivilege[] } export interface SecurityGetPrivilegesRequest extends RequestBase { @@ -17774,10 +19623,13 @@ export interface SecurityGetRoleRequest extends RequestBase { export type SecurityGetRoleResponse = Record export interface SecurityGetRoleRole { - cluster: string[] + cluster: SecurityClusterPrivilege[] indices: SecurityIndicesPrivileges[] + remote_indices?: SecurityRemoteIndicesPrivileges[] + remote_cluster?: SecurityRemoteClusterPrivileges[] metadata: Metadata - run_as: string[] + description?: string + run_as?: string[] transient_metadata?: Record applications: SecurityApplicationPrivileges[] role_templates?: SecurityRoleTemplate[] @@ -17822,6 +19674,16 @@ export interface SecurityGetServiceCredentialsResponse { nodes_credentials: SecurityGetServiceCredentialsNodesCredentials } +export interface SecurityGetSettingsRequest extends RequestBase { + master_timeout?: Duration +} + +export interface SecurityGetSettingsResponse { + security: SecuritySecuritySettings + 'security-profile': SecuritySecuritySettings + 'security-tokens': SecuritySecuritySettings +} + export type SecurityGetTokenAccessTokenGrantType = 'password' | 'client_credentials' | '_kerberos' | 'refresh_token' export interface SecurityGetTokenAuthenticatedUser extends SecurityUser { @@ -17879,8 +19741,10 @@ export interface SecurityGetUserPrivilegesRequest extends RequestBase { export interface SecurityGetUserPrivilegesResponse { applications: SecurityApplicationPrivileges[] cluster: string[] + remote_cluster?: SecurityRemoteClusterPrivileges[] global: SecurityGlobalPrivilege[] indices: SecurityUserIndicesPrivileges[] + remote_indices?: SecurityRemoteUserIndicesPrivileges[] run_as: string[] } @@ -18024,6 +19888,53 @@ export interface SecurityInvalidateTokenResponse { previously_invalidated_tokens: long } +export interface SecurityOidcAuthenticateRequest extends RequestBase { + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + nonce: string + realm?: string + redirect_uri: string + state: string + } +} + +export interface SecurityOidcAuthenticateResponse { + access_token: string + expires_in: integer + refresh_token: string + type: string +} + +export interface SecurityOidcLogoutRequest extends RequestBase { + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + token: string + refresh_token?: string + } +} + +export interface SecurityOidcLogoutResponse { + redirect: string +} + +export interface SecurityOidcPrepareAuthenticationRequest extends RequestBase { + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + iss?: string + login_hint?: string + nonce?: string + realm?: string + state?: string + } +} + +export interface SecurityOidcPrepareAuthenticationResponse { + nonce: string + realm: string + redirect: string + state: string +} + export interface SecurityPutPrivilegesActions { actions: string[] application?: string @@ -18048,6 +19959,8 @@ export interface SecurityPutRoleRequest extends RequestBase { cluster?: SecurityClusterPrivilege[] global?: Record indices?: SecurityIndicesPrivileges[] + remote_indices?: SecurityRemoteIndicesPrivileges[] + remote_cluster?: SecurityRemoteClusterPrivileges[] metadata?: Metadata run_as?: string[] description?: string @@ -18351,6 +20264,35 @@ export interface SecurityUpdateApiKeyResponse { updated: boolean } +export interface SecurityUpdateCrossClusterApiKeyRequest extends RequestBase { + id: Id + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + access: SecurityAccess + expiration?: Duration + metadata?: Metadata + } +} + +export interface SecurityUpdateCrossClusterApiKeyResponse { + updated: boolean +} + +export interface SecurityUpdateSettingsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + security?: SecuritySecuritySettings + 'security-profile'?: SecuritySecuritySettings + 'security-tokens'?: SecuritySecuritySettings + } +} + +export interface SecurityUpdateSettingsResponse { + acknowledged: boolean +} + export interface SecurityUpdateUserProfileDataRequest extends RequestBase { uid: SecurityUserProfileId if_seq_no?: SequenceNumber @@ -18397,7 +20339,6 @@ export interface ShutdownGetNodePluginsStatus { export interface ShutdownGetNodeRequest extends RequestBase { node_id?: NodeIds master_timeout?: TimeUnit - timeout?: TimeUnit } export interface ShutdownGetNodeResponse { @@ -18427,6 +20368,39 @@ export interface ShutdownPutNodeRequest extends RequestBase { export type ShutdownPutNodeResponse = AcknowledgedResponseBase +export interface SimulateIngestIngestDocumentSimulationKeys { + _id: Id + _index: IndexName + _source: Record + _version: SpecUtilsStringified + executed_pipelines: string[] + ignored_fields?: Record[] + error?: ErrorCause +} +export type SimulateIngestIngestDocumentSimulation = SimulateIngestIngestDocumentSimulationKeys +& { [property: string]: string | Id | IndexName | Record | SpecUtilsStringified | string[] | Record[] | ErrorCause } + +export interface SimulateIngestRequest extends RequestBase { + index?: IndexName + pipeline?: PipelineName + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + docs: IngestDocument[] + component_template_substitutions?: Record + index_template_substitutions?: Record + mapping_addition?: MappingTypeMapping + pipeline_substitutions?: Record + } +} + +export interface SimulateIngestResponse { + docs: SimulateIngestSimulateIngestDocumentResult[] +} + +export interface SimulateIngestSimulateIngestDocumentResult { + doc?: SimulateIngestIngestDocumentSimulation +} + export interface SlmConfiguration { ignore_unavailable?: boolean indices?: Indices @@ -18494,12 +20468,16 @@ export interface SlmStatistics { export interface SlmDeleteLifecycleRequest extends RequestBase { policy_id: Name + master_timeout?: Duration + timeout?: Duration } export type SlmDeleteLifecycleResponse = AcknowledgedResponseBase export interface SlmExecuteLifecycleRequest extends RequestBase { policy_id: Name + master_timeout?: Duration + timeout?: Duration } export interface SlmExecuteLifecycleResponse { @@ -18507,17 +20485,23 @@ export interface SlmExecuteLifecycleResponse { } export interface SlmExecuteRetentionRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export type SlmExecuteRetentionResponse = AcknowledgedResponseBase export interface SlmGetLifecycleRequest extends RequestBase { policy_id?: Names + master_timeout?: Duration + timeout?: Duration } export type SlmGetLifecycleResponse = Record export interface SlmGetStatsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export interface SlmGetStatsResponse { @@ -18534,6 +20518,8 @@ export interface SlmGetStatsResponse { } export interface SlmGetStatusRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export interface SlmGetStatusResponse { @@ -18557,11 +20543,15 @@ export interface SlmPutLifecycleRequest extends RequestBase { export type SlmPutLifecycleResponse = AcknowledgedResponseBase export interface SlmStartRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export type SlmStartResponse = AcknowledgedResponseBase export interface SlmStopRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration } export type SlmStopResponse = AcknowledgedResponseBase @@ -18720,6 +20710,7 @@ export interface SnapshotSnapshotShardFailure { node_id?: Id reason: string shard_id: Id + index_uuid: Id status: string } @@ -18781,7 +20772,6 @@ export interface SnapshotCloneRequest extends RequestBase { snapshot: Name target_snapshot: Name master_timeout?: Duration - timeout?: Duration /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { indices: string @@ -18877,6 +20867,127 @@ export interface SnapshotGetRepositoryRequest extends RequestBase { export type SnapshotGetRepositoryResponse = Record +export interface SnapshotRepositoryAnalyzeBlobDetails { + name: string + overwritten: boolean + read_early: boolean + read_end: long + read_start: long + reads: SnapshotRepositoryAnalyzeReadBlobDetails + size: ByteSize + size_bytes: long +} + +export interface SnapshotRepositoryAnalyzeDetailsInfo { + blob: SnapshotRepositoryAnalyzeBlobDetails + overwrite_elapsed?: Duration + overwrite_elapsed_nanos?: DurationValue + write_elapsed: Duration + write_elapsed_nanos: DurationValue + write_throttled: Duration + write_throttled_nanos: DurationValue + writer_node: SnapshotRepositoryAnalyzeSnapshotNodeInfo +} + +export interface SnapshotRepositoryAnalyzeReadBlobDetails { + before_write_complete?: boolean + elapsed?: Duration + elapsed_nanos?: DurationValue + first_byte_time?: Duration + first_byte_time_nanos: DurationValue + found: boolean + node: SnapshotRepositoryAnalyzeSnapshotNodeInfo + throttled?: Duration + throttled_nanos?: DurationValue +} + +export interface SnapshotRepositoryAnalyzeReadSummaryInfo { + count: integer + max_wait: Duration + max_wait_nanos: DurationValue + total_elapsed: Duration + total_elapsed_nanos: DurationValue + total_size: ByteSize + total_size_bytes: long + total_throttled: Duration + total_throttled_nanos: DurationValue + total_wait: Duration + total_wait_nanos: DurationValue +} + +export interface SnapshotRepositoryAnalyzeRequest extends RequestBase { + name: Name + blob_count?: integer + concurrency?: integer + detailed?: boolean + early_read_node_count?: integer + max_blob_size?: ByteSize + max_total_data_size?: ByteSize + rare_action_probability?: double + rarely_abort_writes?: boolean + read_node_count?: integer + register_operation_count?: integer + seed?: integer + timeout?: Duration +} + +export interface SnapshotRepositoryAnalyzeResponse { + blob_count: integer + blob_path: string + concurrency: integer + coordinating_node: SnapshotRepositoryAnalyzeSnapshotNodeInfo + delete_elapsed: Duration + delete_elapsed_nanos: DurationValue + details: SnapshotRepositoryAnalyzeDetailsInfo + early_read_node_count: integer + issues_detected: string[] + listing_elapsed: Duration + listing_elapsed_nanos: DurationValue + max_blob_size: ByteSize + max_blob_size_bytes: long + max_total_data_size: ByteSize + max_total_data_size_bytes: long + rare_action_probability: double + read_node_count: integer + repository: string + seed: long + summary: SnapshotRepositoryAnalyzeSummaryInfo +} + +export interface SnapshotRepositoryAnalyzeSnapshotNodeInfo { + id: Id + name: Name +} + +export interface SnapshotRepositoryAnalyzeSummaryInfo { + read: SnapshotRepositoryAnalyzeReadSummaryInfo + write: SnapshotRepositoryAnalyzeWriteSummaryInfo +} + +export interface SnapshotRepositoryAnalyzeWriteSummaryInfo { + count: integer + total_elapsed: Duration + total_elapsed_nanos: DurationValue + total_size: ByteSize + total_size_bytes: long + total_throttled: Duration + total_throttled_nanos: long +} + +export interface SnapshotRepositoryVerifyIntegrityRequest extends RequestBase { + name: Names + meta_thread_pool_concurrency?: integer + blob_thread_pool_concurrency?: integer + snapshot_verification_concurrency?: integer + index_verification_concurrency?: integer + index_snapshot_verification_concurrency?: integer + max_failed_shard_snapshots?: integer + verify_blob_contents?: boolean + max_bytes_per_sec?: string +} + +export type SnapshotRepositoryVerifyIntegrityResponse = any + export interface SnapshotRestoreRequest extends RequestBase { repository: Name snapshot: Name @@ -18898,7 +21009,8 @@ export interface SnapshotRestoreRequest extends RequestBase { } export interface SnapshotRestoreResponse { - snapshot: SnapshotRestoreSnapshotRestore + accepted?: boolean + snapshot?: SnapshotRestoreSnapshotRestore } export interface SnapshotRestoreSnapshotRestore { @@ -18978,46 +21090,49 @@ export interface SqlGetAsyncStatusRequest extends RequestBase { } export interface SqlGetAsyncStatusResponse { + expiration_time_in_millis: EpochTime id: string is_running: boolean is_partial: boolean start_time_in_millis: EpochTime - expiration_time_in_millis: EpochTime completion_status?: uint } export interface SqlQueryRequest extends RequestBase { - format?: string + format?: SqlQuerySqlFormat /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { + allow_partial_search_results?: boolean catalog?: string columnar?: boolean cursor?: string fetch_size?: integer + field_multi_value_leniency?: boolean filter?: QueryDslQueryContainer + index_using_frozen?: boolean + keep_alive?: Duration + keep_on_completion?: boolean + page_timeout?: Duration + params?: Record query?: string request_timeout?: Duration - page_timeout?: Duration - time_zone?: TimeZone - field_multi_value_leniency?: boolean runtime_mappings?: MappingRuntimeFields + time_zone?: TimeZone wait_for_completion_timeout?: Duration - params?: Record - keep_alive?: Duration - keep_on_completion?: boolean - index_using_frozen?: boolean } } export interface SqlQueryResponse { + columns?: SqlColumn[] + cursor?: string id?: Id is_running?: boolean is_partial?: boolean - columns?: SqlColumn[] - cursor?: string rows: SqlRow[] } +export type SqlQuerySqlFormat = 'csv' | 'json' | 'tsv' | 'txt' | 'yaml' | 'cbor' | 'smile' + export interface SqlTranslateRequest extends RequestBase { /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { @@ -19208,19 +21323,20 @@ export interface TasksListRequest extends RequestBase { actions?: string | string[] detailed?: boolean group_by?: TasksGroupBy - node_id?: string[] + nodes?: NodeIds parent_task_id?: Id - master_timeout?: Duration timeout?: Duration wait_for_completion?: boolean } export type TasksListResponse = TasksTaskListResponseBase -export interface TextStructureFindStructureFieldStat { +export type TextStructureEcsCompatibilityType = 'disabled' | 'v1' + +export interface TextStructureFieldStat { count: integer cardinality: integer - top_hits: TextStructureFindStructureTopHit[] + top_hits: TextStructureTopHit[] mean_value?: integer median_value?: integer max_value?: integer @@ -19229,6 +21345,84 @@ export interface TextStructureFindStructureFieldStat { latest?: string } +export type TextStructureFormatType = 'delimited' | 'ndjson' | 'semi_structured_text' | 'xml' + +export interface TextStructureTopHit { + count: long + value: any +} + +export interface TextStructureFindFieldStructureRequest extends RequestBase { + column_names?: string + delimiter?: string + documents_to_sample?: uint + ecs_compatibility?: TextStructureEcsCompatibilityType + explain?: boolean + field: Field + format?: TextStructureFormatType + grok_pattern?: GrokPattern + index: IndexName + quote?: string + should_trim_fields?: boolean + timeout?: Duration + timestamp_field?: Field + timestamp_format?: string +} + +export interface TextStructureFindFieldStructureResponse { + charset: string + ecs_compatibility?: TextStructureEcsCompatibilityType + field_stats: Record + format: TextStructureFormatType + grok_pattern?: GrokPattern + java_timestamp_formats?: string[] + joda_timestamp_formats?: string[] + ingest_pipeline: IngestPipelineConfig + mappings: MappingTypeMapping + multiline_start_pattern?: string + need_client_timezone: boolean + num_lines_analyzed: integer + num_messages_analyzed: integer + sample_start: string + timestamp_field?: Field +} + +export interface TextStructureFindMessageStructureRequest extends RequestBase { + column_names?: string + delimiter?: string + ecs_compatibility?: TextStructureEcsCompatibilityType + explain?: boolean + format?: TextStructureFormatType + grok_pattern?: GrokPattern + quote?: string + should_trim_fields?: boolean + timeout?: Duration + timestamp_field?: Field + timestamp_format?: string + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + messages: string[] + } +} + +export interface TextStructureFindMessageStructureResponse { + charset: string + ecs_compatibility?: TextStructureEcsCompatibilityType + field_stats: Record + format: TextStructureFormatType + grok_pattern?: GrokPattern + java_timestamp_formats?: string[] + joda_timestamp_formats?: string[] + ingest_pipeline: IngestPipelineConfig + mappings: MappingTypeMapping + multiline_start_pattern?: string + need_client_timezone: boolean + num_lines_analyzed: integer + num_messages_analyzed: integer + sample_start: string + timestamp_field?: Field +} + export interface TextStructureFindStructureRequest { charset?: string column_names?: string @@ -19236,7 +21430,7 @@ export interface TextStructureFindStructureRequest { ecs_compatibility?: string explain?: boolean format?: string - grok_pattern?: string + grok_pattern?: GrokPattern has_header_row?: boolean line_merge_size_limit?: uint lines_to_sample?: uint @@ -19254,7 +21448,7 @@ export interface TextStructureFindStructureResponse { has_header_row?: boolean has_byte_order_marker: boolean format: string - field_stats: Record + field_stats: Record sample_start: string num_messages_analyzed: integer mappings: MappingTypeMapping @@ -19264,7 +21458,7 @@ export interface TextStructureFindStructureResponse { num_lines_analyzed: integer column_names?: string[] explanation?: string[] - grok_pattern?: string + grok_pattern?: GrokPattern multiline_start_pattern?: string exclude_lines_pattern?: string java_timestamp_formats?: string[] @@ -19274,11 +21468,6 @@ export interface TextStructureFindStructureResponse { ingest_pipeline: IngestPipelineConfig } -export interface TextStructureFindStructureTopHit { - count: long - value: any -} - export interface TextStructureTestGrokPatternMatchedField { match: string offset: integer @@ -19294,7 +21483,7 @@ export interface TextStructureTestGrokPatternRequest extends RequestBase { ecs_compatibility?: string /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { - grok_pattern: string + grok_pattern: GrokPattern text: string[] } } @@ -19384,6 +21573,7 @@ export interface TransformGetTransformResponse { export interface TransformGetTransformTransformSummary { authorization?: MlTransformAuthorization create_time?: EpochTime + create_time_string?: DateTime description?: string dest: ReindexDestination frequency?: Duration @@ -19409,11 +21599,12 @@ export interface TransformGetTransformStatsCheckpointStats { export interface TransformGetTransformStatsCheckpointing { changes_last_detected_at?: long - changes_last_detected_at_date_time?: DateTime + changes_last_detected_at_string?: DateTime last: TransformGetTransformStatsCheckpointStats next?: TransformGetTransformStatsCheckpointStats operations_behind?: long last_search_time?: long + last_search_time_string?: DateTime } export interface TransformGetTransformStatsRequest extends RequestBase { @@ -19429,6 +21620,15 @@ export interface TransformGetTransformStatsResponse { transforms: TransformGetTransformStatsTransformStats[] } +export interface TransformGetTransformStatsTransformHealthIssue { + type: string + issue: string + details?: string + count: integer + first_occurrence?: EpochTime + first_occurence_string?: DateTime +} + export interface TransformGetTransformStatsTransformIndexerStats { delete_time_in_ms?: EpochTime documents_indexed: long @@ -19469,6 +21669,7 @@ export interface TransformGetTransformStatsTransformStats { export interface TransformGetTransformStatsTransformStatsHealth { status: HealthStatus + issues?: TransformGetTransformStatsTransformHealthIssue[] } export interface TransformPreviewTransformRequest extends RequestBase { @@ -19517,6 +21718,7 @@ export type TransformPutTransformResponse = AcknowledgedResponseBase export interface TransformResetTransformRequest extends RequestBase { transform_id: Id force?: boolean + timeout?: Duration } export type TransformResetTransformResponse = AcknowledgedResponseBase @@ -19690,15 +21892,15 @@ export type WatcherDay = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursd export interface WatcherEmail { id?: Id - bcc?: string[] + bcc?: string | string[] body?: WatcherEmailBody - cc?: string[] + cc?: string | string[] from?: string priority?: WatcherEmailPriority - reply_to?: string[] + reply_to?: string | string[] sent_date?: DateTime subject: string - to: string[] + to: string | string[] attachments?: Record } @@ -19939,6 +22141,7 @@ export interface WatcherReportingEmailAttachment { export type WatcherResponseContentType = 'json' | 'yaml' | 'text' export interface WatcherScheduleContainer { + timezone?: string cron?: WatcherCronExpression daily?: WatcherDailySchedule hourly?: WatcherHourlySchedule @@ -20176,6 +22379,14 @@ export interface WatcherExecuteWatchWatchRecord { status?: WatcherWatchStatus } +export interface WatcherGetSettingsRequest extends RequestBase { + master_timeout?: Duration +} + +export interface WatcherGetSettingsResponse { + index: IndicesIndexSettings +} + export interface WatcherGetWatchRequest extends RequestBase { id: Name } @@ -20202,7 +22413,8 @@ export interface WatcherPutWatchRequest extends RequestBase { condition?: WatcherConditionContainer input?: WatcherInputContainer metadata?: Metadata - throttle_period?: string + throttle_period?: Duration + throttle_period_in_millis?: DurationValue transform?: TransformContainer trigger?: WatcherTriggerContainer } @@ -20233,6 +22445,7 @@ export interface WatcherQueryWatchesResponse { } export interface WatcherStartRequest extends RequestBase { + master_timeout?: Duration } export type WatcherStartResponse = AcknowledgedResponseBase @@ -20275,10 +22488,25 @@ export interface WatcherStatsWatcherNodeStats { export type WatcherStatsWatcherState = 'stopped' | 'starting' | 'started' | 'stopping' export interface WatcherStopRequest extends RequestBase { + master_timeout?: Duration } export type WatcherStopResponse = AcknowledgedResponseBase +export interface WatcherUpdateSettingsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + 'index.auto_expand_replicas'?: string + 'index.number_of_replicas'?: integer + } +} + +export interface WatcherUpdateSettingsResponse { + acknowledged: boolean +} + export interface XpackInfoBuildInformation { date: DateTime hash: string @@ -20295,17 +22523,17 @@ export interface XpackInfoFeatures { aggregate_metric: XpackInfoFeature analytics: XpackInfoFeature ccr: XpackInfoFeature - data_frame?: XpackInfoFeature - data_science?: XpackInfoFeature data_streams: XpackInfoFeature data_tiers: XpackInfoFeature enrich: XpackInfoFeature + enterprise_search: XpackInfoFeature eql: XpackInfoFeature - flattened?: XpackInfoFeature + esql: XpackInfoFeature frozen_indices: XpackInfoFeature graph: XpackInfoFeature ilm: XpackInfoFeature logstash: XpackInfoFeature + logsdb: XpackInfoFeature ml: XpackInfoFeature monitoring: XpackInfoFeature rollup: XpackInfoFeature @@ -20316,7 +22544,7 @@ export interface XpackInfoFeatures { spatial: XpackInfoFeature sql: XpackInfoFeature transform: XpackInfoFeature - vectors?: XpackInfoFeature + universal_profiling: XpackInfoFeature voting_only: XpackInfoFeature watcher: XpackInfoFeature archive: XpackInfoFeature @@ -20336,7 +22564,7 @@ export interface XpackInfoNativeCodeInformation { } export interface XpackInfoRequest extends RequestBase { - categories?: string[] + categories?: XpackInfoXPackCategory[] accept_enterprise?: boolean human?: boolean } @@ -20348,6 +22576,8 @@ export interface XpackInfoResponse { tagline: string } +export type XpackInfoXPackCategory = 'build' | 'features' | 'license' + export interface XpackUsageAnalytics extends XpackUsageBase { stats: XpackUsageAnalyticsStatistics } @@ -20485,7 +22715,7 @@ export interface XpackUsageIlm { export interface XpackUsageIlmPolicyStatistics { indices_managed: integer - phases: IlmPhases + phases: XpackUsagePhases } export interface XpackUsageInvocations { @@ -20597,6 +22827,19 @@ export interface XpackUsageMonitoring extends XpackUsageBase { enabled_exporters: Record } +export interface XpackUsagePhase { + actions: string[] + min_age: DurationValue +} + +export interface XpackUsagePhases { + cold?: XpackUsagePhase + delete?: XpackUsagePhase + frozen?: XpackUsagePhase + hot?: XpackUsagePhase + warm?: XpackUsagePhase +} + export interface XpackUsageQuery { count?: integer failed?: integer @@ -20798,11 +23041,7 @@ export interface SpecUtilsCommonQueryParameters { export interface SpecUtilsCommonCatQueryParameters { format?: string - h?: Names help?: boolean - local?: boolean - master_timeout?: Duration - s?: Names v?: boolean } diff --git a/src/client.ts b/src/client.ts index 068f3573b..5ff5b061e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -69,11 +69,16 @@ if (transportVersion.includes('-')) { const nodeVersion = process.versions.node export interface NodeOptions { + /** @property url Elasticsearch node's location */ url: URL id?: string + /** @property agent Custom HTTP agent options */ agent?: HttpAgentOptions | UndiciAgentOptions + /** @property ssl Overrides default TLS connection settings */ ssl?: TlsConnectionOptions + /** @property headers Custom HTTP headers that should be sent with each request */ headers?: Record + /** @property roles Common Elasticsearch roles that can be assigned to this node. Can be helpful when writing custom nodeFilter or nodeSelector functions. */ roles?: { master: boolean data: boolean @@ -83,40 +88,110 @@ export interface NodeOptions { } export interface ClientOptions { + /** @property node Elasticsearch node settings, if there is only one node. Required if `nodes` or `cloud` is not set. */ node?: string | string[] | NodeOptions | NodeOptions[] + /** @property nodes Elasticsearch node settings, if there are multiple nodes. Required if `node` or `cloud` is not set. */ nodes?: string | string[] | NodeOptions | NodeOptions[] + /** @property Connection HTTP connection class to use + * @defaultValue `UndiciConnection` */ Connection?: typeof BaseConnection + /** @property ConnectionPool HTTP connection pool class to use + * @defaultValue `CloudConnectionPool`, if connecting to Elastic Cloud, otherwise `WeightedConnectionPool` */ ConnectionPool?: typeof BaseConnectionPool + /** @property Transport Elastic transport class to use + * @defaultValue `Transport` */ Transport?: typeof Transport + /** @property Serializer Serialization class to use + * @defaultValue `Serializer` */ Serializer?: typeof Serializer + /** @property maxRetries Max number of retries for each request + * @defaultValue 3 */ maxRetries?: number + /** @property requestTimeout Max request timeout in milliseconds for each request + * @defaultValue 30000 */ requestTimeout?: number + /** @property pingTimeout Max number of milliseconds a `ClusterConnectionPool` will wait when pinging nodes before marking them dead + * @defaultValue 3000 */ pingTimeout?: number + /** @property sniffInterval Perform a sniff operation every `n` milliseconds + * @remarks Sniffing might not be the best solution for you. Read https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how to learn more. + * @defaultValue */ sniffInterval?: number | boolean + /** @property sniffOnStart Perform a sniff once the client is started + * @remarks Sniffing might not be the best solution for you. Read https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how to learn more. + * @defaultValue false */ sniffOnStart?: boolean + /** @property sniffEndpoint Endpoint to ping during a sniff + * @remarks Sniffing might not be the best solution for you. Read https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how to learn more. + * @defaultValue "_nodes/_all/http" */ sniffEndpoint?: string + /** @property sniffOnConnectionFault Perform a sniff on connection fault + * @remarks Sniffing might not be the best solution for you. Read https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how to learn more. + * @defaultValue false */ sniffOnConnectionFault?: boolean + /** @property resurrectStrategy Strategy for resurrecting dead nodes when using `ClusterConnectionPool`. 'ping' will issue a test request to a node and resurrect it if it responds. 'optimistic' marks a node as alive without testing it. 'none` will never attempt to revive a dead connection. + * @defaultValue 'ping' */ resurrectStrategy?: 'ping' | 'optimistic' | 'none' + /** @property compression Enables gzip request body compression + * @defaultValue `true` if connecting to Elastic Cloud, otherwise `false`. */ compression?: boolean + /** @property tls [TLS configuraton](https://nodejs.org/api/tls.html) + * @defaultValue null */ tls?: TlsConnectionOptions + /** @property agent Custom HTTP agent options + * @defaultValue null */ agent?: HttpAgentOptions | UndiciAgentOptions | agentFn | false + /** @property nodeFilter A custom function used by the connection pool to determine which nodes are qualified to receive a request + * @defaultValue A function that uses the Connection `roles` property to avoid master-only nodes */ nodeFilter?: nodeFilterFn + /** @property nodeSelector A custom function used by the connection pool to determine which node should receive the next request + * @defaultValue A "round robin" function that loops sequentially through each node in the pool. */ nodeSelector?: nodeSelectorFn + /** @property headers Custom HTTP headers that should be sent with each request + * @defaultValue An object with a custom `user-agent` header */ headers?: Record + /** @property opaqueIdPrefix A string prefix to apply to every generated X-Opaque-Id header + * @defaultValue null */ opaqueIdPrefix?: string + /** @property generateRequestId A custom function for generating unique IDs for each request, to make it easier to associate each API request to a single response + * @defaultValue A function that increments a number counter starting from 1 */ generateRequestId?: generateRequestIdFn + /** @property name A name for this client + * @defaultValue 'elasticsearch-js' */ name?: string | symbol + /** @property auth Authentication options for this Elasticsearch cluster + * @defaultValue null */ auth?: BasicAuth | ApiKeyAuth | BearerAuth + /** @property context A custom object attached to each request that can be used to pass data to client events + * @defaultValue null */ context?: Context + /** @property proxy A proxy URL that, when provided, the client will automatically send all requests through + * @defaultValue null */ proxy?: string | URL + /** @property enableMetaHeader If true, adds an header named `x-elastic-client-meta`, containing a small amount of high-level telemetry data, such as the client and platform version + * @defaultValue true */ enableMetaHeader?: boolean + /** @property cloud Custom configuration for connecting to Elastic Cloud, in lieu of a `node` or `nodes` configuration + * @remarks Read https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-connecting.html#client-usage for more details + * @defaultValue null */ cloud?: { id: string } + /** @property disablePrototypePoisoningProtection Disables safe JSON parsing that protects execution of prototype poisoning attacks; disabled by default, as it can introduce a performance penalty + * @defaultValue true */ disablePrototypePoisoningProtection?: boolean | 'proto' | 'constructor' + /** @property caFingerprint If configured, verifies that the fingerprint of the CA certificate that has signed the certificate of the server matches the supplied fingerprint; only accepts SHA256 digest fingerprints + * @defaultValue null */ caFingerprint?: string + /** @property maxResponseSize When configured, verifies that the uncompressed response size is lower than the configured number. If it's higher, it will abort the request. It cannot be higher than `buffer.constants.MAX_STRING_LENGTH` + * @defaultValue null */ maxResponseSize?: number + /** @property maxCompressedResponseSize When configured, verifies that the compressed response size is lower than the configured number. If it's higher, it will abort the request. It cannot be higher than `buffer.constants.MAX_LENGTH` + * @defaultValue null */ maxCompressedResponseSize?: number + /** @property redaction Options for how to redact potentially sensitive data from metadata attached to `Error` objects + * @remarks Read https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/advanced-config.html#redaction for more details + * @defaultValue Configuration that will replace known sources of sensitive data */ redaction?: RedactionOptions } @@ -127,19 +202,42 @@ export default class Client extends API { transport: SniffingTransport serializer: Serializer helpers: Helpers + constructor (opts: ClientOptions) { super() // @ts-expect-error kChild symbol is for internal use only if ((opts.cloud != null) && opts[kChild] === undefined) { const { id } = opts.cloud + if (typeof id !== 'string') { + throw new errors.ConfigurationError('Cloud ID must be a string.') + } + + const parts = id.split(':') + if (parts.length !== 2 || parts[1] === '') { + throw new errors.ConfigurationError( + 'Cloud ID must be in the format "name:base64string".' + ) + } + // the cloud id is `cluster-name:base64encodedurl` // the url is a string divided by two '$', the first is the cloud url // the second the elasticsearch instance, the third the kibana instance - const cloudUrls = Buffer.from(id.split(':')[1], 'base64').toString().split('$') + + let cloudUrls + try { + cloudUrls = Buffer.from(parts[1], 'base64').toString().split('$') + } catch (err) { + throw new errors.ConfigurationError('Cloud ID base64 decoding failed.') + } + if (cloudUrls.length < 2 || cloudUrls[0] === '' || cloudUrls[1] === '') { + throw new errors.ConfigurationError( + 'Cloud ID base64 must contain at least two "$" separated parts: "$[$]".' + ) + } opts.node = `https://${cloudUrls[1]}.${cloudUrls[0]}` - // Cloud has better performances with compression enabled + // Cloud has better performance with compression enabled // see https://github.com/elastic/elasticsearch-py/pull/704. // So unless the user specifies otherwise, we enable compression. if (opts.compression == null) opts.compression = true @@ -211,7 +309,14 @@ export default class Client extends API { } if (options.enableMetaHeader) { - options.headers['x-elastic-client-meta'] = `es=${clientVersion},js=${nodeVersion},t=${transportVersion},hc=${nodeVersion}` + let clientMeta = `es=${clientVersion},js=${nodeVersion},t=${transportVersion}` + if (options.Connection === UndiciConnection) { + clientMeta += `,un=${nodeVersion}` + } else { + // assumes HttpConnection + clientMeta += `,hc=${nodeVersion}` + } + options.headers['x-elastic-client-meta'] = clientMeta } this.name = options.name @@ -228,7 +333,21 @@ export default class Client extends API { this.diagnostic = opts[kChild].diagnostic } else { this.diagnostic = new Diagnostic() - this.serializer = new options.Serializer() + + let serializerOptions + if (opts.disablePrototypePoisoningProtection != null) { + if (typeof opts.disablePrototypePoisoningProtection === 'boolean') { + serializerOptions = { + enablePrototypePoisoningProtection: !opts.disablePrototypePoisoningProtection + } + } else { + serializerOptions = { + enablePrototypePoisoningProtection: opts.disablePrototypePoisoningProtection + } + } + } + this.serializer = new options.Serializer(serializerOptions) + this.connectionPool = new options.ConnectionPool({ pingTimeout: options.pingTimeout, resurrectStrategy: options.resurrectStrategy, @@ -309,6 +428,10 @@ export default class Client extends API { }) } + /** + * Creates a child client instance that shared its connection pool with the parent client + * @see {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/child.html} + */ child (opts: ClientOptions): Client { // Merge the new options with the initial ones // @ts-expect-error kChild symbol is for internal use only @@ -330,6 +453,9 @@ export default class Client extends API { return new Client(options) } + /** + * Closes all connections in the connection pool. Connections shared with any parent or child instances will also be closed. + */ async close (): Promise { return await this.connectionPool.empty() } diff --git a/src/helpers.ts b/src/helpers.ts index 62040083a..73aef10ca 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -25,8 +25,10 @@ import assert from 'node:assert' import * as timersPromises from 'node:timers/promises' import { Readable } from 'node:stream' import { errors, TransportResult, TransportRequestOptions, TransportRequestOptionsWithMeta } from '@elastic/transport' +import { Table, TypeMap, tableFromIPC, AsyncRecordBatchStreamReader } from 'apache-arrow/Arrow.node' import Client from './client' import * as T from './api/types' +import { Id } from './api/types' export interface HelpersOptions { client: Client @@ -155,6 +157,8 @@ export interface EsqlResponse { export interface EsqlHelper { toRecords: () => Promise> + toArrowTable: () => Promise> + toArrowReader: () => Promise } export interface EsqlToRecords { @@ -190,12 +194,18 @@ export default class Helpers { * @param {object} options - The client optional configuration for this request. * @return {array} The documents that matched the request. */ - async search (params: T.SearchRequest, options: TransportRequestOptions = {}): Promise { - appendFilterPath('hits.hits._source', params, true) + async search (params: T.SearchRequest, options: TransportRequestOptions = {}): Promise> { + appendFilterPath('hits.hits._id,hits.hits._source', params, true) options.meta = true const { body: result } = await this[kClient].search(params, options as TransportRequestOptionsWithMeta) if (result.hits?.hits != null) { - return result.hits.hits.map(d => d._source as TDocument) + return result.hits.hits.map(d => ({ + // Starting with version 8.14.0, _id is optional, but in our case it's always present. + // See @es_quirk documentation in elasticsearch-specification/specification/_global/search/_types/hits.ts + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + _id: d._id!, + ...(d._source as TDocument) + })) } return [] } @@ -965,11 +975,6 @@ export default class Helpers { * @returns {object} EsqlHelper instance */ esql (params: T.EsqlQueryRequest, reqOptions: TransportRequestOptions = {}): EsqlHelper { - if (this[kMetaHeader] !== null) { - reqOptions.headers = reqOptions.headers ?? {} - reqOptions.headers['x-elastic-client-meta'] = `${this[kMetaHeader] as string},h=qo` - } - const client = this[kClient] function toRecords (response: EsqlResponse): TDocument[] { @@ -985,17 +990,51 @@ export default class Helpers { }) } + const metaHeader = this[kMetaHeader] + const helper: EsqlHelper = { /** * Pivots ES|QL query results into an array of row objects, rather than the default format where each row is an array of values. */ async toRecords(): Promise> { + if (metaHeader !== null) { + reqOptions.headers = reqOptions.headers ?? {} + reqOptions.headers['x-elastic-client-meta'] = `${metaHeader as string},h=qo` + } + params.format = 'json' + params.columnar = false // @ts-expect-error it's typed as ArrayBuffer but we know it will be JSON const response: EsqlResponse = await client.esql.query(params, reqOptions) const records: TDocument[] = toRecords(response) const { columns } = response return { records, columns } + }, + + async toArrowTable (): Promise> { + if (metaHeader !== null) { + reqOptions.headers = reqOptions.headers ?? {} + reqOptions.headers['x-elastic-client-meta'] = `${metaHeader as string},h=qa` + } + + params.format = 'arrow' + + const response = await client.esql.query(params, reqOptions) + return tableFromIPC(response) + }, + + async toArrowReader (): Promise { + if (metaHeader !== null) { + reqOptions.headers = reqOptions.headers ?? {} + reqOptions.headers['x-elastic-client-meta'] = `${metaHeader as string},h=qa` + reqOptions.asStream = true + } + + params.format = 'arrow' + + // @ts-expect-error response is a Readable when asStream is true + const response: Readable = await client.esql.query(params, reqOptions) + return await AsyncRecordBatchStreamReader.from(Readable.from(response)) } } diff --git a/test/esm/package.json b/test/esm/package.json new file mode 100644 index 000000000..5209563e8 --- /dev/null +++ b/test/esm/package.json @@ -0,0 +1,7 @@ +{ + "name": "esm", + "version": "1.0.0", + "dependencies": { + "@elastic/elasticsearch": "file:../.." + } +} diff --git a/test/esm/test-import.mjs b/test/esm/test-import.mjs new file mode 100644 index 000000000..f7a6f09e6 --- /dev/null +++ b/test/esm/test-import.mjs @@ -0,0 +1,28 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Client } from '@elastic/elasticsearch' + +new Client({ + node: 'http://localhost:9200', + auth: { + username: 'elastic', + password: 'changeme', + } +}) diff --git a/test/integration/index.js b/test/integration/index.js index b07ddd2d7..c6dae550e 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -24,436 +24,63 @@ process.on('unhandledRejection', function (err) { process.exit(1) }) -const { writeFileSync, readFileSync, readdirSync, statSync } = require('fs') -const { join, sep } = require('path') -const yaml = require('js-yaml') -const minimist = require('minimist') -const ms = require('ms') -const { Client } = require('../../index') -const build = require('./test-runner') -const { sleep } = require('./helper') -const createJunitReporter = require('./reporter') +const assert = require('node:assert') +const url = require('node:url') +const fs = require('node:fs') +const path = require('node:path') +const globby = require('globby') +const semver = require('semver') const downloadArtifacts = require('../../scripts/download-artifacts') -const yamlFolder = downloadArtifacts.locations.freeTestFolder -const xPackYamlFolder = downloadArtifacts.locations.xPackTestFolder +const buildTests = require('./test-builder') -const MAX_API_TIME = 1000 * 90 -const MAX_FILE_TIME = 1000 * 30 -const MAX_TEST_TIME = 1000 * 3 +const yamlFolder = downloadArtifacts.locations.testYamlFolder -const options = minimist(process.argv.slice(2), { - boolean: ['bail'], - string: ['suite', 'test'], -}) - -const freeSkips = { - // working on fixes for these - '/free/aggregations/bucket_selector.yml': ['bad script'], - '/free/aggregations/bucket_script.yml': ['bad script'], - - // either the YAML test definition is wrong, or this fails because JSON.stringify is coercing "1.0" to "1" - '/free/aggregations/percentiles_bucket.yml': ['*'], - - // not supported yet - '/free/cluster.desired_nodes/10_basic.yml': ['*'], - - // Cannot find methods on `Internal` object - '/free/cluster.desired_balance/10_basic.yml': ['*'], - '/free/cluster.desired_nodes/20_dry_run.yml': ['*'], - '/free/cluster.prevalidate_node_removal/10_basic.yml': ['*'], - - // the v8 client never sends the scroll_id in querystring, - // the way the test is structured causes a security exception - 'free/scroll/10_basic.yml': ['Body params override query string'], - 'free/scroll/11_clear.yml': [ - 'Body params with array param override query string', - 'Body params with string param scroll id override query string' - ], - 'free/cat.allocation/10_basic.yml': ['*'], - 'free/cat.snapshots/10_basic.yml': ['Test cat snapshots output'], - - 'indices.stats/50_disk_usage.yml': ['Disk usage stats'], - 'indices.stats/60_field_usage.yml': ['Field usage stats'], - - // skipping because we are booting ES with `discovery.type=single-node` - // and this test will fail because of this configuration - 'nodes.stats/30_discovery.yml': ['*'], - - // the expected error is returning a 503, - // which triggers a retry and the node to be marked as dead - 'search.aggregation/240_max_buckets.yml': ['*'], - - // long values and json do not play nicely together - 'search.aggregation/40_range.yml': ['Min and max long range bounds'], - - // the yaml runner assumes that null means "does not exists", - // while null is a valid json value, so the check will fail - 'search/320_disallow_queries.yml': ['Test disallow expensive queries'], - 'free/tsdb/90_unsupported_operations.yml': ['noop update'], -} - -const platinumDenyList = { - 'api_key/10_basic.yml': ['Test get api key'], - 'api_key/20_query.yml': ['*'], - 'api_key/11_invalidation.yml': ['Test invalidate api key by realm name'], - 'analytics/histogram.yml': ['Histogram requires values in increasing order'], - - // object keys must me strings, and `0.0.toString()` is `0` - 'ml/evaluate_data_frame.yml': [ - 'Test binary_soft_classifition precision', - 'Test binary_soft_classifition recall', - 'Test binary_soft_classifition confusion_matrix' - ], - - // The cleanup fails with a index not found when retrieving the jobs - 'ml/get_datafeed_stats.yml': ['Test get datafeed stats when total_search_time_ms mapping is missing'], - 'ml/bucket_correlation_agg.yml': ['Test correlation bucket agg simple'], - - // start should be a string - 'ml/jobs_get_result_overall_buckets.yml': ['Test overall buckets given epoch start and end params'], - - // this can't happen with the client - 'ml/start_data_frame_analytics.yml': ['Test start with inconsistent body/param ids'], - 'ml/stop_data_frame_analytics.yml': ['Test stop with inconsistent body/param ids'], - 'ml/preview_datafeed.yml': ['*'], - - // Investigate why is failing - 'ml/inference_crud.yml': ['*'], - 'ml/categorization_agg.yml': ['Test categorization aggregation with poor settings'], - 'ml/filter_crud.yml': ['*'], - - // investigate why this is failing - 'monitoring/bulk/10_basic.yml': ['*'], - 'monitoring/bulk/20_privileges.yml': ['*'], - 'license/20_put_license.yml': ['*'], - 'snapshot/10_basic.yml': ['*'], - 'snapshot/20_operator_privileges_disabled.yml': ['*'], - - // the body is correct, but the regex is failing - 'sql/sql.yml': ['Getting textual representation'], - 'searchable_snapshots/10_usage.yml': ['*'], - 'service_accounts/10_basic.yml': ['*'], - - // we are setting two certificates in the docker config - 'ssl/10_basic.yml': ['*'], - 'token/10_basic.yml': ['*'], - 'token/11_invalidation.yml': ['*'], - - // very likely, the index template has not been loaded yet. - // we should run a indices.existsTemplate, but the name of the - // template may vary during time. - 'transforms_crud.yml': [ - 'Test basic transform crud', - 'Test transform with query and array of indices in source', - 'Test PUT continuous transform', - 'Test PUT continuous transform without delay set' - ], - 'transforms_force_delete.yml': [ - 'Test force deleting a running transform' - ], - 'transforms_cat_apis.yml': ['*'], - 'transforms_start_stop.yml': ['*'], - 'transforms_stats.yml': ['*'], - 'transforms_stats_continuous.yml': ['*'], - 'transforms_update.yml': ['*'], - - // js does not support ulongs - 'unsigned_long/10_basic.yml': ['*'], - 'unsigned_long/20_null_value.yml': ['*'], - 'unsigned_long/30_multi_fields.yml': ['*'], - 'unsigned_long/40_different_numeric.yml': ['*'], - 'unsigned_long/50_script_values.yml': ['*'], - - // the v8 client flattens the body into the parent object - 'platinum/users/10_basic.yml': ['Test put user with different username in body'], - - // docker issue? - 'watcher/execute_watch/60_http_input.yml': ['*'], - - // the checks are correct, but for some reason the test is failing on js side - // I bet is because the backslashes in the rg - 'watcher/execute_watch/70_invalid.yml': ['*'], - 'watcher/put_watch/10_basic.yml': ['*'], - 'xpack/15_basic.yml': ['*'], - - // test that are failing that needs to be investigated - // the error cause can either be in the yaml test or in the specification - - // start should be a string in the yaml test - 'platinum/ml/delete_job_force.yml': ['Test force delete an open job that is referred by a started datafeed'], - 'platinum/ml/evaluate_data_frame.yml': ['*'], - 'platinum/ml/get_datafeed_stats.yml': ['*'], - - // start should be a string in the yaml test - 'platinum/ml/start_stop_datafeed.yml': ['*'], -} - -function runner (opts = {}) { - const options = { node: opts.node } - if (opts.isXPack) { - options.tls = { - ca: readFileSync(join(__dirname, '..', '..', '.buildkite', 'certs', 'ca.crt'), 'utf8'), - rejectUnauthorized: false +const getAllFiles = async dir => { + const files = await globby(dir, { + expandDirectories: { + extensions: ['yml', 'yaml'] } - } - const client = new Client(options) - log('Loading yaml suite') - start({ client, isXPack: opts.isXPack }) - .catch(err => { - if (err.name === 'ResponseError') { - console.error(err) - console.log(JSON.stringify(err.meta, null, 2)) - } else { - console.error(err) - } - process.exit(1) - }) + }) + return files.sort() } -async function waitCluster (client, times = 0) { - try { - await client.cluster.health({ wait_for_status: 'green', timeout: '50s' }) - } catch (err) { - if (++times < 10) { - await sleep(5000) - return waitCluster(client, times) - } - console.error(err) - process.exit(1) - } -} - -async function start ({ client, isXPack }) { - log('Waiting for Elasticsearch') - await waitCluster(client) - - const body = await client.info() - const { number: version, build_hash: hash } = body.version - - log(`Downloading artifacts for hash ${hash}...`) - await downloadArtifacts({ hash, version }) - - log(`Testing ${isXPack ? 'Platinum' : 'Free'} api...`) - const junit = createJunitReporter() - const junitTestSuites = junit.testsuites(`Integration test for ${isXPack ? 'Platinum' : 'Free'} api`) - - const stats = { - total: 0, - skip: 0, - pass: 0, - assertions: 0 - } - const folders = getAllFiles(isXPack ? xPackYamlFolder : yamlFolder) - .filter(t => !/(README|TODO)/g.test(t)) - // we cluster the array based on the folder names, - // to provide a better test log output - .reduce((arr, file) => { - const path = file.slice(file.indexOf('/rest-api-spec/test'), file.lastIndexOf('/')) - let inserted = false - for (let i = 0; i < arr.length; i++) { - if (arr[i][0].includes(path)) { - inserted = true - arr[i].push(file) - break - } - } - if (!inserted) arr.push([file]) - return arr - }, []) - - const totalTime = now() - for (const folder of folders) { - // pretty name - const apiName = folder[0].slice( - folder[0].indexOf(`${sep}rest-api-spec${sep}test`) + 19, - folder[0].lastIndexOf(sep) - ) - - log('Testing ' + apiName.slice(1)) - const apiTime = now() - - for (const file of folder) { - const testRunner = build({ - client, - version, - isXPack: file.includes('platinum') - }) - const fileTime = now() - const data = readFileSync(file, 'utf8') - // get the test yaml (as object), some file has multiple yaml documents inside, - // every document is separated by '---', so we split on the separator - // and then we remove the empty strings, finally we parse them - const tests = data - .split('\n---\n') - .map(s => s.trim()) - // empty strings - .filter(Boolean) - .map(parse) - // null values - .filter(Boolean) - - // get setup and teardown if present - let setupTest = null - let teardownTest = null - for (const test of tests) { - if (test.setup) setupTest = test.setup - if (test.teardown) teardownTest = test.teardown - } - - const cleanPath = file.slice(file.lastIndexOf(apiName)) - - // skip if --suite CLI arg doesn't match - if (options.suite && !cleanPath.endsWith(options.suite)) continue - - log(' ' + cleanPath) - const junitTestSuite = junitTestSuites.testsuite(apiName.slice(1) + ' - ' + cleanPath) - - for (const test of tests) { - const testTime = now() - const name = Object.keys(test)[0] - - // skip setups, teardowns and anything that doesn't match --test flag when present - if (name === 'setup' || name === 'teardown') continue - if (options.test && !name.endsWith(options.test)) continue - - const junitTestCase = junitTestSuite.testcase(name, `node_${process.version}: ${cleanPath}`) - - stats.total += 1 - if (shouldSkip(isXPack, file, name)) { - stats.skip += 1 - junitTestCase.skip('This test is in the skip list of the client') - junitTestCase.end() - continue - } - log(' - ' + name) - try { - await testRunner.run(setupTest, test[name], teardownTest, stats, junitTestCase) - stats.pass += 1 - } catch (err) { - junitTestCase.failure(err) - junitTestCase.end() - junitTestSuite.end() - junitTestSuites.end() - generateJunitXmlReport(junit, isXPack ? 'platinum' : 'free') - err.meta = JSON.stringify(err.meta ?? {}, null, 2) - console.error(err) - - if (options.bail) { - process.exit(1) - } else { - continue - } - } - const totalTestTime = now() - testTime - junitTestCase.end() - if (totalTestTime > MAX_TEST_TIME) { - log(' took too long: ' + ms(totalTestTime)) - } else { - log(' took: ' + ms(totalTestTime)) - } - } - junitTestSuite.end() - const totalFileTime = now() - fileTime - if (totalFileTime > MAX_FILE_TIME) { - log(` ${cleanPath} took too long: ` + ms(totalFileTime)) - } else { - log(` ${cleanPath} took: ` + ms(totalFileTime)) - } - } - const totalApiTime = now() - apiTime - if (totalApiTime > MAX_API_TIME) { - log(`${apiName} took too long: ` + ms(totalApiTime)) - } else { - log(`${apiName} took: ` + ms(totalApiTime)) - } - } - junitTestSuites.end() - generateJunitXmlReport(junit, isXPack ? 'platinum' : 'free') - log(`Total testing time: ${ms(now() - totalTime)}`) - log(`Test stats: - - Total: ${stats.total} - - Skip: ${stats.skip} - - Pass: ${stats.pass} - - Fail: ${stats.total - (stats.pass + stats.skip)} - - Assertions: ${stats.assertions} - `) -} - -function log (text) { - process.stdout.write(text + '\n') -} - -function now () { - const ts = process.hrtime() - return (ts[0] * 1e3) + (ts[1] / 1e6) -} - -function parse (data) { - let doc - try { - doc = yaml.load(data, { schema: yaml.CORE_SCHEMA }) - } catch (err) { - console.error(err) - return - } - return doc -} - -function generateJunitXmlReport (junit, suite) { - writeFileSync( - join(__dirname, '..', '..', `${suite}-report-junit.xml`), - junit.prettyPrint() - ) +async function doTestBuilder (version, clientOptions) { + await downloadArtifacts(undefined, version) + const files = await getAllFiles(yamlFolder) + await buildTests(files, clientOptions) } if (require.main === module) { - const scheme = process.env.TEST_SUITE === 'platinum' ? 'https' : 'http' - const node = process.env.TEST_ES_SERVER || `${scheme}://elastic:changeme@localhost:9200` - const opts = { - node, - isXPack: process.env.TEST_SUITE !== 'free' - } - runner(opts) -} - -const shouldSkip = (isXPack, file, name) => { - if (options.suite || options.test) return false - - let list = Object.keys(freeSkips) - for (let i = 0; i < list.length; i++) { - const freeTest = freeSkips[list[i]] - for (let j = 0; j < freeTest.length; j++) { - if (file.endsWith(list[i]) && (name === freeTest[j] || freeTest[j] === '*')) { - const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name - log(`Skipping test ${testName} because it is denylisted in the free test suite`) - return true - } - } + const node = process.env.TEST_ES_SERVER + const apiKey = process.env.ES_API_SECRET_KEY + const password = process.env.ELASTIC_PASSWORD + let version = process.env.STACK_VERSION + + assert(node != null, 'Environment variable missing: TEST_ES_SERVER') + assert(apiKey != null || password != null, 'Environment variable missing: ES_API_SECRET_KEY or ELASTIC_PASSWORD') + assert(version != null, 'Environment variable missing: STACK_VERSION') + + version = semver.clean(version.includes('SNAPSHOT') ? version.split('-')[0] : version) + + const clientOptions = { node } + if (apiKey != null) { + clientOptions.auth = { apiKey } + } else { + clientOptions.auth = { username: 'elastic', password } } - - if (file.includes('x-pack') || isXPack) { - list = Object.keys(platinumDenyList) - for (let i = 0; i < list.length; i++) { - const platTest = platinumDenyList[list[i]] - for (let j = 0; j < platTest.length; j++) { - if (file.endsWith(list[i]) && (name === platTest[j] || platTest[j] === '*')) { - const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name - log(`Skipping test ${testName} because it is denylisted in the platinum test suite`) - return true - } - } + const nodeUrl = new url.URL(node) + if (nodeUrl.protocol === 'https:') { + clientOptions.tls = { + ca: fs.readFileSync(path.join(__dirname, '..', '..', '.buildkite', 'certs', 'ca.crt'), 'utf8'), + rejectUnauthorized: false } } - return false + doTestBuilder(version, clientOptions) + .then(() => process.exit(0)) + .catch(err => { + console.error(err) + process.exit(1) + }) } - -const getAllFiles = dir => - readdirSync(dir).reduce((files, file) => { - const name = join(dir, file) - const isDirectory = statSync(name).isDirectory() - return isDirectory ? [...files, ...getAllFiles(name)] : [...files, name] - }, []) - -module.exports = runner diff --git a/test/integration/reporter.js b/test/integration/reporter.js deleted file mode 100644 index d94e09ba3..000000000 --- a/test/integration/reporter.js +++ /dev/null @@ -1,110 +0,0 @@ -'use strict' - -const assert = require('node:assert') -const { create } = require('xmlbuilder2') - -function createJunitReporter () { - const report = {} - - return { testsuites, prettyPrint } - - function prettyPrint () { - return create(report).end({ prettyPrint: true }) - } - - function testsuites (name) { - assert(name, 'The testsuites name is required') - assert(report.testsuites === undefined, 'Cannot set more than one testsuites block') - const startTime = Date.now() - - report.testsuites = { - '@id': new Date().toISOString(), - '@name': name - } - - const testsuiteList = [] - - return { - testsuite: createTestSuite(testsuiteList), - end () { - report.testsuites['@time'] = Math.round((Date.now() - startTime) / 1000) - report.testsuites['@tests'] = testsuiteList.reduce((acc, val) => { - acc += val['@tests'] - return acc - }, 0) - report.testsuites['@failures'] = testsuiteList.reduce((acc, val) => { - acc += val['@failures'] - return acc - }, 0) - report.testsuites['@skipped'] = testsuiteList.reduce((acc, val) => { - acc += val['@skipped'] - return acc - }, 0) - if (testsuiteList.length) { - report.testsuites.testsuite = testsuiteList - } - } - } - } - - function createTestSuite (testsuiteList) { - return function testsuite (name) { - assert(name, 'The testsuite name is required') - const startTime = Date.now() - const suite = { - '@id': new Date().toISOString(), - '@name': name - } - const testcaseList = [] - testsuiteList.push(suite) - return { - testcase: createTestCase(testcaseList), - end () { - suite['@time'] = Math.round((Date.now() - startTime) / 1000) - suite['@tests'] = testcaseList.length - suite['@failures'] = testcaseList.filter(t => t.failure).length - suite['@skipped'] = testcaseList.filter(t => t.skipped).length - if (testcaseList.length) { - suite.testcase = testcaseList - } - } - } - } - } - - function createTestCase (testcaseList) { - return function testcase (name, file) { - assert(name, 'The testcase name is required') - const startTime = Date.now() - const tcase = { - '@id': new Date().toISOString(), - '@name': name - } - if (file) tcase['@file'] = file - testcaseList.push(tcase) - return { - failure (error) { - assert(error, 'The failure error object is required') - tcase.failure = { - '#': error.stack, - '@message': error.message, - '@type': error.code - } - }, - skip (reason) { - if (typeof reason !== 'string') { - reason = JSON.stringify(reason, null, 2) - } - tcase.skipped = { - '#': reason - } - }, - end () { - tcase['@time'] = Math.round((Date.now() - startTime) / 1000) - } - } - } - } -} - -module.exports = createJunitReporter diff --git a/test/integration/test-builder.js b/test/integration/test-builder.js new file mode 100644 index 000000000..64ce97dd2 --- /dev/null +++ b/test/integration/test-builder.js @@ -0,0 +1,482 @@ +/* + * Copyright Elasticsearch B.V. and contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +'use strict' + +const { join, sep } = require('node:path') +const { readFileSync, writeFileSync, promises } = require('node:fs') +const yaml = require('js-yaml') +const { rimraf } = require('rimraf') +const { mkdir } = promises + +const generatedTestsPath = join(__dirname, '..', '..', 'generated-tests') + +const stackSkips = [ + // test definition bug: response is empty string + 'cat/fielddata.yml', + // test definition bug: response is empty string + 'cluster/delete_voting_config_exclusions.yml', + // test definition bug: response is empty string + 'cluster/voting_config_exclusions.yml', + // client bug: ILM request takes a "body" param, but "body" is a special keyword in the JS client + 'ilm/10_basic.yml', + // health report is... not healthy + 'health_report.yml', + // TODO: `contains` action only supports checking for primitives inside arrays or strings inside strings, not referenced values like objects inside arrays + 'entsearch/10_basic.yml', + // test definition bug: error message does not match + 'entsearch/30_sync_jobs_stack.yml', + // no handler found for uri [/knn_test/_knn_search] + 'knn_search.yml', + // TODO: fix license on ES startup - "Operation failed: Current license is basic." + 'license/10_stack.yml', + // response.body should be truthy. found: "" + 'logstash/10_basic.yml', + // test definition bug? security_exception: unable to authenticate user [x_pack_rest_user] for REST request [/_ml/trained_models/test_model/definition/0] + 'machine_learning/clear_tm_deployment_cache.yml', + // client bug: 0.99995 does not equal 0.5 + 'machine_learning/data_frame_evaluate.yml', + // test definition bug? regex has whitespace, maybe needs to be removed + 'machine_learning/explain_data_frame_analytics.yml', + // client bug: 4 != 227 + 'machine_learning/preview_datafeed.yml', + // test definition bug: error message does not match + 'machine_learning/revert_model_snapshot.yml', + // test definition bug: error message does not match + 'machine_learning/update_model_snapshot.yml', + // version_conflict_engine_exception + 'machine_learning/jobs_crud.yml', + // test definition bug: error message does not match + 'machine_learning/model_snapshots.yml', + // test definition bug: error message does not match + 'query_rules/30_test.yml', + // client bug: 0 != 0.1 + 'script/10_basic.yml', + // client bug: request takes a "body" param, but "body" is a special keyword in the JS client + 'searchable_snapshots/10_basic.yml', + // test builder bug: does `match` action need to support "array contains value"? + 'security/10_api_key_basic.yml', + // test definition bug: error message does not match + 'security/140_user.yml', + // test definition bug: error message does not match + 'security/30_privileges_stack.yml', + // unknown issue: $profile.enabled path doesn't exist in response + 'security/130_user_profile.yml', + // test definition bug: error message does not match + 'security/change_password.yml', + // test builder bug: media_type_header_exception + 'simulate/ingest.yml', + // client bug: request takes a "body" param, but "body" is a special keyword in the JS client + 'snapshot/10_basic.yml', + // test definition bug: illegal_argument_exception + 'sql/10_basic.yml', + // test definition bug: illegal_argument_exception + 'text_structure/10_basic.yml', + // test definition bug: illegal_argument_exception + 'transform/10_basic.yml', +] + +const serverlessSkips = [ + // TODO: sql.getAsync does not set a content-type header but ES expects one + // transport only sets a content-type if the body is not empty + 'sql/10_basic.yml', + // TODO: bulk call in setup fails due to "malformed action/metadata line" + // bulk body is being sent as a Buffer, unsure if related. + 'transform/10_basic.yml', + // TODO: scripts_painless_execute expects {"result":"0.1"}, gets {"result":"0"} + // body sent as Buffer, unsure if related + 'script/10_basic.yml', + // TODO: expects {"outlier_detection.auc_roc.value":0.99995}, gets {"outlier_detection.auc_roc.value":0.5} + // remove if/when https://github.com/elastic/elasticsearch-clients-tests/issues/37 is resolved + 'machine_learning/data_frame_evaluate.yml', + // TODO: Cannot perform requested action because job [job-crud-test-apis] is not open + 'machine_learning/jobs_crud.yml', + // TODO: test runner needs to support ignoring 410 errors + 'enrich/10_basic.yml', + // TODO: parameter `enabled` is not allowed in source + // Same underlying problem as https://github.com/elastic/elasticsearch-clients-tests/issues/55 + 'cluster/component_templates.yml', + // TODO: expecting `ct_field` field mapping to be returned, but instead only finds `field` + 'indices/simulate_template.yml', + 'indices/simulate_index_template.yml', + // TODO: test currently times out + 'inference/10_basic.yml', + // TODO: Fix: "Trained model deployment [test_model] is not allocated to any nodes" + 'machine_learning/20_trained_model_serverless.yml', + // TODO: query_rules api not available yet + 'query_rules/10_query_rules.yml', + 'query_rules/20_rulesets.yml', + 'query_rules/30_test.yml', + // TODO: security.putRole API not available + 'security/50_roles_serverless.yml', + // TODO: expected undefined to equal 'some_table' + 'entsearch/50_connector_updates.yml', + // TODO: resource_not_found_exception + 'tasks_serverless.yml', +] + +function parse (data) { + let doc + try { + doc = yaml.load(data, { schema: yaml.CORE_SCHEMA }) + } catch (err) { + console.error(err) + return + } + return doc +} + +async function build (yamlFiles, clientOptions) { + await rimraf(generatedTestsPath) + await mkdir(generatedTestsPath, { recursive: true }) + + for (const file of yamlFiles) { + const apiName = file.split(`${sep}tests${sep}`)[1] + const data = readFileSync(file, 'utf8') + + const tests = data + .split('\n---\n') + .map(s => s.trim()) + // empty strings + .filter(Boolean) + .map(parse) + // null values + .filter(Boolean) + + let code = "import { test } from 'tap'\n" + code += "import { Client } from '@elastic/elasticsearch'\n\n" + + const requires = tests.find(test => test.requires != null) + let skip = new Set() + if (requires != null) { + const { serverless = true, stack = true } = requires.requires + if (!serverless) skip.add('process.env.TEST_ES_SERVERLESS === "1"') + if (!stack) skip.add('process.env.TEST_ES_STACK === "1"') + } + + if (stackSkips.includes(apiName)) skip.add('process.env.TEST_ES_STACK === "1"') + if (serverlessSkips.includes(apiName)) skip.add('process.env.TEST_ES_SERVERLESS === "1"') + + if (skip.size > 0) { + code += `test('${apiName}', { skip: ${Array.from(skip).join(' || ')} }, t => {\n` + } else { + code += `test('${apiName}', t => {\n` + } + + for (const test of tests) { + if (test.setup != null) { + code += ' t.before(async () => {\n' + code += indent(buildActions(test.setup), 4) + code += ' })\n\n' + } + + if (test.teardown != null) { + code += ' t.after(async () => {\n' + code += indent(buildActions(test.teardown), 4) + code += ' })\n\n' + } + + for (const key of Object.keys(test).filter(k => !['setup', 'teardown', 'requires'].includes(k))) { + if (test[key].find(action => Object.keys(action)[0] === 'skip') != null) { + code += ` t.test('${key}', { skip: true }, async t => {\n` + } else { + code += ` t.test('${key}', async t => {\n` + } + code += indent(buildActions(test[key]), 4) + code += '\n t.end()\n' + code += ' })\n' + } + // if (test.requires != null) requires = test.requires + } + + code += '\n t.end()\n' + code += '})\n' + + const testDir = join(generatedTestsPath, apiName.split(sep).slice(0, -1).join(sep)) + const testFile = join(testDir, apiName.split(sep).pop().replace(/\.ya?ml$/, '.mjs')) + await mkdir(testDir, { recursive: true }) + writeFileSync(testFile, code, 'utf8') + } + + function buildActions (actions) { + let code = `const client = new Client(${JSON.stringify(clientOptions, null, 2)})\n` + code += 'let response\n\n' + + const vars = new Set() + + for (const action of actions) { + const key = Object.keys(action)[0] + switch (key) { + case 'do': + code += buildDo(action.do) + break + case 'set': + const setResult = buildSet(action.set, vars) + vars.add(setResult.varName) + code += setResult.code + break + case 'transform_and_set': + code += buildTransformAndSet(action.transform_and_set) + break + case 'match': + code += buildMatch(action.match) + break + case 'lt': + code += buildLt(action.lt) + break + case 'lte': + code += buildLte(action.lte) + break + case 'gt': + code += buildGt(action.gt) + break + case 'gte': + code += buildGte(action.gte) + break + case 'length': + code += buildLength(action.length) + break + case 'is_true': + code += buildIsTrue(action.is_true) + break + case 'is_false': + code += buildIsFalse(action.is_false) + break + case 'contains': + code += buildContains(action.contains) + break + case 'exists': + code += buildExists(action.exists) + break + case 'skip': + break + default: + console.warn(`Action not supported: ${key}`) + break + } + } + return code + } +} + +function buildDo (action) { + let code = '' + const keys = Object.keys(action) + if (keys.includes('catch')) { + code += 'try {\n' + code += indent(buildRequest(action), 2) + code += '} catch (err) {\n' + code += ` t.match(err.toString(), ${buildValLiteral(action.catch)})\n` + code += '}\n' + } else { + code += buildRequest(action) + } + return code +} + +function buildRequest(action) { + let code = '' + + const options = { meta: true } + + for (const key of Object.keys(action)) { + if (key === 'catch') continue + + if (key === 'headers') { + options.headers = action.headers + continue + } + + const params = action[key] + if (params.ignore != null) { + if (Array.isArray(params.ignore)) { + options.ignore = params.ignore + } else { + options.ignore = [params.ignore] + } + } + + code += `response = await client.${toCamelCase(key)}(${buildApiParams(action[key])}, ${JSON.stringify(options)})\n` + } + return code +} + +function buildSet (action, vars) { + const key = Object.keys(action)[0] + const varName = action[key] + const lookup = buildLookup(key) + + let code = '' + if (vars.has(varName)) { + code = `${varName} = ${lookup}\n` + } else { + code =`let ${varName} = ${lookup}\n` + } + return { code, varName } +} + +function buildTransformAndSet (action) { + return `// TODO buildTransformAndSet: ${JSON.stringify(action)}\n` +} + +function buildMatch (action) { + const key = Object.keys(action)[0] + let lookup = buildLookup(key) + const val = buildValLiteral(action[key]) + return `t.match(${lookup}, ${val})\n` +} + +function buildLt (action) { + const key = Object.keys(action)[0] + const lookup = buildLookup(key) + const val = buildValLiteral(action[key]) + return `t.ok(${lookup} < ${val})\n` +} + +function buildLte (action) { + const key = Object.keys(action)[0] + const lookup = buildLookup(key) + const val = buildValLiteral(action[key]) + return `t.ok(${lookup} <= ${val})\n` +} + +function buildGt (action) { + const key = Object.keys(action)[0] + const lookup = buildLookup(key) + const val = buildValLiteral(action[key]) + return `t.ok(${lookup} > ${val})\n` +} + +function buildGte (action) { + const key = Object.keys(action)[0] + const lookup = buildLookup(key) + const val = buildValLiteral(action[key]) + return `t.ok(${lookup} >= ${val})\n` +} + +function buildLength (action) { + const key = Object.keys(action)[0] + const lookup = buildLookup(key) + const val = buildValLiteral(action[key]) + + let code = '' + code += `if (typeof ${lookup} === 'object' && !Array.isArray(${lookup})) {\n` + code += ` t.equal(Object.keys(${lookup}).length, ${val})\n` + code += `} else {\n` + code += ` t.equal(${lookup}.length, ${val})\n` + code += `}\n` + return code +} + +function buildIsTrue (action) { + let lookup = `${buildLookup(action)}` + let errMessage = `\`${action} should be truthy. found: '\$\{JSON.stringify(${lookup})\}'\`` + if (lookup.includes('JSON.stringify')) errMessage = `\`${action} should be truthy. found: '\$\{${lookup}\}'\`` + return `t.ok(${lookup} === "true" || (Boolean(${lookup}) && ${lookup} !== "false"), ${errMessage})\n` +} + +function buildIsFalse (action) { + let lookup = `${buildLookup(action)}` + let errMessage = `\`${action} should be falsy. found: '\$\{JSON.stringify(${lookup})\}'\`` + if (lookup.includes('JSON.stringify')) errMessage = `\`${action} should be falsy. found: '\$\{${lookup}\}'\`` + return `t.ok(${lookup} === "false" || !Boolean(${lookup}), ${errMessage})\n` +} + +function buildContains (action) { + const key = Object.keys(action)[0] + const lookup = buildLookup(key) + const val = buildValLiteral(action[key]) + return `t.ok(${lookup}.includes(${val}), '${JSON.stringify(val)} not found in ${key}')\n` +} + +function buildExists (keyName) { + const lookup = buildLookup(keyName) + return `t.ok(${lookup} != null, \`Key "${keyName}" not found in response body: \$\{JSON.stringify(response.body, null, 2)\}\`)\n` +} + +function buildApiParams (params) { + if (Object.keys(params).length === 0) { + return 'undefined' + } else { + const out = {} + Object.keys(params).filter(k => k !== 'ignore' && k !== 'headers').forEach(k => out[k] = params[k]) + return buildValLiteral(out) + } +} + +function toCamelCase (name) { + return name.replace(/_([a-z])/g, g => g[1].toUpperCase()) +} + +function indent (str, spaces) { + const tabs = ' '.repeat(spaces) + return str.replace(/\s+$/, '').split('\n').map(l => `${tabs}${l}`).join('\n') + '\n' +} + +function buildLookup (path) { + if (path === '$body') return '(typeof response.body === "string" ? response.body : JSON.stringify(response.body))' + + const outPath = path.split('.').map(step => { + if (parseInt(step, 10).toString() === step) { + return `[${step}]` + } else if (step.match(/^\$[a-zA-Z0-9_]+$/)) { + const lookup = step.replace(/^\$/, '') + if (lookup === 'body') return '' + return `[${lookup}]` + } else if (step === '') { + return '' + } else { + return `['${step}']` + } + }).join('') + return `response.body${outPath}` +} + +function buildValLiteral (val) { + if (typeof val === 'string') val = val.trim() + if (isRegExp(val)) { + return JSON.stringify(val).replace(/^"/, '').replace(/"$/, '').replaceAll('\\\\', '\\') + } else if (isVariable(val)) { + if (val === '$body') return 'JSON.stringify(response.body)' + return val.replace(/^\$/, '') + } else if (isPlainObject(val)) { + return JSON.stringify(cleanObject(val), null, 2).replace(/"\$([a-zA-Z0-9_]+)"/g, '$1') + } else { + return JSON.stringify(val) + } +} + +function isRegExp (str) { + return typeof str === 'string' && str.startsWith('/') && str.endsWith('/') +} + +function isVariable (str) { + return typeof str === 'string' && str.match(/^\$[a-zA-Z0-9_]+$/) != null +} + +function cleanObject (obj) { + Object.keys(obj).forEach(key => { + let val = obj[key] + if (typeof val === 'string' && val.trim().startsWith('{') && val.trim().endsWith('}')) { + // attempt to parse as object + try { + val = JSON.parse(val) + } catch { + } + } else if (isPlainObject(val)) { + val = cleanObject(val) + } else if (Array.isArray(val)) { + val = val.map(item => isPlainObject(item) ? cleanObject(item) : item) + } + obj[key] = val + }) + return obj +} + +function isPlainObject(obj) { + return typeof obj === 'object' && !Array.isArray(obj) && obj != null +} + +module.exports = build diff --git a/test/integration/test-runner.js b/test/integration/test-runner.js deleted file mode 100644 index ce80da43e..000000000 --- a/test/integration/test-runner.js +++ /dev/null @@ -1,1086 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -'use strict' - -/* eslint camelcase: 0 */ - -const chai = require('chai') -const semver = require('semver') -const helper = require('./helper') -const { join } = require('path') -const { locations } = require('../../scripts/download-artifacts') -const packageJson = require('../../package.json') - -chai.config.showDiff = true -chai.config.truncateThreshold = 0 -const { assert } = chai - -const { delve, to, isXPackTemplate, sleep, updateParams } = helper - -const supportedFeatures = [ - 'gtelte', - 'regex', - 'benchmark', - 'stash_in_path', - 'groovy_scripting', - 'headers', - 'transform_and_set', - 'catch_unauthorized', - 'arbitrary_key' -] - -function build (opts = {}) { - const client = opts.client - const esVersion = opts.version - const isXPack = opts.isXPack - const stash = new Map() - let response = null - - /** - * Runs a cleanup, removes all indices, aliases, templates, and snapshots - * @returns {Promise} - */ - async function cleanup (isXPack) { - response = null - stash.clear() - - await client.cluster.health({ - wait_for_no_initializing_shards: true, - timeout: '70s', - level: 'shards' - }) - - if (isXPack) { - // wipe rollup jobs - const jobsList = await client.rollup.getJobs({ id: '_all' }) - const jobsIds = jobsList.jobs.map(j => j.config.id) - await helper.runInParallel( - client, 'rollup.stopJob', - jobsIds.map(j => ({ id: j, wait_for_completion: true })) - ) - await helper.runInParallel( - client, 'rollup.deleteJob', - jobsIds.map(j => ({ id: j })) - ) - - // delete slm policies - const policies = await client.slm.getLifecycle() - await helper.runInParallel( - client, 'slm.deleteLifecycle', - Object.keys(policies).map(p => ({ policy_id: p })) - ) - - // remove 'x_pack_rest_user', used in some xpack test - try { - await client.security.deleteUser({ username: 'x_pack_rest_user' }, { ignore: [404] }) - } catch { - // do nothing - } - - const searchableSnapshotIndices = await client.cluster.state({ - metric: 'metadata', - filter_path: 'metadata.indices.*.settings.index.store.snapshot' - }) - if (searchableSnapshotIndices.metadata != null && searchableSnapshotIndices.metadata.indices != null) { - await helper.runInParallel( - client, 'indices.delete', - Object.keys(searchableSnapshotIndices.metadata.indices).map(i => ({ index: i })), - { ignore: [404] } - ) - } - } - - // clean snapshots - const repositories = await client.snapshot.getRepository() - for (const repository of Object.keys(repositories)) { - await client.snapshot.delete({ repository, snapshot: '*' }, { ignore: [404] }) - await client.snapshot.deleteRepository({ name: repository }, { ignore: [404] }) - } - - if (isXPack) { - // clean data streams - await client.indices.deleteDataStream({ name: '*', expand_wildcards: 'all' }) - } - - // clean all indices - await client.indices.delete({ - index: [ - '*', - '-.ds-ilm-history-*' - ], - expand_wildcards: 'open,closed,hidden' - }, { - ignore: [404] - }) - - // delete templates - const templates = await client.cat.templates({ h: 'name' }) - for (const template of templates.split('\n').filter(Boolean)) { - if (isXPackTemplate(template)) continue - const body = await client.indices.deleteTemplate({ name: template }, { ignore: [404] }) - if (JSON.stringify(body).includes(`index_template [${template}] missing`)) { - await client.indices.deleteIndexTemplate({ name: template }, { ignore: [404] }) - } - } - - // delete component template - const body = await client.cluster.getComponentTemplate() - const components = body.component_templates.filter(c => !isXPackTemplate(c.name)).map(c => c.name) - if (components.length > 0) { - try { - await client.cluster.deleteComponentTemplate({ name: components.join(',') }, { ignore: [404] }) - } catch { - // do nothing - } - } - - // Remove any cluster setting - const settings = await client.cluster.getSettings() - const newSettings = {} - for (const setting in settings) { - if (Object.keys(settings[setting]).length === 0) continue - newSettings[setting] = {} - for (const key in settings[setting]) { - newSettings[setting][`${key}.*`] = null - } - } - if (Object.keys(newSettings).length > 0) { - await client.cluster.putSettings(newSettings) - } - - if (isXPack) { - // delete ilm policies - const preserveIlmPolicies = [ - "ilm-history-ilm-policy", - "slm-history-ilm-policy", - "watch-history-ilm-policy", - "watch-history-ilm-policy-16", - "ml-size-based-ilm-policy", - "logs", - "metrics", - "synthetics", - "7-days-default", - "30-days-default", - "90-days-default", - "180-days-default", - "365-days-default", - ".fleet-actions-results-ilm-policy", - ".fleet-file-data-ilm-policy", - ".fleet-files-ilm-policy", - ".deprecation-indexing-ilm-policy", - ".monitoring-8-ilm-policy", - "behavioral_analytics-events-default_policy", - ] - const policies = await client.ilm.getLifecycle() - for (const policy in policies) { - if (preserveIlmPolicies.includes(policy)) continue - await client.ilm.deleteLifecycle({ name: policy }) - } - - // delete autofollow patterns - const patterns = await client.ccr.getAutoFollowPattern() - for (const { name } of patterns.patterns) { - await client.ccr.deleteAutoFollowPattern({ name }) - } - - // delete all tasks - const nodesTask = await client.tasks.list() - const tasks = Object.keys(nodesTask.nodes) - .reduce((acc, node) => { - const { tasks } = nodesTask.nodes[node] - Object.keys(tasks).forEach(id => { - if (tasks[id].cancellable) acc.push(id) - }) - return acc - }, []) - - await helper.runInParallel( - client, 'tasks.cancel', - tasks.map(id => ({ task_id: id })) - ) - - // cleanup ml - const jobsList = await client.ml.getJobs() - const jobsIds = jobsList.jobs.map(j => j.job_id) - await helper.runInParallel( - client, 'ml.deleteJob', - jobsIds.map(j => ({ job_id: j, force: true })) - ) - - const dataFrame = await client.ml.getDataFrameAnalytics() - const dataFrameIds = dataFrame.data_frame_analytics.map(d => d.id) - await helper.runInParallel( - client, 'ml.deleteDataFrameAnalytics', - dataFrameIds.map(d => ({ id: d, force: true })) - ) - - const calendars = await client.ml.getCalendars() - const calendarsId = calendars.calendars.map(c => c.calendar_id) - await helper.runInParallel( - client, 'ml.deleteCalendar', - calendarsId.map(c => ({ calendar_id: c })) - ) - - const training = await client.ml.getTrainedModels() - const trainingId = training.trained_model_configs - .filter(t => t.created_by !== '_xpack') - .map(t => t.model_id) - await helper.runInParallel( - client, 'ml.deleteTrainedModel', - trainingId.map(t => ({ model_id: t, force: true })) - ) - - // cleanup transforms - const transforms = await client.transform.getTransform() - const transformsId = transforms.transforms.map(t => t.id) - await helper.runInParallel( - client, 'transform.deleteTransform', - transformsId.map(t => ({ transform_id: t, force: true })) - ) - } - - const shutdownNodes = await client.shutdown.getNode() - if (shutdownNodes._nodes == null && shutdownNodes.cluster_name == null) { - for (const node of shutdownNodes.nodes) { - await client.shutdown.deleteNode({ node_id: node.node_id }) - } - } - - // wait for pending task before resolving the promise - await sleep(100) - while (true) { - const body = await client.cluster.pendingTasks() - if (body.tasks.length === 0) break - await sleep(500) - } - } - - /** - * Runs the given test. - * It runs the test components in the following order: - * - skip check - * - xpack user - * - setup - * - the actual test - * - teardown - * - xpack cleanup - * - cleanup - * @param {object} setup (null if not needed) - * @param {object} test - * @param {object} teardown (null if not needed) - * @returns {Promise} - */ - async function run (setup, test, teardown, stats, junit) { - // if we should skip a feature in the setup/teardown section - // we should skip the entire test file - const skip = getSkip(setup) || getSkip(teardown) - if (skip && shouldSkip(esVersion, skip)) { - junit.skip(skip) - logSkip(skip) - return - } - - if (isXPack) { - // Some xpack test requires this user - // tap.comment('Creating x-pack user') - try { - await client.security.putUser({ - username: 'x_pack_rest_user', - password: 'x-pack-test-password', - roles: ['superuser'] - }) - } catch (err) { - assert.ifError(err, 'should not error: security.putUser') - } - } - - if (setup) await exec('Setup', setup, stats, junit) - - await exec('Test', test, stats, junit) - - if (teardown) await exec('Teardown', teardown, stats, junit) - - await cleanup(isXPack) - } - - /** - * Fill the stashed values of a command - * let's say the we have stashed the `master` value, - * is_true: nodes.$master.transport.profiles - * becomes - * is_true: nodes.new_value.transport.profiles - * @param {object|string} the action to update - * @returns {object|string} the updated action - */ - function fillStashedValues (obj) { - if (typeof obj === 'string') { - return getStashedValues(obj) - } - // iterate every key of the object - for (const key in obj) { - const val = obj[key] - // if the key value is a string, and the string includes '${' - // that we must update the content of '${...}'. - // eg: 'Basic ${auth}' we search the stahed value 'auth' - // and the resulting value will be 'Basic valueOfAuth' - if (typeof val === 'string' && val.includes('${')) { - while (obj[key].includes('${')) { - const val = obj[key] - const start = val.indexOf('${') - const end = val.indexOf('}', val.indexOf('${')) - const stashedKey = val.slice(start + 2, end) - const stashed = stash.get(stashedKey) - obj[key] = val.slice(0, start) + stashed + val.slice(end + 1) - } - continue - } - // handle json strings, eg: '{"hello":"$world"}' - if (typeof val === 'string' && val.includes('"$')) { - while (obj[key].includes('"$')) { - const val = obj[key] - const start = val.indexOf('"$') - const end = val.indexOf('"', start + 1) - const stashedKey = val.slice(start + 2, end) - const stashed = '"' + stash.get(stashedKey) + '"' - obj[key] = val.slice(0, start) + stashed + val.slice(end + 1) - } - continue - } - // if the key value is a string, and the string includes '$' - // we run the "update value" code - if (typeof val === 'string' && val.includes('$')) { - // update the key value - obj[key] = getStashedValues(val) - continue - } - - // go deep in the object - if (val !== null && typeof val === 'object') { - fillStashedValues(val) - } - } - - return obj - - function getStashedValues (str) { - const arr = str - // we split the string on the dots - // handle the key with a dot inside that is not a part of the path - .split(/(? { - if (part[0] === '$') { - const stashed = stash.get(part.slice(1)) - if (stashed == null) { - throw new Error(`Cannot find stashed value '${part}' for '${JSON.stringify(obj)}'`) - } - return stashed - } - return part - }) - - // recreate the string value only if the array length is higher than one - // otherwise return the first element which in some test this could be a number, - // and call `.join` will coerce it to a string. - return arr.length > 1 ? arr.join('.') : arr[0] - } - } - - /** - * Stashes a value - * @param {string} the key to search in the previous response - * @param {string} the name to identify the stashed value - * @returns {TestRunner} - */ - function set (key, name) { - if (key.includes('_arbitrary_key_')) { - let currentVisit = null - for (const path of key.split('.')) { - if (path === '_arbitrary_key_') { - const keys = Object.keys(currentVisit) - const arbitraryKey = keys[getRandomInt(0, keys.length)] - stash.set(name, arbitraryKey) - } else { - currentVisit = delve(response, path) - } - } - } else { - stash.set(name, delve(response, key)) - } - } - - /** - * Applies a given transformation and stashes the result. - * @param {string} the name to identify the stashed value - * @param {string} the transformation function as string - * @returns {TestRunner} - */ - function transform_and_set (name, transform) { - if (/base64EncodeCredentials/.test(transform)) { - const [user, password] = transform - .slice(transform.indexOf('(') + 1, -1) - .replace(/ /g, '') - .split(',') - const userAndPassword = `${delve(response, user)}:${delve(response, password)}` - stash.set(name, Buffer.from(userAndPassword).toString('base64')) - } else { - throw new Error(`Unknown transform: '${transform}'`) - } - } - - /** - * Runs a client command - * @param {object} the action to perform - * @returns {Promise} - */ - async function doAction (action, stats) { - const cmd = await updateParams(parseDo(action)) - let api - try { - api = delve(client, cmd.method).bind(client) - } catch (err) { - console.error(`\nError: Cannot find the method '${cmd.method}' in the client.\n`) - process.exit(1) - } - - if (action.headers) { - switch (action.headers['Content-Type'] || action.headers['content-type']) { - case 'application/json': - delete action.headers['Content-Type'] - delete action.headers['content-type'] - action.headers['Content-Type'] = `application/vnd.elasticsearch+json; compatible-with=${packageJson.version.split('.')[0]}` - break - case 'application/x-ndjson': - delete action.headers['Content-Type'] - delete action.headers['content-type'] - action.headers['Content-Type'] = `application/vnd.elasticsearch+x-ndjson; compatible-with=${packageJson.version.split('.')[0]}` - break - } - } - - const options = { ignore: cmd.params.ignore, headers: action.headers, meta: true } - if (!Array.isArray(options.ignore)) options.ignore = [options.ignore] - if (cmd.params.ignore) delete cmd.params.ignore - - // ndjson apis should always send the body as an array - if (isNDJson(cmd.api) && !Array.isArray(cmd.params.body)) { - cmd.params.body = [cmd.params.body] - } - - if (typeof cmd.params.body === 'string' && !isNDJson(cmd.api)) { - cmd.params.body = JSON.parse(cmd.params.body) - } - - let err, result; - try { - [err, result] = await to(api(cmd.params, options)) - } catch (exc) { - if (JSON.stringify(exc).includes('resource_already_exists_exception')) { - console.warn(`Resource already exists: ${JSON.stringify(cmd.params)}`) - // setup task was already done because cleanup didn't catch it? do nothing - } else { - throw exc - } - } - let warnings = result ? result.warnings : null - const body = result ? result.body : null - - if (action.warnings && warnings === null) { - assert.fail('We should get a warning header', action.warnings) - } else if (!action.warnings && warnings !== null) { - // if there is only the 'default shard will change' - // warning we skip the check, because the yaml - // spec may not be updated - let hasDefaultShardsWarning = false - warnings.forEach(h => { - if (/default\snumber\sof\sshards/g.test(h)) { - hasDefaultShardsWarning = true - } - }) - - if (hasDefaultShardsWarning === true && warnings.length > 1) { - assert.fail('We are not expecting warnings', warnings) - } - } else if (action.warnings && warnings !== null) { - // if the yaml warnings do not contain the - // 'default shard will change' warning - // we do not check it presence in the warnings array - // because the yaml spec may not be updated - let hasDefaultShardsWarning = false - action.warnings.forEach(h => { - if (/default\snumber\sof\sshards/g.test(h)) { - hasDefaultShardsWarning = true - } - }) - - if (hasDefaultShardsWarning === false) { - warnings = warnings.filter(h => !h.test(/default\snumber\sof\sshards/g)) - } - - stats.assertions += 1 - assert.deepEqual(warnings, action.warnings) - } - - if (action.catch) { - stats.assertions += 1 - assert.ok(err, `Expecting an error, but instead got ${JSON.stringify(err)}, the response was ${JSON.stringify(result)}`) - assert.ok( - parseDoError(err, action.catch), - `the error should match: ${action.catch}, found ${JSON.stringify(err.body)}` - ) - try { - response = JSON.parse(err.body) - } catch (e) { - response = err.body - } - } else { - stats.assertions += 1 - assert.ifError(err, `should not error: ${cmd.method}`, action) - response = body - } - } - - /** - * Runs an actual test - * @param {string} the name of the test - * @param {object} the actions to perform - * @returns {Promise} - */ - async function exec (name, actions, stats, junit) { - // tap.comment(name) - for (const action of actions) { - if (action.skip) { - if (shouldSkip(esVersion, action.skip)) { - junit.skip(fillStashedValues(action.skip)) - logSkip(fillStashedValues(action.skip)) - break - } - } - - if (action.do) { - await doAction(fillStashedValues(action.do), stats) - } - - if (action.set) { - const key = Object.keys(action.set)[0] - set(fillStashedValues(key), action.set[key]) - } - - if (action.transform_and_set) { - const key = Object.keys(action.transform_and_set)[0] - transform_and_set(key, action.transform_and_set[key]) - } - - if (action.match) { - stats.assertions += 1 - const key = Object.keys(action.match)[0] - match( - // in some cases, the yaml refers to the body with an empty string - key.split('.')[0] === '$body' || key === '' - ? response - : delve(response, fillStashedValues(key)), - key.split('.')[0] === '$body' - ? action.match[key] - : fillStashedValues(action.match)[key], - action.match, - response - ) - } - - if (action.lt) { - stats.assertions += 1 - const key = Object.keys(action.lt)[0] - lt( - delve(response, fillStashedValues(key)), - fillStashedValues(action.lt)[key], - response - ) - } - - if (action.gt) { - stats.assertions += 1 - const key = Object.keys(action.gt)[0] - gt( - delve(response, fillStashedValues(key)), - fillStashedValues(action.gt)[key], - response - ) - } - - if (action.lte) { - stats.assertions += 1 - const key = Object.keys(action.lte)[0] - lte( - delve(response, fillStashedValues(key)), - fillStashedValues(action.lte)[key], - response - ) - } - - if (action.gte) { - stats.assertions += 1 - const key = Object.keys(action.gte)[0] - gte( - delve(response, fillStashedValues(key)), - fillStashedValues(action.gte)[key], - response - ) - } - - if (action.length) { - stats.assertions += 1 - const key = Object.keys(action.length)[0] - length( - key === '$body' || key === '' - ? response - : delve(response, fillStashedValues(key)), - key === '$body' - ? action.length[key] - : fillStashedValues(action.length)[key], - response - ) - } - - if (action.is_true) { - stats.assertions += 1 - const isTrue = fillStashedValues(action.is_true) - is_true( - delve(response, isTrue), - isTrue, - response - ) - } - - if (action.is_false) { - stats.assertions += 1 - const isFalse = fillStashedValues(action.is_false) - is_false( - delve(response, isFalse), - isFalse, - response - ) - } - } - } - - return { run } -} - -/** - * Asserts that the given value is truthy - * @param {any} the value to check - * @param {string} an optional message - * @param {any} debugging metadata to attach to any assertion errors - * @returns {TestRunner} - */ -function is_true (val, msg, response) { - try { - assert.ok((typeof val === 'string' && val.toLowerCase() === 'true') || val, `expect truthy value: ${msg} - value: ${JSON.stringify(val)}`) - } catch (err) { - err.response = JSON.stringify(response) - throw err - } -} - -/** - * Asserts that the given value is falsey - * @param {any} the value to check - * @param {string} an optional message - * @param {any} debugging metadata to attach to any assertion errors - * @returns {TestRunner} - */ -function is_false (val, msg, response) { - try { - assert.ok((typeof val === 'string' && val.toLowerCase() === 'false') || !val, `expect falsey value: ${msg} - value: ${JSON.stringify(val)}`) - } catch (err) { - err.response = JSON.stringify(response) - throw err - } -} - -/** - * Asserts that two values are the same - * @param {any} the first value - * @param {any} the second value - * @param {any} debugging metadata to attach to any assertion errors - * @returns {TestRunner} - */ -function match (val1, val2, action, response) { - try { - // both values are objects - if (typeof val1 === 'object' && typeof val2 === 'object') { - assert.deepEqual(val1, val2, typeof action === 'object' ? JSON.stringify(action) : action) - // the first value is the body as string and the second a pattern string - } else if ( - typeof val1 === 'string' && typeof val2 === 'string' && - val2.startsWith('/') && (val2.endsWith('/\n') || val2.endsWith('/')) - ) { - const regStr = val2 - .replace(/(^|[^\\])#.*/g, '$1') - .replace(/(^|[^\\])\s+/g, '$1') - .slice(1, -1) - // 'm' adds the support for multiline regex - assert.match(val1, new RegExp(regStr, 'm'), `should match pattern provided: ${val2}, but got: ${val1}: ${JSON.stringify(action)}`) - } else if (typeof val1 === 'string' && typeof val2 === 'string') { - // string comparison - assert.include(val1, val2, `should include pattern provided: ${val2}, but got: ${val1}: ${JSON.stringify(action)}`) - } else { - // everything else - assert.equal(val1, val2, `should be equal: ${val1} - ${val2}, action: ${JSON.stringify(action)}`) - } - } catch (err) { - err.response = JSON.stringify(response) - throw err - } -} - -/** - * Asserts that the first value is less than the second - * It also verifies that the two values are numbers - * @param {any} the first value - * @param {any} the second value - * @param {any} debugging metadata to attach to any assertion errors - * @returns {TestRunner} - */ -function lt (val1, val2, response) { - try { - ;[val1, val2] = getNumbers(val1, val2) - assert.ok(val1 < val2) - } catch (err) { - err.response = JSON.stringify(response) - throw err - } -} - -/** - * Asserts that the first value is greater than the second - * It also verifies that the two values are numbers - * @param {any} the first value - * @param {any} the second value - * @param {any} debugging metadata to attach to any assertion errors - * @returns {TestRunner} - */ -function gt (val1, val2, response) { - try { - ;[val1, val2] = getNumbers(val1, val2) - assert.ok(val1 > val2) - } catch (err) { - err.response = JSON.stringify(response) - throw err - } -} - -/** - * Asserts that the first value is less than or equal the second - * It also verifies that the two values are numbers - * @param {any} the first value - * @param {any} the second value - * @param {any} debugging metadata to attach to any assertion errors - * @returns {TestRunner} - */ -function lte (val1, val2, response) { - try { - ;[val1, val2] = getNumbers(val1, val2) - assert.ok(val1 <= val2) - } catch (err) { - err.response = JSON.stringify(response) - throw err - } -} - -/** - * Asserts that the first value is greater than or equal the second - * It also verifies that the two values are numbers - * @param {any} the first value - * @param {any} the second value - * @param {any} debugging metadata to attach to any assertion errors - * @returns {TestRunner} -*/ -function gte (val1, val2, response) { - try { - ;[val1, val2] = getNumbers(val1, val2) - assert.ok(val1 >= val2) - } catch (err) { - err.response = JSON.stringify(response) - throw err - } -} - -/** - * Asserts that the given value has the specified length - * @param {string|object|array} the object to check - * @param {number} the expected length - * @param {any} debugging metadata to attach to any assertion errors - * @returns {TestRunner} - */ -function length (val, len, response) { - try { - if (typeof val === 'string' || Array.isArray(val)) { - assert.equal(val.length, len) - } else if (typeof val === 'object' && val !== null) { - assert.equal(Object.keys(val).length, len) - } else { - assert.fail(`length: the given value is invalid: ${val}`) - } - } catch (err) { - err.response = JSON.stringify(response) - throw err - } -} - -/** - * Gets a `do` action object and returns a structured object, - * where the action is the key and the parameter is the value. - * Eg: - * { - * 'indices.create': { - * 'index': 'test' - * }, - * 'warnings': [ - * '[index] is deprecated' - * ] - * } - * becomes - * { - * method: 'indices.create', - * params: { - * index: 'test' - * }, - * warnings: [ - * '[index] is deprecated' - * ] - * } - * @param {object} - * @returns {object} - */ -function parseDo (action) { - action = JSON.parse(JSON.stringify(action)) - - if (typeof action === 'string') action = {[action]: {}} - if (Array.isArray(action)) action = action[0] - - return Object.keys(action).reduce((acc, val) => { - switch (val) { - case 'catch': - acc.catch = action.catch - break - case 'warnings': - acc.warnings = action.warnings - break - case 'node_selector': - acc.node_selector = action.node_selector - break - default: - // converts underscore to camelCase - // eg: put_mapping => putMapping - acc.method = val.replace(/_([a-z])/g, g => g[1].toUpperCase()) - acc.api = val - acc.params = action[val] // camelify(action[val]) - if (typeof acc.params.body === 'string') { - try { - acc.params.body = JSON.parse(acc.params.body) - } catch (err) {} - } - } - return acc - }, {}) - - // function camelify (obj) { - // const newObj = {} - - // // TODO: add camelCase support for this fields - // const doNotCamelify = ['copy_settings'] - - // for (const key in obj) { - // const val = obj[key] - // let newKey = key - // if (!~doNotCamelify.indexOf(key)) { - // // if the key starts with `_` we should not camelify the first occurence - // // eg: _source_include => _sourceInclude - // newKey = key[0] === '_' - // ? '_' + key.slice(1).replace(/_([a-z])/g, k => k[1].toUpperCase()) - // : key.replace(/_([a-z])/g, k => k[1].toUpperCase()) - // } - - // if ( - // val !== null && - // typeof val === 'object' && - // !Array.isArray(val) && - // key !== 'body' - // ) { - // newObj[newKey] = camelify(val) - // } else { - // newObj[newKey] = val - // } - // } - - // return newObj - // } -} - -function parseDoError (err, spec) { - const httpErrors = { - bad_request: 400, - unauthorized: 401, - forbidden: 403, - missing: 404, - request_timeout: 408, - conflict: 409, - unavailable: 503 - } - - if (httpErrors[spec]) { - return err.statusCode === httpErrors[spec] - } - - if (spec === 'request') { - return err.statusCode >= 400 && err.statusCode < 600 - } - - if (spec.startsWith('/') && spec.endsWith('/')) { - return new RegExp(spec.slice(1, -1), 'g').test(JSON.stringify(err.body)) - } - - if (spec === 'param') { - // the new client do not perform runtime checks, - // but it relies on typescript informing the user - return true - // return err instanceof ConfigurationError - } - - return false -} - -function getSkip (arr) { - if (!Array.isArray(arr)) return null - for (let i = 0; i < arr.length; i++) { - if (arr[i].skip) return arr[i].skip - } - return null -} - -// Gets two *maybe* numbers and returns two valida numbers -// it throws if one or both are not a valid number -// the returned value is an array with the new values -function getNumbers (val1, val2) { - const val1Numeric = Number(val1) - if (isNaN(val1Numeric)) { - throw new TypeError(`val1 is not a valid number: ${val1}`) - } - const val2Numeric = Number(val2) - if (isNaN(val2Numeric)) { - throw new TypeError(`val2 is not a valid number: ${val2}`) - } - return [val1Numeric, val2Numeric] -} - -function getRandomInt (min, max) { - return Math.floor(Math.random() * (max - min)) + min -} - -/** - * Logs a skip - * @param {object} the actions - * @returns {TestRunner} - */ -function logSkip (action) { - if (action.reason && action.version) { - console.log(`Skip: ${action.reason} (${action.version})`) - } else if (action.features) { - console.log(`Skip: ${JSON.stringify(action.features)})`) - } else { - console.log('Skipped') - } -} - -/** - * Decides if a test should be skipped - * @param {object} the actions - * @returns {boolean} - */ -function shouldSkip (esVersion, action) { - let shouldSkip = false - // skip based on the version - if (action.version) { - if (action.version.trim() === 'all') return true - const versions = action.version.split(',').filter(Boolean) - for (const version of versions) { - const [min, max] = version.split('-').map(v => v.trim()) - // if both `min` and `max` are specified - if (min && max) { - shouldSkip = semver.satisfies(esVersion, action.version) - // if only `min` is specified - } else if (min) { - shouldSkip = semver.gte(esVersion, min) - // if only `max` is specified - } else if (max) { - shouldSkip = semver.lte(esVersion, max) - // something went wrong! - } else { - throw new Error(`skip: Bad version range: ${action.version}`) - } - } - } - - if (shouldSkip) return true - - if (action.features) { - if (!Array.isArray(action.features)) action.features = [action.features] - // returns true if one of the features is not present in the supportedFeatures - shouldSkip = !!action.features.filter(f => !~supportedFeatures.indexOf(f)).length - } - - if (shouldSkip) return true - - return false -} - -function isNDJson (api) { - const spec = require(join(locations.specFolder, `${api}.json`)) - const { content_type } = spec[Object.keys(spec)[0]].headers - return Boolean(content_type && content_type.includes('application/x-ndjson')) -} - -/** - * Updates the array syntax of keys and values - * eg: 'hits.hits.1.stuff' to 'hits.hits[1].stuff' - * @param {object} the action to update - * @returns {obj} the updated action - */ -// function updateArraySyntax (obj) { -// const newObj = {} - -// for (const key in obj) { -// const newKey = key.replace(/\.\d{1,}\./g, v => `[${v.slice(1, -1)}].`) -// const val = obj[key] - -// if (typeof val === 'string') { -// newObj[newKey] = val.replace(/\.\d{1,}\./g, v => `[${v.slice(1, -1)}].`) -// } else if (val !== null && typeof val === 'object') { -// newObj[newKey] = updateArraySyntax(val) -// } else { -// newObj[newKey] = val -// } -// } - -// return newObj -// } - -module.exports = build diff --git a/test/unit/client.test.ts b/test/unit/client.test.ts index b896946ad..d09b56e8a 100644 --- a/test/unit/client.test.ts +++ b/test/unit/client.test.ts @@ -24,7 +24,7 @@ import FakeTimers from '@sinonjs/fake-timers' import { buildServer, connection } from '../utils' import { Client, errors } from '../..' import * as symbols from '@elastic/transport/lib/symbols' -import { BaseConnectionPool, CloudConnectionPool, WeightedConnectionPool } from '@elastic/transport' +import { BaseConnectionPool, CloudConnectionPool, WeightedConnectionPool, HttpConnection } from '@elastic/transport' let clientVersion: string = require('../../package.json').version // eslint-disable-line if (clientVersion.includes('-')) { @@ -77,6 +77,31 @@ test('Missing node(s)', t => { t.end() }) +test('multi nodes with roles, using default node filter', async t => { + const client = new Client({ + nodes: [ + { + url: new URL('http://node1:9200'), + roles: { master: true, data: false, ingest: false, ml: false } + }, + { + url: new URL('http://node2:9200'), + roles: { master: true, data: true, ingest: false, ml: false } + }, + ] + }) + const conn = client.connectionPool.getConnection({ + now: Date.now() + 1000 * 60 * 3, + requestId: 1, + name: 'elasticsearch-js', + context: null + }) + + t.equal(conn?.url.hostname, 'node2') + + t.end() +}) + test('Custom headers', t => { const client = new Client({ node: 'http://localhost:9200', @@ -293,18 +318,32 @@ test('Elastic Cloud config', t => { }) t.ok(client.connectionPool instanceof CloudConnectionPool) - t.match(client.connectionPool.connections.find(c => c.id === 'https://abcd.localhost/'), { - url: new URL('https://elastic:changeme@abcd.localhost'), - id: 'https://abcd.localhost/', - headers: { - authorization: 'Basic ' + Buffer.from('elastic:changeme').toString('base64') - }, - tls: { secureProtocol: 'TLSv1_2_method' } + const connection = client.connectionPool.connections.find(c => c.id === 'https://abcd.localhost/') + + t.equal(connection?.headers?.authorization, `Basic ${Buffer.from('elastic:changeme').toString('base64')}`) + t.same(connection?.tls, { secureProtocol: 'TLSv1_2_method' }) + t.equal(connection?.url.hostname, 'abcd.localhost') + t.equal(connection?.url.protocol, 'https:') + + t.test('Invalid Cloud ID will throw ConfigurationError', t => { + t.throws(() => new Client({ + cloud : { + id : 'invalidCloudIdThatIsNotBase64' + }, + auth : { + username: 'elastic', + password: 'changeme' + } + + }), errors.ConfigurationError) + t.end() }) t.end() }) + + test('Override default Elastic Cloud options', t => { const client = new Client({ cloud: { @@ -405,6 +444,44 @@ test('Meta header disabled', async t => { await client.transport.request({ method: 'GET', path: '/' }) }) +test('Meta header indicates when UndiciConnection is used', async t => { + t.plan(1) + + function handler (req: http.IncomingMessage, res: http.ServerResponse) { + t.equal(req.headers['x-elastic-client-meta'], `es=${clientVersion},js=${nodeVersion},t=${transportVersion},un=${nodeVersion}`) + res.end('ok') + } + + const [{ port }, server] = await buildServer(handler) + + const client = new Client({ + node: `http://localhost:${port}`, + // Connection: UndiciConnection is the default + }) + + await client.transport.request({ method: 'GET', path: '/' }) + server.stop() +}) + +test('Meta header indicates when HttpConnection is used', async t => { + t.plan(1) + + function handler (req: http.IncomingMessage, res: http.ServerResponse) { + t.equal(req.headers['x-elastic-client-meta'], `es=${clientVersion},js=${nodeVersion},t=${transportVersion},hc=${nodeVersion}`) + res.end('ok') + } + + const [{ port }, server] = await buildServer(handler) + + const client = new Client({ + node: `http://localhost:${port}`, + Connection: HttpConnection, + }) + + await client.transport.request({ method: 'GET', path: '/' }) + server.stop() +}) + test('caFingerprint', t => { const client = new Client({ node: 'https://localhost:9200', @@ -482,3 +559,49 @@ test('Ensure new client does not time out at default (30s) when client sets requ t.end() } }) + +test('Pass disablePrototypePoisoningProtection option to serializer', async t => { + let client = new Client({ + node: 'http://localhost:9200', + disablePrototypePoisoningProtection: false + }) + t.same(client.serializer[symbols.kJsonOptions], { + protoAction: 'error', + constructorAction: 'error' + }) + + client = new Client({ + node: 'http://localhost:9200', + disablePrototypePoisoningProtection: true + }) + t.same(client.serializer[symbols.kJsonOptions], { + protoAction: 'ignore', + constructorAction: 'ignore' + }) + + client = new Client({ + node: 'http://localhost:9200', + disablePrototypePoisoningProtection: 'proto' + }) + t.same(client.serializer[symbols.kJsonOptions], { + protoAction: 'error', + constructorAction: 'ignore' + }) + + client = new Client({ + node: 'http://localhost:9200', + disablePrototypePoisoningProtection: 'constructor' + }) + t.same(client.serializer[symbols.kJsonOptions], { + protoAction: 'ignore', + constructorAction: 'error' + }) +}) + +test('disablePrototypePoisoningProtection is true by default', async t => { + const client = new Client({ node: 'http://localhost:9200' }) + t.same(client.serializer[symbols.kJsonOptions], { + protoAction: 'ignore', + constructorAction: 'ignore' + }) +}) diff --git a/test/unit/helpers/bulk.test.ts b/test/unit/helpers/bulk.test.ts index 1f2ddf575..94db5c5e4 100644 --- a/test/unit/helpers/bulk.test.ts +++ b/test/unit/helpers/bulk.test.ts @@ -1819,6 +1819,7 @@ test('Flush interval', t => { }) server.stop() + t.end() }) test(`flush timeout does not lock process when flushInterval is greater than server timeout`, async t => { @@ -1868,6 +1869,7 @@ test('Flush interval', t => { }) server.stop() + t.end() }) test(`flush timeout does not lock process when flushInterval is equal to server timeout`, async t => { @@ -1917,6 +1919,7 @@ test('Flush interval', t => { }) server.stop() + t.end() }) t.end() diff --git a/test/unit/helpers/esql.test.ts b/test/unit/helpers/esql.test.ts index b029e1323..a9a97d4b3 100644 --- a/test/unit/helpers/esql.test.ts +++ b/test/unit/helpers/esql.test.ts @@ -18,6 +18,7 @@ */ import { test } from 'tap' +import * as arrow from 'apache-arrow' import { connection } from '../../utils' import { Client } from '../../../' @@ -109,5 +110,199 @@ test('ES|QL helper', t => { t.end() }) + + test('toArrowTable', t => { + t.test('Parses a binary response into an Arrow table', async t => { + const binaryContent = '/////zABAAAQAAAAAAAKAA4ABgANAAgACgAAAAAABAAQAAAAAAEKAAwAAAAIAAQACgAAAAgAAAAIAAAAAAAAAAIAAAB8AAAABAAAAJ7///8UAAAARAAAAEQAAAAAAAoBRAAAAAEAAAAEAAAAjP///wgAAAAQAAAABAAAAGRhdGUAAAAADAAAAGVsYXN0aWM6dHlwZQAAAAAAAAAAgv///wAAAQAEAAAAZGF0ZQAAEgAYABQAEwASAAwAAAAIAAQAEgAAABQAAABMAAAAVAAAAAAAAwFUAAAAAQAAAAwAAAAIAAwACAAEAAgAAAAIAAAAEAAAAAYAAABkb3VibGUAAAwAAABlbGFzdGljOnR5cGUAAAAAAAAAAAAABgAIAAYABgAAAAAAAgAGAAAAYW1vdW50AAAAAAAA/////7gAAAAUAAAAAAAAAAwAFgAOABUAEAAEAAwAAABgAAAAAAAAAAAABAAQAAAAAAMKABgADAAIAAQACgAAABQAAABYAAAABQAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAQAAAAAAAAAIAAAAAAAAACgAAAAAAAAAMAAAAAAAAAABAAAAAAAAADgAAAAAAAAAKAAAAAAAAAAAAAAAAgAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAHwAAAAAAAAAAAACgmZkTQAAAAGBmZiBAAAAAAAAAL0AAAADAzMwjQAAAAMDMzCtAHwAAAAAAAADV6yywkgEAANWPBquSAQAA1TPgpZIBAADV17mgkgEAANV7k5uSAQAA/////wAAAAA=' + + const MockConnection = connection.buildMockConnection({ + onRequest (_params) { + return { + body: Buffer.from(binaryContent, 'base64'), + statusCode: 200, + headers: { + 'content-type': 'application/vnd.elasticsearch+arrow+stream' + } + } + } + }) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection + }) + + const result = await client.helpers.esql({ query: 'FROM sample_data' }).toArrowTable() + t.ok(result instanceof arrow.Table) + + const table = [...result] + t.same(table[0], [ + ["amount", 4.900000095367432], + ["date", 1729532586965], + ]) + t.end() + }) + + t.test('ESQL helper uses correct x-elastic-client-meta helper value', async t => { + const binaryContent = '/////zABAAAQAAAAAAAKAA4ABgANAAgACgAAAAAABAAQAAAAAAEKAAwAAAAIAAQACgAAAAgAAAAIAAAAAAAAAAIAAAB8AAAABAAAAJ7///8UAAAARAAAAEQAAAAAAAoBRAAAAAEAAAAEAAAAjP///wgAAAAQAAAABAAAAGRhdGUAAAAADAAAAGVsYXN0aWM6dHlwZQAAAAAAAAAAgv///wAAAQAEAAAAZGF0ZQAAEgAYABQAEwASAAwAAAAIAAQAEgAAABQAAABMAAAAVAAAAAAAAwFUAAAAAQAAAAwAAAAIAAwACAAEAAgAAAAIAAAAEAAAAAYAAABkb3VibGUAAAwAAABlbGFzdGljOnR5cGUAAAAAAAAAAAAABgAIAAYABgAAAAAAAgAGAAAAYW1vdW50AAAAAAAA/////7gAAAAUAAAAAAAAAAwAFgAOABUAEAAEAAwAAABgAAAAAAAAAAAABAAQAAAAAAMKABgADAAIAAQACgAAABQAAABYAAAABQAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAQAAAAAAAAAIAAAAAAAAACgAAAAAAAAAMAAAAAAAAAABAAAAAAAAADgAAAAAAAAAKAAAAAAAAAAAAAAAAgAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAHwAAAAAAAAAAAACgmZkTQAAAAGBmZiBAAAAAAAAAL0AAAADAzMwjQAAAAMDMzCtAHwAAAAAAAADV6yywkgEAANWPBquSAQAA1TPgpZIBAADV17mgkgEAANV7k5uSAQAA/////wAAAAA=' + + const MockConnection = connection.buildMockConnection({ + onRequest (params) { + const header = params.headers?.['x-elastic-client-meta'] ?? '' + t.ok(header.includes('h=qa'), `Client meta header does not include ESQL helper value: ${header}`) + return { + body: Buffer.from(binaryContent, 'base64'), + statusCode: 200, + headers: { + 'content-type': 'application/vnd.elasticsearch+arrow+stream' + } + } + } + }) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection + }) + + await client.helpers.esql({ query: 'FROM sample_data' }).toArrowTable() + t.end() + }) + + t.end() + }) + + test('toArrowReader', async t => { + const testRecords = [ + { amount: 4.900000095367432, }, + { amount: 8.199999809265137, }, + { amount: 15.5, }, + { amount: 9.899999618530273, }, + { amount: 13.899999618530273, }, + ] + + // build reusable Arrow table + const table = arrow.tableFromJSON(testRecords) + const rawData = await arrow.RecordBatchStreamWriter.writeAll(table).toUint8Array() + + t.test('Parses a binary response into an Arrow stream reader', async t => { + const MockConnection = connection.buildMockConnection({ + onRequest (_params) { + return { + body: Buffer.from(rawData), + statusCode: 200, + headers: { + 'content-type': 'application/vnd.elasticsearch+arrow+stream', + 'transfer-encoding': 'chunked' + } + } + } + }) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection + }) + + const result = await client.helpers.esql({ query: 'FROM sample_data' }).toArrowReader() + t.ok(result.isStream()) + + let count = 0 + for await (const recordBatch of result) { + for (const record of recordBatch) { + t.same(record.toJSON(), testRecords[count]) + count++ + } + } + + t.end() + }) + + t.test('ESQL helper uses correct x-elastic-client-meta helper value', async t => { + const MockConnection = connection.buildMockConnection({ + onRequest (params) { + const header = params.headers?.['x-elastic-client-meta'] ?? '' + t.ok(header.includes('h=qa'), `Client meta header does not include ESQL helper value: ${header}`) + return { + body: Buffer.from(rawData), + statusCode: 200, + headers: { + 'content-type': 'application/vnd.elasticsearch+arrow+stream', + 'transfer-encoding': 'chunked' + } + } + } + }) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection + }) + + await client.helpers.esql({ query: 'FROM sample_data' }).toArrowReader() + t.end() + }) + + t.test('multi-batch support', async t => { + const intType = new arrow.Uint32 + const floatType = new arrow.Float32 + const schema = new arrow.Schema([ + arrow.Field.new('id', intType), + arrow.Field.new('val', floatType) + ]) + + function getBatch(ids: number[], vals: number[]) { + const id = arrow.makeData({ type: intType, data: ids }) + const val = arrow.makeData({ type: floatType, data: vals }) + return new arrow.RecordBatch({ id, val }) + } + + const batch1 = getBatch([1, 2, 3], [0.1, 0.2, 0.3]) + const batch2 = getBatch([4, 5, 6], [0.4, 0.5, 0.6]) + const batch3 = getBatch([7, 8, 9], [0.7, 0.8, 0.9]) + + const table = new arrow.Table(schema, [ + new arrow.RecordBatch(schema, batch1.data), + new arrow.RecordBatch(schema, batch2.data), + new arrow.RecordBatch(schema, batch3.data), + ]) + + const rawData = await arrow.RecordBatchStreamWriter.writeAll(table).toUint8Array() + + const MockConnection = connection.buildMockConnection({ + onRequest (_params) { + return { + body: Buffer.from(rawData), + statusCode: 200, + headers: { + 'content-type': 'application/vnd.elasticsearch+arrow+stream' + } + } + } + }) + + const client = new Client({ + node: 'http://localhost:9200', + Connection: MockConnection + }) + + const result = await client.helpers.esql({ query: 'FROM sample_data' }).toArrowReader() + t.ok(result.isStream()) + + let counter = 0 + for await (const batch of result) { + for (const row of batch) { + counter++ + const { id, val } = row.toJSON() + t.equal(id, counter) + // floating points are hard in JS + t.equal((Math.round(val * 10) / 10).toFixed(1), (counter * 0.1).toFixed(1)) + } + } + t.end() + }) + + t.end() + }) t.end() }) diff --git a/test/unit/helpers/search.test.ts b/test/unit/helpers/search.test.ts index 9ed4605ab..e318571a8 100644 --- a/test/unit/helpers/search.test.ts +++ b/test/unit/helpers/search.test.ts @@ -24,14 +24,14 @@ import { connection } from '../../utils' test('Search should have an additional documents property', async t => { const MockConnection = connection.buildMockConnection({ onRequest (params) { - t.equal(params.querystring, 'filter_path=hits.hits._source') + t.equal(params.querystring, 'filter_path=hits.hits._id%2Chits.hits._source') return { body: { hits: { hits: [ - { _source: { one: 'one' } }, - { _source: { two: 'two' } }, - { _source: { three: 'three' } } + { _id: '1', _source: { one: 'one' } }, + { _id: '2', _source: { two: 'two' } }, + { _id: '3', _source: { three: 'three' } } ] } } @@ -49,16 +49,16 @@ test('Search should have an additional documents property', async t => { query: { match_all: {} } }) t.same(result, [ - { one: 'one' }, - { two: 'two' }, - { three: 'three' } + { _id: '1', one: 'one' }, + { _id: '2', two: 'two' }, + { _id: '3', three: 'three' } ]) }) test('kGetHits fallback', async t => { const MockConnection = connection.buildMockConnection({ onRequest (params) { - t.equal(params.querystring, 'filter_path=hits.hits._source') + t.equal(params.querystring, 'filter_path=hits.hits._id%2Chits.hits._source') return { body: {} } } }) @@ -78,14 +78,14 @@ test('kGetHits fallback', async t => { test('Merge filter paths (snake_case)', async t => { const MockConnection = connection.buildMockConnection({ onRequest (params) { - t.equal(params.querystring, 'filter_path=foo%2Chits.hits._source') + t.equal(params.querystring, 'filter_path=foo%2Chits.hits._id%2Chits.hits._source') return { body: { hits: { hits: [ - { _source: { one: 'one' } }, - { _source: { two: 'two' } }, - { _source: { three: 'three' } } + { _id: '1', _source: { one: 'one' } }, + { _id: '2', _source: { two: 'two' } }, + { _id: '3', _source: { three: 'three' } } ] } } @@ -104,9 +104,9 @@ test('Merge filter paths (snake_case)', async t => { query: { match_all: {} } }) t.same(result, [ - { one: 'one' }, - { two: 'two' }, - { three: 'three' } + { _id: '1', one: 'one' }, + { _id: '2', two: 'two' }, + { _id: '3', three: 'three' } ]) }) diff --git a/tsconfig.json b/tsconfig.json index e93828bd8..a7d7a1352 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es2019", + "target": "ES2019", "module": "commonjs", "moduleResolution": "node", "declaration": true, @@ -21,7 +21,8 @@ "importHelpers": true, "outDir": "lib", "lib": [ - "esnext" + "ES2019", + "dom" ] }, "formatCodeOptions": {