Skip to content

Commit 8b0c2c2

Browse files
Auto-generated API code
1 parent e47b135 commit 8b0c2c2

18 files changed

+249
-10
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.inference.put({
7+
task_type: "text_embedding",
8+
inference_id: "watsonx-embeddings",
9+
inference_config: {
10+
service: "watsonxai",
11+
service_settings: {
12+
api_key: "<api_key>",
13+
url: "<url>",
14+
model_id: "ibm/slate-30m-english-rtrvr",
15+
project_id: "<project_id>",
16+
api_version: "2024-03-14",
17+
},
18+
},
19+
});
20+
console.log(response);
21+
----

docs/doc_examples/d1a285aa244ec461d68f13e7078a33c0.asciidoc renamed to docs/doc_examples/3ab8f65fcb55a0e3664c55749ec41efd.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const response = await client.indices.create({
2929
"arabic_normalization",
3030
"persian_normalization",
3131
"persian_stop",
32+
"persian_stem",
3233
],
3334
},
3435
},
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.index({
7+
index: "amazon-reviews",
8+
id: 1,
9+
document: {
10+
review_text:
11+
"This product is lifechanging! I'm telling all my friends about it.",
12+
review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
13+
},
14+
});
15+
console.log(response);
16+
----
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.inference.streamInference({
7+
task_type: "completion",
8+
inference_id: "openai-completion",
9+
body: {
10+
input: "What is Elastic?",
11+
},
12+
});
13+
console.log(response);
14+
----
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.inference.put({
7+
task_type: "sparse_embedding",
8+
inference_id: "small_chunk_size",
9+
inference_config: {
10+
service: "elasticsearch",
11+
service_settings: {
12+
num_allocations: 1,
13+
num_threads: 1,
14+
},
15+
chunking_settings: {
16+
strategy: "sentence",
17+
max_chunk_size: 100,
18+
sentence_overlap: 0,
19+
},
20+
},
21+
});
22+
console.log(response);
23+
----

