Auto-generated code for 8.x (#2412)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
This commit is contained in:
Elastic Machine
2024-10-28 21:12:33 +01:00
committed by GitHub
parent 4ca358cad6
commit 7da9976777
93 changed files with 2023 additions and 438 deletions

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
kwd: {
type: "keyword",

View File

@ -3,8 +3,6 @@
[source, js]
----
const response = await client.cluster.reroute({
metric: "none",
});
const response = await client.cluster.reroute();
console.log(response);
----

View File

@ -8,6 +8,7 @@ const response = await client.esql.asyncQuery({
body: {
query:
"\n FROM my-index-000001,cluster_one:my-index-000001,cluster_two:my-index*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
include_ccs_metadata: true,
},
});
console.log(response);

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: "cooking_blog",
query: {
match: {
title: {
query: "fluffy pancakes breakfast",
minimum_should_match: 2,
},
},
},
});
console.log(response);
----

View File

@ -9,7 +9,7 @@ const response = await client.connector.put({
name: "My Connector",
description: "My Connector to sync data to Elastic index from Google Drive",
service_type: "google_drive",
language: "english",
language: "en",
});
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: "text_embedding",
inference_id: "watsonx-embeddings",
inference_config: {
service: "watsonxai",
service_settings: {
api_key: "<api_key>",
url: "<url>",
model_id: "ibm/slate-30m-english-rtrvr",
project_id: "<project_id>",
api_version: "2024-03-14",
},
},
});
console.log(response);
----

View File

@ -0,0 +1,55 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "cooking_blog",
query: {
bool: {
must: [
{
term: {
"category.keyword": "Main Course",
},
},
{
term: {
tags: "vegetarian",
},
},
{
range: {
rating: {
gte: 4.5,
},
},
},
],
should: [
{
multi_match: {
query: "curry spicy",
fields: ["title^2", "description"],
},
},
{
range: {
date: {
gte: "now-1M/d",
},
},
},
],
must_not: [
{
term: {
"category.keyword": "Dessert",
},
},
],
},
},
});
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.index({
index: "mv",
refresh: "true",
document: {
a: [2, null, 1],
},
});
console.log(response);
const response1 = await client.esql.query({
query: "FROM mv | LIMIT 1",
});
console.log(response1);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
card: {
type: "wildcard",

View File

@ -0,0 +1,77 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.create({
index: "my-index-000001",
mappings: {
properties: {
attributes: {
type: "passthrough",
priority: 10,
properties: {
id: {
type: "keyword",
},
},
},
},
},
});
console.log(response);
const response1 = await client.index({
index: "my-index-000001",
id: 1,
document: {
attributes: {
id: "foo",
zone: 10,
},
},
});
console.log(response1);
const response2 = await client.search({
index: "my-index-000001",
query: {
bool: {
must: [
{
match: {
id: "foo",
},
},
{
match: {
zone: 10,
},
},
],
},
},
});
console.log(response2);
const response3 = await client.search({
index: "my-index-000001",
query: {
bool: {
must: [
{
match: {
"attributes.id": "foo",
},
},
{
match: {
"attributes.zone": 10,
},
},
],
},
},
});
console.log(response3);
----

View File

@ -29,6 +29,7 @@ const response = await client.indices.create({
"arabic_normalization",
"persian_normalization",
"persian_stop",
"persian_stem",
],
},
},

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.index({
index: "amazon-reviews",
id: 1,
document: {
review_text:
"This product is lifechanging! I'm telling all my friends about it.",
review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
},
});
console.log(response);
----

View File

