Compare commits

..

10 Commits

Author SHA1 Message Date
ca3b25c929 Upgraded @types/node package to v18 (#2374)
(cherry picked from commit c274b1b32f)
2024-10-14 16:14:16 +00:00
424cc94458 Auto-generated code for 8.15 (#2370) 2024-09-30 13:37:38 -05:00
7aca5cf652 [Backport 8.15] Upgrade transport to 8.8.1 (#2367)
(cherry picked from commit aad41df231)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-09-26 16:42:34 -05:00
a8927727b1 Auto-generated code for 8.15 (#2363) 2024-09-24 10:04:11 -05:00
15a450eba4 Update 8.15 auto-merge action to match main (#2361) 2024-09-03 13:08:33 -05:00
8f028a522a Auto-generated code for 8.15 (#2359) 2024-09-03 09:36:52 -05:00
411f379006 Auto-generated code for 8.15 (#2350) 2024-08-26 13:57:17 -05:00
242b4227ee Auto-generated code for 8.15 (#2342) 2024-08-19 10:52:15 -05:00
78332da539 [Backport 8.15] Add support for auto-merge (#2339)
* Add support for auto-merge

* Fix bad request-converter version

* Switch back to pull_request

pull_request_target is the wrong trigger for this action

(cherry picked from commit 4b8969cc78)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-08-14 10:16:43 -05:00
62b2d78b15 [Backport 8.15] Generate documentation example snippets (#2334)
* Update docs example generation script

* Add docs examples generation to codegen job

(cherry picked from commit 77e2f613f2)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-08-12 13:22:07 -05:00
189 changed files with 2740 additions and 743 deletions

View File

@ -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 $`mv ${join(import.meta.url, '..', 'src', 'api', 'reference.asciidoc')} ${join(import.meta.url, '..', 'docs', 'reference.asciidoc')}`
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) {

18
.github/workflows/auto-merge.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Automerge
on:
pull_request_review:
types:
- submitted
jobs:
automerge:
runs-on: ubuntu-latest
if: github.event.review.state == 'approved'
steps:
- uses: reitermarkus/automerge@v2
with:
token: ${{ secrets.GH_TOKEN }}
merge-method: squash
pull-request-author-associations: OWNER
review-author-associations: OWNER,CONTRIBUTOR

View File

@ -2,7 +2,7 @@
name: Node CI
on:
pull_request_target: {}
pull_request: {}
jobs:
paths-filter:

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/my-e5-model",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "my-e5-model",
inference_config: {
service: "elasticsearch",
service_settings: {
num_allocations: 1,

View File

@ -26,7 +26,7 @@ const response1 = await client.cluster.putComponentTemplate({
type: "keyword",
script: {
source:
"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))",
"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
},
},
},

View 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);
----

View File

@ -4,7 +4,7 @@
[source, js]
----
const response = await client.indices.create({
index: "my-index-000002",
index: "my-index-000003",
mappings: {
properties: {
metrics: {
@ -29,7 +29,7 @@ const response = await client.indices.create({
console.log(response);
const response1 = await client.indices.getMapping({
index: "my-index-000002",
index: "my-index-000003",
});
console.log(response1);
----

View File

@ -3,13 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_connector/my-connector/_api_key_id",
body: {
api_key_id: "my-api-key-id",
api_key_secret_id: "my-connector-secret-id",
},
const response = await client.connector.updateApiKeyId({
connector_id: "my-connector",
api_key_id: "my-api-key-id",
api_key_secret_id: "my-connector-secret-id",
});
console.log(response);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/google_vertex_ai_embeddings",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "google_vertex_ai_embeddings",
inference_config: {
service: "googlevertexai",
service_settings: {
service_account_json: "<service_account_json>",

View 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);
----

View 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);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/amazon_bedrock_embeddings",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "amazon_bedrock_embeddings",
inference_config: {
service: "amazonbedrock",
service_settings: {
access_key: "<aws_access_key>",

View File

@ -3,29 +3,26 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_connector/my-g-drive-connector/_filtering",
body: {
rules: [
{
field: "file_extension",
id: "exclude-txt-files",
order: 0,
policy: "exclude",
rule: "equals",
value: "txt",
},
{
field: "_",
id: "DEFAULT",
order: 1,
policy: "include",
rule: "regex",
value: ".*",
},
],
},
const response = await client.connector.updateFiltering({
connector_id: "my-g-drive-connector",
rules: [
{
field: "file_extension",
id: "exclude-txt-files",
order: 0,
policy: "exclude",
rule: "equals",
value: "txt",
},
{
field: "_",
id: "DEFAULT",
order: 1,
policy: "include",
rule: "regex",
value: ".*",
},
],
});
console.log(response);
----

View File

@ -10,7 +10,7 @@ const response = await client.search({
type: "keyword",
script: {
source:
"emit(doc['@timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ROOT))",
"emit(doc['@timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
},
},
},

View File

@ -5,6 +5,21 @@
----
const response = await client.searchApplication.renderQuery({
name: "my-app",
body: {
params: {
query_string: "my first query",
text_fields: [
{
name: "title",
boost: 5,
},
{
name: "description",
boost: 1,
},
],
},
},
});
console.log(response);
----

View 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);
----

View File

@ -5,6 +5,11 @@
----
const response = await client.security.queryUser({
with_profile_uid: "true",
query: {
prefix: {
roles: "other",
},
},
});
console.log(response);
----

View File

@ -3,13 +3,11 @@
[source, js]
----
const response = await client.transport.request({
method: "POST",
path: "/_inference/sparse_embedding/my-elser-model",
body: {
input:
"The sky above the port was the color of television tuned to a dead channel.",
},
const response = await client.inference.inference({
task_type: "sparse_embedding",
inference_id: "my-elser-model",
input:
"The sky above the port was the color of television tuned to a dead channel.",
});
console.log(response);
----

View 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);
----

View 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);
----

View File

@ -3,6 +3,25 @@
[source, js]
----
const response = await client.simulate.ingest({});
const response = await client.simulate.ingest({
body: {
docs: [
{
_index: "my-index",
_id: "123",
_source: {
foo: "bar",
},
},
{
_index: "my-index",
_id: "456",
_source: {
foo: "rab",
},
},
],
},
});
console.log(response);
----

View 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.transport.request({
method: "DELETE",
path: "/_ingest/geoip/database/my-database-id",
});
console.log(response);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/openai_embeddings",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "openai_embeddings",
inference_config: {
service: "openai",
service_settings: {
api_key: "<api_key>",

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/rerank/google_vertex_ai_rerank",
body: {
const response = await client.inference.put({
task_type: "rerank",
inference_id: "google_vertex_ai_rerank",
inference_config: {
service: "googlevertexai",
service_settings: {
service_account_json: "<service_account_json>",

View File

@ -4,7 +4,7 @@
[source, js]
----
const response = await client.ingest.putPipeline({
id: "hugging_face_embeddings",
id: "hugging_face_embeddings_pipeline",
processors: [
{
inference: {

View 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);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/azure_ai_studio_embeddings",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "azure_ai_studio_embeddings",
inference_config: {
service: "azureaistudio",
service_settings: {
api_key: "<api_key>",

View File

@ -3,12 +3,8 @@
[source, js]
----
const response = await client.transport.request({
method: "GET",
path: "/_connector",
querystring: {
service_type: "sharepoint_online",
},
const response = await client.connector.list({
service_type: "sharepoint_online",
});
console.log(response);
----

View 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);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/azure_ai_studio_embeddings",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "azure_ai_studio_embeddings",
inference_config: {
service: "azureaistudio",
service_settings: {
api_key: "<api_key>",

View File

@ -10,7 +10,7 @@ const response = await client.search({
"date.day_of_week": {
type: "keyword",
script:
"emit(doc['date'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))",
"emit(doc['date'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
},
},
aggs: {

View File

@ -11,7 +11,7 @@ const response = await client.reindex({
},
dest: {
index: "azure-ai-studio-embeddings",
pipeline: "azure_ai_studio_embeddings",
pipeline: "azure_ai_studio_embeddings_pipeline",
},
});
console.log(response);

View File

@ -3,6 +3,12 @@
[source, js]
----
const response = await client.security.oidcLogout({});
const response = await client.security.oidcLogout({
body: {
token:
"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
refresh_token: "vLBPvmAB6KvwvJZr27cS",
},
});
console.log(response);
----

View 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);
----

View File

@ -6,6 +6,7 @@
const response = await client.esql.asyncQueryGet({
id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
wait_for_completion_timeout: "30s",
body: null,
});
console.log(response);
----

View 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);
----

View 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.indices.create({
index: "bad_example_index",
mappings: {
properties: {
field_1: {
type: "text",
copy_to: "field_2",
},
field_2: {
type: "text",
copy_to: "field_3",
},
field_3: {
type: "text",
},
},
},
});
console.log(response);
----

View File

@ -4,7 +4,7 @@
[source, js]
----
const response = await client.ingest.putPipeline({
id: "azure_ai_studio_embeddings",
id: "azure_ai_studio_embeddings_pipeline",
processors: [
{
inference: {

View File

@ -3,14 +3,11 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_connector/my-connector",
body: {
index_name: "search-google-drive",
name: "My Connector",
service_type: "google_drive",
},
const response = await client.connector.put({
connector_id: "my-connector",
index_name: "search-google-drive",
name: "My Connector",
service_type: "google_drive",
});
console.log(response);
----

View File

@ -11,7 +11,7 @@ const response = await client.reindex({
},
dest: {
index: "openai-embeddings",
pipeline: "openai_embeddings",
pipeline: "openai_embeddings_pipeline",
},
});
console.log(response);

View 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: "completion",
inference_id: "anthropic_completion",
inference_config: {
service: "anthropic",
service_settings: {
api_key: "<api_key>",
model_id: "<model_id>",
},
task_settings: {
max_tokens: 1024,
},
},
});
console.log(response);
----

View File

@ -3,6 +3,6 @@
[source, js]
----
const response = await client.simulate.ingest({});
const response = await client.nodes.hotThreads();
console.log(response);
----

View File

@ -11,7 +11,7 @@ const response = await client.reindex({
},
dest: {
index: "amazon-bedrock-embeddings",
pipeline: "amazon_bedrock_embeddings",
pipeline: "amazon_bedrock_embeddings_pipeline",
},
});
console.log(response);

View 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.transport.request({
method: "GET",
path: "/_ingest/geoip/database/my-database-id",
});
console.log(response);
----

View 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.inference.put({
task_type: "text_embedding",
inference_id: "alibabacloud_ai_search_embeddings",
inference_config: {
service: "alibabacloud-ai-search",
service_settings: {
api_key: "<api_key>",
service_id: "<service_id>",
host: "<host>",
workspace: "<workspace>",
},
},
});
console.log(response);
----

View File

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

View File

@ -5,6 +5,7 @@
----
const response = await client.esql.asyncQueryGet({
id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
body: null,
});
console.log(response);
----

View File

@ -3,16 +3,13 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_connector/my-connector/_pipeline",
body: {
pipeline: {
extract_binary_content: true,
name: "my-connector-pipeline",
reduce_whitespace: true,
run_ml_inference: true,
},
const response = await client.connector.updatePipeline({
connector_id: "my-connector",
pipeline: {
extract_binary_content: true,
name: "my-connector-pipeline",
reduce_whitespace: true,
run_ml_inference: true,
},
});
console.log(response);

View File

@ -3,12 +3,9 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_connector/my-connector/_status",
body: {
status: "needs_configuration",
},
const response = await client.connector.updateStatus({
connector_id: "my-connector",
status: "needs_configuration",
});
console.log(response);
----

View 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: "restaurants",
retriever: {
knn: {
field: "vector",
query_vector: [10, 22, 77],
k: 10,
num_candidates: 10,
},
},
});
console.log(response);
----

View 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", "my_user_role"],
});
console.log(response);
----

View 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.ml.startTrainedModelDeployment({
model_id: "my_model",
deployment_id: "my_model_for_search",
});
console.log(response);
----

View File

@ -10,7 +10,7 @@ const response = await client.search({
type: "keyword",
script: {
source:
"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))",
"emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))",
},
},
},

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/my-msmarco-minilm-model",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "my-msmarco-minilm-model",
inference_config: {
service: "elasticsearch",
service_settings: {
num_allocations: 1,

View File

@ -4,7 +4,7 @@
[source, js]
----
const response = await client.ingest.putPipeline({
id: "openai_embeddings",
id: "openai_embeddings_pipeline",
processors: [
{
inference: {

View File

@ -3,9 +3,9 @@
[source, js]
----
const response = await client.transport.request({
method: "DELETE",
path: "/_inference/sparse_embedding/my-elser-model",
const response = await client.inference.delete({
task_type: "sparse_embedding",
inference_id: "my-elser-model",
});
console.log(response);
----

View 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.reindex({
wait_for_completion: "false",
source: {
index: "test-data",
size: 50,
},
dest: {
index: "elser-embeddings",
pipeline: "elser_embeddings_pipeline",
},
});
console.log(response);
----

View 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.nodes.stats({
human: "true",
filter_path: "nodes.*.indexing_pressure",
});
console.log(response);
----

View 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.inference.put({
task_type: "sparse_embedding",
inference_id: "alibabacloud_ai_search_sparse",
inference_config: {
service: "alibabacloud-ai-search",
service_settings: {
api_key: "<api_key>",
service_id: "ops-text-sparse-embedding-001",
host: "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
workspace: "default",
},
},
});
console.log(response);
----

View 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.transport.request({
method: "DELETE",
path: "/_ingest/geoip/database/example-database-id",
});
console.log(response);
----

View File

@ -4,7 +4,7 @@
[source, js]
----
const response = await client.ingest.putPipeline({
id: "cohere_embeddings",
id: "cohere_embeddings_pipeline",
processors: [
{
inference: {

View 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.indices.create({
index: "alibabacloud-ai-search-embeddings",
mappings: {
properties: {
content_embedding: {
type: "dense_vector",
dims: 1024,
element_type: "float",
},
content: {
type: "text",
},
},
},
});
console.log(response);
----

View File

@ -11,7 +11,7 @@ const response = await client.reindex({
},
dest: {
index: "hugging-face-embeddings",
pipeline: "hugging_face_embeddings",
pipeline: "hugging_face_embeddings_pipeline",
},
});
console.log(response);

View 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.inference.put({
task_type: "sparse_embedding",
inference_id: "my-elser-model",
inference_config: {
service: "elser",
service_settings: {
adaptive_allocations: {
enabled: true,
min_number_of_allocations: 3,
max_number_of_allocations: 10,
},
num_threads: 1,
},
},
});
console.log(response);
----

View File

@ -3,6 +3,12 @@
[source, js]
----
const response = await client.security.oidcPrepareAuthentication({});
const response = await client.security.oidcPrepareAuthentication({
body: {
realm: "oidc1",
state: "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO",
nonce: "zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5",
},
});
console.log(response);
----

View 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.indices.create({
index: "my-index-000002",
mappings: {
properties: {
inference_field: {
type: "semantic_text",
inference_id: "my-elser-endpoint-for-ingest",
search_inference_id: "my-elser-endpoint-for-search",
},
},
},
});
console.log(response);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/completion/openai-completion",
body: {
const response = await client.inference.put({
task_type: "completion",
inference_id: "openai-completion",
inference_config: {
service: "openai",
service_settings: {
api_key: "<api_key>",

View 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: "test_index",
mappings: {
dynamic: "strict",
properties: {
description: {
properties: {
notes: {
type: "text",
copy_to: ["description.notes_raw"],
analyzer: "standard",
search_analyzer: "standard",
},
notes_raw: {
type: "keyword",
},
},
},
},
},
});
console.log(response);
----

View 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", "not_an_existing_role"],
});
console.log(response);
----

View File

@ -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.search({
query: {
intervals: {
my_text: {
all_of: {
intervals: [
{
match: {
query: "the",
},
},
{
any_of: {
intervals: [
{
match: {
query: "big",
},
},
{
match: {
query: "big bad",
},
},
],
},
},
{
match: {
query: "wolf",
},
},
],
max_gaps: 0,
ordered: true,
},
},
},
},
});
console.log(response);
----

View File

@ -29,7 +29,7 @@ const response = await client.transport.request({
},
{
rule_id: "rule2",
type: "pinned",
type: "exclude",
criteria: [
{
type: "contains",

View File

@ -3,8 +3,8 @@
[source, js]
----
const response = await client.indices.delete({
index: "my-index",
const response = await client.nodes.stats({
metric: "breaker",
});
console.log(response);
----

View File

@ -0,0 +1,59 @@
// This 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.bulkPutRole({
roles: {
my_admin_role: {
cluster: ["all"],
indices: [
{
names: ["index1", "index2"],
privileges: ["all"],
field_security: {
grant: ["title", "body"],
},
query: '{"match": {"title": "foo"}}',
},
],
applications: [
{
application: "myapp",
privileges: ["admin", "read"],
resources: ["*"],
},
],
run_as: ["other_user"],
metadata: {
version: 1,
},
},
my_user_role: {
cluster: ["all"],
indices: [
{
names: ["index1"],
privileges: ["read"],
field_security: {
grant: ["title", "body"],
},
query: '{"match": {"title": "foo"}}',
},
],
applications: [
{
application: "myapp",
privileges: ["admin", "read"],
resources: ["*"],
},
],
run_as: ["other_user"],
metadata: {
version: 1,
},
},
},
});
console.log(response);
----

View File

@ -3,21 +3,18 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_connector/my-connector/_last_sync",
body: {
last_access_control_sync_error: "Houston, we have a problem!",
last_access_control_sync_scheduled_at: "2023-11-09T15:13:08.231Z",
last_access_control_sync_status: "pending",
last_deleted_document_count: 42,
last_incremental_sync_scheduled_at: "2023-11-09T15:13:08.231Z",
last_indexed_document_count: 42,
last_sync_error: "Houston, we have a problem!",
last_sync_scheduled_at: "2024-11-09T15:13:08.231Z",
last_sync_status: "completed",
last_synced: "2024-11-09T15:13:08.231Z",
},
const response = await client.connector.lastSync({
connector_id: "my-connector",
last_access_control_sync_error: "Houston, we have a problem!",
last_access_control_sync_scheduled_at: "2023-11-09T15:13:08.231Z",
last_access_control_sync_status: "pending",
last_deleted_document_count: 42,
last_incremental_sync_scheduled_at: "2023-11-09T15:13:08.231Z",
last_indexed_document_count: 42,
last_sync_error: "Houston, we have a problem!",
last_sync_scheduled_at: "2024-11-09T15:13:08.231Z",
last_sync_status: "completed",
last_synced: "2024-11-09T15:13:08.231Z",
});
console.log(response);
----

View File

@ -3,12 +3,9 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_connector/my-connector/_index_name",
body: {
index_name: "data-from-my-google-drive",
},
const response = await client.connector.updateIndexName({
connector_id: "my-connector",
index_name: "data-from-my-google-drive",
});
console.log(response);
----

View 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.inference.put({
task_type: "rerank",
inference_id: "my-msmarco-minilm-model",
inference_config: {
service: "elasticsearch",
service_settings: {
num_allocations: 1,
num_threads: 1,
model_id: "cross-encoder__ms-marco-minilm-l-6-v2",
},
},
});
console.log(response);
----

View 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.reindex({
wait_for_completion: "false",
source: {
index: "test-data",
size: 50,
},
dest: {
index: "google-vertex-ai-embeddings",
pipeline: "google_vertex_ai_embeddings_pipeline",
},
});
console.log(response);
----

View File

@ -29,7 +29,7 @@ const response = await client.transport.request({
},
{
rule_id: "my-rule2",
type: "pinned",
type: "exclude",
criteria: [
{
type: "fuzzy",

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/completion/azure_ai_studio_completion",
body: {
const response = await client.inference.put({
task_type: "completion",
inference_id: "azure_ai_studio_completion",
inference_config: {
service: "azureaistudio",
service_settings: {
api_key: "<api_key>",

View File

@ -0,0 +1,45 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "movies",
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
sparse_vector: {
field: "plot_embedding",
inference_id: "my-elser-model",
query: "films that explore psychological depths",
},
},
},
},
{
standard: {
query: {
multi_match: {
query: "crime",
fields: ["plot", "title"],
},
},
},
},
{
knn: {
field: "vector",
query_vector: [10, 22, 77],
k: 10,
num_candidates: 10,
},
},
],
},
},
});
console.log(response);
----

View File

@ -3,6 +3,10 @@
[source, js]
----
const response = await client.security.bulkUpdateApiKeys({});
const response = await client.security.bulkUpdateApiKeys({
body: {
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
},
});
console.log(response);
----

View File

@ -3,15 +3,13 @@
[source, js]
----
const response = await client.transport.request({
method: "POST",
path: "/_inference/text_embedding/my-cohere-endpoint",
body: {
input:
"The sky above the port was the color of television tuned to a dead channel.",
task_settings: {
input_type: "ingest",
},
const response = await client.inference.inference({
task_type: "text_embedding",
inference_id: "my-cohere-endpoint",
input:
"The sky above the port was the color of television tuned to a dead channel.",
task_settings: {
input_type: "ingest",
},
});
console.log(response);

View File

@ -11,7 +11,7 @@ const response = await client.search({
filter: {
range: {
price: {
to: "500",
lte: "500",
},
},
},

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/amazon_bedrock_embeddings",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "amazon_bedrock_embeddings",
inference_config: {
service: "amazonbedrock",
service_settings: {
access_key: "<aws_access_key>",

View File

@ -3,6 +3,33 @@
[source, js]
----
const response = await client.textStructure.findMessageStructure({});
const response = await client.textStructure.findMessageStructure({
body: {
messages: [
"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128",
"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]",
"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]",
"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]",
"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]",
"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]",
"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]",
"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]",
"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]",
"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]",
"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]",
"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]",
"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]",
"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]",
"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]",
"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled",
"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled",
"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled",
"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]",
"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]",
"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized",
"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...",
],
},
});
console.log(response);
----

View File

@ -3,12 +3,9 @@
[source, js]
----
const response = await client.transport.request({
method: "DELETE",
path: "/_connector/another-connector",
querystring: {
delete_sync_jobs: "true",
},
const response = await client.connector.delete({
connector_id: "another-connector",
delete_sync_jobs: "true",
});
console.log(response);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/azure_openai_embeddings",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "azure_openai_embeddings",
inference_config: {
service: "azureopenai",
service_settings: {
api_key: "<api_key>",

View File

@ -11,7 +11,7 @@ const response = await client.reindex({
},
dest: {
index: "cohere-embeddings",
pipeline: "cohere_embeddings",
pipeline: "cohere_embeddings_pipeline",
},
});
console.log(response);

View File

@ -0,0 +1,51 @@
// This 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-000004",
mappings: {
properties: {
metrics: {
subobjects: "auto",
properties: {
time: {
type: "object",
properties: {
min: {
type: "long",
},
},
},
to: {
type: "object",
properties: {
inner_metrics: {
type: "object",
subobjects: "auto",
properties: {
time: {
type: "object",
properties: {
max: {
type: "long",
},
},
},
},
},
},
},
},
},
},
},
});
console.log(response);
const response1 = await client.indices.getMapping({
index: "my-index-000004",
});
console.log(response1);
----

View File

@ -19,6 +19,12 @@ const response = await client.security.putRole({
clusters: ["my_remote_cluster"],
},
],
remote_cluster: [
{
privileges: ["monitor_enrich"],
clusters: ["my_remote_cluster"],
},
],
});
console.log(response);
----

View File

@ -3,6 +3,28 @@
[source, js]
----
const response = await client.security.bulkUpdateApiKeys({});
const response = await client.security.bulkUpdateApiKeys({
body: {
ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
role_descriptors: {
"role-a": {
indices: [
{
names: ["*"],
privileges: ["write"],
},
],
},
},
metadata: {
environment: {
level: 2,
trusted: true,
tags: ["production"],
},
},
expiration: "30d",
},
});
console.log(response);
----

View 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.cat.shards({
v: "true",
});
console.log(response);
const response1 = await client.cat.recovery({
v: "true",
active_only: "true",
});
console.log(response1);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/completion/amazon_bedrock_completion",
body: {
const response = await client.inference.put({
task_type: "completion",
inference_id: "amazon_bedrock_completion",
inference_config: {
service: "amazonbedrock",
service_settings: {
access_key: "<aws_access_key>",

View File

@ -17,7 +17,7 @@ const response = await client.search({
{
range: {
"result.execution_time": {
from: "now-10s",
gte: "now-10s",
},
},
},

View 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.snapshot.create({
repository: "my_repository",
snapshot: "_verify_integrity",
});
console.log(response);
----

View 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.search({
index: "my-index",
query: {
semantic: {
field: "inference_field",
query: "mountain lake",
inner_hits: {
from: 1,
size: 1,
},
},
},
});
console.log(response);
----

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/mistral_embeddings",
body: {
const response = await client.inference.put({
task_type: "text_embedding",
inference_id: "mistral_embeddings",
inference_config: {
service: "mistral",
service_settings: {
api_key: "<api_key>",

View File

@ -3,10 +3,10 @@
[source, js]
----
const response = await client.transport.request({
method: "PUT",
path: "/_inference/rerank/cohere-rerank",
body: {
const response = await client.inference.put({
task_type: "rerank",
inference_id: "cohere-rerank",
inference_config: {
service: "cohere",
service_settings: {
api_key: "<API-KEY>",

View File

@ -11,7 +11,7 @@ const response = await client.reindex({
},
dest: {
index: "mistral-embeddings",
pipeline: "mistral_embeddings",
pipeline: "mistral_embeddings_pipeline",
},
});
console.log(response);

View File

@ -3,8 +3,8 @@
[source, js]
----
const response = await client.nodes.hotThreads({
node_id: "my-node,my-other-node",
const response = await client.security.queryRole({
sort: ["name"],
});
console.log(response);
----

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