Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/doc_examples/0e31b8ad176b31028becf9500989bcbd.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const response = await client.indices.create({
"arabic_normalization",
"persian_normalization",
"persian_stop",
"persian_stem",
],
},
},
Expand Down
16 changes: 16 additions & 0 deletions docs/doc_examples/40f287bf733420bbab134b74c7d0ea5d.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
14 changes: 14 additions & 0 deletions docs/doc_examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
23 changes: 23 additions & 0 deletions docs/doc_examples/5ceb734e3affe00e2cdc29af748d95bf.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const response = await client.indices.create({
properties: {
inference_field: {
type: "semantic_text",
inference_id: "my-elser-endpoint",
},
},
},
Expand Down
52 changes: 52 additions & 0 deletions docs/doc_examples/76c73b54f3f1e5cb1c0fcccd7c3fd18e.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[source, js]
----
const response = await client.indices.create({
index: "my-index-000002",
index: "my-index-000003",
mappings: {
properties: {
inference_field: {
Expand Down
23 changes: 23 additions & 0 deletions docs/doc_examples/7b9691bd34a02dd859562eb927f175e0.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
18 changes: 18 additions & 0 deletions docs/doc_examples/7db09cab02d71f3a10d91071216d80fc.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
});
Expand Down
17 changes: 17 additions & 0 deletions docs/doc_examples/85f9fc6f98e8573efed9b034e853d5ae.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const response = await client.indices.create({
properties: {
content: {
type: "semantic_text",
inference_id: "my-elser-endpoint",
},
},
},
Expand Down
18 changes: 18 additions & 0 deletions docs/doc_examples/96e88611f99e6834bd64b58dc8a282c1.asciidoc
Original file line number Diff line number Diff line change
@@ -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.indices.create({
index: "my-index-000002",
mappings: {
properties: {
inference_field: {
type: "semantic_text",
inference_id: "my-openai-endpoint",
},
},
},
});
console.log(response);
----
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 23 additions & 0 deletions docs/doc_examples/c8aa8e8c0ac160b8c4efd1ac3b9f48f3.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ const response = await client.simulate.ingest({
composed_of: ["component_template_1", "component_template_2"],
},
},
mapping_addition: {
dynamic: "strict",
properties: {
foo: {
type: "keyword",
},
},
},
},
});
console.log(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
----
const response = await client.cat.mlTrainedModels({
h: "c,o,l,ct,v",
v: "ture",
v: "true",
});
console.log(response);
----
Loading