@ -0,0 +1,14 @@
// 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.streamInference({
task_type: "completion",
inference_id: "openai-completion",
body: {
input: "What is Elastic?",
},
});
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.indices.create({
index: "my-index-000002",
mappings: {
properties: {
attributes: {
type: "passthrough",
priority: 10,
properties: {
id: {
type: "keyword",
},
},
},
"resource.attributes": {
type: "passthrough",
priority: 20,
properties: {
id: {
type: "keyword",
},
},
},
},
},
});
console.log(response);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
agg_metric: {
type: "aggregate_metric_double",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
my_range: {
type: "long_range",

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: "cooking_blog",
query: {
range: {
date: {
gte: "2023-05-01",
lte: "2023-05-31",
},
},
},
});
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.indices.create({
index: "semantic-embeddings",
mappings: {
properties: {
semantic_text: {
type: "semantic_text",
inference_id: "my-elser-endpoint",
},
content: {
type: "text",
copy_to: "semantic_text",
},
},
},
});
console.log(response);
----

View File

@ -8,6 +8,7 @@ const response = await client.esql.asyncQuery({
body: {
query:
"\n FROM cluster_one:my-index*,cluster_two:logs*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ",
include_ccs_metadata: true,
},
});
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: "sparse_embedding",
inference_id: "small_chunk_size",
inference_config: {
service: "elasticsearch",
service_settings: {
num_allocations: 1,
num_threads: 1,
},
chunking_settings: {
strategy: "sentence",
max_chunk_size: 100,
sentence_overlap: 0,
},
},
});
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: "idx",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
});
console.log(response);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
flattened: {
type: "flattened",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
text: {
type: "text",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
versions: {
type: "version",

View File

@ -4,7 +4,6 @@
[source, js]
----
const response = await client.cluster.reroute({
metric: "none",
commands: [
{
allocate_empty_primary: {

View File

@ -0,0 +1,52 @@
// 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({
operations: [
{
index: {
_index: "amazon-reviews",
_id: "2",
},
},
{
review_text: "This product is amazing! I love it.",
review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
},
{
index: {
_index: "amazon-reviews",
_id: "3",
},
},
{
review_text: "This product is terrible. I hate it.",
review_vector: [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1],
},
{
index: {
_index: "amazon-reviews",
_id: "4",
},
},
{
review_text: "This product is great. I can do anything with it.",
review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
},
{
index: {
_index: "amazon-reviews",
_id: "5",
},
},
{
review_text:
"This product has ruined my life and the lives of my family and friends.",
review_vector: [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1],
},
],
});
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: "cooking_blog",
query: {
match: {
description: {
query: "fluffy pancakes",
operator: "and",
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,49 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.putIndexTemplate({
name: "my-metrics",
index_patterns: ["metrics-mymetrics-*"],
priority: 200,
data_stream: {},
template: {
settings: {
"index.mode": "time_series",
},
mappings: {
properties: {
attributes: {
type: "passthrough",
priority: 10,
time_series_dimension: true,
properties: {
"host.name": {
type: "keyword",
},
},
},
cpu: {
type: "integer",
time_series_metric: "counter",
},
},
},
},
});
console.log(response);
const response1 = await client.index({
index: "metrics-mymetrics-test",
document: {
"@timestamp": "2020-01-01T00:00:00.000Z",
attributes: {
"host.name": "foo",
zone: "bar",
},
cpu: 10,
},
});
console.log(response1);
----

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

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
flattened: {
type: "flattened",

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: "amazon-reviews",
retriever: {
knn: {
field: "review_vector",
query_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
k: 2,
num_candidates: 5,
},
},
});
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.search({
index: "cooking_blog",
query: {
match: {
description: {
query: "fluffy pancakes",
},
},
},
});
console.log(response);
----

View File

@ -3,9 +3,10 @@
[source, js]
----
const response = await client.indices.putSettings({
index: ".watches",
settings: {
const response = await client.transport.request({
method: "PUT",
path: "/_watcher/settings",
body: {
"index.routing.allocation.include.role": "watcher",
},
});

View File

@ -3,9 +3,8 @@
[source, js]
----
const response = await client.snapshot.create({
repository: "my_repository",
snapshot: "_verify_integrity",
const response = await client.snapshot.repositoryVerifyIntegrity({
name: "my_repository",
});
console.log(response);
----

View File

@ -0,0 +1,15 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "cooking_blog",
query: {
term: {
"author.keyword": "Maria Rodriguez",
},
},
});
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.inference.put({
task_type: "sparse_embedding",
inference_id: "use_existing_deployment",
inference_config: {
service: "elasticsearch",
service_settings: {
deployment_id: ".elser_model_2",
},
},
});
console.log(response);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx_keep",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
path: {
type: "object",

View File

@ -0,0 +1,61 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.putMapping({
index: "cooking_blog",
properties: {
title: {
type: "text",
analyzer: "standard",
fields: {
keyword: {
type: "keyword",
ignore_above: 256,
},
},
},
description: {
type: "text",
fields: {
keyword: {
type: "keyword",
},
},
},
author: {
type: "text",
fields: {
keyword: {
type: "keyword",
},
},
},
date: {
type: "date",
format: "yyyy-MM-dd",
},
category: {
type: "text",
fields: {
keyword: {
type: "keyword",
},
},
},
tags: {
type: "text",
fields: {
keyword: {
type: "keyword",
},
},
},
rating: {
type: "float",
},
},
});
console.log(response);
----

View File

@ -0,0 +1,35 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "semantic-embeddings",
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
match: {
content: "How to avoid muscle soreness while running?",
},
},
},
},
{
standard: {
query: {
semantic: {
field: "semantic_text",
query: "How to avoid muscle soreness while running?",
},
},
},
},
],
},
},
});
console.log(response);
----

View File

@ -4,7 +4,6 @@
[source, js]
----
const response = await client.cluster.reroute({
metric: "none",
commands: [
{
move: {

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
flattened: {
type: "flattened",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
my_range: {
type: "long_range",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
date: {
type: "date_nanos",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
bool: {
type: "boolean",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
my_range: {
type: "integer_range",

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.search({
index: "cooking_blog",
query: {
bool: {
filter: [
{
term: {
"category.keyword": "Breakfast",
},
},
],
},
},
});
console.log(response);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
f: {
type: "scaled_float",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
my_range: {
type: "date_range",

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.search({
index: "cooking_blog",
query: {
multi_match: {
query: "vegetarian curry",
fields: ["title^3", "description^2", "tags"],
},
},
});
console.log(response);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
point: {
type: "geo_point",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
long: {
type: "long",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
binary: {
type: "binary",

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-000001",
id: 1,
document: {
attributes: {
id: "foo",
},
id: "bar",
},
});
console.log(response);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
date: {
type: "date",

View File

@ -0,0 +1,88 @@
// 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: "cooking_blog",
refresh: "wait_for",
operations: [
{
index: {
_id: "1",
},
},
{
title: "Perfect Pancakes: A Fluffy Breakfast Delight",
description:
"Learn the secrets to making the fluffiest pancakes, so amazing you won't believe your tastebuds. This recipe uses buttermilk and a special folding technique to create light, airy pancakes that are perfect for lazy Sunday mornings.",
author: "Maria Rodriguez",
date: "2023-05-01",
category: "Breakfast",
tags: ["pancakes", "breakfast", "easy recipes"],
rating: 4.8,
},
{
index: {
_id: "2",
},
},
{
title: "Spicy Thai Green Curry: A Vegetarian Adventure",
description:
"Dive into the flavors of Thailand with this vibrant green curry. Packed with vegetables and aromatic herbs, this dish is both healthy and satisfying. Don't worry about the heat - you can easily adjust the spice level to your liking.",
author: "Liam Chen",
date: "2023-05-05",
category: "Main Course",
tags: ["thai", "vegetarian", "curry", "spicy"],
rating: 4.6,
},
{
index: {
_id: "3",
},
},
{
title: "Classic Beef Stroganoff: A Creamy Comfort Food",
description:
"Indulge in this rich and creamy beef stroganoff. Tender strips of beef in a savory mushroom sauce, served over a bed of egg noodles. It's the ultimate comfort food for chilly evenings.",
author: "Emma Watson",
date: "2023-05-10",
category: "Main Course",
tags: ["beef", "pasta", "comfort food"],
rating: 4.7,
},
{
index: {
_id: "4",
},
},
{
title: "Vegan Chocolate Avocado Mousse",
description:
"Discover the magic of avocado in this rich, vegan chocolate mousse. Creamy, indulgent, and secretly healthy, it's the perfect guilt-free dessert for chocolate lovers.",
author: "Alex Green",
date: "2023-05-15",
category: "Dessert",
tags: ["vegan", "chocolate", "avocado", "healthy dessert"],
rating: 4.5,
},
{
index: {
_id: "5",
},
},
{
title: "Crispy Oven-Fried Chicken",
description:
"Get that perfect crunch without the deep fryer! This oven-fried chicken recipe delivers crispy, juicy results every time. A healthier take on the classic comfort food.",
author: "Maria Rodriguez",
date: "2023-05-20",
category: "Main Course",
tags: ["chicken", "oven-fried", "healthy"],
rating: 4.9,
},
],
});
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.search({
index: "cooking_blog",
query: {
multi_match: {
query: "vegetarian curry",
fields: ["title", "description", "tags"],
},
},
});
console.log(response);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
kwd: {
type: "keyword",

View File

@ -0,0 +1,37 @@
// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.search({
index: "my-index",
size: 10,
knn: {
query_vector: [0.04283529, 0.85670587, -0.51402352, 0],
field: "my_int4_vector",
k: 20,
num_candidates: 50,
},
rescore: {
window_size: 20,
query: {
rescore_query: {
script_score: {
query: {
match_all: {},
},
script: {
source: "(dotProduct(params.queryVector, 'my_int4_vector') + 1.0)",
params: {
queryVector: [0.04283529, 0.85670587, -0.51402352, 0],
},
},
},
},
query_weight: 0,
rescore_query_weight: 1,
},
},
});
console.log(response);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
ip: {
type: "ip",

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: "amazon-reviews",
mappings: {
properties: {
review_vector: {
type: "dense_vector",
dims: 8,
index: true,
similarity: "cosine",
},
review_text: {
type: "text",
},
},
},
});
console.log(response);
----

View File

@ -52,6 +52,20 @@ const response = await client.simulate.ingest({
},
},
},
index_template_substitutions: {
"my-index-template": {
index_patterns: ["my-index-*"],
composed_of: ["component_template_1", "component_template_2"],
},
},
mapping_addition: {
dynamic: "strict",
properties: {
foo: {
type: "keyword",
},
},
},
},
});
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: "my-index",
size: 10,
query: {
script_score: {
query: {
knn: {
query_vector: [0.04283529, 0.85670587, -0.51402352, 0],
field: "my_int4_vector",
num_candidates: 20,
},
},
script: {
source: "(dotProduct(params.queryVector, 'my_int4_vector') + 1.0)",
params: {
queryVector: [0.04283529, 0.85670587, -0.51402352, 0],
},
},
},
},
});
console.log(response);
----

View File

@ -0,0 +1,14 @@
// 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.inference({
task_type: "my-inference-endpoint",
inference_id: "_update",
service_settings: {
api_key: "<API_KEY>",
},
});
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.indices.create({
index: "my-byte-quantized-index",
mappings: {
properties: {
my_vector: {
type: "dense_vector",
dims: 64,
index: true,
index_options: {
type: "bbq_hnsw",
},
},
},
},
});
console.log(response);
----

View File

@ -4,12 +4,7 @@
[source, js]
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
},
},
index: "cooking_blog",
});
console.log(response);
----

View File

@ -5,7 +5,7 @@
----
const response = await client.cat.mlTrainedModels({
h: "c,o,l,ct,v",
v: "ture",
v: "true",
});
console.log(response);
----

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
text: {
type: "text",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
kwd: {
type: "keyword",

View File

@ -5,10 +5,16 @@
----
const response = await client.indices.create({
index: "idx",
mappings: {
_source: {
mode: "synthetic",
settings: {
index: {
mapping: {
source: {
mode: "synthetic",
},
},
},
},
mappings: {
properties: {
my_range: {
type: "ip_range",

File diff suppressed because it is too large Load Diff