Skip to content

Commit

Permalink
Auto-generated code for 8.x (#2500)
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Dec 2, 2024
1 parent dbd0ec2 commit 4e1273e
Show file tree
Hide file tree
Showing 34 changed files with 1,024 additions and 102 deletions.
46 changes: 46 additions & 0 deletions docs/doc_examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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: "retrievers_example",
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
range: {
year: {
gt: 2023,
},
},
},
},
},
{
standard: {
query: {
term: {
topic: "elastic",
},
},
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
_source: false,
aggs: {
topics: {
terms: {
field: "topic",
},
},
},
});
console.log(response);
----
18 changes: 18 additions & 0 deletions docs/doc_examples/0165d22da5f2fc7678392b31d8eb5566.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.inference.put({
task_type: "rerank",
inference_id: "my-rerank-model",
inference_config: {
service: "cohere",
service_settings: {
model_id: "rerank-english-v3.0",
api_key: "{{COHERE_API_KEY}}",
},
},
});
console.log(response);
----
49 changes: 49 additions & 0 deletions docs/doc_examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc
Original file line number Diff line number Diff line change
@@ -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.search({
index: "retrievers_example_nested",
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
nested: {
path: "nested_field",
inner_hits: {
name: "nested_vector",
_source: false,
fields: ["nested_field.paragraph_id"],
},
query: {
knn: {
field: "nested_field.nested_vector",
query_vector: [1, 0, 0.5],
k: 10,
},
},
},
},
},
},
{
standard: {
query: {
term: {
topic: "ai",
},
},
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
_source: ["topic"],
});
console.log(response);
----
57 changes: 57 additions & 0 deletions docs/doc_examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// 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: "retrievers_example",
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
term: {
topic: "elastic",
},
},
},
},
{
rrf: {
retrievers: [
{
standard: {
query: {
query_string: {
query:
"(information retrieval) OR (artificial intelligence)",
default_field: "text",
},
},
},
},
{
knn: {
field: "vector",
query_vector: [0.23, 0.67, 0.89],
k: 3,
num_candidates: 5,
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
_source: false,
size: 1,
explain: true,
});
console.log(response);
----
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const response = await client.search({
},
},
field: "text",
inference_id: "my-cohere-rerank-model",
inference_id: "elastic-rerank",
inference_text: "How often does the moon hide the sun?",
rank_window_size: 100,
min_score: 0.5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

[source, js]
----
const response = await client.cluster.getSettings({
flat_settings: "true",
const response = await client.indices.rollover({
alias: "datastream",
});
console.log(response);
----
28 changes: 0 additions & 28 deletions docs/doc_examples/2577acb462b95bd4394523cf2f8a661f.asciidoc

This file was deleted.

16 changes: 0 additions & 16 deletions docs/doc_examples/2bb41b0b4876ce98cd0cd8fb6d337f18.asciidoc

This file was deleted.

23 changes: 23 additions & 0 deletions docs/doc_examples/30d051f534aeb884176eedb2c11dac85.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: "rerank",
inference_id: "my-elastic-rerank",
inference_config: {
service: "elasticsearch",
service_settings: {
model_id: ".rerank-v1",
num_threads: 1,
adaptive_allocations: {
enabled: true,
min_number_of_allocations: 1,
max_number_of_allocations: 4,
},
},
},
});
console.log(response);
----
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ const response = await client.search({
query: {
bool: {
must: [
{
term: {
"category.keyword": "Main Course",
},
},
{
term: {
tags: "vegetarian",
Expand All @@ -27,6 +22,11 @@ const response = await client.search({
},
],
should: [
{
term: {
category: "Main Course",
},
},
{
multi_match: {
query: "curry spicy",
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ console.log(response);
const response1 = await client.indices.putIndexTemplate({
name: 2,
index_patterns: ["k8s*"],
index_patterns: ["k9s*"],
composed_of: ["destination_template"],
data_stream: {},
});
Expand Down
44 changes: 44 additions & 0 deletions docs/doc_examples/76e02434835630cb830724beb92df354.asciidoc
Original file line number Diff line number Diff line change
@@ -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.search({
index: "retrievers_example",
retriever: {
rrf: {
retrievers: [
{
knn: {
field: "vector",
query_vector: [0.23, 0.67, 0.89],
k: 3,
num_candidates: 5,
},
},
{
text_similarity_reranker: {
retriever: {
standard: {
query: {
term: {
topic: "ai",
},
},
},
},
field: "text",
inference_id: "my-rerank-model",
inference_text:
"Can I use generative AI to identify user intent and improve search relevance?",
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
_source: false,
});
console.log(response);
----
46 changes: 46 additions & 0 deletions docs/doc_examples/78043831fd32004a82930c8ac8a1d809.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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: "retrievers_example",
retriever: {
text_similarity_reranker: {
retriever: {
rrf: {
retrievers: [
{
standard: {
query: {
query_string: {
query:
"(information retrieval) OR (artificial intelligence)",
default_field: "text",
},
},
},
},
{
knn: {
field: "vector",
query_vector: [0.23, 0.67, 0.89],
k: 3,
num_candidates: 5,
},
},
],
rank_window_size: 10,
rank_constant: 1,
},
},
field: "text",
inference_id: "my-rerank-model",
inference_text:
"What are the state of the art applications of AI in information retrieval?",
},
},
_source: false,
});
console.log(response);
----
Loading

0 comments on commit 4e1273e

Please sign in to comment.