Compare commits
91 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 | |||
| fceebae8ae | |||
| e45ed28c05 | |||
| 58b457eedc | |||
| 132d6d6062 | |||
| 9e08aaebe2 | |||
| 889fee2316 | |||
| 83b32f7ef4 | |||
| 60aa521b7e | |||
| 608b517d64 | |||
| bf4c57f7bc | |||
| 715292b501 | |||
| 1042a02733 | |||
| 9c959971a5 | |||
| e2745b4c75 | |||
| 4b8969cc78 | |||
| d62d8c9831 | |||
| 77e2f613f2 | |||
| 69b243171b | |||
| 37b8a33209 | |||
| 99cefe8b19 | |||
| 84ab2a787d | |||
| f737290d10 | |||
| 94da0d241a | |||
| 384debee9e | |||
| 94bf5b2aa7 | |||
| f34bb6aa28 | |||
| 1f9db892ea |
@ -3,14 +3,14 @@ FROM node:$NODE_VERSION
|
|||||||
|
|
||||||
# Install required tools
|
# Install required tools
|
||||||
RUN apt-get clean -y && \
|
RUN apt-get clean -y && \
|
||||||
apt-get -qy update && \
|
apt-get -qy update && \
|
||||||
apt-get -y install zip && \
|
apt-get -y install zip && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
RUN npm install --production=false
|
RUN npm install
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
@ -24,7 +24,7 @@ USER ${BUILDER_UID}:${BUILDER_GID}
|
|||||||
|
|
||||||
# install dependencies
|
# install dependencies
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
RUN npm install --production=false
|
RUN npm install
|
||||||
|
|
||||||
# copy project files
|
# copy project files
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
@ -125,6 +125,13 @@ async function codegen (args) {
|
|||||||
await $`cp -R ${join(import.meta.url, '..', '..', 'elastic-client-generator-js', 'output')}/* ${join(import.meta.url, '..', 'src', 'api')}`
|
await $`cp -R ${join(import.meta.url, '..', '..', 'elastic-client-generator-js', 'output')}/* ${join(import.meta.url, '..', 'src', 'api')}`
|
||||||
await $`mv ${join(import.meta.url, '..', 'src', 'api', 'reference.asciidoc')} ${join(import.meta.url, '..', 'docs', 'reference.asciidoc')}`
|
await $`mv ${join(import.meta.url, '..', 'src', 'api', 'reference.asciidoc')} ${join(import.meta.url, '..', 'docs', 'reference.asciidoc')}`
|
||||||
await $`npm run build`
|
await $`npm run build`
|
||||||
|
|
||||||
|
// run docs example generation
|
||||||
|
if (version === 'main') {
|
||||||
|
await $`node ./scripts/generate-docs-examples.js`
|
||||||
|
} else {
|
||||||
|
await $`node ./scripts/generate-docs-examples.js ${version.split('.').slice(0, 2).join('.')}`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onError (err) {
|
function onError (err) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ steps:
|
|||||||
env:
|
env:
|
||||||
NODE_VERSION: "{{ matrix.nodejs }}"
|
NODE_VERSION: "{{ matrix.nodejs }}"
|
||||||
TEST_SUITE: "{{ matrix.suite }}"
|
TEST_SUITE: "{{ matrix.suite }}"
|
||||||
STACK_VERSION: 8.15.0
|
STACK_VERSION: 8.16.0
|
||||||
matrix:
|
matrix:
|
||||||
setup:
|
setup:
|
||||||
suite:
|
suite:
|
||||||
|
|||||||
@ -5,3 +5,4 @@ elasticsearch
|
|||||||
.git
|
.git
|
||||||
lib
|
lib
|
||||||
junit-output
|
junit-output
|
||||||
|
.tap
|
||||||
|
|||||||
50
.github/ISSUE_TEMPLATE/bug.md
vendored
50
.github/ISSUE_TEMPLATE/bug.md
vendored
@ -1,50 +0,0 @@
|
|||||||
---
|
|
||||||
name: 🐛 Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
labels: ["Category: Bug"]
|
|
||||||
---
|
|
||||||
|
|
||||||
It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should [search](https://github.com/elastic/elasticsearch-js/issues) at first before submitting a new one.
|
|
||||||
|
|
||||||
**Please read this entire template before posting any issue. If you ignore these instructions
|
|
||||||
and post an issue here that does not follow the instructions, your issue might be closed,
|
|
||||||
locked, and assigned the `Category: Not an issue` label.**
|
|
||||||
|
|
||||||
## 🐛 Bug Report
|
|
||||||
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
## To Reproduce
|
|
||||||
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
|
|
||||||
Paste your code here:
|
|
||||||
|
|
||||||
```js
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
<!--
|
|
||||||
In some cases, it might be challenging to reproduce the bug in a few lines of code.
|
|
||||||
You can fork the following repository, which contains all the configuration needed
|
|
||||||
to spin up a three nodes Elasticsearch cluster with security enabled.
|
|
||||||
The repository also contains a preconfigured client instance that you can use to reproduce the issue.
|
|
||||||
https://github.com/delvedor/es-reproduce-issue
|
|
||||||
--->
|
|
||||||
|
|
||||||
## Expected behavior
|
|
||||||
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
Paste the results here:
|
|
||||||
|
|
||||||
```js
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Your Environment
|
|
||||||
|
|
||||||
- *node version*: 6,8,10
|
|
||||||
- `@elastic/elasticsearch` *version*: >=7.0.0
|
|
||||||
- *os*: Mac, Windows, Linux
|
|
||||||
- *any other relevant information*
|
|
||||||
66
.github/ISSUE_TEMPLATE/bug.yaml
vendored
Normal file
66
.github/ISSUE_TEMPLATE/bug.yaml
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
name: 🐛 Bug report
|
||||||
|
description: Create a report to help us improve
|
||||||
|
labels: ["Category: Bug"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should [search](https://github.com/elastic/elasticsearch-js/issues) at first before submitting a new one.
|
||||||
|
|
||||||
|
**Please read this entire template before posting any issue. If you ignore these instructions
|
||||||
|
and post an issue here that does not follow the instructions, your issue might be closed,
|
||||||
|
locked, and assigned the `Category: Not an issue` label.**
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: bug-report
|
||||||
|
attributes:
|
||||||
|
label: 🐛 Bug report
|
||||||
|
description: A clear and concise description of what the bug is.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: reproduction
|
||||||
|
attributes:
|
||||||
|
label: To reproduce
|
||||||
|
description: Steps to reproduce the behavior
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: Expected behavior
|
||||||
|
description: A clear and concise description of what you expected to happen.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
id: node-js-version
|
||||||
|
attributes:
|
||||||
|
label: Node.js version
|
||||||
|
placeholder: 18.x, 20.x, etc.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
id: client-version
|
||||||
|
attributes:
|
||||||
|
label: "@elastic/elasticsearch version"
|
||||||
|
placeholder: 7.17.0, 8.14.1, etc.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
id: os
|
||||||
|
attributes:
|
||||||
|
label: Operating system
|
||||||
|
placeholder: Ubuntu 22.04, macOS, etc.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
id: env-info
|
||||||
|
attributes:
|
||||||
|
label: Any other relevant environment information
|
||||||
23
.github/ISSUE_TEMPLATE/feature.md
vendored
23
.github/ISSUE_TEMPLATE/feature.md
vendored
@ -1,23 +0,0 @@
|
|||||||
---
|
|
||||||
name: 🚀 Feature Proposal
|
|
||||||
about: Submit a proposal for a new feature
|
|
||||||
labels: ["Category: Feature"]
|
|
||||||
---
|
|
||||||
|
|
||||||
It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should [search](https://github.com/elastic/elasticsearch-js/issues) at first before submitting a new one.
|
|
||||||
|
|
||||||
**Please read this entire template before posting any issue. If you ignore these instructions
|
|
||||||
and post an issue here that does not follow the instructions, your issue might be closed,
|
|
||||||
locked, and assigned the `Category: Not an issue` label.**
|
|
||||||
|
|
||||||
## 🚀 Feature Proposal
|
|
||||||
|
|
||||||
A clear and concise description of what the feature is.
|
|
||||||
|
|
||||||
## Motivation
|
|
||||||
|
|
||||||
Please outline the motivation for the proposal.
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
Please provide an example for how this feature would be used.
|
|
||||||
33
.github/ISSUE_TEMPLATE/feature.yaml
vendored
Normal file
33
.github/ISSUE_TEMPLATE/feature.yaml
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
name: 🚀 Feature Proposal
|
||||||
|
description: Submit a proposal for a new feature
|
||||||
|
labels: ["Category: Feature"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should [search](https://github.com/elastic/elasticsearch-js/issues) at first before submitting a new one.
|
||||||
|
|
||||||
|
**Please read this entire template before posting any issue. If you ignore these instructions
|
||||||
|
and post an issue here that does not follow the instructions, your issue might be closed,
|
||||||
|
locked, and assigned the `Category: Not an issue` label.**
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: feature-proposal
|
||||||
|
attributes:
|
||||||
|
label: 🚀 Feature Proposal
|
||||||
|
description: A clear and concise description of what the feature is.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: motivation
|
||||||
|
attributes:
|
||||||
|
label: Motivation
|
||||||
|
description: Please outline the motivation for the proposal.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: example
|
||||||
|
attributes:
|
||||||
|
label: Example
|
||||||
|
description: Please provide an example for how this feature would be used.
|
||||||
11
.github/ISSUE_TEMPLATE/question.md
vendored
11
.github/ISSUE_TEMPLATE/question.md
vendored
@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
name: 💬 Questions / Help
|
|
||||||
about: If you have questions, please check our Gitter or Help repo
|
|
||||||
labels: ["Category: Question"]
|
|
||||||
---
|
|
||||||
|
|
||||||
## 💬 Questions and Help
|
|
||||||
|
|
||||||
### Please note that this issue tracker is not a help forum and this issue may be closed.
|
|
||||||
|
|
||||||
It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should [search](https://github.com/elastic/elasticsearch-js/issues) at first before submitting a new one.
|
|
||||||
21
.github/ISSUE_TEMPLATE/question.yaml
vendored
Normal file
21
.github/ISSUE_TEMPLATE/question.yaml
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
name: 💬 Questions / Help
|
||||||
|
description: If you have questions, please check our community forum or support
|
||||||
|
labels: ["Category: Question"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
### Please note that this issue tracker is not a help forum and this issue may be closed.
|
||||||
|
|
||||||
|
Please check our [community forum](https://discuss.elastic.co/) or [contact Elastic support](https://www.elastic.co/support) if your issue is not specifically related to the documented functionality of this client library.
|
||||||
|
|
||||||
|
It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should [search](https://github.com/elastic/elasticsearch-js/issues) at first before submitting a new one.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: question
|
||||||
|
attributes:
|
||||||
|
label: Question
|
||||||
|
description: Your question or comment
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
6
.github/ISSUE_TEMPLATE/security.md
vendored
6
.github/ISSUE_TEMPLATE/security.md
vendored
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
name: 👮 Security Issue
|
|
||||||
about: Responsible Disclosure
|
|
||||||
---
|
|
||||||
|
|
||||||
If you want to report a security issue, please take a look at [elastic/security](https://www.elastic.co/community/security).
|
|
||||||
8
.github/ISSUE_TEMPLATE/security.yaml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/security.yaml
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
name: 👮 Security Issue
|
||||||
|
description: Responsible disclosure
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
If you want to report a security issue, please take a look at [elastic/security](https://www.elastic.co/community/security).
|
||||||
196
.github/make.sh
vendored
196
.github/make.sh
vendored
@ -37,7 +37,7 @@ product="elastic/elasticsearch-js"
|
|||||||
output_folder=".buildkite/output"
|
output_folder=".buildkite/output"
|
||||||
codegen_folder=".buildkite/output"
|
codegen_folder=".buildkite/output"
|
||||||
OUTPUT_DIR="$repo/${output_folder}"
|
OUTPUT_DIR="$repo/${output_folder}"
|
||||||
NODE_JS_VERSION=18
|
NODE_JS_VERSION=22
|
||||||
WORKFLOW=${WORKFLOW-staging}
|
WORKFLOW=${WORKFLOW-staging}
|
||||||
mkdir -p "$OUTPUT_DIR"
|
mkdir -p "$OUTPUT_DIR"
|
||||||
|
|
||||||
@ -46,84 +46,84 @@ echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m"
|
|||||||
echo -e "\033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR}\033[0m"
|
echo -e "\033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR}\033[0m"
|
||||||
|
|
||||||
case $CMD in
|
case $CMD in
|
||||||
clean)
|
clean)
|
||||||
echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m"
|
echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m"
|
||||||
rm -rf "$output_folder"
|
rm -rf "$output_folder"
|
||||||
echo -e "\033[32;1mdone.\033[0m"
|
echo -e "\033[32;1mdone.\033[0m"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
assemble)
|
assemble)
|
||||||
if [ -v $VERSION ]; then
|
if [ -v $VERSION ]; then
|
||||||
echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m"
|
echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo -e "\033[36;1mTARGET: assemble artifact $VERSION\033[0m"
|
echo -e "\033[36;1mTARGET: assemble artifact $VERSION\033[0m"
|
||||||
TASK=release
|
TASK=release
|
||||||
TASK_ARGS=("$VERSION" "$output_folder")
|
TASK_ARGS=("$VERSION" "$output_folder")
|
||||||
;;
|
;;
|
||||||
codegen)
|
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
|
||||||
echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using \`main\`\033[0m"
|
echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using \`main\`\033[0m"
|
||||||
VERSION="main"
|
VERSION="main"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$VERSION" = 'main' ]; then
|
if [ "$VERSION" = 'main' ]; then
|
||||||
echo -e "\033[36;1mTARGET: codegen API $VERSION\033[0m"
|
echo -e "\033[36;1mTARGET: codegen API $VERSION\033[0m"
|
||||||
else
|
else
|
||||||
echo -e "\033[36;1mTARGET: codegen API v$VERSION\033[0m"
|
echo -e "\033[36;1mTARGET: codegen API v$VERSION\033[0m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TASK=codegen
|
TASK=codegen
|
||||||
TASK_ARGS=("$VERSION")
|
TASK_ARGS=("$VERSION")
|
||||||
;;
|
;;
|
||||||
docsgen)
|
docsgen)
|
||||||
if [ -v $VERSION ]; then
|
if [ -v $VERSION ]; then
|
||||||
echo -e "\033[31;1mTARGET: docsgen -> missing version parameter\033[0m"
|
echo -e "\033[31;1mTARGET: docsgen -> missing version parameter\033[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m"
|
echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m"
|
||||||
TASK=codegen
|
TASK=codegen
|
||||||
TASK_ARGS=("$VERSION" "$codegen_folder")
|
TASK_ARGS=("$VERSION" "$codegen_folder")
|
||||||
;;
|
;;
|
||||||
examplesgen)
|
examplesgen)
|
||||||
echo -e "\033[36;1mTARGET: generate examples\033[0m"
|
echo -e "\033[36;1mTARGET: generate examples\033[0m"
|
||||||
TASK=codegen
|
TASK=codegen
|
||||||
TASK_ARGS=("$VERSION" "$codegen_folder")
|
TASK_ARGS=("$VERSION" "$codegen_folder")
|
||||||
;;
|
;;
|
||||||
bump)
|
bump)
|
||||||
if [ -v $VERSION ]; then
|
if [ -v $VERSION ]; then
|
||||||
echo -e "\033[31;1mTARGET: bump -> missing version parameter\033[0m"
|
echo -e "\033[31;1mTARGET: bump -> missing version parameter\033[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo -e "\033[36;1mTARGET: bump to version $VERSION\033[0m"
|
echo -e "\033[36;1mTARGET: bump to version $VERSION\033[0m"
|
||||||
TASK=bump
|
TASK=bump
|
||||||
TASK_ARGS=("$VERSION")
|
TASK_ARGS=("$VERSION")
|
||||||
;;
|
;;
|
||||||
bumpmatrix)
|
bumpmatrix)
|
||||||
if [ -v $VERSION ]; then
|
if [ -v $VERSION ]; then
|
||||||
echo -e "\033[31;1mTARGET: bumpmatrix -> missing version parameter\033[0m"
|
echo -e "\033[31;1mTARGET: bumpmatrix -> missing version parameter\033[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo -e "\033[36;1mTARGET: bump stack in test matrix to version $VERSION\033[0m"
|
echo -e "\033[36;1mTARGET: bump stack in test matrix to version $VERSION\033[0m"
|
||||||
TASK=bumpmatrix
|
TASK=bumpmatrix
|
||||||
TASK_ARGS=("$VERSION")
|
TASK_ARGS=("$VERSION")
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "\n'$CMD' is not supported right now\n"
|
echo -e "\n'$CMD' is not supported right now\n"
|
||||||
echo -e "\nUsage:"
|
echo -e "\nUsage:"
|
||||||
echo -e "\t $0 release \$VERSION\n"
|
echo -e "\t $0 release \$VERSION\n"
|
||||||
echo -e "\t $0 bump \$VERSION"
|
echo -e "\t $0 bump \$VERSION"
|
||||||
echo -e "\t $0 codegen \$VERSION"
|
echo -e "\t $0 codegen \$VERSION"
|
||||||
exit 1
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------- #
|
# ------------------------------------------------------- #
|
||||||
# Build Container
|
# Build Container
|
||||||
# ------------------------------------------------------- #
|
# ------------------------------------------------------- #
|
||||||
@ -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[*]}"
|
||||||
@ -179,36 +187,36 @@ fi
|
|||||||
# ------------------------------------------------------- #
|
# ------------------------------------------------------- #
|
||||||
|
|
||||||
if [[ "$CMD" == "assemble" ]]; then
|
if [[ "$CMD" == "assemble" ]]; then
|
||||||
if compgen -G ".buildkite/output/*" > /dev/null; then
|
if compgen -G ".buildkite/output/*" >/dev/null; then
|
||||||
echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m"
|
echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m"
|
||||||
else
|
else
|
||||||
echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m"
|
echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$CMD" == "bump" ]]; then
|
if [[ "$CMD" == "bump" ]]; then
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
echo -e "\033[32;1mTARGET: successfully bumped client v$VERSION\033[0m"
|
echo -e "\033[32;1mTARGET: successfully bumped client v$VERSION\033[0m"
|
||||||
else
|
else
|
||||||
echo -e "\033[31;1mTARGET: failed bumped client v$VERSION\033[0m"
|
echo -e "\033[31;1mTARGET: failed bumped client v$VERSION\033[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$CMD" == "codegen" ]]; then
|
if [[ "$CMD" == "codegen" ]]; then
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
echo -e "\033[32;1mTARGET: successfully generated client v$VERSION\033[0m"
|
echo -e "\033[32;1mTARGET: successfully generated client v$VERSION\033[0m"
|
||||||
else
|
else
|
||||||
echo -e "\033[31;1mTARGET: failed generating client v$VERSION\033[0m"
|
echo -e "\033[31;1mTARGET: failed generating client v$VERSION\033[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$CMD" == "docsgen" ]]; then
|
if [[ "$CMD" == "docsgen" ]]; then
|
||||||
echo "TODO"
|
echo "TODO"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$CMD" == "examplesgen" ]]; then
|
if [[ "$CMD" == "examplesgen" ]]; then
|
||||||
echo "TODO"
|
echo "TODO"
|
||||||
fi
|
fi
|
||||||
|
|||||||
68
.github/workflows/nodejs.yml
vendored
68
.github/workflows/nodejs.yml
vendored
@ -2,7 +2,7 @@
|
|||||||
name: Node CI
|
name: Node CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target: {}
|
pull_request: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
paths-filter:
|
paths-filter:
|
||||||
@ -11,8 +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
|
||||||
- uses: dorny/paths-filter/@v2.11.1
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: dorny/paths-filter/@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
id: changes
|
id: changes
|
||||||
with:
|
with:
|
||||||
filters: |
|
filters: |
|
||||||
@ -30,14 +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:
|
||||||
|
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 }}
|
||||||
|
|
||||||
@ -53,15 +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:
|
||||||
|
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
|
||||||
|
|
||||||
@ -73,12 +83,38 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npm run license-checker
|
npm run license-checker
|
||||||
|
|
||||||
auto-approve:
|
test-bun:
|
||||||
name: Auto-approve
|
name: Test Bun
|
||||||
needs: [test, license]
|
runs-on: ${{ matrix.os }}
|
||||||
runs-on: ubuntu-latest
|
needs: paths-filter
|
||||||
permissions:
|
# only run if code relevant to unit tests was changed
|
||||||
pull-requests: write
|
if: needs.paths-filter.outputs.src-only == 'true'
|
||||||
if: github.actor == 'elasticmachine'
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: hmarr/auto-approve-action@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Use Bun
|
||||||
|
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: |
|
||||||
|
bun install
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: |
|
||||||
|
bun run lint
|
||||||
|
|
||||||
|
- name: Unit test
|
||||||
|
run: |
|
||||||
|
bun run test:unit-bun
|
||||||
|
|
||||||
|
- name: ECMAScript module test
|
||||||
|
run: |
|
||||||
|
bun run test:esm
|
||||||
|
|||||||
9
.github/workflows/npm-publish.yml
vendored
9
.github/workflows/npm-publish.yml
vendored
@ -9,15 +9,16 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: write
|
||||||
id-token: write
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
|
persist-credentials: false
|
||||||
ref: ${{ github.event.inputs.branch }}
|
ref: ${{ github.event.inputs.branch }}
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||||
with:
|
with:
|
||||||
node-version: "20.x"
|
node-version: "22.x"
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
- run: npm install -g npm
|
- run: npm install -g npm
|
||||||
- run: npm install
|
- run: npm install
|
||||||
|
|||||||
16
.github/workflows/serverless-patch.yml
vendored
16
.github/workflows/serverless-patch.yml
vendored
@ -26,26 +26,28 @@ jobs:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
|
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
|
||||||
repository: elastic/elasticsearch-serverless-js
|
repository: elastic/elasticsearch-serverless-js
|
||||||
ref: main
|
ref: main
|
||||||
path: serverless
|
path: serverless
|
||||||
- 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
|
||||||
title: '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 }}'
|
commit-message: "Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}"
|
||||||
body-path: /tmp/pr_body
|
body-path: /tmp/pr_body
|
||||||
draft: '${{ steps.apply-patch.outputs.PR_DRAFT }}'
|
draft: "${{ steps.apply-patch.outputs.PR_DRAFT }}"
|
||||||
add-paths: ':!*.rej'
|
add-paths: ":!*.rej"
|
||||||
|
|||||||
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
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -64,3 +64,7 @@ test/bundlers/parcel-test/.parcel-cache
|
|||||||
|
|
||||||
lib
|
lib
|
||||||
junit-output
|
junit-output
|
||||||
|
bun.lockb
|
||||||
|
test-results
|
||||||
|
processinfo
|
||||||
|
.tap
|
||||||
|
|||||||
@ -72,3 +72,5 @@ CODE_OF_CONDUCT.md
|
|||||||
CONTRIBUTING.md
|
CONTRIBUTING.md
|
||||||
|
|
||||||
src
|
src
|
||||||
|
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`
|
||||||
@ -252,8 +244,8 @@ const client = new Client({
|
|||||||
----
|
----
|
||||||
|
|
||||||
|`disablePrototypePoisoningProtection`
|
|`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. +
|
|`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:_ `false`
|
_Default:_ `true`
|
||||||
|
|
||||||
|`caFingerprint`
|
|`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. +
|
|`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. +
|
||||||
|
|||||||
@ -1,6 +1,138 @@
|
|||||||
[[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]
|
||||||
|
=== 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 <<esql-helper>> 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]
|
[discrete]
|
||||||
=== 8.15.0
|
=== 8.15.0
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,11 @@
|
|||||||
== Configuration
|
== 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.
|
section, you can see the possible options that you can use to configure it.
|
||||||
|
|
||||||
* <<basic-config>>
|
* <<basic-config>>
|
||||||
* <<advanced-config>>
|
* <<advanced-config>>
|
||||||
|
* <<timeout-best-practices>>
|
||||||
* <<child>>
|
* <<child>>
|
||||||
* <<client-testing>>
|
* <<client-testing>>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[[client-connecting]]
|
[[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}.
|
{es}.
|
||||||
|
|
||||||
**On this page**
|
**On this page**
|
||||||
@ -19,7 +19,7 @@ This page contains the information you need to connect and use the Client with
|
|||||||
[discrete]
|
[discrete]
|
||||||
=== Authentication
|
=== 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.
|
providers.
|
||||||
|
|
||||||
|
|
||||||
@ -27,18 +27,18 @@ providers.
|
|||||||
[[auth-ec]]
|
[[auth-ec]]
|
||||||
==== Elastic Cloud
|
==== Elastic Cloud
|
||||||
|
|
||||||
If you are using https://www.elastic.co/cloud[Elastic Cloud], the client offers
|
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
|
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
|
that you can find in the cloud console, then your username and password inside
|
||||||
the `auth` option.
|
the `auth` option.
|
||||||
|
|
||||||
NOTE: When connecting to Elastic Cloud, the client will automatically enable
|
NOTE: When connecting to Elastic Cloud, the client will automatically enable
|
||||||
both request and response compression by default, since it yields significant
|
both request and response compression by default, since it yields significant
|
||||||
throughput improvements. Moreover, the client will also set the tls option
|
throughput improvements. Moreover, the client will also set the tls option
|
||||||
`secureProtocol` to `TLSv1_2_method` unless specified otherwise. You can still
|
`secureProtocol` to `TLSv1_2_method` unless specified otherwise. You can still
|
||||||
override this option by configuring them.
|
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.
|
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]
|
Take a look https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how[here]
|
||||||
to know more.
|
to know more.
|
||||||
@ -61,18 +61,18 @@ const client = new Client({
|
|||||||
[[connect-self-managed-new]]
|
[[connect-self-managed-new]]
|
||||||
=== Connecting to a self-managed cluster
|
=== Connecting to a self-managed cluster
|
||||||
|
|
||||||
By default {es} will start with security features like authentication and TLS
|
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}
|
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
|
client to use HTTPS with the generated CA certificate in order to make requests
|
||||||
successfully.
|
successfully.
|
||||||
|
|
||||||
If you're just getting started with {es} we recommend reading the documentation
|
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]
|
on https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html[configuring]
|
||||||
and
|
and
|
||||||
https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html[starting {es}]
|
https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html[starting {es}]
|
||||||
to ensure your cluster is running as expected.
|
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):
|
below in the output from {es} (you may have to scroll up if it's been a while):
|
||||||
|
|
||||||
[source,sh]
|
[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
|
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
|
connection, either verifying with the CA certificate itself or via the HTTP CA
|
||||||
certificate fingerprint.
|
certificate fingerprint.
|
||||||
|
|
||||||
[discrete]
|
[discrete]
|
||||||
[[auth-tls]]
|
[[auth-tls]]
|
||||||
==== TLS configuration
|
==== TLS configuration
|
||||||
|
|
||||||
The generated root CA certificate can be found in the `certs` directory in your
|
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}
|
{es} config location (`$ES_CONF_PATH/certs/http_ca.crt`). If you're running {es}
|
||||||
in Docker there is
|
in Docker there is
|
||||||
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html[additional documentation for retrieving the CA certificate].
|
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
|
Without any additional configuration you can specify `https://` node urls, and
|
||||||
the certificates used to sign these requests will be verified. To turn off
|
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
|
certificate verification, you must specify an `tls` object in the top level
|
||||||
config and set `rejectUnauthorized: false`. The default `tls` values are the
|
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()`]
|
same that Node.js's https://nodejs.org/api/tls.html#tls_tls_connect_options_callback[`tls.connect()`]
|
||||||
uses.
|
uses.
|
||||||
|
|
||||||
[source,js]
|
[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:
|
certificate file:
|
||||||
|
|
||||||
[source,sh]
|
[source,sh]
|
||||||
@ -160,8 +160,8 @@ certificate file:
|
|||||||
openssl x509 -fingerprint -sha256 -noout -in /path/to/http_ca.crt
|
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
|
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
|
following script to output the root CA fingerprint of the {es} instance with
|
||||||
`openssl s_client`:
|
`openssl s_client`:
|
||||||
|
|
||||||
[source,sh]
|
[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.
|
WARNING: Running {es} without security enabled is not recommended.
|
||||||
|
|
||||||
If your cluster is configured with
|
If your cluster is configured with
|
||||||
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html[security explicitly disabled]
|
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html[security explicitly disabled]
|
||||||
then you can connect via HTTP:
|
then you can connect via HTTP:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
@ -208,14 +208,14 @@ Following you can find all the supported authentication strategies.
|
|||||||
[[auth-apikey]]
|
[[auth-apikey]]
|
||||||
==== ApiKey authentication
|
==== ApiKey authentication
|
||||||
|
|
||||||
You can use the
|
You can use the
|
||||||
{ref-7x}/security-api-create-api-key.html[ApiKey]
|
{ref-7x}/security-api-create-api-key.html[ApiKey]
|
||||||
authentication by passing the `apiKey` parameter via the `auth` option. The
|
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
|
`apiKey` parameter can be either a base64 encoded string or an object with the
|
||||||
values that you can obtain from the
|
values that you can obtain from the
|
||||||
{ref-7x}/security-api-create-api-key.html[create api key endpoint].
|
{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.
|
configuration, the ApiKey takes precedence.
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
@ -268,10 +268,10 @@ const client = new Client({
|
|||||||
[[auth-basic]]
|
[[auth-basic]]
|
||||||
==== Basic authentication
|
==== 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.
|
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.
|
configuration, the Api Key will take precedence.
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
@ -342,14 +342,14 @@ const result = await client.search({
|
|||||||
}, { meta: true })
|
}, { meta: true })
|
||||||
----
|
----
|
||||||
|
|
||||||
In this case, the result will be:
|
In this case, the result will be:
|
||||||
[source,ts]
|
[source,ts]
|
||||||
----
|
----
|
||||||
{
|
{
|
||||||
body: object | boolean
|
body: object | boolean
|
||||||
statusCode: number
|
statusCode: number
|
||||||
headers: object
|
headers: object
|
||||||
warnings: [string],
|
warnings: string[],
|
||||||
meta: object
|
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.
|
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`.
|
`RequestAbortedError`.
|
||||||
|
|
||||||
|
|
||||||
@ -410,19 +410,23 @@ The supported request specific options are:
|
|||||||
[cols=2*]
|
[cols=2*]
|
||||||
|===
|
|===
|
||||||
|`ignore`
|
|`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`
|
_Default:_ `null`
|
||||||
|
|
||||||
|`requestTimeout`
|
|`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`
|
_Default:_ `30000`
|
||||||
|
|
||||||
|
|`retryOnTimeout`
|
||||||
|
|`boolean` - Retry requests that have timed out.
|
||||||
|
_Default:_ `false`
|
||||||
|
|
||||||
|`maxRetries`
|
|`maxRetries`
|
||||||
|`number` - Max number of retries for the request, it overrides the client default. +
|
|`number` - Max number of retries for the request, it overrides the client default. +
|
||||||
_Default:_ `3`
|
_Default:_ `3`
|
||||||
|
|
||||||
|`compression`
|
|`compression`
|
||||||
|`string, boolean` - Enables body compression for the request. +
|
|`string | boolean` - Enables body compression for the request. +
|
||||||
_Options:_ `false`, `'gzip'` +
|
_Options:_ `false`, `'gzip'` +
|
||||||
_Default:_ `false`
|
_Default:_ `false`
|
||||||
|
|
||||||
@ -446,6 +450,10 @@ _Default:_ `null`
|
|||||||
|`any` - Custom object per request. _(you can use it to pass data to the clients events)_ +
|
|`any` - Custom object per request. _(you can use it to pass data to the clients events)_ +
|
||||||
_Default:_ `null`
|
_Default:_ `null`
|
||||||
|
|
||||||
|
|`opaqueId`
|
||||||
|
|`string` - Set the `X-Opaque-Id` HTTP header. See {ref}/api-conventions.html#x-opaque-id
|
||||||
|
_Default:_ `null`
|
||||||
|
|
||||||
|`maxResponseSize`
|
|`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 +
|
|`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`
|
_Default:_ `null`
|
||||||
@ -458,6 +466,17 @@ _Default:_ `null`
|
|||||||
|`AbortSignal` - The AbortSignal instance to allow request abortion. +
|
|`AbortSignal` - The AbortSignal instance to allow request abortion. +
|
||||||
_Default:_ `null`
|
_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 <<redaction>>.
|
||||||
|
|
||||||
|
|`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]
|
[discrete]
|
||||||
@ -537,8 +556,8 @@ Resources used to assess these recommendations:
|
|||||||
|
|
||||||
~Added~ ~in~ ~`v7.10.0`~
|
~Added~ ~in~ ~`v7.10.0`~
|
||||||
|
|
||||||
If you need to pass through an http(s) proxy for connecting to {es}, the client
|
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
|
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.
|
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.
|
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
|
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.
|
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.
|
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.
|
subsequent API calls.
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.inference.put({
|
||||||
method: "PUT",
|
task_type: "text_embedding",
|
||||||
path: "/_inference/text_embedding/my-e5-model",
|
inference_id: "my-e5-model",
|
||||||
body: {
|
inference_config: {
|
||||||
service: "elasticsearch",
|
service: "elasticsearch",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
num_allocations: 1,
|
num_allocations: 1,
|
||||||
|
|||||||
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);
|
||||||
|
----
|
||||||
@ -5,10 +5,16 @@
|
|||||||
----
|
----
|
||||||
const response = await client.indices.create({
|
const response = await client.indices.create({
|
||||||
index: "idx",
|
index: "idx",
|
||||||
mappings: {
|
settings: {
|
||||||
_source: {
|
index: {
|
||||||
mode: "synthetic",
|
mapping: {
|
||||||
|
source: {
|
||||||
|
mode: "synthetic",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
mappings: {
|
||||||
properties: {
|
properties: {
|
||||||
kwd: {
|
kwd: {
|
||||||
type: "keyword",
|
type: "keyword",
|
||||||
@ -26,7 +26,7 @@ const response1 = await client.cluster.putComponentTemplate({
|
|||||||
type: "keyword",
|
type: "keyword",
|
||||||
script: {
|
script: {
|
||||||
source:
|
source:
|
||||||
"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))",
|
"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
12
docs/doc_examples/01cd0ea360282a2c591a366679d7187d.asciidoc
Normal file
12
docs/doc_examples/01cd0ea360282a2c591a366679d7187d.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.tasks.list({
|
||||||
|
human: "true",
|
||||||
|
detailed: "true",
|
||||||
|
actions: "indices:data/write/bulk",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,13 +3,10 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.connector.updateApiKeyId({
|
||||||
method: "PUT",
|
connector_id: "my-connector",
|
||||||
path: "/_connector/my-connector/_api_key_id",
|
api_key_id: "my-api-key-id",
|
||||||
body: {
|
api_key_secret_id: "my-connector-secret-id",
|
||||||
api_key_id: "my-api-key-id",
|
|
||||||
api_key_secret_id: "my-connector-secret-id",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.inference.put({
|
||||||
method: "PUT",
|
task_type: "text_embedding",
|
||||||
path: "/_inference/text_embedding/google_vertex_ai_embeddings",
|
inference_id: "google_vertex_ai_embeddings",
|
||||||
body: {
|
inference_config: {
|
||||||
service: "googlevertexai",
|
service: "googlevertexai",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
service_account_json: "<service_account_json>",
|
service_account_json: "<service_account_json>",
|
||||||
|
|||||||
21
docs/doc_examples/05e637284bc3bedd46e0b7c26ad983c4.asciidoc
Normal file
21
docs/doc_examples/05e637284bc3bedd46e0b7c26ad983c4.asciidoc
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.ingest.putPipeline({
|
||||||
|
id: "alibabacloud_ai_search_embeddings_pipeline",
|
||||||
|
processors: [
|
||||||
|
{
|
||||||
|
inference: {
|
||||||
|
model_id: "alibabacloud_ai_search_embeddings",
|
||||||
|
input_output: {
|
||||||
|
input_field: "content",
|
||||||
|
output_field: "content_embedding",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.simulate.ingest({});
|
const response = await client.cluster.reroute();
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
10
docs/doc_examples/0722b302b2b3275a988d858044f99d5d.asciidoc
Normal file
10
docs/doc_examples/0722b302b2b3275a988d858044f99d5d.asciidoc
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.indices.getMapping({
|
||||||
|
index: "kibana_sample_data_ecommerce",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -11,6 +11,8 @@ const response = await client.indices.putSettings({
|
|||||||
"index.indexing.slowlog.threshold.index.debug": "2s",
|
"index.indexing.slowlog.threshold.index.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);
|
||||||
|
----
|
||||||
23
docs/doc_examples/083b92e8ea264e49bf9fd40fc6a3094b.asciidoc
Normal file
23
docs/doc_examples/083b92e8ea264e49bf9fd40fc6a3094b.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: "text_embedding",
|
||||||
|
inference_id: "my-e5-model",
|
||||||
|
inference_config: {
|
||||||
|
service: "elasticsearch",
|
||||||
|
service_settings: {
|
||||||
|
adaptive_allocations: {
|
||||||
|
enabled: true,
|
||||||
|
min_number_of_allocations: 3,
|
||||||
|
max_number_of_allocations: 10,
|
||||||
|
},
|
||||||
|
num_threads: 1,
|
||||||
|
model_id: ".multilingual-e5-small",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.inference.put({
|
||||||
method: "PUT",
|
task_type: "text_embedding",
|
||||||
path: "/_inference/text_embedding/amazon_bedrock_embeddings",
|
inference_id: "amazon_bedrock_embeddings",
|
||||||
body: {
|
inference_config: {
|
||||||
service: "amazonbedrock",
|
service: "amazonbedrock",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
access_key: "<aws_access_key>",
|
access_key: "<aws_access_key>",
|
||||||
|
|||||||
@ -3,29 +3,26 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.connector.updateFiltering({
|
||||||
method: "PUT",
|
connector_id: "my-g-drive-connector",
|
||||||
path: "/_connector/my-g-drive-connector/_filtering",
|
rules: [
|
||||||
body: {
|
{
|
||||||
rules: [
|
field: "file_extension",
|
||||||
{
|
id: "exclude-txt-files",
|
||||||
field: "file_extension",
|
order: 0,
|
||||||
id: "exclude-txt-files",
|
policy: "exclude",
|
||||||
order: 0,
|
rule: "equals",
|
||||||
policy: "exclude",
|
value: "txt",
|
||||||
rule: "equals",
|
},
|
||||||
value: "txt",
|
{
|
||||||
},
|
field: "_",
|
||||||
{
|
id: "DEFAULT",
|
||||||
field: "_",
|
order: 1,
|
||||||
id: "DEFAULT",
|
policy: "include",
|
||||||
order: 1,
|
rule: "regex",
|
||||||
policy: "include",
|
value: ".*",
|
||||||
rule: "regex",
|
},
|
||||||
value: ".*",
|
],
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
@ -10,7 +10,7 @@ const response = await client.search({
|
|||||||
type: "keyword",
|
type: "keyword",
|
||||||
script: {
|
script: {
|
||||||
source:
|
source:
|
||||||
"emit(doc['@timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ROOT))",
|
"emit(doc['@timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
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);
|
||||||
|
----
|
||||||
19
docs/doc_examples/0bee07a581c5776e068f6f4efad5a399.asciidoc
Normal file
19
docs/doc_examples/0bee07a581c5776e068f6f4efad5a399.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.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);
|
||||||
|
----
|
||||||
@ -10,7 +10,7 @@ const response = await client.ingest.putPipeline({
|
|||||||
{
|
{
|
||||||
attachment: {
|
attachment: {
|
||||||
field: "data",
|
field: "data",
|
||||||
remove_binary: false,
|
remove_binary: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
18
docs/doc_examples/0c8be7aec84ea86b243904f5d4162f5a.asciidoc
Normal file
18
docs/doc_examples/0c8be7aec84ea86b243904f5d4162f5a.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: "cooking_blog",
|
||||||
|
query: {
|
||||||
|
match: {
|
||||||
|
title: {
|
||||||
|
query: "fluffy pancakes breakfast",
|
||||||
|
minimum_should_match: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
15
docs/doc_examples/0d30077cd34e93377a3a86f2ebd69415.asciidoc
Normal file
15
docs/doc_examples/0d30077cd34e93377a3a86f2ebd69415.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.connector.put({
|
||||||
|
connector_id: "my-connector",
|
||||||
|
index_name: "search-google-drive",
|
||||||
|
name: "My Connector",
|
||||||
|
description: "My Connector to sync data to Elastic index from Google Drive",
|
||||||
|
service_type: "google_drive",
|
||||||
|
language: "en",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
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,24 @@
|
|||||||
|
|
||||||
[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: {
|
||||||
|
params: {
|
||||||
|
query_string: "my first query",
|
||||||
|
text_fields: [
|
||||||
|
{
|
||||||
|
name: "title",
|
||||||
|
boost: 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "description",
|
||||||
|
boost: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
21
docs/doc_examples/0e31b8ad176b31028becf9500989bcbd.asciidoc
Normal file
21
docs/doc_examples/0e31b8ad176b31028becf9500989bcbd.asciidoc
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.inference.put({
|
||||||
|
task_type: "text_embedding",
|
||||||
|
inference_id: "watsonx-embeddings",
|
||||||
|
inference_config: {
|
||||||
|
service: "watsonxai",
|
||||||
|
service_settings: {
|
||||||
|
api_key: "<api_key>",
|
||||||
|
url: "<url>",
|
||||||
|
model_id: "ibm/slate-30m-english-rtrvr",
|
||||||
|
project_id: "<project_id>",
|
||||||
|
api_version: "2024-03-14",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
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.merge.policy.max_merge_at_once_explicit": null,
|
index: {
|
||||||
|
number_of_replicas: "<original_number_of_replicas>",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
20
docs/doc_examples/0fbca60a487f5f22a4d51d73b2434cc4.asciidoc
Normal file
20
docs/doc_examples/0fbca60a487f5f22a4d51d73b2434cc4.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.indices.create({
|
||||||
|
index: "elser-embeddings",
|
||||||
|
mappings: {
|
||||||
|
properties: {
|
||||||
|
content_embedding: {
|
||||||
|
type: "sparse_vector",
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
type: "text",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -5,6 +5,11 @@
|
|||||||
----
|
----
|
||||||
const response = await client.security.queryUser({
|
const response = await client.security.queryUser({
|
||||||
with_profile_uid: "true",
|
with_profile_uid: "true",
|
||||||
|
query: {
|
||||||
|
prefix: {
|
||||||
|
roles: "other",
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
15
docs/doc_examples/11be807bdeaeecc8174dec88e0851ea7.asciidoc
Normal file
15
docs/doc_examples/11be807bdeaeecc8174dec88e0851ea7.asciidoc
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.transport.request({
|
||||||
|
method: "GET",
|
||||||
|
path: "/_connector/_sync_job",
|
||||||
|
querystring: {
|
||||||
|
connector_id: "my-connector-id",
|
||||||
|
size: "1",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
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);
|
||||||
|
----
|
||||||
18
docs/doc_examples/12e9e758f7f18a6cbf27e9d0aea57a19.asciidoc
Normal file
18
docs/doc_examples/12e9e758f7f18a6cbf27e9d0aea57a19.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.update({
|
||||||
|
index: ".elastic-connectors",
|
||||||
|
id: "connector_id",
|
||||||
|
doc: {
|
||||||
|
features: {
|
||||||
|
native_connector_api_keys: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,13 +3,11 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.inference.inference({
|
||||||
method: "POST",
|
task_type: "sparse_embedding",
|
||||||
path: "/_inference/sparse_embedding/my-elser-model",
|
inference_id: "my-elser-model",
|
||||||
body: {
|
input:
|
||||||
input:
|
"The sky above the port was the color of television tuned to a dead channel.",
|
||||||
"The sky above the port was the color of television tuned to a dead channel.",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
23
docs/doc_examples/13fe12cdb73bc89f07a83f1e6b127511.asciidoc
Normal file
23
docs/doc_examples/13fe12cdb73bc89f07a83f1e6b127511.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: "google-vertex-ai-embeddings",
|
||||||
|
mappings: {
|
||||||
|
properties: {
|
||||||
|
content_embedding: {
|
||||||
|
type: "dense_vector",
|
||||||
|
dims: 768,
|
||||||
|
element_type: "float",
|
||||||
|
similarity: "dot_product",
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
type: "text",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
16
docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc
Normal file
16
docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.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.inference.put({
|
||||||
|
task_type: "my-inference-endpoint",
|
||||||
|
inference_id: "_update",
|
||||||
|
inference_config: {
|
||||||
|
service_settings: {
|
||||||
|
api_key: "<API_KEY>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
12
docs/doc_examples/14a33c364873c2f930ca83d0a3005389.asciidoc
Normal file
12
docs/doc_examples/14a33c364873c2f930ca83d0a3005389.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.cluster.allocationExplain({
|
||||||
|
index: "my-index",
|
||||||
|
shard: 0,
|
||||||
|
primary: false,
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
19
docs/doc_examples/1522a9297151d7046e6345b9b27539ca.asciidoc
Normal file
19
docs/doc_examples/1522a9297151d7046e6345b9b27539ca.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.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);
|
||||||
|
----
|
||||||
28
docs/doc_examples/15f769bbd7b5fddeb3353ae726b71b14.asciidoc
Normal file
28
docs/doc_examples/15f769bbd7b5fddeb3353ae726b71b14.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-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);
|
||||||
|
----
|
||||||
@ -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: {},
|
||||||
|
|||||||
15
docs/doc_examples/16a7ce08b4a6b3af269f27eecc71d664.asciidoc
Normal file
15
docs/doc_examples/16a7ce08b4a6b3af269f27eecc71d664.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.delete({
|
||||||
|
index: "books",
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
|
||||||
|
const response1 = await client.indices.delete({
|
||||||
|
index: "my-explicit-mappings-books",
|
||||||
|
});
|
||||||
|
console.log(response1);
|
||||||
|
----
|
||||||
26
docs/doc_examples/17316a81c9dbdd120b7754116bf0461c.asciidoc
Normal file
26
docs/doc_examples/17316a81c9dbdd120b7754116bf0461c.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.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);
|
||||||
|
----
|
||||||
@ -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,8 +3,8 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.cluster.reroute({
|
const response = await client.indices.create({
|
||||||
metric: "none",
|
index: "books",
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
@ -3,6 +3,27 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.simulate.ingest({});
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_ingest/_simulate",
|
||||||
|
body: {
|
||||||
|
docs: [
|
||||||
|
{
|
||||||
|
_index: "my-index",
|
||||||
|
_id: "123",
|
||||||
|
_source: {
|
||||||
|
foo: "bar",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_index: "my-index",
|
||||||
|
_id: "456",
|
||||||
|
_source: {
|
||||||
|
foo: "rab",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.inference.put({
|
||||||
method: "PUT",
|
task_type: "text_embedding",
|
||||||
path: "/_inference/text_embedding/openai_embeddings",
|
inference_id: "openai_embeddings",
|
||||||
body: {
|
inference_config: {
|
||||||
service: "openai",
|
service: "openai",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
api_key: "<api_key>",
|
api_key: "<api_key>",
|
||||||
|
|||||||
19
docs/doc_examples/1a7483796087053ba55029d0dc2ab356.asciidoc
Normal file
19
docs/doc_examples/1a7483796087053ba55029d0dc2ab356.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.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);
|
||||||
|
----
|
||||||
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.inference.put({
|
||||||
method: "PUT",
|
task_type: "rerank",
|
||||||
path: "/_inference/rerank/google_vertex_ai_rerank",
|
inference_id: "google_vertex_ai_rerank",
|
||||||
body: {
|
inference_config: {
|
||||||
service: "googlevertexai",
|
service: "googlevertexai",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
service_account_json: "<service_account_json>",
|
service_account_json: "<service_account_json>",
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.ingest.putPipeline({
|
const response = await client.ingest.putPipeline({
|
||||||
id: "hugging_face_embeddings",
|
id: "hugging_face_embeddings_pipeline",
|
||||||
processors: [
|
processors: [
|
||||||
{
|
{
|
||||||
inference: {
|
inference: {
|
||||||
@ -4,7 +4,7 @@
|
|||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.delete({
|
const response = await client.indices.delete({
|
||||||
index: "my-index",
|
index: "music",
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
21
docs/doc_examples/1cbecd19be22979aefb45b4f160e77ea.asciidoc
Normal file
21
docs/doc_examples/1cbecd19be22979aefb45b4f160e77ea.asciidoc
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.ingest.putPipeline({
|
||||||
|
id: "google_vertex_ai_embeddings_pipeline",
|
||||||
|
processors: [
|
||||||
|
{
|
||||||
|
inference: {
|
||||||
|
model_id: "google_vertex_ai_embeddings",
|
||||||
|
input_output: {
|
||||||
|
input_field: "content",
|
||||||
|
output_field: "content_embedding",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.inference.put({
|
||||||
method: "PUT",
|
task_type: "text_embedding",
|
||||||
path: "/_inference/text_embedding/azure_ai_studio_embeddings",
|
inference_id: "azure_ai_studio_embeddings",
|
||||||
body: {
|
inference_config: {
|
||||||
service: "azureaistudio",
|
service: "azureaistudio",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
api_key: "<api_key>",
|
api_key: "<api_key>",
|
||||||
|
|||||||
@ -3,12 +3,8 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.connector.list({
|
||||||
method: "GET",
|
service_type: "sharepoint_online",
|
||||||
path: "/_connector",
|
|
||||||
querystring: {
|
|
||||||
service_type: "sharepoint_online",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
19
docs/doc_examples/1ead35c954963e83f89872048dabdbe9.asciidoc
Normal file
19
docs/doc_examples/1ead35c954963e83f89872048dabdbe9.asciidoc
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.security.queryRole({
|
||||||
|
query: {
|
||||||
|
bool: {
|
||||||
|
must_not: {
|
||||||
|
term: {
|
||||||
|
"metadata._reserved": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sort: ["name"],
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
33
docs/doc_examples/1fb2c77c0988bc6545040b20e3afa7e9.asciidoc
Normal file
33
docs/doc_examples/1fb2c77c0988bc6545040b20e3afa7e9.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.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);
|
||||||
|
----
|
||||||
22
docs/doc_examples/20179a8889e949d6a8ee5fbf2ba35c96.asciidoc
Normal file
22
docs/doc_examples/20179a8889e949d6a8ee5fbf2ba35c96.asciidoc
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "google-vertex-ai-embeddings",
|
||||||
|
knn: {
|
||||||
|
field: "content_embedding",
|
||||||
|
query_vector_builder: {
|
||||||
|
text_embedding: {
|
||||||
|
model_id: "google_vertex_ai_embeddings",
|
||||||
|
model_text: "Calculate fuel cost",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
k: 10,
|
||||||
|
num_candidates: 100,
|
||||||
|
},
|
||||||
|
_source: ["id", "content"],
|
||||||
|
});
|
||||||
|
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,10 +3,10 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.transport.request({
|
const response = await client.inference.put({
|
||||||
method: "PUT",
|
task_type: "text_embedding",
|
||||||
path: "/_inference/text_embedding/azure_ai_studio_embeddings",
|
inference_id: "azure_ai_studio_embeddings",
|
||||||
body: {
|
inference_config: {
|
||||||
service: "azureaistudio",
|
service: "azureaistudio",
|
||||||
service_settings: {
|
service_settings: {
|
||||||
api_key: "<api_key>",
|
api_key: "<api_key>",
|
||||||
|
|||||||
@ -5,10 +5,16 @@
|
|||||||
----
|
----
|
||||||
const response = await client.indices.create({
|
const response = await client.indices.create({
|
||||||
index: "idx",
|
index: "idx",
|
||||||
mappings: {
|
settings: {
|
||||||
_source: {
|
index: {
|
||||||
mode: "synthetic",
|
mapping: {
|
||||||
|
source: {
|
||||||
|
mode: "synthetic",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
mappings: {
|
||||||
properties: {
|
properties: {
|
||||||
card: {
|
card: {
|
||||||
type: "wildcard",
|
type: "wildcard",
|
||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.indices.unfreeze({
|
const response = await client.indices.rollover({
|
||||||
index: "my-index-000001",
|
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);
|
||||||
|
----
|
||||||
@ -10,7 +10,7 @@ const response = await client.search({
|
|||||||
"date.day_of_week": {
|
"date.day_of_week": {
|
||||||
type: "keyword",
|
type: "keyword",
|
||||||
script:
|
script:
|
||||||
"emit(doc['date'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))",
|
"emit(doc['date'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
aggs: {
|
aggs: {
|
||||||
@ -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);
|
||||||
|
----
|
||||||
@ -11,7 +11,7 @@ const response = await client.reindex({
|
|||||||
},
|
},
|
||||||
dest: {
|
dest: {
|
||||||
index: "azure-ai-studio-embeddings",
|
index: "azure-ai-studio-embeddings",
|
||||||
pipeline: "azure_ai_studio_embeddings",
|
pipeline: "azure_ai_studio_embeddings_pipeline",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
@ -3,6 +3,14 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.security.oidcLogout({});
|
const response = await client.transport.request({
|
||||||
|
method: "POST",
|
||||||
|
path: "/_security/oidc/logout",
|
||||||
|
body: {
|
||||||
|
token:
|
||||||
|
"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
|
||||||
|
refresh_token: "vLBPvmAB6KvwvJZr27cS",
|
||||||
|
},
|
||||||
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
26
docs/doc_examples/2a21674c40f9b182a8944769d20b2357.asciidoc
Normal file
26
docs/doc_examples/2a21674c40f9b182a8944769d20b2357.asciidoc
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// This file is autogenerated, DO NOT EDIT
|
||||||
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||||
|
|
||||||
|
[source, js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: "my-rank-vectors-float",
|
||||||
|
query: {
|
||||||
|
script_score: {
|
||||||
|
query: {
|
||||||
|
match_all: {},
|
||||||
|
},
|
||||||
|
script: {
|
||||||
|
source: "maxSimDotProduct(params.query_vector, 'my_vector')",
|
||||||
|
params: {
|
||||||
|
query_vector: [
|
||||||
|
[0.5, 10, 6],
|
||||||
|
[-0.5, 10, 10],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
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);
|
||||||
|
----
|
||||||
10
docs/doc_examples/2acf75803494fef29f9ca70671aa6be1.asciidoc
Normal file
10
docs/doc_examples/2acf75803494fef29f9ca70671aa6be1.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.security.bulkDeleteRole({
|
||||||
|
names: ["my_admin_role", "superuser"],
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
----
|
||||||
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,9 +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=",
|
||||||
|
querystring: {
|
||||||
|
wait_for_completion_timeout: "30s",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
77
docs/doc_examples/2c079d1ae4819a0c206b9e1aa5623523.asciidoc
Normal file
77
docs/doc_examples/2c079d1ae4819a0c206b9e1aa5623523.asciidoc
Normal file
@ -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);
|
||||||
|
----
|
||||||
28
docs/doc_examples/2c86840a46242a38cf82024a9321be46.asciidoc
Normal file
28
docs/doc_examples/2c86840a46242a38cf82024a9321be46.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.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);
|
||||||
|
----
|
||||||
25
docs/doc_examples/2d0244c020075595acb625aa5ba8f455.asciidoc
Normal file
25
docs/doc_examples/2d0244c020075595acb625aa5ba8f455.asciidoc
Normal file
@ -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);
|
||||||
|
----
|
||||||
16
docs/doc_examples/2e09666d3ad5ad9afc22763ee6e97a2b.asciidoc
Normal file
16
docs/doc_examples/2e09666d3ad5ad9afc22763ee6e97a2b.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.slm.putLifecycle({
|
||||||
|
policy_id: "hourly-snapshots",
|
||||||
|
schedule: "1h",
|
||||||
|
name: "<hourly-snap-{now/d}>",
|
||||||
|
repository: "my_repository",
|
||||||
|
config: {
|
||||||
|
indices: ["data-*", "important"],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
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