Compare commits
3 Commits
v9.0.0-alp
...
drop-body-
| Author | SHA1 | Date | |
|---|---|---|---|
| 70aae3b44f | |||
| 444975b4e6 | |||
| 341168d2a1 |
19
.github/workflows/docs-build.yml
vendored
19
.github/workflows/docs-build.yml
vendored
@ -1,19 +0,0 @@
|
||||
name: docs-build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request_target: ~
|
||||
merge_group: ~
|
||||
|
||||
jobs:
|
||||
docs-preview:
|
||||
uses: elastic/docs-builder/.github/workflows/preview-build.yml@main
|
||||
with:
|
||||
path-pattern: docs/**
|
||||
permissions:
|
||||
deployments: write
|
||||
id-token: write
|
||||
contents: read
|
||||
pull-requests: read
|
||||
14
.github/workflows/docs-cleanup.yml
vendored
14
.github/workflows/docs-cleanup.yml
vendored
@ -1,14 +0,0 @@
|
||||
name: docs-cleanup
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
docs-preview:
|
||||
uses: elastic/docs-builder/.github/workflows/preview-cleanup.yml@main
|
||||
permissions:
|
||||
contents: none
|
||||
id-token: write
|
||||
deployments: write
|
||||
4
.github/workflows/nodejs.yml
vendored
4
.github/workflows/nodejs.yml
vendored
@ -41,7 +41,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
|
||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
@ -71,7 +71,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
|
||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: 22.x
|
||||
|
||||
|
||||
37
.github/workflows/npm-publish.yml
vendored
37
.github/workflows/npm-publish.yml
vendored
@ -16,45 +16,26 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: "22.x"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
- run: npm install -g npm
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
- name: npm publish
|
||||
run: |
|
||||
version=$(jq -r .version package.json)
|
||||
tag_meta=$(echo "$version" | cut -s -d '-' -f2)
|
||||
if [[ -z "$tag_meta" ]]; then
|
||||
npm publish --provenance --access public
|
||||
else
|
||||
tag=$(echo "$tag_meta" | cut -d '.' -f1)
|
||||
npm publish --provenance --access public --tag "$tag"
|
||||
fi
|
||||
- run: npm publish --provenance --access public --tag alpha
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
- name: Publish version on GitHub
|
||||
run: |
|
||||
version=$(jq -r .version package.json)
|
||||
tag_meta=$(echo "$version" | cut -s -d '-' -f2)
|
||||
if [[ -z "$tag_meta" ]]; then
|
||||
gh release create \
|
||||
-n "[Changelog](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/$BRANCH_NAME/changelog-client.html)"
|
||||
--target "$BRANCH_NAME" \
|
||||
--title "v$version" \
|
||||
"v$version"
|
||||
else
|
||||
tag_main=$(echo "$version" | cut -d '-' -f1)
|
||||
gh release create \
|
||||
-n "This is a $tag_main pre-release. Changes may not be stable." \
|
||||
--latest=false \
|
||||
--prerelease \
|
||||
--target "$BRANCH_NAME" \
|
||||
--title "v$version" \
|
||||
"v$version"
|
||||
fi
|
||||
gh release create \
|
||||
-n "This is a 9.0.0 pre-release alpha. Changes may not be stable." \
|
||||
--latest=false \
|
||||
--prerelease \
|
||||
--target "$BRANCH_NAME" \
|
||||
--title "v$version" \
|
||||
"v$version"
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.event.inputs.branch }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
43
.github/workflows/serverless-patch.sh
vendored
Executable file
43
.github/workflows/serverless-patch.sh
vendored
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -exuo pipefail
|
||||
|
||||
merge_commit_sha=$(jq -r '.pull_request.merge_commit_sha' "$GITHUB_EVENT_PATH")
|
||||
pull_request_id=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH")
|
||||
pr_shortcode="elastic/elasticsearch-js#$pull_request_id"
|
||||
|
||||
# generate patch file
|
||||
cd "$GITHUB_WORKSPACE/stack"
|
||||
git format-patch -1 --stdout "$merge_commit_sha" > /tmp/patch.diff
|
||||
|
||||
# set committer info
|
||||
git config --global user.email "elasticmachine@users.noreply.github.com"
|
||||
git config --global user.name "Elastic Machine"
|
||||
|
||||
# apply patch file
|
||||
cd "$GITHUB_WORKSPACE/serverless"
|
||||
git am -C1 --reject /tmp/patch.diff || git am --quit
|
||||
|
||||
# generate PR body comment
|
||||
comment="Patch applied from $pr_shortcode"
|
||||
|
||||
# enumerate rejected patches in PR comment
|
||||
has_rejects='false'
|
||||
for f in ./**/*.rej; do
|
||||
has_rejects='true'
|
||||
comment="$comment
|
||||
|
||||
## Rejected patch \`$f\` must be resolved:
|
||||
|
||||
\`\`\`diff
|
||||
$(cat "$f")
|
||||
\`\`\`
|
||||
"
|
||||
done
|
||||
|
||||
# delete .rej files
|
||||
rm -fv ./**/*.rej
|
||||
|
||||
# send data to output parameters
|
||||
echo "$comment" > /tmp/pr_body
|
||||
echo "PR_DRAFT=$has_rejects" >> "$GITHUB_OUTPUT"
|
||||
53
.github/workflows/serverless-patch.yml
vendored
Normal file
53
.github/workflows/serverless-patch.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
---
|
||||
name: Apply PR changes to serverless
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- closed
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
apply-patch:
|
||||
name: Apply patch
|
||||
runs-on: ubuntu-latest
|
||||
# Only react to merged PRs for security reasons.
|
||||
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
|
||||
if: >
|
||||
github.event.pull_request.merged
|
||||
&& (
|
||||
(
|
||||
github.event.action == 'closed'
|
||||
&& contains(github.event.pull_request.labels.*.name, 'apply-to-serverless')
|
||||
)
|
||||
||
|
||||
(
|
||||
github.event.action == 'labeled'
|
||||
&& github.event.label.name == 'apply-to-serverless'
|
||||
)
|
||||
)
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
repository: elastic/elasticsearch-js
|
||||
ref: main
|
||||
path: stack
|
||||
fetch-depth: 0
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
repository: elastic/elasticsearch-serverless-js
|
||||
ref: main
|
||||
path: serverless
|
||||
- name: Apply patch from stack to serverless
|
||||
id: apply-patch
|
||||
run: $GITHUB_WORKSPACE/stack/.github/workflows/serverless-patch.sh
|
||||
- uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7
|
||||
with:
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
path: serverless
|
||||
title: "Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}"
|
||||
commit-message: "Apply patch from elastic/elasticsearch-js#${{ github.event.pull_request.number }}"
|
||||
body-path: /tmp/pr_body
|
||||
draft: "${{ steps.apply-patch.outputs.PR_DRAFT }}"
|
||||
add-paths: ":!*.rej"
|
||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9
|
||||
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9
|
||||
with:
|
||||
stale-issue-label: stale
|
||||
stale-pr-label: stale
|
||||
|
||||
@ -28,9 +28,6 @@ spec:
|
||||
spec:
|
||||
repository: elastic/elasticsearch-js
|
||||
pipeline_file: .buildkite/pipeline.yml
|
||||
env:
|
||||
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: "true"
|
||||
SLACK_NOTIFICATIONS_CHANNEL: "#devtools-notify-javascript"
|
||||
teams:
|
||||
devtools-team:
|
||||
access_level: MANAGE_BUILD_AND_READ
|
||||
@ -48,9 +45,6 @@ spec:
|
||||
8_x:
|
||||
branch: "8.x"
|
||||
cronline: "@daily"
|
||||
8_17:
|
||||
branch: "8.17"
|
||||
cronline: "@daily"
|
||||
8_18:
|
||||
branch: "8.18"
|
||||
8_14:
|
||||
branch: "8.16"
|
||||
cronline: "@daily"
|
||||
|
||||
@ -13,6 +13,7 @@ const client = new Client({
|
||||
cloud: { id: '<cloud-id>' },
|
||||
auth: { apiKey: 'base64EncodedKey' },
|
||||
maxRetries: 5,
|
||||
requestTimeout: 60000,
|
||||
sniffOnStart: true
|
||||
})
|
||||
----
|
||||
@ -81,7 +82,7 @@ _Default:_ `3`
|
||||
|
||||
|`requestTimeout`
|
||||
|`number` - Max request timeout in milliseconds for each request. +
|
||||
_Default:_ No value
|
||||
_Default:_ `30000`
|
||||
|
||||
|`pingTimeout`
|
||||
|`number` - Max ping request timeout in milliseconds for each request. +
|
||||
|
||||
@ -12,27 +12,6 @@
|
||||
|
||||
In 8.0, the top-level `body` parameter that was available on all API functions <<remove-body-key,was deprecated>>. In 9.0 this property is completely removed.
|
||||
|
||||
[discrete]
|
||||
===== Remove the default 30-second timeout on all requests sent to Elasticsearch
|
||||
|
||||
Setting HTTP timeouts on Elasticsearch requests goes against Elastic's recommendations. See <<timeout-best-practices>> for more information.
|
||||
|
||||
[discrete]
|
||||
=== 8.17.1
|
||||
|
||||
[discrete]
|
||||
==== Fixes
|
||||
|
||||
[discrete]
|
||||
===== Improved support for Elasticsearch `v8.17`
|
||||
|
||||
Updated TypeScript types based on fixes and improvements to the Elasticsearch specification.
|
||||
|
||||
[discrete]
|
||||
===== Report correct transport connection type in telemetry
|
||||
|
||||
The client's telemetry reporting mechanism was incorrectly reporting all traffic as using `HttpConnection` when the default is `UndiciConnection`. https://github.com/elastic/elasticsearch-js/issues/2324[#2324]
|
||||
|
||||
[discrete]
|
||||
=== 8.17.0
|
||||
|
||||
@ -45,22 +24,6 @@ The client's telemetry reporting mechanism was incorrectly reporting all traffic
|
||||
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.4
|
||||
|
||||
[discrete]
|
||||
==== Fixes
|
||||
|
||||
[discrete]
|
||||
===== Improved support for Elasticsearch `v8.16`
|
||||
|
||||
Updated TypeScript types based on fixes and improvements to the Elasticsearch specification.
|
||||
|
||||
[discrete]
|
||||
===== Report correct transport connection type in telemetry
|
||||
|
||||
The client's telemetry reporting mechanism was incorrectly reporting all traffic as using `HttpConnection` when the default is `UndiciConnection`. https://github.com/elastic/elasticsearch-js/issues/2324[#2324]
|
||||
|
||||
[discrete]
|
||||
=== 8.16.3
|
||||
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
[[child]]
|
||||
=== Creating a child client
|
||||
|
||||
There are some use cases where you may need multiple instances of the client.
|
||||
You can easily do that by calling `new Client()` as many times as you need, but
|
||||
you will lose all the benefits of using one single client, such as the long
|
||||
living connections and the connection pool handling. To avoid this problem, the
|
||||
client offers a `child` API, which returns a new client instance that shares the
|
||||
There are some use cases where you may need multiple instances of the client.
|
||||
You can easily do that by calling `new Client()` as many times as you need, but
|
||||
you will lose all the benefits of using one single client, such as the long
|
||||
living connections and the connection pool handling. To avoid this problem, the
|
||||
client offers a `child` API, which returns a new client instance that shares the
|
||||
connection pool with the parent client.
|
||||
|
||||
NOTE: The event emitter is shared between the parent and the child(ren). If you
|
||||
extend the parent client, the child client will have the same extensions, while
|
||||
NOTE: The event emitter is shared between the parent and the child(ren). If you
|
||||
extend the parent client, the child client will have the same extensions, while
|
||||
if the child client adds an extension, the parent client will not be extended.
|
||||
|
||||
You can pass to the `child` every client option you would pass to a normal
|
||||
client, but the connection pool specific options (`ssl`, `agent`, `pingTimeout`,
|
||||
You can pass to the `child` every client option you would pass to a normal
|
||||
client, but the connection pool specific options (`ssl`, `agent`, `pingTimeout`,
|
||||
`Connection`, and `resurrectStrategy`).
|
||||
|
||||
CAUTION: If you call `close` in any of the parent/child clients, every client
|
||||
CAUTION: If you call `close` in any of the parent/child clients, every client
|
||||
will be closed.
|
||||
|
||||
[source,js]
|
||||
@ -28,8 +28,9 @@ const client = new Client({
|
||||
})
|
||||
const child = client.child({
|
||||
headers: { 'x-foo': 'bar' },
|
||||
requestTimeout: 1000
|
||||
})
|
||||
|
||||
client.info().then(console.log, console.log)
|
||||
child.info().then(console.log, console.log)
|
||||
----
|
||||
----
|
||||
@ -414,8 +414,8 @@ The supported request specific options are:
|
||||
_Default:_ `null`
|
||||
|
||||
|`requestTimeout`
|
||||
|`number | string | null` - Max request timeout for the request in milliseconds. This overrides the client default, which is to not time out at all. See https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#_http_client_configuration[Elasticsearch best practices for HTML clients] for more info. +
|
||||
_Default:_ No timeout
|
||||
|`number | string` - Max request timeout for the request in milliseconds, it overrides the client default. +
|
||||
_Default:_ `30000`
|
||||
|
||||
|`retryOnTimeout`
|
||||
|`boolean` - Retry requests that have timed out.
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.getDataStream({
|
||||
name: "my-data-stream",
|
||||
filter_path: "data_streams.indices.index_name",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,10 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.getMapping({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,42 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "my-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);
|
||||
----
|
||||
@ -5,8 +5,10 @@
|
||||
----
|
||||
const response = await client.cluster.putSettings({
|
||||
persistent: {
|
||||
"cluster.routing.allocation.disk.watermark.low": "90%",
|
||||
"cluster.routing.allocation.disk.watermark.high": "95%",
|
||||
"cluster.routing.allocation.disk.watermark.low": "100gb",
|
||||
"cluster.routing.allocation.disk.watermark.high": "50gb",
|
||||
"cluster.routing.allocation.disk.watermark.flood_stage": "10gb",
|
||||
"cluster.info.update.interval": "1m",
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -1,20 +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.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);
|
||||
----
|
||||
@ -1,11 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.addBlock({
|
||||
index: ".ml-anomalies-custom-example",
|
||||
block: "read_only",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -6,15 +6,14 @@
|
||||
const response = await client.search({
|
||||
index: "test-index",
|
||||
query: {
|
||||
match: {
|
||||
my_semantic_field: "Which country is Paris in?",
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
fields: {
|
||||
my_semantic_field: {
|
||||
number_of_fragments: 2,
|
||||
order: "score",
|
||||
nested: {
|
||||
path: "inference_field.inference.chunks",
|
||||
query: {
|
||||
sparse_vector: {
|
||||
field: "inference_field.inference.chunks.embeddings",
|
||||
inference_id: "my-inference-id",
|
||||
query: "mountain lake",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -10,7 +10,7 @@ const response = await client.ingest.putPipeline({
|
||||
{
|
||||
attachment: {
|
||||
field: "data",
|
||||
remove_binary: true,
|
||||
remove_binary: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
@ -1,19 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.security.queryRole({
|
||||
query: {
|
||||
bool: {
|
||||
must_not: {
|
||||
term: {
|
||||
"metadata._reserved": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
sort: ["name"],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -14,7 +14,6 @@ const response = await client.indices.putSettings({
|
||||
"index.search.slowlog.threshold.fetch.info": "800ms",
|
||||
"index.search.slowlog.threshold.fetch.debug": "500ms",
|
||||
"index.search.slowlog.threshold.fetch.trace": "200ms",
|
||||
"index.search.slowlog.include.user": true,
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -1,67 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "my-rank-vectors-bit",
|
||||
mappings: {
|
||||
properties: {
|
||||
my_vector: {
|
||||
type: "rank_vectors",
|
||||
element_type: "bit",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
|
||||
const response1 = await client.bulk({
|
||||
index: "my-rank-vectors-bit",
|
||||
refresh: "true",
|
||||
operations: [
|
||||
{
|
||||
index: {
|
||||
_id: "1",
|
||||
},
|
||||
},
|
||||
{
|
||||
my_vector: [127, -127, 0, 1, 42],
|
||||
},
|
||||
{
|
||||
index: {
|
||||
_id: "2",
|
||||
},
|
||||
},
|
||||
{
|
||||
my_vector: "8100012a7f",
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response1);
|
||||
|
||||
const response2 = await client.search({
|
||||
index: "my-rank-vectors-bit",
|
||||
query: {
|
||||
script_score: {
|
||||
query: {
|
||||
match_all: {},
|
||||
},
|
||||
script: {
|
||||
source: "maxSimDotProduct(params.query_vector, 'my_vector')",
|
||||
params: {
|
||||
query_vector: [
|
||||
[
|
||||
0.35, 0.77, 0.95, 0.15, 0.11, 0.08, 0.58, 0.06, 0.44, 0.52, 0.21,
|
||||
0.62, 0.65, 0.16, 0.64, 0.39, 0.93, 0.06, 0.93, 0.31, 0.92, 0,
|
||||
0.66, 0.86, 0.92, 0.03, 0.81, 0.31, 0.2, 0.92, 0.95, 0.64, 0.19,
|
||||
0.26, 0.77, 0.64, 0.78, 0.32, 0.97, 0.84,
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response2);
|
||||
----
|
||||
@ -1,11 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.addBlock({
|
||||
index: ".ml-anomalies-custom-example",
|
||||
block: "write",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,26 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "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);
|
||||
----
|
||||
@ -1,35 +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.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);
|
||||
----
|
||||
@ -4,10 +4,9 @@
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.putSettings({
|
||||
index: "*",
|
||||
index: "my-index-000001",
|
||||
settings: {
|
||||
"index.indexing.slowlog.include.user": true,
|
||||
"index.indexing.slowlog.threshold.index.warn": "30s",
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -1,23 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "test-index",
|
||||
mappings: {
|
||||
properties: {
|
||||
source_field: {
|
||||
type: "text",
|
||||
fields: {
|
||||
infer_field: {
|
||||
type: "semantic_text",
|
||||
inference_id: ".elser-2-elasticsearch",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,28 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "my-index-*",
|
||||
query: {
|
||||
bool: {
|
||||
must: [
|
||||
{
|
||||
match: {
|
||||
"user.id": "kimchy",
|
||||
},
|
||||
},
|
||||
],
|
||||
must_not: [
|
||||
{
|
||||
terms: {
|
||||
_index: ["my-index-01"],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.migration.deprecations({
|
||||
index: ".ml-anomalies-*",
|
||||
const response = await client.indices.unfreeze({
|
||||
index: "my-index-000001",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,31 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.ilm.putLifecycle({
|
||||
name: "my_policy",
|
||||
policy: {
|
||||
phases: {
|
||||
hot: {
|
||||
actions: {
|
||||
rollover: {
|
||||
max_primary_shard_size: "50gb",
|
||||
},
|
||||
searchable_snapshot: {
|
||||
snapshot_repository: "backing_repo",
|
||||
replicate_for: "14d",
|
||||
},
|
||||
},
|
||||
},
|
||||
delete: {
|
||||
min_age: "28d",
|
||||
actions: {
|
||||
delete: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -4,11 +4,9 @@
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.putSettings({
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
index: "my-index-000001",
|
||||
settings: {
|
||||
index: {
|
||||
number_of_replicas: 0,
|
||||
},
|
||||
"index.search.slowlog.include.user": true,
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -6,7 +6,6 @@
|
||||
const response = await client.indices.resolveCluster({
|
||||
name: "not-present,clust*:my-index*,oldcluster:*",
|
||||
ignore_unavailable: "false",
|
||||
timeout: "5s",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -10,7 +10,7 @@ const response = await client.ingest.putPipeline({
|
||||
{
|
||||
attachment: {
|
||||
field: "data",
|
||||
remove_binary: true,
|
||||
remove_binary: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
@ -1,70 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "movies",
|
||||
size: 10,
|
||||
retriever: {
|
||||
rescorer: {
|
||||
rescore: {
|
||||
window_size: 50,
|
||||
query: {
|
||||
rescore_query: {
|
||||
script_score: {
|
||||
query: {
|
||||
match_all: {},
|
||||
},
|
||||
script: {
|
||||
source:
|
||||
"cosineSimilarity(params.queryVector, 'product-vector_final_stage') + 1.0",
|
||||
params: {
|
||||
queryVector: [-0.5, 90, -10, 14.8, -156],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
retriever: {
|
||||
rrf: {
|
||||
rank_window_size: 100,
|
||||
retrievers: [
|
||||
{
|
||||
standard: {
|
||||
query: {
|
||||
sparse_vector: {
|
||||
field: "plot_embedding",
|
||||
inference_id: "my-elser-model",
|
||||
query: "films that explore psychological depths",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
standard: {
|
||||
query: {
|
||||
multi_match: {
|
||||
query: "crime",
|
||||
fields: ["plot", "title"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
knn: {
|
||||
field: "vector",
|
||||
query_vector: [10, 22, 77],
|
||||
k: 10,
|
||||
num_candidates: 10,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,23 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "my-index",
|
||||
settings: {
|
||||
index: {
|
||||
number_of_shards: 3,
|
||||
"blocks.write": true,
|
||||
},
|
||||
},
|
||||
mappings: {
|
||||
properties: {
|
||||
field1: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
23
docs/doc_examples/38ba93890494bfa7beece58dffa44f98.asciidoc
Normal file
23
docs/doc_examples/38ba93890494bfa7beece58dffa44f98.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.bulk({
|
||||
index: "test-index",
|
||||
operations: [
|
||||
{
|
||||
update: {
|
||||
_id: "1",
|
||||
},
|
||||
},
|
||||
{
|
||||
doc: {
|
||||
infer_field: "updated inference field",
|
||||
source_field: "updated source field",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,19 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: ".ml-anomalies-custom-example",
|
||||
size: 0,
|
||||
aggs: {
|
||||
job_ids: {
|
||||
terms: {
|
||||
field: "job_id",
|
||||
size: 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,61 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "retrievers_example",
|
||||
retriever: {
|
||||
linear: {
|
||||
retrievers: [
|
||||
{
|
||||
retriever: {
|
||||
standard: {
|
||||
query: {
|
||||
function_score: {
|
||||
query: {
|
||||
term: {
|
||||
topic: "ai",
|
||||
},
|
||||
},
|
||||
functions: [
|
||||
{
|
||||
script_score: {
|
||||
script: {
|
||||
source: "doc['timestamp'].value.millis",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
boost_mode: "replace",
|
||||
},
|
||||
},
|
||||
sort: {
|
||||
timestamp: {
|
||||
order: "asc",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
weight: 2,
|
||||
normalizer: "minmax",
|
||||
},
|
||||
{
|
||||
retriever: {
|
||||
knn: {
|
||||
field: "vector",
|
||||
query_vector: [0.23, 0.67, 0.89],
|
||||
k: 3,
|
||||
num_candidates: 5,
|
||||
},
|
||||
},
|
||||
weight: 1.5,
|
||||
},
|
||||
],
|
||||
rank_window_size: 10,
|
||||
},
|
||||
},
|
||||
_source: false,
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,16 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.updateAliases({
|
||||
actions: [
|
||||
{
|
||||
remove_index: {
|
||||
index: "my-index-2099.05.06-000001",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,18 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
order_stats: {
|
||||
stats: {
|
||||
field: "taxful_total_price",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -6,11 +6,15 @@
|
||||
const response = await client.update({
|
||||
index: "test",
|
||||
id: 1,
|
||||
doc: {
|
||||
product_price: 100,
|
||||
script: {
|
||||
source: "ctx._source.counter += params.count",
|
||||
lang: "painless",
|
||||
params: {
|
||||
count: 4,
|
||||
},
|
||||
},
|
||||
upsert: {
|
||||
product_price: 50,
|
||||
counter: 1,
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -1,47 +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.transport.request({
|
||||
method: "POST",
|
||||
path: "/_inference/chat_completion/openai-completion/_stream",
|
||||
body: {
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "What's the price of a scarf?",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
tools: [
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "get_current_price",
|
||||
description: "Get the current price of a item",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
item: {
|
||||
id: "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
tool_choice: {
|
||||
type: "function",
|
||||
function: {
|
||||
name: "get_current_price",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -3,18 +3,15 @@
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "image-index",
|
||||
const response = await client.knnSearch({
|
||||
index: "my-index",
|
||||
knn: {
|
||||
field: "image-vector",
|
||||
query_vector: [-5, 9, -12],
|
||||
field: "image_vector",
|
||||
query_vector: [0.3, 0.1, 1.2],
|
||||
k: 10,
|
||||
num_candidates: 100,
|
||||
rescore_vector: {
|
||||
oversample: 2,
|
||||
},
|
||||
},
|
||||
fields: ["title", "file-type"],
|
||||
_source: ["name", "file_type"],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,16 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "jinaai-index",
|
||||
query: {
|
||||
semantic: {
|
||||
field: "content",
|
||||
query: "who inspired taking care of the sea?",
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,10 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.getSettings({
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -4,12 +4,16 @@
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "jinaai-index",
|
||||
index: "semantic-embeddings",
|
||||
mappings: {
|
||||
properties: {
|
||||
content: {
|
||||
semantic_text: {
|
||||
type: "semantic_text",
|
||||
inference_id: "jinaai-embeddings",
|
||||
inference_id: "my-elser-endpoint",
|
||||
},
|
||||
content: {
|
||||
type: "text",
|
||||
copy_to: "semantic_text",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -11,7 +11,7 @@ const response = await client.ingest.putPipeline({
|
||||
attachment: {
|
||||
field: "data",
|
||||
properties: ["content", "title"],
|
||||
remove_binary: true,
|
||||
remove_binary: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
@ -1,15 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.putSettings({
|
||||
index: "*",
|
||||
settings: {
|
||||
"index.search.slowlog.include.user": true,
|
||||
"index.search.slowlog.threshold.fetch.warn": "30s",
|
||||
"index.search.slowlog.threshold.query.warn": "30s",
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,16 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.reindex({
|
||||
wait_for_completion: "false",
|
||||
source: {
|
||||
index: ".ml-anomalies-custom-example",
|
||||
},
|
||||
dest: {
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,24 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "my-index-000001",
|
||||
query: {
|
||||
prefix: {
|
||||
full_name: {
|
||||
value: "ki",
|
||||
},
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
fields: {
|
||||
full_name: {
|
||||
matched_fields: ["full_name._index_prefix"],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,33 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
daily_sales: {
|
||||
date_histogram: {
|
||||
field: "order_date",
|
||||
calendar_interval: "day",
|
||||
},
|
||||
aggs: {
|
||||
daily_revenue: {
|
||||
sum: {
|
||||
field: "taxful_total_price",
|
||||
},
|
||||
},
|
||||
smoothed_revenue: {
|
||||
moving_fn: {
|
||||
buckets_path: "daily_revenue",
|
||||
window: 3,
|
||||
script: "MovingFunctions.unweightedAvg(values)",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
26
docs/doc_examples/74b229a6e020113e5749099451979c89.asciidoc
Normal file
26
docs/doc_examples/74b229a6e020113e5749099451979c89.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: "test-index",
|
||||
query: {
|
||||
nested: {
|
||||
path: "inference_field.inference.chunks",
|
||||
query: {
|
||||
knn: {
|
||||
field: "inference_field.inference.chunks.embeddings",
|
||||
query_vector_builder: {
|
||||
text_embedding: {
|
||||
model_id: "my_inference_id",
|
||||
model_text: "mountain lake",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,35 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
query: {
|
||||
intervals: {
|
||||
my_text: {
|
||||
all_of: {
|
||||
ordered: false,
|
||||
max_gaps: 1,
|
||||
intervals: [
|
||||
{
|
||||
match: {
|
||||
query: "my favorite food",
|
||||
max_gaps: 0,
|
||||
ordered: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
match: {
|
||||
query: "cold porridge",
|
||||
max_gaps: 4,
|
||||
ordered: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,37 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
daily_sales: {
|
||||
date_histogram: {
|
||||
field: "order_date",
|
||||
calendar_interval: "day",
|
||||
format: "yyyy-MM-dd",
|
||||
},
|
||||
aggs: {
|
||||
revenue: {
|
||||
sum: {
|
||||
field: "taxful_total_price",
|
||||
},
|
||||
},
|
||||
unique_customers: {
|
||||
cardinality: {
|
||||
field: "customer_id",
|
||||
},
|
||||
},
|
||||
avg_basket_size: {
|
||||
avg: {
|
||||
field: "total_quantity",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,34 +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.transport.request({
|
||||
method: "POST",
|
||||
path: "/_inference/chat_completion/openai-completion/_stream",
|
||||
body: {
|
||||
messages: [
|
||||
{
|
||||
role: "assistant",
|
||||
content: "Let's find out what the weather is",
|
||||
tool_calls: [
|
||||
{
|
||||
id: "call_KcAjWtAww20AihPHphUh46Gd",
|
||||
type: "function",
|
||||
function: {
|
||||
name: "get_current_weather",
|
||||
arguments: '{"location":"Boston, MA"}',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
role: "tool",
|
||||
content: "The weather is cold",
|
||||
tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -11,8 +11,6 @@ const response = await client.indices.putSettings({
|
||||
"index.indexing.slowlog.threshold.index.debug": "2s",
|
||||
"index.indexing.slowlog.threshold.index.trace": "500ms",
|
||||
"index.indexing.slowlog.source": "1000",
|
||||
"index.indexing.slowlog.reformat": true,
|
||||
"index.indexing.slowlog.include.user": true,
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -7,14 +7,14 @@ const response = await client.indices.create({
|
||||
index: "test-index",
|
||||
mappings: {
|
||||
properties: {
|
||||
infer_field: {
|
||||
type: "semantic_text",
|
||||
inference_id: "my-elser-endpoint",
|
||||
},
|
||||
source_field: {
|
||||
type: "text",
|
||||
copy_to: "infer_field",
|
||||
},
|
||||
infer_field: {
|
||||
type: "semantic_text",
|
||||
inference_id: ".elser-2-elasticsearch",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -1,12 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.esql.query({
|
||||
query:
|
||||
'\nFROM library\n| EVAL year = DATE_EXTRACT("year", release_date)\n| WHERE page_count > ? AND match(author, ?, {"minimum_should_match": ?})\n| LIMIT 5\n',
|
||||
params: [300, "Frank Herbert", 2],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.getAlias({
|
||||
index: ".ml-anomalies-custom-example",
|
||||
const response = await client.security.queryRole({
|
||||
sort: ["name"],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,39 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
categories: {
|
||||
terms: {
|
||||
field: "category.keyword",
|
||||
size: 5,
|
||||
order: {
|
||||
total_revenue: "desc",
|
||||
},
|
||||
},
|
||||
aggs: {
|
||||
total_revenue: {
|
||||
sum: {
|
||||
field: "taxful_total_price",
|
||||
},
|
||||
},
|
||||
avg_order_value: {
|
||||
avg: {
|
||||
field: "taxful_total_price",
|
||||
},
|
||||
},
|
||||
total_items: {
|
||||
sum: {
|
||||
field: "total_quantity",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -5,11 +5,16 @@
|
||||
----
|
||||
const response = await client.inference.put({
|
||||
task_type: "sparse_embedding",
|
||||
inference_id: "elser-model-eis",
|
||||
inference_id: "my-elser-endpoint",
|
||||
inference_config: {
|
||||
service: "elastic",
|
||||
service: "elser",
|
||||
service_settings: {
|
||||
model_name: "elser",
|
||||
adaptive_allocations: {
|
||||
enabled: true,
|
||||
min_number_of_allocations: 3,
|
||||
max_number_of_allocations: 10,
|
||||
},
|
||||
num_threads: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -1,42 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.bulk({
|
||||
index: "jinaai-index",
|
||||
operations: [
|
||||
{
|
||||
index: {
|
||||
_index: "jinaai-index",
|
||||
_id: "1",
|
||||
},
|
||||
},
|
||||
{
|
||||
content:
|
||||
"Sarah Johnson is a talented marine biologist working at the Oceanographic Institute. Her groundbreaking research on coral reef ecosystems has garnered international attention and numerous accolades.",
|
||||
},
|
||||
{
|
||||
index: {
|
||||
_index: "jinaai-index",
|
||||
_id: "2",
|
||||
},
|
||||
},
|
||||
{
|
||||
content:
|
||||
"She spends months at a time diving in remote locations, meticulously documenting the intricate relationships between various marine species. ",
|
||||
},
|
||||
{
|
||||
index: {
|
||||
_index: "jinaai-index",
|
||||
_id: "3",
|
||||
},
|
||||
},
|
||||
{
|
||||
content:
|
||||
"Her dedication to preserving these delicate underwater environments has inspired a new generation of conservationists.",
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -30,13 +30,6 @@ const response = await client.search({
|
||||
],
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
fields: {
|
||||
semantic_text: {
|
||||
number_of_fragments: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,30 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "my-rank-vectors-byte",
|
||||
mappings: {
|
||||
properties: {
|
||||
my_vector: {
|
||||
type: "rank_vectors",
|
||||
element_type: "byte",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
|
||||
const response1 = await client.index({
|
||||
index: "my-rank-vectors-byte",
|
||||
id: 1,
|
||||
document: {
|
||||
my_vector: [
|
||||
[1, 2, 3],
|
||||
[4, 5, 6],
|
||||
],
|
||||
},
|
||||
});
|
||||
console.log(response1);
|
||||
----
|
||||
@ -5,7 +5,7 @@
|
||||
----
|
||||
const response = await client.cluster.putSettings({
|
||||
persistent: {
|
||||
"migrate.data_stream_reindex_max_request_per_second": 10000,
|
||||
"cluster.routing.allocation.disk.watermark.low": "30gb",
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -10,8 +10,7 @@ const response = await client.inference.put({
|
||||
service: "openai",
|
||||
service_settings: {
|
||||
api_key: "<api_key>",
|
||||
model_id: "text-embedding-3-small",
|
||||
dimensions: 128,
|
||||
model_id: "text-embedding-ada-002",
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -7,7 +7,7 @@ const response = await client.inference.put({
|
||||
task_type: "sparse_embedding",
|
||||
inference_id: "elser_embeddings",
|
||||
inference_config: {
|
||||
service: "elasticsearch",
|
||||
service: "elser",
|
||||
service_settings: {
|
||||
num_allocations: 1,
|
||||
num_threads: 1,
|
||||
@ -1,12 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.cat.indices({
|
||||
index: ".ml-anomalies-custom-example",
|
||||
v: "true",
|
||||
h: "index,store.size",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,12 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.get({
|
||||
index: ".migrated-ds-my-data-stream-2025.01.23-000001",
|
||||
human: "true",
|
||||
filter_path: "*.settings.index.version.created_string",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -14,7 +14,7 @@ const response = await client.ingest.putPipeline({
|
||||
attachment: {
|
||||
target_field: "_ingest._value.attachment",
|
||||
field: "_ingest._value.data",
|
||||
remove_binary: true,
|
||||
remove_binary: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1,18 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
avg_order_value: {
|
||||
avg: {
|
||||
field: "taxful_total_price",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,21 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
daily_orders: {
|
||||
date_histogram: {
|
||||
field: "order_date",
|
||||
calendar_interval: "day",
|
||||
format: "yyyy-MM-dd",
|
||||
min_doc_count: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -12,7 +12,7 @@ const response = await client.ingest.putPipeline({
|
||||
field: "data",
|
||||
indexed_chars: 11,
|
||||
indexed_chars_field: "max_size",
|
||||
remove_binary: true,
|
||||
remove_binary: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
@ -1,12 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.getSettings({
|
||||
index: "_all",
|
||||
expand_wildcards: "all",
|
||||
filter_path: "*.settings.index.*.slowlog",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,22 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
sales_by_category: {
|
||||
terms: {
|
||||
field: "category.keyword",
|
||||
size: 5,
|
||||
order: {
|
||||
_count: "desc",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,31 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "kibana_sample_data_ecommerce",
|
||||
size: 0,
|
||||
aggs: {
|
||||
daily_sales: {
|
||||
date_histogram: {
|
||||
field: "order_date",
|
||||
calendar_interval: "day",
|
||||
},
|
||||
aggs: {
|
||||
revenue: {
|
||||
sum: {
|
||||
field: "taxful_total_price",
|
||||
},
|
||||
},
|
||||
cumulative_revenue: {
|
||||
cumulative_sum: {
|
||||
buckets_path: "revenue",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -5,9 +5,6 @@
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "retrievers_example_nested",
|
||||
settings: {
|
||||
number_of_shards: 1,
|
||||
},
|
||||
mappings: {
|
||||
properties: {
|
||||
nested_field: {
|
||||
@ -21,9 +18,6 @@ const response = await client.indices.create({
|
||||
dims: 3,
|
||||
similarity: "l2_norm",
|
||||
index: true,
|
||||
index_options: {
|
||||
type: "flat",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1,22 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.inference.put({
|
||||
task_type: "rerank",
|
||||
inference_id: "jinaai-rerank",
|
||||
inference_config: {
|
||||
service: "jinaai",
|
||||
service_settings: {
|
||||
api_key: "<api_key>",
|
||||
model_id: "jina-reranker-v2-base-multilingual",
|
||||
},
|
||||
task_settings: {
|
||||
top_n: 10,
|
||||
return_documents: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,11 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.esql.query({
|
||||
query:
|
||||
'\nFROM library\n| WHERE match(author, "Frank Herbert", {"minimum_should_match": 2, "operator": "AND"})\n| LIMIT 5\n',
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,35 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
query: {
|
||||
intervals: {
|
||||
my_text: {
|
||||
all_of: {
|
||||
ordered: true,
|
||||
max_gaps: 1,
|
||||
intervals: [
|
||||
{
|
||||
match: {
|
||||
query: "my favorite food",
|
||||
max_gaps: 0,
|
||||
ordered: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
match: {
|
||||
query: "cold porridge",
|
||||
max_gaps: 4,
|
||||
ordered: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -6,13 +6,13 @@
|
||||
const response = await client.indices.create({
|
||||
index: "test-index",
|
||||
query: {
|
||||
match: {
|
||||
my_field: "Which country is Paris in?",
|
||||
semantic: {
|
||||
field: "my_semantic_field",
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
fields: {
|
||||
my_field: {
|
||||
my_semantic_field: {
|
||||
type: "semantic",
|
||||
number_of_fragments: 2,
|
||||
order: "score",
|
||||
@ -1,11 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.cluster.state({
|
||||
metric: "metadata",
|
||||
filter_path: "metadata.indices.*.system",
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,28 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "jinaai-index",
|
||||
retriever: {
|
||||
text_similarity_reranker: {
|
||||
retriever: {
|
||||
standard: {
|
||||
query: {
|
||||
semantic: {
|
||||
field: "content",
|
||||
query: "who inspired taking care of the sea?",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
field: "content",
|
||||
rank_window_size: 100,
|
||||
inference_id: "jinaai-rerank",
|
||||
inference_text: "who inspired taking care of the sea?",
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,44 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: "retrievers_example",
|
||||
retriever: {
|
||||
linear: {
|
||||
retrievers: [
|
||||
{
|
||||
retriever: {
|
||||
standard: {
|
||||
query: {
|
||||
query_string: {
|
||||
query: "(information retrieval) OR (artificial intelligence)",
|
||||
default_field: "text",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
weight: 2,
|
||||
normalizer: "minmax",
|
||||
},
|
||||
{
|
||||
retriever: {
|
||||
knn: {
|
||||
field: "vector",
|
||||
query_vector: [0.23, 0.67, 0.89],
|
||||
k: 3,
|
||||
num_candidates: 5,
|
||||
},
|
||||
},
|
||||
weight: 1.5,
|
||||
normalizer: "minmax",
|
||||
},
|
||||
],
|
||||
rank_window_size: 10,
|
||||
},
|
||||
},
|
||||
_source: false,
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,17 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.inference.put({
|
||||
task_type: "chat_completion",
|
||||
inference_id: "chat-completion-endpoint",
|
||||
inference_config: {
|
||||
service: "elastic",
|
||||
service_settings: {
|
||||
model_id: "model-1",
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,57 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.updateAliases({
|
||||
actions: [
|
||||
{
|
||||
add: {
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
alias: ".ml-anomalies-example1",
|
||||
filter: {
|
||||
term: {
|
||||
job_id: {
|
||||
value: "example1",
|
||||
},
|
||||
},
|
||||
},
|
||||
is_hidden: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
add: {
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
alias: ".ml-anomalies-example2",
|
||||
filter: {
|
||||
term: {
|
||||
job_id: {
|
||||
value: "example2",
|
||||
},
|
||||
},
|
||||
},
|
||||
is_hidden: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
remove: {
|
||||
index: ".ml-anomalies-custom-example",
|
||||
aliases: ".ml-anomalies-*",
|
||||
},
|
||||
},
|
||||
{
|
||||
remove_index: {
|
||||
index: ".ml-anomalies-custom-example",
|
||||
},
|
||||
},
|
||||
{
|
||||
add: {
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
alias: ".ml-anomalies-custom-example",
|
||||
is_hidden: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -3,13 +3,11 @@
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.inference.put({
|
||||
const response = await client.inference.inference({
|
||||
task_type: "my-inference-endpoint",
|
||||
inference_id: "_update",
|
||||
inference_config: {
|
||||
service_settings: {
|
||||
api_key: "<API_KEY>",
|
||||
},
|
||||
service_settings: {
|
||||
api_key: "<API_KEY>",
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -4,11 +4,9 @@
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.putSettings({
|
||||
index: ".reindexed-v9-ml-anomalies-custom-example",
|
||||
index: "my-index-000001",
|
||||
settings: {
|
||||
index: {
|
||||
number_of_replicas: "<original_number_of_replicas>",
|
||||
},
|
||||
"index.blocks.read_only_allow_delete": null,
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
@ -1,29 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "my-rank-vectors-float",
|
||||
mappings: {
|
||||
properties: {
|
||||
my_vector: {
|
||||
type: "rank_vectors",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
|
||||
const response1 = await client.index({
|
||||
index: "my-rank-vectors-float",
|
||||
id: 1,
|
||||
document: {
|
||||
my_vector: [
|
||||
[0.5, 10, 6],
|
||||
[-0.5, 10, 10],
|
||||
],
|
||||
},
|
||||
});
|
||||
console.log(response1);
|
||||
----
|
||||
@ -5,9 +5,6 @@
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: "retrievers_example",
|
||||
settings: {
|
||||
number_of_shards: 1,
|
||||
},
|
||||
mappings: {
|
||||
properties: {
|
||||
vector: {
|
||||
@ -15,9 +12,6 @@ const response = await client.indices.create({
|
||||
dims: 3,
|
||||
similarity: "l2_norm",
|
||||
index: true,
|
||||
index_options: {
|
||||
type: "flat",
|
||||
},
|
||||
},
|
||||
text: {
|
||||
type: "text",
|
||||
@ -28,9 +22,6 @@ const response = await client.indices.create({
|
||||
topic: {
|
||||
type: "keyword",
|
||||
},
|
||||
timestamp: {
|
||||
type: "date",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -44,7 +35,6 @@ const response1 = await client.index({
|
||||
text: "Large language models are revolutionizing information retrieval by boosting search precision, deepening contextual understanding, and reshaping user experiences in data-rich environments.",
|
||||
year: 2024,
|
||||
topic: ["llm", "ai", "information_retrieval"],
|
||||
timestamp: "2021-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response1);
|
||||
@ -57,7 +47,6 @@ const response2 = await client.index({
|
||||
text: "Artificial intelligence is transforming medicine, from advancing diagnostics and tailoring treatment plans to empowering predictive patient care for improved health outcomes.",
|
||||
year: 2023,
|
||||
topic: ["ai", "medicine"],
|
||||
timestamp: "2022-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response2);
|
||||
@ -70,7 +59,6 @@ const response3 = await client.index({
|
||||
text: "AI is redefining security by enabling advanced threat detection, proactive risk analysis, and dynamic defenses against increasingly sophisticated cyber threats.",
|
||||
year: 2024,
|
||||
topic: ["ai", "security"],
|
||||
timestamp: "2023-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response3);
|
||||
@ -83,7 +71,6 @@ const response4 = await client.index({
|
||||
text: "Elastic introduces Elastic AI Assistant, the open, generative AI sidekick powered by ESRE to democratize cybersecurity and enable users of every skill level.",
|
||||
year: 2023,
|
||||
topic: ["ai", "elastic", "assistant"],
|
||||
timestamp: "2024-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response4);
|
||||
@ -96,7 +83,6 @@ const response5 = await client.index({
|
||||
text: "Learn how to spin up a deployment of our hosted Elasticsearch Service and use Elastic Observability to gain deeper insight into the behavior of your applications and systems.",
|
||||
year: 2024,
|
||||
topic: ["documentation", "observability", "elastic"],
|
||||
timestamp: "2025-01-01T12:10:30",
|
||||
},
|
||||
});
|
||||
console.log(response5);
|
||||
@ -12,7 +12,7 @@ const response = await client.ingest.putPipeline({
|
||||
field: "data",
|
||||
indexed_chars: 11,
|
||||
indexed_chars_field: "max_size",
|
||||
remove_binary: true,
|
||||
remove_binary: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
@ -12,13 +12,6 @@ const response = await client.search({
|
||||
fields: ["my_field", "my_field._2gram", "my_field._3gram"],
|
||||
},
|
||||
},
|
||||
highlight: {
|
||||
fields: {
|
||||
my_field: {
|
||||
matched_fields: ["my_field._index_prefix"],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,18 +0,0 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.inference.put({
|
||||
task_type: "text_embedding",
|
||||
inference_id: "jinaai-embeddings",
|
||||
inference_config: {
|
||||
service: "jinaai",
|
||||
service_settings: {
|
||||
model_id: "jina-embeddings-v3",
|
||||
api_key: "<api_key>",
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
@ -1,10 +1,10 @@
|
||||
[[bulk_examples]]
|
||||
=== Bulk
|
||||
|
||||
With the {jsclient}/api-reference.html#_bulk[`bulk` API], you can perform multiple index/delete operations in a
|
||||
With the {jsclient}/api-reference.html#_bulk[`bulk` API], you can perform multiple index/delete operations in a
|
||||
single API call. The `bulk` API significantly increases indexing speed.
|
||||
|
||||
NOTE: You can also use the <<bulk-helper,bulk helper>>.
|
||||
NOTE: You can also use the {jsclient}/client-helpers.html[bulk helper].
|
||||
|
||||
[source,js]
|
||||
----
|
||||
|
||||
@ -6,7 +6,7 @@ Check that the document `/game-of-thrones/1` exists.
|
||||
NOTE: Since this API uses the `HEAD` method, the body value will be boolean.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
---------
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
@ -34,4 +34,4 @@ async function run () {
|
||||
}
|
||||
|
||||
run().catch(console.log)
|
||||
----
|
||||
---------
|
||||
@ -1,12 +1,12 @@
|
||||
[[get_examples]]
|
||||
=== Get
|
||||
|
||||
The get API allows to get a typed JSON document from the index based on its id.
|
||||
The following example gets a JSON document from an index called
|
||||
The get API allows to get a typed JSON document from the index based on its id.
|
||||
The following example gets a JSON document from an index called
|
||||
`game-of-thrones`, under a type called `_doc`, with id valued `'1'`.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
---------
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
@ -34,4 +34,4 @@ async function run () {
|
||||
}
|
||||
|
||||
run().catch(console.log)
|
||||
----
|
||||
---------
|
||||
@ -62,4 +62,4 @@ async function run () {
|
||||
}
|
||||
|
||||
run().catch(console.log)
|
||||
----
|
||||
----
|
||||
@ -1,25 +1,25 @@
|
||||
[[scroll_examples]]
|
||||
=== Scroll
|
||||
|
||||
While a search request returns a single “page” of results, the scroll API can be
|
||||
used to retrieve large numbers of results (or even all results) from a single
|
||||
search request, in much the same way as you would use a cursor on a traditional
|
||||
While a search request returns a single “page” of results, the scroll API can be
|
||||
used to retrieve large numbers of results (or even all results) from a single
|
||||
search request, in much the same way as you would use a cursor on a traditional
|
||||
database.
|
||||
|
||||
Scrolling is not intended for real time user requests, but rather for processing
|
||||
large amounts of data, for example in order to reindex the contents of one index
|
||||
Scrolling is not intended for real time user requests, but rather for processing
|
||||
large amounts of data, for example in order to reindex the contents of one index
|
||||
into a new index with a different configuration.
|
||||
|
||||
NOTE: The results that are returned from a scroll request reflect the state of
|
||||
the index at the time that the initial search request was made, like a snapshot
|
||||
in time. Subsequent changes to documents (index, update or delete) will only
|
||||
NOTE: The results that are returned from a scroll request reflect the state of
|
||||
the index at the time that the initial search request was made, like a snapshot
|
||||
in time. Subsequent changes to documents (index, update or delete) will only
|
||||
affect later search requests.
|
||||
|
||||
In order to use scrolling, the initial search request should specify the scroll
|
||||
parameter in the query string, which tells {es} how long it should keep the
|
||||
In order to use scrolling, the initial search request should specify the scroll
|
||||
parameter in the query string, which tells {es} how long it should keep the
|
||||
“search context” alive.
|
||||
|
||||
NOTE: Did you know that we provide an helper for sending scroll requests? You can find it <<scroll-search-helper,here>>.
|
||||
NOTE: Did you know that we provide an helper for sending scroll requests? You can find it {jsclient}/client-helpers.html[here].
|
||||
|
||||
[source,js]
|
||||
----
|
||||
@ -113,7 +113,7 @@ async function run () {
|
||||
run().catch(console.log)
|
||||
----
|
||||
|
||||
Another cool usage of the `scroll` API can be done with Node.js ≥ 10, by using
|
||||
Another cool usage of the `scroll` API can be done with Node.js ≥ 10, by using
|
||||
async iteration!
|
||||
|
||||
[source,js]
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
[[update_examples]]
|
||||
=== Update
|
||||
|
||||
The update API allows updates of a specific document using the given script. In
|
||||
the following example, we will index a document that also tracks how many times
|
||||
The update API allows updates of a specific document using the given script. In
|
||||
the following example, we will index a document that also tracks how many times
|
||||
a character has said the given quote, and then we will update the `times` field.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
---------
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
@ -48,12 +48,12 @@ async function run () {
|
||||
|
||||
run().catch(console.log)
|
||||
|
||||
----
|
||||
---------
|
||||
|
||||
With the update API, you can also run a partial update of a document.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
---------
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
@ -92,4 +92,4 @@ async function run () {
|
||||
run().catch(console.log)
|
||||
|
||||
|
||||
----
|
||||
---------
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user