Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a3504f1bb | |||
| 4a059fdc0c | |||
| c5dd4e96d4 | |||
| c9666e1778 | |||
| 1ee6a34e73 | |||
| 34bb7f5916 | |||
| 124753aea7 | |||
| e36b0e5374 | |||
| e5c88add07 | |||
| 75f31d974d | |||
| 177a420521 | |||
| c0f7fa503a | |||
| 93e2b8b695 | |||
| 9c092a0b30 | |||
| d161c0a428 | |||
| 8c7d4c42e6 | |||
| fbc4fa0685 | |||
| cb6084b7c3 | |||
| 35ce1bfef1 | |||
| 151aef2707 | |||
| 8579a85fde | |||
| be0400789a | |||
| e2905c5708 | |||
| f02c66cdcc | |||
| 8d868df86a | |||
| 5ebd549ad1 | |||
| 7f364b75b7 | |||
| fe0ddb31a1 | |||
| 955eb121fb | |||
| da1a798310 | |||
| 82c9e5df37 | |||
| 4e1273ef33 | |||
| dbd0ec2457 | |||
| fc7109aa66 | |||
| 758b745254 | |||
| 3f3e9bac1e | |||
| b3b9d40293 | |||
| 14cdd64f7d | |||
| 5d41135190 | |||
| e4c4f1acb7 | |||
| ad3caf9e94 | |||
| fcb421a54e | |||
| 71e6e7007a | |||
| dabe34dae8 | |||
| 346663f704 | |||
| 32345dac41 | |||
| 6efbed6be1 | |||
| 8be306b82d | |||
| 979475b542 | |||
| a829634f83 | |||
| dd9b38b051 | |||
| 0e98719d60 | |||
| 7da9976777 | |||
| 4ca358cad6 | |||
| cf2eda1ab3 | |||
| 5d747eec0c | |||
| f38cbde243 | |||
| 61c18a6ba5 | |||
| 432cd36879 | |||
| e7de86a1f2 | |||
| f23f77cc41 | |||
| 09b5c84d24 | |||
| 604d4aefa7 | |||
| e279b3ebfa |
@ -5,3 +5,4 @@ elasticsearch
|
|||||||
.git
|
.git
|
||||||
lib
|
lib
|
||||||
junit-output
|
junit-output
|
||||||
|
.tap
|
||||||
|
|||||||
14
.github/make.sh
vendored
14
.github/make.sh
vendored
@ -65,7 +65,7 @@ codegen)
|
|||||||
if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then
|
if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then
|
||||||
# fall back to branch name or `main` if no VERSION is set
|
# fall back to branch name or `main` if no VERSION is set
|
||||||
branch_name=$(git rev-parse --abbrev-ref HEAD)
|
branch_name=$(git rev-parse --abbrev-ref HEAD)
|
||||||
if [[ "$branch_name" =~ ^[0-9]+\.[0-9]+ ]]; then
|
if [[ "$branch_name" =~ ^[0-9]+\.([0-9]+|x) ]]; then
|
||||||
echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m"
|
echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m"
|
||||||
VERSION="$branch_name"
|
VERSION="$branch_name"
|
||||||
else
|
else
|
||||||
@ -150,7 +150,7 @@ if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x}
|
|||||||
-u "$(id -u):$(id -g)" \
|
-u "$(id -u):$(id -g)" \
|
||||||
--volume "$repo:/usr/src/elasticsearch-js" \
|
--volume "$repo:/usr/src/elasticsearch-js" \
|
||||||
--volume /usr/src/elasticsearch-js/node_modules \
|
--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" \
|
--env "WORKFLOW=$WORKFLOW" \
|
||||||
--name make-elasticsearch-js \
|
--name make-elasticsearch-js \
|
||||||
--rm \
|
--rm \
|
||||||
@ -159,6 +159,14 @@ if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x}
|
|||||||
node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}"
|
node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}"
|
||||||
else
|
else
|
||||||
echo -e "\033[34;1mINFO: Running in CI mode"
|
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 \
|
docker run \
|
||||||
--volume "$repo:/usr/src/elasticsearch-js" \
|
--volume "$repo:/usr/src/elasticsearch-js" \
|
||||||
--volume /usr/src/elasticsearch-js/node_modules \
|
--volume /usr/src/elasticsearch-js/node_modules \
|
||||||
@ -168,7 +176,7 @@ else
|
|||||||
--rm \
|
--rm \
|
||||||
$product \
|
$product \
|
||||||
/bin/bash -c "cd /usr/src && \
|
/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 && \
|
mkdir -p /usr/src/elastic-client-generator-js/output && \
|
||||||
cd /usr/src/elasticsearch-js && \
|
cd /usr/src/elasticsearch-js && \
|
||||||
node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}"
|
node .buildkite/make.mjs --task $TASK ${TASK_ARGS[*]}"
|
||||||
|
|||||||
34
.github/workflows/nodejs.yml
vendored
34
.github/workflows/nodejs.yml
vendored
@ -11,10 +11,10 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
src-only: "${{ steps.changes.outputs.src-only }}"
|
src-only: "${{ steps.changes.outputs.src-only }}"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- uses: dorny/paths-filter/@v3.0.2
|
- uses: dorny/paths-filter/@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
id: changes
|
id: changes
|
||||||
with:
|
with:
|
||||||
filters: |
|
filters: |
|
||||||
@ -32,16 +32,16 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
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]
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
@ -57,17 +57,21 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npm run test:unit
|
npm run test:unit
|
||||||
|
|
||||||
|
- name: ECMAScript module test
|
||||||
|
run: |
|
||||||
|
npm run test:esm
|
||||||
|
|
||||||
license:
|
license:
|
||||||
name: License check
|
name: License check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||||
with:
|
with:
|
||||||
node-version: 22.x
|
node-version: 22.x
|
||||||
|
|
||||||
@ -92,12 +96,12 @@ jobs:
|
|||||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Use Bun
|
- name: Use Bun
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
|
||||||
|
|
||||||
- name: Install
|
- name: Install
|
||||||
run: |
|
run: |
|
||||||
@ -111,12 +115,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
bun run test:unit-bun
|
bun run test:unit-bun
|
||||||
|
|
||||||
auto-approve:
|
- name: ECMAScript module test
|
||||||
name: Auto-approve
|
run: |
|
||||||
needs: [test, license]
|
bun run test:esm
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
if: github.actor == 'elasticmachine'
|
|
||||||
steps:
|
|
||||||
- uses: hmarr/auto-approve-action@v4
|
|
||||||
|
|||||||
4
.github/workflows/npm-publish.yml
vendored
4
.github/workflows/npm-publish.yml
vendored
@ -12,11 +12,11 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
id-token: write
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
ref: ${{ github.event.inputs.branch }}
|
ref: ${{ github.event.inputs.branch }}
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||||
with:
|
with:
|
||||||
node-version: "22.x"
|
node-version: "22.x"
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|||||||
6
.github/workflows/serverless-patch.yml
vendored
6
.github/workflows/serverless-patch.yml
vendored
@ -26,14 +26,14 @@ jobs:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
repository: elastic/elasticsearch-js
|
repository: elastic/elasticsearch-js
|
||||||
ref: main
|
ref: main
|
||||||
path: stack
|
path: stack
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
repository: elastic/elasticsearch-serverless-js
|
repository: elastic/elasticsearch-serverless-js
|
||||||
@ -42,7 +42,7 @@ jobs:
|
|||||||
- name: Apply patch from stack to serverless
|
- name: Apply patch from stack to serverless
|
||||||
id: apply-patch
|
id: apply-patch
|
||||||
run: $GITHUB_WORKSPACE/stack/.github/workflows/serverless-patch.sh
|
run: $GITHUB_WORKSPACE/stack/.github/workflows/serverless-patch.sh
|
||||||
- uses: peter-evans/create-pull-request@v6
|
- uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
path: serverless
|
path: serverless
|
||||||
|
|||||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
|||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v8
|
- uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8
|
||||||
with:
|
with:
|
||||||
stale-issue-label: stale
|
stale-issue-label: stale
|
||||||
stale-pr-label: stale
|
stale-pr-label: stale
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -67,3 +67,4 @@ junit-output
|
|||||||
bun.lockb
|
bun.lockb
|
||||||
test-results
|
test-results
|
||||||
processinfo
|
processinfo
|
||||||
|
.tap
|
||||||
|
|||||||
@ -73,3 +73,4 @@ CONTRIBUTING.md
|
|||||||
|
|
||||||
src
|
src
|
||||||
bun.lockb
|
bun.lockb
|
||||||
|
.tap
|
||||||
|
|||||||
@ -42,6 +42,9 @@ spec:
|
|||||||
main:
|
main:
|
||||||
branch: "main"
|
branch: "main"
|
||||||
cronline: "@daily"
|
cronline: "@daily"
|
||||||
8_14:
|
8_x:
|
||||||
branch: "8.14"
|
branch: "8.x"
|
||||||
|
cronline: "@daily"
|
||||||
|
8_14:
|
||||||
|
branch: "8.16"
|
||||||
cronline: "@daily"
|
cronline: "@daily"
|
||||||
|
|||||||
@ -167,19 +167,11 @@ const client = new Client({
|
|||||||
----
|
----
|
||||||
|
|
||||||
|`nodeFilter`
|
|`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:_
|
_Default:_
|
||||||
[source,js]
|
[source,js]
|
||||||
----
|
----
|
||||||
function defaultNodeFilter (node) {
|
() => true
|
||||||
// avoid master only nodes
|
|
||||||
if (node.roles.master === true &&
|
|
||||||
node.roles.data === false &&
|
|
||||||
node.roles.ingest === false) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|`nodeSelector`
|
|`nodeSelector`
|
||||||
|
|||||||
@ -1,6 +1,75 @@
|
|||||||
[[changelog-client]]
|
[[changelog-client]]
|
||||||
== Release notes
|
== Release notes
|
||||||
|
|
||||||
|
=== 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]
|
[discrete]
|
||||||
=== 8.16.0
|
=== 8.16.0
|
||||||
|
|
||||||
@ -26,11 +95,27 @@ The ES|QL helper can now return results as an Apache Arrow `Table` or `RecordBat
|
|||||||
|
|
||||||
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.
|
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]
|
[discrete]
|
||||||
=== 8.15.2
|
=== 8.15.2
|
||||||
|
|
||||||
[discrete]
|
[discrete]
|
||||||
==== Features
|
==== Fixes
|
||||||
|
|
||||||
[discrete]
|
[discrete]
|
||||||
===== Improved support for Elasticsearch `v8.15`
|
===== Improved support for Elasticsearch `v8.15`
|
||||||
@ -41,7 +126,7 @@ Updated TypeScript types based on fixes and improvements to the Elasticsearch sp
|
|||||||
=== 8.15.1
|
=== 8.15.1
|
||||||
|
|
||||||
[discrete]
|
[discrete]
|
||||||
==== Features
|
==== Fixes
|
||||||
|
|
||||||
[discrete]
|
[discrete]
|
||||||
===== Improved support for Elasticsearch `v8.15`
|
===== Improved support for Elasticsearch `v8.15`
|
||||||
|
|||||||
11
docs/doc_examples/00ad41bde67beac991534ae0e04b1296.asciidoc
Normal file
11
docs/doc_examples/00ad41bde67beac991534ae0e04b1296.asciidoc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.getDataStream({
|
||||||
|
name: "my-data-stream",
|
||||||
|
filter_path: "data_streams.indices.index_name",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
46
docs/doc_examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc
Normal file
46
docs/doc_examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "retrievers_example",
|
||||||
|
retriever: {
|
||||||
|
rrf: {
|
||||||
|
retrievers: [
|
||||||
|
{
|
||||||
|
standard: {
|
||||||
|
query: {
|
||||||
|
range: {
|
||||||
|
year: {
|
||||||
|
gt: 2023,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
standard: {
|
||||||
|
query: {
|
||||||
|
term: {
|
||||||
|
topic: "elastic",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
rank_window_size: 10,
|
||||||
|
rank_constant: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
_source: false,
|
||||||
|
aggs: {
|
||||||
|
topics: {
|
||||||
|
terms: {
|
||||||
|
field: "topic",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
18
docs/doc_examples/0165d22da5f2fc7678392b31d8eb5566.asciidoc
Normal file
18
docs/doc_examples/0165d22da5f2fc7678392b31d8eb5566.asciidoc
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.inference.put({
|
||||||
|
task_type: "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);
|
||||||
|
----
|
||||||
@ -3,9 +3,8 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.cluster.getSettings({
|
const response = await client.indices.getMapping({
|
||||||
flat_settings: "true",
|
index: "kibana_sample_data_ecommerce",
|
||||||
filter_path: "transient",
|
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
@ -11,6 +11,8 @@ const response = await client.indices.putSettings({
|
|||||||
"index.indexing.slowlog.threshold.index.debug": "2s",
|
"index.indexing.slowlog.threshold.index.debug": "2s",
|
||||||
"index.indexing.slowlog.threshold.index.trace": "500ms",
|
"index.indexing.slowlog.threshold.index.trace": "500ms",
|
||||||
"index.indexing.slowlog.source": "1000",
|
"index.indexing.slowlog.source": "1000",
|
||||||
|
"index.indexing.slowlog.reformat": true,
|
||||||
|
"index.indexing.slowlog.include.user": true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
42
docs/doc_examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc
Normal file
42
docs/doc_examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.create({
|
||||||
|
index: "my-rank-vectors-bit",
|
||||||
|
mappings: {
|
||||||
|
properties: {
|
||||||
|
my_vector: {
|
||||||
|
type: "rank_vectors",
|
||||||
|
element_type: "bit",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
|
||||||
|
const response1 = await client.bulk({
|
||||||
|
index: "my-rank-vectors-bit",
|
||||||
|
refresh: "true",
|
||||||
|
operations: [
|
||||||
|
{
|
||||||
|
index: {
|
||||||
|
_id: "1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
my_vector: [127, -127, 0, 1, 42],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: {
|
||||||
|
_id: "2",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
my_vector: "8100012a7f",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
console.log(response1);
|
||||||
|
----
|
||||||
49
docs/doc_examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc
Normal file
49
docs/doc_examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "retrievers_example_nested",
|
||||||
|
retriever: {
|
||||||
|
rrf: {
|
||||||
|
retrievers: [
|
||||||
|
{
|
||||||
|
standard: {
|
||||||
|
query: {
|
||||||
|
nested: {
|
||||||
|
path: "nested_field",
|
||||||
|
inner_hits: {
|
||||||
|
name: "nested_vector",
|
||||||
|
_source: false,
|
||||||
|
fields: ["nested_field.paragraph_id"],
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
knn: {
|
||||||
|
field: "nested_field.nested_vector",
|
||||||
|
query_vector: [1, 0, 0.5],
|
||||||
|
k: 10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
standard: {
|
||||||
|
query: {
|
||||||
|
term: {
|
||||||
|
topic: "ai",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
rank_window_size: 10,
|
||||||
|
rank_constant: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
_source: ["topic"],
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,8 +3,12 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQuery({
|
const response = await client.transport.request({
|
||||||
format: "json",
|
method: "POST",
|
||||||
|
path: "/_query/async",
|
||||||
|
querystring: {
|
||||||
|
format: "json",
|
||||||
|
},
|
||||||
body: {
|
body: {
|
||||||
query:
|
query:
|
||||||
"\n FROM my-index-000001,cluster_one:my-index-000001,cluster_two:my-index*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
|
"\n FROM my-index-000001,cluster_one:my-index-000001,cluster_two:my-index*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
|
||||||
|
|||||||
@ -10,7 +10,7 @@ const response = await client.ingest.putPipeline({
|
|||||||
{
|
{
|
||||||
attachment: {
|
attachment: {
|
||||||
field: "data",
|
field: "data",
|
||||||
remove_binary: false,
|
remove_binary: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
57
docs/doc_examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc
Normal file
57
docs/doc_examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.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);
|
||||||
|
----
|
||||||
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.searchApplication.renderQuery({
|
const response = await client.transport.request({
|
||||||
name: "my-app",
|
method: "POST",
|
||||||
|
path: "/_application/search_application/my-app/_render_query",
|
||||||
body: {
|
body: {
|
||||||
params: {
|
params: {
|
||||||
query_string: "my first query",
|
query_string: "my first query",
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
// This file is autogenerated, DO NOT EDIT
|
|
||||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
|
||||||
|
|
||||||
[source, js]
|
|
||||||
----
|
|
||||||
const response = await client.cluster.putSettings({
|
|
||||||
persistent: {
|
|
||||||
"cluster.routing.allocation.disk.watermark.low": "100gb",
|
|
||||||
"cluster.routing.allocation.disk.watermark.high": "50gb",
|
|
||||||
"cluster.routing.allocation.disk.watermark.flood_stage": "10gb",
|
|
||||||
"cluster.info.update.interval": "1m",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(response);
|
|
||||||
----
|
|
||||||
@ -4,9 +4,11 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.putSettings({
|
const response = await client.indices.putSettings({
|
||||||
index: "my-index-000001",
|
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||||
settings: {
|
settings: {
|
||||||
"index.blocks.read_only_allow_delete": null,
|
index: {
|
||||||
|
number_of_replicas: "<original_number_of_replicas>",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
20
docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc
Normal file
20
docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_inference/chat_completion/openai-completion/_stream",
|
||||||
|
body: {
|
||||||
|
model: "gpt-4o",
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
role: "user",
|
||||||
|
content: "What is Elastic?",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
11
docs/doc_examples/12adea5d76f73d94d80d42f53f67563f.asciidoc
Normal file
11
docs/doc_examples/12adea5d76f73d94d80d42f53f67563f.asciidoc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.addBlock({
|
||||||
|
index: ".ml-anomalies-custom-example",
|
||||||
|
block: "read_only",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,11 +3,13 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.inference({
|
const response = await client.inference.put({
|
||||||
task_type: "my-inference-endpoint",
|
task_type: "my-inference-endpoint",
|
||||||
inference_id: "_update",
|
inference_id: "_update",
|
||||||
service_settings: {
|
inference_config: {
|
||||||
api_key: "<API_KEY>",
|
service_settings: {
|
||||||
|
api_key: "<API_KEY>",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
@ -11,7 +11,7 @@ const response = await client.searchApplication.put({
|
|||||||
script: {
|
script: {
|
||||||
lang: "mustache",
|
lang: "mustache",
|
||||||
source:
|
source:
|
||||||
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n \n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
|
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
|
||||||
params: {
|
params: {
|
||||||
query: "",
|
query: "",
|
||||||
_es_filters: {},
|
_es_filters: {},
|
||||||
|
|||||||
@ -16,7 +16,7 @@ const response = await client.search({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
field: "text",
|
field: "text",
|
||||||
inference_id: "my-cohere-rerank-model",
|
inference_id: "elastic-rerank",
|
||||||
inference_text: "How often does the moon hide the sun?",
|
inference_text: "How often does the moon hide the sun?",
|
||||||
rank_window_size: 100,
|
rank_window_size: 100,
|
||||||
min_score: 0.5,
|
min_score: 0.5,
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.simulate.ingest({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_ingest/_simulate",
|
||||||
body: {
|
body: {
|
||||||
docs: [
|
docs: [
|
||||||
{
|
{
|
||||||
|
|||||||
19
docs/doc_examples/1ead35c954963e83f89872048dabdbe9.asciidoc
Normal file
19
docs/doc_examples/1ead35c954963e83f89872048dabdbe9.asciidoc
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.security.queryRole({
|
||||||
|
query: {
|
||||||
|
bool: {
|
||||||
|
must_not: {
|
||||||
|
term: {
|
||||||
|
"metadata._reserved": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sort: ["name"],
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -5,7 +5,7 @@
|
|||||||
----
|
----
|
||||||
const response = await client.ingest.putPipeline({
|
const response = await client.ingest.putPipeline({
|
||||||
id: "geoip",
|
id: "geoip",
|
||||||
description: "Add geoip info",
|
description: "Add ip geolocation info",
|
||||||
processors: [
|
processors: [
|
||||||
{
|
{
|
||||||
geoip: {
|
geoip: {
|
||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.queryRole({
|
const response = await client.indices.rollover({
|
||||||
sort: ["name"],
|
alias: "datastream",
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
67
docs/doc_examples/246763219ec06172f7aa57bba28d344a.asciidoc
Normal file
67
docs/doc_examples/246763219ec06172f7aa57bba28d344a.asciidoc
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.create({
|
||||||
|
index: "my-rank-vectors-bit",
|
||||||
|
mappings: {
|
||||||
|
properties: {
|
||||||
|
my_vector: {
|
||||||
|
type: "rank_vectors",
|
||||||
|
element_type: "bit",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
|
||||||
|
const response1 = await client.bulk({
|
||||||
|
index: "my-rank-vectors-bit",
|
||||||
|
refresh: "true",
|
||||||
|
operations: [
|
||||||
|
{
|
||||||
|
index: {
|
||||||
|
_id: "1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
my_vector: [127, -127, 0, 1, 42],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: {
|
||||||
|
_id: "2",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
my_vector: "8100012a7f",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
console.log(response1);
|
||||||
|
|
||||||
|
const response2 = await client.search({
|
||||||
|
index: "my-rank-vectors-bit",
|
||||||
|
query: {
|
||||||
|
script_score: {
|
||||||
|
query: {
|
||||||
|
match_all: {},
|
||||||
|
},
|
||||||
|
script: {
|
||||||
|
source: "maxSimDotProduct(params.query_vector, 'my_vector')",
|
||||||
|
params: {
|
||||||
|
query_vector: [
|
||||||
|
[
|
||||||
|
0.35, 0.77, 0.95, 0.15, 0.11, 0.08, 0.58, 0.06, 0.44, 0.52, 0.21,
|
||||||
|
0.62, 0.65, 0.16, 0.64, 0.39, 0.93, 0.06, 0.93, 0.31, 0.92, 0,
|
||||||
|
0.66, 0.86, 0.92, 0.03, 0.81, 0.31, 0.2, 0.92, 0.95, 0.64, 0.19,
|
||||||
|
0.26, 0.77, 0.64, 0.78, 0.32, 0.97, 0.84,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response2);
|
||||||
|
----
|
||||||
@ -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);
|
|
||||||
----
|
|
||||||
11
docs/doc_examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc
Normal file
11
docs/doc_examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.addBlock({
|
||||||
|
index: ".ml-anomalies-custom-example",
|
||||||
|
block: "write",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.oidcLogout({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/oidc/logout",
|
||||||
body: {
|
body: {
|
||||||
token:
|
token:
|
||||||
"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
|
"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
|
||||||
|
|||||||
26
docs/doc_examples/2a21674c40f9b182a8944769d20b2357.asciidoc
Normal file
26
docs/doc_examples/2a21674c40f9b182a8944769d20b2357.asciidoc
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "my-rank-vectors-float",
|
||||||
|
query: {
|
||||||
|
script_score: {
|
||||||
|
query: {
|
||||||
|
match_all: {},
|
||||||
|
},
|
||||||
|
script: {
|
||||||
|
source: "maxSimDotProduct(params.query_vector, 'my_vector')",
|
||||||
|
params: {
|
||||||
|
query_vector: [
|
||||||
|
[0.5, 10, 6],
|
||||||
|
[-0.5, 10, 10],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
35
docs/doc_examples/2a67608dadbf220a2f040f3a79d3677d.asciidoc
Normal file
35
docs/doc_examples/2a67608dadbf220a2f040f3a79d3677d.asciidoc
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.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);
|
||||||
|
----
|
||||||
24
docs/doc_examples/2afd49985950cbcccf727fa858d00067.asciidoc
Normal file
24
docs/doc_examples/2afd49985950cbcccf727fa858d00067.asciidoc
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.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);
|
||||||
|
----
|
||||||
@ -3,10 +3,12 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQueryGet({
|
const response = await client.transport.request({
|
||||||
id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
|
method: "GET",
|
||||||
wait_for_completion_timeout: "30s",
|
path: "/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
|
||||||
body: null,
|
querystring: {
|
||||||
|
wait_for_completion_timeout: "30s",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
23
docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc
Normal file
23
docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.create({
|
||||||
|
index: "test-index",
|
||||||
|
mappings: {
|
||||||
|
properties: {
|
||||||
|
source_field: {
|
||||||
|
type: "text",
|
||||||
|
fields: {
|
||||||
|
infer_field: {
|
||||||
|
type: "semantic_text",
|
||||||
|
inference_id: ".elser-2-elasticsearch",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
23
docs/doc_examples/30d051f534aeb884176eedb2c11dac85.asciidoc
Normal file
23
docs/doc_examples/30d051f534aeb884176eedb2c11dac85.asciidoc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.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);
|
||||||
|
----
|
||||||
28
docs/doc_examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc
Normal file
28
docs/doc_examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "my-index-*",
|
||||||
|
query: {
|
||||||
|
bool: {
|
||||||
|
must: [
|
||||||
|
{
|
||||||
|
match: {
|
||||||
|
"user.id": "kimchy",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
must_not: [
|
||||||
|
{
|
||||||
|
terms: {
|
||||||
|
_index: ["my-index-01"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
31
docs/doc_examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc
Normal file
31
docs/doc_examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.ilm.putLifecycle({
|
||||||
|
name: "my_policy",
|
||||||
|
policy: {
|
||||||
|
phases: {
|
||||||
|
hot: {
|
||||||
|
actions: {
|
||||||
|
rollover: {
|
||||||
|
max_primary_shard_size: "50gb",
|
||||||
|
},
|
||||||
|
searchable_snapshot: {
|
||||||
|
snapshot_repository: "backing_repo",
|
||||||
|
replicate_for: "14d",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
delete: {
|
||||||
|
min_age: "28d",
|
||||||
|
actions: {
|
||||||
|
delete: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -14,6 +14,7 @@ const response = await client.indices.putSettings({
|
|||||||
"index.search.slowlog.threshold.fetch.info": "800ms",
|
"index.search.slowlog.threshold.fetch.info": "800ms",
|
||||||
"index.search.slowlog.threshold.fetch.debug": "500ms",
|
"index.search.slowlog.threshold.fetch.debug": "500ms",
|
||||||
"index.search.slowlog.threshold.fetch.trace": "200ms",
|
"index.search.slowlog.threshold.fetch.trace": "200ms",
|
||||||
|
"index.search.slowlog.include.user": true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
@ -5,7 +5,7 @@
|
|||||||
----
|
----
|
||||||
const response = await client.ingest.putPipeline({
|
const response = await client.ingest.putPipeline({
|
||||||
id: "geoip",
|
id: "geoip",
|
||||||
description: "Add geoip info",
|
description: "Add ip geolocation info",
|
||||||
processors: [
|
processors: [
|
||||||
{
|
{
|
||||||
geoip: {
|
geoip: {
|
||||||
70
docs/doc_examples/36792c81c053e0555407d1e83e7e054f.asciidoc
Normal file
70
docs/doc_examples/36792c81c053e0555407d1e83e7e054f.asciidoc
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "movies",
|
||||||
|
size: 10,
|
||||||
|
retriever: {
|
||||||
|
rescorer: {
|
||||||
|
rescore: {
|
||||||
|
window_size: 50,
|
||||||
|
query: {
|
||||||
|
rescore_query: {
|
||||||
|
script_score: {
|
||||||
|
query: {
|
||||||
|
match_all: {},
|
||||||
|
},
|
||||||
|
script: {
|
||||||
|
source:
|
||||||
|
"cosineSimilarity(params.queryVector, 'product-vector_final_stage') + 1.0",
|
||||||
|
params: {
|
||||||
|
queryVector: [-0.5, 90, -10, 14.8, -156],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
retriever: {
|
||||||
|
rrf: {
|
||||||
|
rank_window_size: 100,
|
||||||
|
retrievers: [
|
||||||
|
{
|
||||||
|
standard: {
|
||||||
|
query: {
|
||||||
|
sparse_vector: {
|
||||||
|
field: "plot_embedding",
|
||||||
|
inference_id: "my-elser-model",
|
||||||
|
query: "films that explore psychological depths",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
standard: {
|
||||||
|
query: {
|
||||||
|
multi_match: {
|
||||||
|
query: "crime",
|
||||||
|
fields: ["plot", "title"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
knn: {
|
||||||
|
field: "vector",
|
||||||
|
query_vector: [10, 22, 77],
|
||||||
|
k: 10,
|
||||||
|
num_candidates: 10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
23
docs/doc_examples/3722dad876023e0757138dd5a6d3240e.asciidoc
Normal file
23
docs/doc_examples/3722dad876023e0757138dd5a6d3240e.asciidoc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.create({
|
||||||
|
index: "my-index",
|
||||||
|
settings: {
|
||||||
|
index: {
|
||||||
|
number_of_shards: 3,
|
||||||
|
"blocks.write": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mappings: {
|
||||||
|
properties: {
|
||||||
|
field1: {
|
||||||
|
type: "text",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -1,23 +0,0 @@
|
|||||||
// This file is autogenerated, DO NOT EDIT
|
|
||||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
|
||||||
|
|
||||||
[source, js]
|
|
||||||
----
|
|
||||||
const response = await client.bulk({
|
|
||||||
index: "test-index",
|
|
||||||
operations: [
|
|
||||||
{
|
|
||||||
update: {
|
|
||||||
_id: "1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
doc: {
|
|
||||||
infer_field: "updated inference field",
|
|
||||||
source_field: "updated source field",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
console.log(response);
|
|
||||||
----
|
|
||||||
19
docs/doc_examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc
Normal file
19
docs/doc_examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: ".ml-anomalies-custom-example",
|
||||||
|
size: 0,
|
||||||
|
aggs: {
|
||||||
|
job_ids: {
|
||||||
|
terms: {
|
||||||
|
field: "job_id",
|
||||||
|
size: 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
61
docs/doc_examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc
Normal file
61
docs/doc_examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "retrievers_example",
|
||||||
|
retriever: {
|
||||||
|
linear: {
|
||||||
|
retrievers: [
|
||||||
|
{
|
||||||
|
retriever: {
|
||||||
|
standard: {
|
||||||
|
query: {
|
||||||
|
function_score: {
|
||||||
|
query: {
|
||||||
|
term: {
|
||||||
|
topic: "ai",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
functions: [
|
||||||
|
{
|
||||||
|
script_score: {
|
||||||
|
script: {
|
||||||
|
source: "doc['timestamp'].value.millis",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
boost_mode: "replace",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sort: {
|
||||||
|
timestamp: {
|
||||||
|
order: "asc",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
weight: 2,
|
||||||
|
normalizer: "minmax",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
retriever: {
|
||||||
|
knn: {
|
||||||
|
field: "vector",
|
||||||
|
query_vector: [0.23, 0.67, 0.89],
|
||||||
|
k: 3,
|
||||||
|
num_candidates: 5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
weight: 1.5,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
rank_window_size: 10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
_source: false,
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
16
docs/doc_examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc
Normal file
16
docs/doc_examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.updateAliases({
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
remove_index: {
|
||||||
|
index: "my-index-2099.05.06-000001",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQuery({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_query/async",
|
||||||
body: {
|
body: {
|
||||||
query:
|
query:
|
||||||
"\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ",
|
"\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ",
|
||||||
|
|||||||
18
docs/doc_examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc
Normal file
18
docs/doc_examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "kibana_sample_data_ecommerce",
|
||||||
|
size: 0,
|
||||||
|
aggs: {
|
||||||
|
order_stats: {
|
||||||
|
stats: {
|
||||||
|
field: "taxful_total_price",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQueryGet({
|
const response = await client.transport.request({
|
||||||
id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
|
method: "GET",
|
||||||
body: null,
|
path: "/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
@ -4,16 +4,12 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.create({
|
const response = await client.indices.create({
|
||||||
index: "semantic-embeddings",
|
index: "jinaai-index",
|
||||||
mappings: {
|
mappings: {
|
||||||
properties: {
|
properties: {
|
||||||
semantic_text: {
|
|
||||||
type: "semantic_text",
|
|
||||||
inference_id: "my-elser-endpoint",
|
|
||||||
},
|
|
||||||
content: {
|
content: {
|
||||||
type: "text",
|
type: "semantic_text",
|
||||||
copy_to: "semantic_text",
|
inference_id: "jinaai-embeddings",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
47
docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc
Normal file
47
docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_inference/chat_completion/openai-completion/_stream",
|
||||||
|
body: {
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
role: "user",
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: "What's the price of a scarf?",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
tools: [
|
||||||
|
{
|
||||||
|
type: "function",
|
||||||
|
function: {
|
||||||
|
name: "get_current_price",
|
||||||
|
description: "Get the current price of a item",
|
||||||
|
parameters: {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
item: {
|
||||||
|
id: "123",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
tool_choice: {
|
||||||
|
type: "function",
|
||||||
|
function: {
|
||||||
|
name: "get_current_price",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -10,7 +10,8 @@ const response = await client.inference.put({
|
|||||||
service: "openai",
|
service: "openai",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
api_key: "<api_key>",
|
api_key: "<api_key>",
|
||||||
model_id: "text-embedding-ada-002",
|
model_id: "text-embedding-3-small",
|
||||||
|
dimensions: 128,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.streamInference({
|
const response = await client.transport.request({
|
||||||
task_type: "completion",
|
method: "POST",
|
||||||
inference_id: "openai-completion",
|
path: "/_inference/completion/openai-completion/_stream",
|
||||||
body: {
|
body: {
|
||||||
input: "What is Elastic?",
|
input: "What is Elastic?",
|
||||||
},
|
},
|
||||||
|
|||||||
17
docs/doc_examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc
Normal file
17
docs/doc_examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.inference.put({
|
||||||
|
task_type: "sparse_embedding",
|
||||||
|
inference_id: "elser-model-eis",
|
||||||
|
inference_config: {
|
||||||
|
service: "elastic",
|
||||||
|
service_settings: {
|
||||||
|
model_name: "elser",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -8,11 +8,6 @@ const response = await client.search({
|
|||||||
query: {
|
query: {
|
||||||
bool: {
|
bool: {
|
||||||
must: [
|
must: [
|
||||||
{
|
|
||||||
term: {
|
|
||||||
"category.keyword": "Main Course",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
term: {
|
term: {
|
||||||
tags: "vegetarian",
|
tags: "vegetarian",
|
||||||
@ -27,6 +22,11 @@ const response = await client.search({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
should: [
|
should: [
|
||||||
|
{
|
||||||
|
term: {
|
||||||
|
category: "Main Course",
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
multi_match: {
|
multi_match: {
|
||||||
query: "curry spicy",
|
query: "curry spicy",
|
||||||
@ -3,15 +3,18 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.knnSearch({
|
const response = await client.search({
|
||||||
index: "my-index",
|
index: "image-index",
|
||||||
knn: {
|
knn: {
|
||||||
field: "image_vector",
|
field: "image-vector",
|
||||||
query_vector: [0.3, 0.1, 1.2],
|
query_vector: [-5, 9, -12],
|
||||||
k: 10,
|
k: 10,
|
||||||
num_candidates: 100,
|
num_candidates: 100,
|
||||||
|
rescore_vector: {
|
||||||
|
oversample: 2,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
_source: ["name", "file_type"],
|
fields: ["title", "file-type"],
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
@ -5,7 +5,7 @@
|
|||||||
----
|
----
|
||||||
const response = await client.cluster.putSettings({
|
const response = await client.cluster.putSettings({
|
||||||
persistent: {
|
persistent: {
|
||||||
"cluster.routing.allocation.disk.watermark.low": "30gb",
|
"migrate.data_stream_reindex_max_request_per_second": 10000,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
18
docs/doc_examples/53d9d2ec9cb8d211772d764e76fe6890.asciidoc
Normal file
18
docs/doc_examples/53d9d2ec9cb8d211772d764e76fe6890.asciidoc
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.ingest.simulate({
|
||||||
|
id: "query_helper_pipeline",
|
||||||
|
docs: [
|
||||||
|
{
|
||||||
|
_source: {
|
||||||
|
content:
|
||||||
|
"artificial intelligence in medicine articles published in the last 12 months",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.oidcPrepareAuthentication({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/oidc/prepare",
|
||||||
body: {
|
body: {
|
||||||
realm: "oidc1",
|
realm: "oidc1",
|
||||||
state: "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO",
|
state: "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO",
|
||||||
|
|||||||
16
docs/doc_examples/5836b09198feb1269ed12839b416123d.asciidoc
Normal file
16
docs/doc_examples/5836b09198feb1269ed12839b416123d.asciidoc
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "jinaai-index",
|
||||||
|
query: {
|
||||||
|
semantic: {
|
||||||
|
field: "content",
|
||||||
|
query: "who inspired taking care of the sea?",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
10
docs/doc_examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc
Normal file
10
docs/doc_examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.getSettings({
|
||||||
|
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,8 +3,12 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.esql.asyncQuery({
|
const response = await client.transport.request({
|
||||||
format: "json",
|
method: "POST",
|
||||||
|
path: "/_query/async",
|
||||||
|
querystring: {
|
||||||
|
format: "json",
|
||||||
|
},
|
||||||
body: {
|
body: {
|
||||||
query:
|
query:
|
||||||
"\n FROM cluster_one:my-index*,cluster_two:logs*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
|
"\n FROM cluster_one:my-index*,cluster_two:logs*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.putRole({
|
const response = await client.security.putRole({
|
||||||
name: "role_with_remote_indices",
|
name: "only_remote_access_role",
|
||||||
remote_indices: [
|
remote_indices: [
|
||||||
{
|
{
|
||||||
clusters: ["my_remote"],
|
clusters: ["my_remote"],
|
||||||
@ -12,6 +12,12 @@ const response = await client.security.putRole({
|
|||||||
privileges: ["read", "read_cross_cluster", "view_index_metadata"],
|
privileges: ["read", "read_cross_cluster", "view_index_metadata"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
remote_cluster: [
|
||||||
|
{
|
||||||
|
clusters: ["my_remote"],
|
||||||
|
privileges: ["monitor_stats"],
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
@ -9,7 +9,6 @@ const response = await client.indices.create({
|
|||||||
properties: {
|
properties: {
|
||||||
inference_field: {
|
inference_field: {
|
||||||
type: "semantic_text",
|
type: "semantic_text",
|
||||||
inference_id: "my-elser-endpoint",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -45,7 +45,7 @@ console.log(response);
|
|||||||
|
|
||||||
const response1 = await client.indices.putIndexTemplate({
|
const response1 = await client.indices.putIndexTemplate({
|
||||||
name: 2,
|
name: 2,
|
||||||
index_patterns: ["k8s*"],
|
index_patterns: ["k9s*"],
|
||||||
composed_of: ["destination_template"],
|
composed_of: ["destination_template"],
|
||||||
data_stream: {},
|
data_stream: {},
|
||||||
});
|
});
|
||||||
15
docs/doc_examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc
Normal file
15
docs/doc_examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.putSettings({
|
||||||
|
index: "*",
|
||||||
|
settings: {
|
||||||
|
"index.search.slowlog.include.user": true,
|
||||||
|
"index.search.slowlog.threshold.fetch.warn": "30s",
|
||||||
|
"index.search.slowlog.threshold.query.warn": "30s",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -11,7 +11,7 @@ const response = await client.searchApplication.put({
|
|||||||
script: {
|
script: {
|
||||||
lang: "mustache",
|
lang: "mustache",
|
||||||
source:
|
source:
|
||||||
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n \n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
|
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
|
||||||
params: {
|
params: {
|
||||||
query: "",
|
query: "",
|
||||||
_es_filters: {},
|
_es_filters: {},
|
||||||
|
|||||||
@ -6,14 +6,15 @@
|
|||||||
const response = await client.search({
|
const response = await client.search({
|
||||||
index: "test-index",
|
index: "test-index",
|
||||||
query: {
|
query: {
|
||||||
nested: {
|
match: {
|
||||||
path: "inference_field.inference.chunks",
|
my_semantic_field: "Which country is Paris in?",
|
||||||
query: {
|
},
|
||||||
sparse_vector: {
|
},
|
||||||
field: "inference_field.inference.chunks.embeddings",
|
highlight: {
|
||||||
inference_id: "my-inference-id",
|
fields: {
|
||||||
query: "mountain lake",
|
my_semantic_field: {
|
||||||
},
|
number_of_fragments: 2,
|
||||||
|
order: "score",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
16
docs/doc_examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc
Normal file
16
docs/doc_examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.reindex({
|
||||||
|
wait_for_completion: "false",
|
||||||
|
source: {
|
||||||
|
index: ".ml-anomalies-custom-example",
|
||||||
|
},
|
||||||
|
dest: {
|
||||||
|
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.bulkUpdateApiKeys({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/api_key/_bulk_update",
|
||||||
body: {
|
body: {
|
||||||
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -12,6 +12,13 @@ const response = await client.search({
|
|||||||
fields: ["my_field", "my_field._2gram", "my_field._3gram"],
|
fields: ["my_field", "my_field._2gram", "my_field._3gram"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
highlight: {
|
||||||
|
fields: {
|
||||||
|
my_field: {
|
||||||
|
matched_fields: ["my_field._index_prefix"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
24
docs/doc_examples/730045fae3743c39b612813a42c330c3.asciidoc
Normal file
24
docs/doc_examples/730045fae3743c39b612813a42c330c3.asciidoc
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "my-index-000001",
|
||||||
|
query: {
|
||||||
|
prefix: {
|
||||||
|
full_name: {
|
||||||
|
value: "ki",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
highlight: {
|
||||||
|
fields: {
|
||||||
|
full_name: {
|
||||||
|
matched_fields: ["full_name._index_prefix"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
33
docs/doc_examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc
Normal file
33
docs/doc_examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "kibana_sample_data_ecommerce",
|
||||||
|
size: 0,
|
||||||
|
aggs: {
|
||||||
|
daily_sales: {
|
||||||
|
date_histogram: {
|
||||||
|
field: "order_date",
|
||||||
|
calendar_interval: "day",
|
||||||
|
},
|
||||||
|
aggs: {
|
||||||
|
daily_revenue: {
|
||||||
|
sum: {
|
||||||
|
field: "taxful_total_price",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
smoothed_revenue: {
|
||||||
|
moving_fn: {
|
||||||
|
buckets_path: "daily_revenue",
|
||||||
|
window: 3,
|
||||||
|
script: "MovingFunctions.unweightedAvg(values)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -1,26 +0,0 @@
|
|||||||
// This file is autogenerated, DO NOT EDIT
|
|
||||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
|
||||||
|
|
||||||
[source, js]
|
|
||||||
----
|
|
||||||
const response = await client.search({
|
|
||||||
index: "test-index",
|
|
||||||
query: {
|
|
||||||
nested: {
|
|
||||||
path: "inference_field.inference.chunks",
|
|
||||||
query: {
|
|
||||||
knn: {
|
|
||||||
field: "inference_field.inference.chunks.embeddings",
|
|
||||||
query_vector_builder: {
|
|
||||||
text_embedding: {
|
|
||||||
model_id: "my_inference_id",
|
|
||||||
model_text: "mountain lake",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(response);
|
|
||||||
----
|
|
||||||
44
docs/doc_examples/76e02434835630cb830724beb92df354.asciidoc
Normal file
44
docs/doc_examples/76e02434835630cb830724beb92df354.asciidoc
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "retrievers_example",
|
||||||
|
retriever: {
|
||||||
|
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);
|
||||||
|
----
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.textStructure.findMessageStructure({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_text_structure/find_message_structure",
|
||||||
body: {
|
body: {
|
||||||
messages: [
|
messages: [
|
||||||
"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128",
|
"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128",
|
||||||
|
|||||||
@ -5,11 +5,8 @@
|
|||||||
----
|
----
|
||||||
const response = await client.cluster.putSettings({
|
const response = await client.cluster.putSettings({
|
||||||
persistent: {
|
persistent: {
|
||||||
"cluster.indices.close.enable": false,
|
"cluster.routing.allocation.disk.watermark.low": "90%",
|
||||||
"indices.recovery.max_bytes_per_sec": "50mb",
|
"cluster.routing.allocation.disk.watermark.high": "95%",
|
||||||
},
|
|
||||||
transient: {
|
|
||||||
"*": null,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
46
docs/doc_examples/78043831fd32004a82930c8ac8a1d809.asciidoc
Normal file
46
docs/doc_examples/78043831fd32004a82930c8ac8a1d809.asciidoc
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "retrievers_example",
|
||||||
|
retriever: {
|
||||||
|
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);
|
||||||
|
----
|
||||||
35
docs/doc_examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc
Normal file
35
docs/doc_examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
query: {
|
||||||
|
intervals: {
|
||||||
|
my_text: {
|
||||||
|
all_of: {
|
||||||
|
ordered: false,
|
||||||
|
max_gaps: 1,
|
||||||
|
intervals: [
|
||||||
|
{
|
||||||
|
match: {
|
||||||
|
query: "my favorite food",
|
||||||
|
max_gaps: 0,
|
||||||
|
ordered: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: {
|
||||||
|
query: "cold porridge",
|
||||||
|
max_gaps: 4,
|
||||||
|
ordered: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -4,17 +4,18 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.put({
|
const response = await client.inference.put({
|
||||||
task_type: "sparse_embedding",
|
task_type: "rerank",
|
||||||
inference_id: "my-elser-endpoint",
|
inference_id: "my-elastic-rerank",
|
||||||
inference_config: {
|
inference_config: {
|
||||||
service: "elser",
|
service: "elasticsearch",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
|
model_id: ".rerank-v1",
|
||||||
|
num_threads: 1,
|
||||||
adaptive_allocations: {
|
adaptive_allocations: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
min_number_of_allocations: 3,
|
min_number_of_allocations: 1,
|
||||||
max_number_of_allocations: 10,
|
max_number_of_allocations: 10,
|
||||||
},
|
},
|
||||||
num_threads: 1,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -4,7 +4,7 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.create({
|
const response = await client.indices.create({
|
||||||
index: "my-index-000002",
|
index: "my-index-000003",
|
||||||
mappings: {
|
mappings: {
|
||||||
properties: {
|
properties: {
|
||||||
inference_field: {
|
inference_field: {
|
||||||
@ -5,7 +5,7 @@
|
|||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.transport.request({
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
path: "/_ingest/geoip/database/example-database-id",
|
path: "/_ingest/ip_location/database/my-database-id",
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
@ -7,14 +7,14 @@ const response = await client.indices.create({
|
|||||||
index: "test-index",
|
index: "test-index",
|
||||||
mappings: {
|
mappings: {
|
||||||
properties: {
|
properties: {
|
||||||
infer_field: {
|
|
||||||
type: "semantic_text",
|
|
||||||
inference_id: "my-elser-endpoint",
|
|
||||||
},
|
|
||||||
source_field: {
|
source_field: {
|
||||||
type: "text",
|
type: "text",
|
||||||
copy_to: "infer_field",
|
copy_to: "infer_field",
|
||||||
},
|
},
|
||||||
|
infer_field: {
|
||||||
|
type: "semantic_text",
|
||||||
|
inference_id: ".elser-2-elasticsearch",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
37
docs/doc_examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc
Normal file
37
docs/doc_examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "kibana_sample_data_ecommerce",
|
||||||
|
size: 0,
|
||||||
|
aggs: {
|
||||||
|
daily_sales: {
|
||||||
|
date_histogram: {
|
||||||
|
field: "order_date",
|
||||||
|
calendar_interval: "day",
|
||||||
|
format: "yyyy-MM-dd",
|
||||||
|
},
|
||||||
|
aggs: {
|
||||||
|
revenue: {
|
||||||
|
sum: {
|
||||||
|
field: "taxful_total_price",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
unique_customers: {
|
||||||
|
cardinality: {
|
||||||
|
field: "customer_id",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
avg_basket_size: {
|
||||||
|
avg: {
|
||||||
|
field: "total_quantity",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
34
docs/doc_examples/7f1fade93225f8cf6000b93334d76ce4.asciidoc
Normal file
34
docs/doc_examples/7f1fade93225f8cf6000b93334d76ce4.asciidoc
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.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);
|
||||||
|
----
|
||||||
@ -12,7 +12,7 @@ const response = await client.ingest.putPipeline({
|
|||||||
field: "data",
|
field: "data",
|
||||||
indexed_chars: 11,
|
indexed_chars: 11,
|
||||||
indexed_chars_field: "max_size",
|
indexed_chars_field: "max_size",
|
||||||
remove_binary: false,
|
remove_binary: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.bulkUpdateApiKeys({
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/api_key/_bulk_update",
|
||||||
body: {
|
body: {
|
||||||
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
|
||||||
role_descriptors: {
|
role_descriptors: {
|
||||||
|
|||||||
34
docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc
Normal file
34
docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_inference/chat_completion/openai-completion/_stream",
|
||||||
|
body: {
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
role: "assistant",
|
||||||
|
content: "Let's find out what the weather is",
|
||||||
|
tool_calls: [
|
||||||
|
{
|
||||||
|
id: "call_KcAjWtAww20AihPHphUh46Gd",
|
||||||
|
type: "function",
|
||||||
|
function: {
|
||||||
|
name: "get_current_weather",
|
||||||
|
arguments: '{"location":"Boston, MA"}',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: "tool",
|
||||||
|
content: "The weather is cold",
|
||||||
|
tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -4,9 +4,11 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.putSettings({
|
const response = await client.indices.putSettings({
|
||||||
index: "my-index-000001",
|
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||||
settings: {
|
settings: {
|
||||||
"index.search.slowlog.include.user": true,
|
index: {
|
||||||
|
number_of_replicas: 0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
12
docs/doc_examples/89f547649895176c246bb8c41313ff21.asciidoc
Normal file
12
docs/doc_examples/89f547649895176c246bb8c41313ff21.asciidoc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.esql.query({
|
||||||
|
query:
|
||||||
|
'\nFROM library\n| EVAL year = DATE_EXTRACT("year", release_date)\n| WHERE page_count > ? AND match(author, ?, {"minimum_should_match": ?})\n| LIMIT 5\n',
|
||||||
|
params: [300, "Frank Herbert", 2],
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -9,7 +9,6 @@ const response = await client.indices.create({
|
|||||||
properties: {
|
properties: {
|
||||||
content: {
|
content: {
|
||||||
type: "semantic_text",
|
type: "semantic_text",
|
||||||
inference_id: "my-elser-endpoint",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.unfreeze({
|
const response = await client.indices.getAlias({
|
||||||
index: "my-index-000001",
|
index: ".ml-anomalies-custom-example",
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
39
docs/doc_examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc
Normal file
39
docs/doc_examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "kibana_sample_data_ecommerce",
|
||||||
|
size: 0,
|
||||||
|
aggs: {
|
||||||
|
categories: {
|
||||||
|
terms: {
|
||||||
|
field: "category.keyword",
|
||||||
|
size: 5,
|
||||||
|
order: {
|
||||||
|
total_revenue: "desc",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
aggs: {
|
||||||
|
total_revenue: {
|
||||||
|
sum: {
|
||||||
|
field: "taxful_total_price",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
avg_order_value: {
|
||||||
|
avg: {
|
||||||
|
field: "taxful_total_price",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
total_items: {
|
||||||
|
sum: {
|
||||||
|
field: "total_quantity",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user