docs/doc_examples/19f1f9f25933f8e7aba59a10881c648b.asciidoc renamed to docs/doc_examples/5f16358ebb5d14b86f57612d5f92d923.asciidoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const response = await client.indices.create({
99
properties: {
1010
inference_field: {
1111
type: "semantic_text",
12-
inference_id: "my-elser-endpoint",
1312
},
1413
},
1514
},
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.bulk({
7+
operations: [
8+
{
9+
index: {
10+
_index: "amazon-reviews",
11+
_id: "2",
12+
},
13+
},
14+
{
15+
review_text: "This product is amazing! I love it.",
16+
review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
17+
},
18+
{
19+
index: {
20+
_index: "amazon-reviews",
21+
_id: "3",
22+
},
23+
},
24+
{
25+
review_text: "This product is terrible. I hate it.",
26+
review_vector: [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1],
27+
},
28+
{
29+
index: {
30+
_index: "amazon-reviews",
31+
_id: "4",
32+
},
33+
},
34+
{
35+
review_text: "This product is great. I can do anything with it.",
36+
review_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
37+
},
38+
{
39+
index: {
40+
_index: "amazon-reviews",
41+
_id: "5",
42+
},
43+
},
44+
{
45+
review_text:
46+
"This product has ruined my life and the lives of my family and friends.",
47+
review_vector: [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1],
48+
},
49+
],
50+
});
51+
console.log(response);
52+
----

docs/doc_examples/58f6b72009512851843c7b7a20e9504a.asciidoc renamed to docs/doc_examples/7a2fdfd7b0553d63440af7598f9ad867.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[source, js]
55
----
66
const response = await client.indices.create({
7-
index: "my-index-000002",
7+
index: "my-index-000003",
88
mappings: {
99
properties: {
1010
inference_field: {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.inference.put({
7+
task_type: "sparse_embedding",
8+
inference_id: "my-elser-model",
9+
inference_config: {
10+
service: "elasticsearch",
11+
service_settings: {
12+
adaptive_allocations: {
13+
enabled: true,
14+
min_number_of_allocations: 1,
15+
max_number_of_allocations: 10,
16+
},
17+
num_threads: 1,
18+
model_id: ".elser_model_2",
19+
},
20+
},
21+
});
22+
console.log(response);
23+
----
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.search({
7+
index: "amazon-reviews",
8+
retriever: {
9+
knn: {
10+
field: "review_vector",
11+
query_vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
12+
k: 2,
13+
num_candidates: 5,
14+
},
15+
},
16+
});
17+
console.log(response);
18+
----

docs/doc_examples/1d918e206ad8dab916e59183da24d9ec.asciidoc renamed to docs/doc_examples/8080cd9e24a8785728ce7c372ec4acf1.asciidoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44
[source, js]
55
----
6-
const response = await client.indices.putSettings({
7-
index: ".watches",
8-
settings: {
6+
const response = await client.transport.request({
7+
method: "PUT",
8+
path: "/_watcher/settings",
9+
body: {
910
"index.routing.allocation.include.role": "watcher",
1011
},
1112
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.inference.put({
7+
task_type: "sparse_embedding",
8+
inference_id: "use_existing_deployment",
9+
inference_config: {
10+
service: "elasticsearch",
11+
service_settings: {
12+
deployment_id: ".elser_model_2",
13+
},
14+
},
15+
});
16+
console.log(response);
17+
----

docs/doc_examples/c8fa8d7e029792d539464fede18ce258.asciidoc renamed to docs/doc_examples/8a0b5f759de3f27f0801c1176e616117.asciidoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const response = await client.indices.create({
99
properties: {
1010
content: {
1111
type: "semantic_text",
12-
inference_id: "my-elser-endpoint",
1312
},
1413
},
1514
},
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.indices.create({
7+
index: "my-index-000002",
8+
mappings: {
9+
properties: {
10+
inference_field: {
11+
type: "semantic_text",
12+
inference_id: "my-openai-endpoint",
13+
},
14+
},
15+
},
16+
});
17+
console.log(response);
18+
----

docs/doc_examples/51390ca10aa22d7104e8970f09ea4512.asciidoc renamed to docs/doc_examples/b3f442a7d9eb391121dcab991787f9d6.asciidoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55
----
66
const response = await client.indices.create({
77
index: "idx",
8-
mappings: {
9-
_source: {
10-
mode: "synthetic",
8+
settings: {
9+
index: {
10+
mapping: {
11+
source: {
12+
mode: "synthetic",
13+
},
14+
},
1115
},
16+
},
17+
mappings: {
1218
properties: {
1319
binary: {
1420
type: "binary",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.indices.create({
7+
index: "amazon-reviews",
8+
mappings: {
9+
properties: {
10+
review_vector: {
11+
type: "dense_vector",
12+
dims: 8,
13+
index: true,
14+
similarity: "cosine",
15+
},
16+
review_text: {
17+
type: "text",
18+
},
19+
},
20+
},
21+
});
22+
console.log(response);
23+
----

docs/doc_examples/2267e2ac10e6f4ecc691b7c6d46d1c14.asciidoc renamed to docs/doc_examples/ccc613951c61f0b17e1ed8a2d3ae54a2.asciidoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ const response = await client.simulate.ingest({
5858
composed_of: ["component_template_1", "component_template_2"],
5959
},
6060
},
61+
mapping_addition: {
62+
dynamic: "strict",
63+
properties: {
64+
foo: {
65+
type: "keyword",
66+
},
67+
},
68+
},
6169
},
6270
});
6371
console.log(response);

docs/doc_examples/1af9742c71ce0587cd49a73ec7fc1f6c.asciidoc renamed to docs/doc_examples/f95a4d7ab02bf400246c8822f0245f02.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
----
66
const response = await client.cat.mlTrainedModels({
77
h: "c,o,l,ct,v",
8-
v: "ture",
8+
v: "true",
99
});
1010
console.log(response);
1111
----

0 commit comments

Comments
 (0)