Skip to content

Commit

Permalink
Auto-generated API code
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Dec 2, 2024
1 parent 7d4ae5e commit 0023d03
Show file tree
Hide file tree
Showing 60 changed files with 1,007 additions and 106 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);
----
8 changes: 6 additions & 2 deletions docs/doc_examples/0bee07a581c5776e068f6f4efad5a399.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

[source, js]
----
const response = await client.esql.asyncQuery({
format: "json",
const response = await client.transport.request({
method: "POST",
path: "/_query/async",
querystring: {
format: "json",
},
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 ",
Expand Down
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);
----
5 changes: 3 additions & 2 deletions docs/doc_examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

[source, js]
----
const response = await client.searchApplication.renderQuery({
name: "my-app",
const response = await client.transport.request({
method: "POST",
path: "/_application/search_application/my-app/_render_query",
body: {
params: {
query_string: "my first query",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const response = await client.searchApplication.put({
script: {
lang: "mustache",
source:
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n \n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
'\n {\n "query": {\n "bool": {\n "must": [\n {{#query}}\n {{/query}}\n ],\n "filter": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n "_source": {\n "includes": ["title", "plot"]\n },\n "highlight": {\n "fields": {\n "title": { "fragment_size": 0 },\n "plot": { "fragment_size": 200 }\n }\n },\n "aggs": {{#toJson}}_es_aggs{{/toJson}},\n "from": {{from}},\n "size": {{size}},\n "sort": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ',
params: {
query: "",
_es_filters: {},
Expand Down
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
4 changes: 3 additions & 1 deletion docs/doc_examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

[source, js]
----
const response = await client.simulate.ingest({
const response = await client.transport.request({
method: "POST",
path: "/_ingest/_simulate",
body: {
docs: [
{
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.

4 changes: 3 additions & 1 deletion docs/doc_examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

[source, js]
----
const response = await client.security.oidcLogout({
const response = await client.transport.request({
method: "POST",
path: "/_security/oidc/logout",
body: {
token:
"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
Expand Down
10 changes: 6 additions & 4 deletions docs/doc_examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

[source, js]
----
const response = await client.esql.asyncQueryGet({
id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
wait_for_completion_timeout: "30s",
body: null,
const response = await client.transport.request({
method: "GET",
path: "/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
querystring: {
wait_for_completion_timeout: "30s",
},
});
console.log(response);
----
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);
----
4 changes: 3 additions & 1 deletion docs/doc_examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

[source, js]
----
const response = await client.esql.asyncQuery({
const response = await client.transport.request({
method: "POST",
path: "/_query/async",
body: {
query:
"\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ",
Expand Down
6 changes: 3 additions & 3 deletions docs/doc_examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

[source, js]
----
const response = await client.esql.asyncQueryGet({
id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
body: null,
const response = await client.transport.request({
method: "GET",
path: "/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
});
console.log(response);
----
6 changes: 3 additions & 3 deletions docs/doc_examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

[source, js]
----
const response = await client.inference.streamInference({
task_type: "completion",
inference_id: "openai-completion",
const response = await client.transport.request({
method: "POST",
path: "/_inference/completion/openai-completion/_stream",
body: {
input: "What is Elastic?",
},
Expand Down
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
Loading

0 comments on commit 0023d03

Please sign in to comment.