Skip to content

Commit fc80b32

Browse files
Auto-generated code for 8.15 (#2411)
1 parent e47b135 commit fc80b32

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+
----

0 commit comments

Comments
 (0)