Auto-generated code for main (#2368)

This commit is contained in:
Elastic Machine
2024-09-30 20:37:11 +02:00
committed by GitHub
parent aad41df231
commit 428a7b023d
31 changed files with 865 additions and 66 deletions

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

@ -14,6 +14,7 @@ const response = await client.inference.put({
min_number_of_allocations: 3,
max_number_of_allocations: 10,
},
num_threads: 1,
model_id: ".multilingual-e5-small",
},
},

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

@ -14,6 +14,7 @@ const response = await client.inference.put({
min_number_of_allocations: 3,
max_number_of_allocations: 10,
},
num_threads: 1,
},
},
});

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

@ -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,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

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

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

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

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

@ -9,7 +9,11 @@ const response = await client.inference.put({
inference_config: {
service: "elser",
service_settings: {
num_allocations: 1,
adaptive_allocations: {
enabled: true,
min_number_of_allocations: 3,
max_number_of_allocations: 10,
},
num_threads: 1,
},
},

View File

@ -0,0 +1,17 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "my-index",
query: {
semantic: {
field: "inference_field",
query: "mountain lake",
inner_hits: {},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,36 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "restaurants",
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
multi_match: {
query: "Austria",
fields: ["city", "region"],
},
},
},
},
{
knn: {
field: "vector",
query_vector: [10, 22, 77],
k: 10,
num_candidates: 10,
},
},
],
rank_constant: 1,
rank_window_size: 50,
},
},
});
console.log(response);
----

View 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: "movies",
retriever: {
text_similarity_reranker: {
retriever: {
standard: {
query: {
match: {
genre: "drama",
},
},
},
},
field: "plot",
inference_id: "my-msmarco-minilm-model",
inference_text: "films that explore psychological depths",
},
},
});
console.log(response);
----

View File

@ -0,0 +1,17 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.index({
index: "my-index",
id: "lake_tahoe",
document: {
inference_field: [
"Lake Tahoe is the largest alpine lake in North America",
"When hiking in the area, please be on alert for bears",
],
},
});
console.log(response);
----

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.search({
index: "index",
retriever: {
text_similarity_reranker: {
retriever: {
standard: {
query: {
match_phrase: {
text: "landmark in Paris",
},
},
},
},
field: "text",
inference_id: "my-cohere-rerank-model",
inference_text: "Most famous landmark in Paris",
rank_window_size: 100,
min_score: 0.5,
},
},
});
console.log(response);
----

View File

@ -0,0 +1,32 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "restaurants",
retriever: {
standard: {
query: {
bool: {
should: [
{
match: {
region: "Austria",
},
},
],
filter: [
{
term: {
year: "2019",
},
},
],
},
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,68 @@
// This 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: {
metrics: {
type: "object",
subobjects: "auto",
properties: {
inner: {
type: "object",
enabled: false,
},
nested: {
type: "nested",
},
},
},
},
},
});
console.log(response);
const response1 = await client.index({
index: "my-index-000002",
id: "metric_1",
document: {
"metrics.time": 100,
"metrics.time.min": 10,
"metrics.time.max": 900,
},
});
console.log(response1);
const response2 = await client.index({
index: "my-index-000002",
id: "metric_2",
document: {
metrics: {
time: 100,
"time.min": 10,
"time.max": 900,
inner: {
foo: "bar",
"path.to.some.field": "baz",
},
nested: [
{
id: 10,
},
{
id: 1,
},
],
},
},
});
console.log(response2);
const response3 = await client.indices.getMapping({
index: "my-index-000002",
});
console.log(response3);
----

View File

@ -33,6 +33,25 @@ const response = await client.simulate.ingest({
],
},
},
component_template_substitutions: {
"my-component-template": {
template: {
mappings: {
dynamic: "true",
properties: {
field3: {
type: "keyword",
},
},
},
settings: {
index: {
default_pipeline: "my-pipeline",
},
},
},
},
},
},
});
console.log(response);

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.ml.postCalendarEvents({
calendar_id: "dst-germany",
events: [
{
description: "Fall 2024",
start_time: 1729994400000,
end_time: 1730167200000,
skip_result: false,
skip_model_update: false,
force_time_shift: -3600,
},
{
description: "Spring 2025",
start_time: 1743296400000,
end_time: 1743469200000,
skip_result: false,
skip_model_update: false,
force_time_shift: 3600,
},
],
});
console.log(response);
----

View File

@ -0,0 +1,13 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.create({
index: "my-index-000001",
settings: {
"index.mapping.ignore_above": 256,
},
});
console.log(response);
----

View File

@ -0,0 +1,44 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.simulate.ingest({
body: {
docs: [
{
_index: "my-index",
_id: "123",
_source: {
foo: "foo",
},
},
{
_index: "my-index",
_id: "456",
_source: {
bar: "rab",
},
},
],
component_template_substitutions: {
"my-mappings_template": {
template: {
mappings: {
dynamic: "strict",
properties: {
foo: {
type: "keyword",
},
bar: {
type: "keyword",
},
},
},
},
},
},
},
});
console.log(response);
----

View File

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