Skip to content

Commit c72be9c

Browse files
Auto-generated API code (#3459)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 67ee28b commit c72be9c

8 files changed

Lines changed: 864 additions & 63 deletions

File tree

‎docs/reference/api-reference.md‎

Lines changed: 177 additions & 35 deletions
Large diffs are not rendered by default.

‎src/api/api/data_recovery.ts‎

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
// This file was automatically generated by elastic/elastic-client-generator-js
7+
// DO NOT MODIFY IT BY HAND. Instead, modify the source open api file,
8+
// and elastic/elastic-client-generator-js to regenerate this file again.
9+
10+
import {
11+
Transport,
12+
TransportRequestMetadata,
13+
TransportRequestOptions,
14+
TransportRequestOptionsWithMeta,
15+
TransportRequestOptionsWithOutMeta,
16+
TransportResult
17+
} from '@elastic/transport'
18+
import * as T from '../types'
19+
import { kAcceptedParams } from '../../symbols'
20+
21+
interface That {
22+
transport: Transport
23+
[kAcceptedParams]: Record<string, { path: string[], body: string[], query: string[] }>
24+
}
25+
26+
export default class DataRecovery {
27+
transport: Transport
28+
[kAcceptedParams]: Record<string, { path: string[], body: string[], query: string[] }>
29+
constructor (transport: Transport) {
30+
this.transport = transport
31+
this[kAcceptedParams] = {
32+
'data_recovery.get_recovery_points': {
33+
path: [],
34+
body: [],
35+
query: [
36+
'end_time_before',
37+
'master_timeout',
38+
'size'
39+
]
40+
}
41+
}
42+
}
43+
44+
/**
45+
* Get recovery points. Get recovery points from the platform-managed data recovery repository. This API is intended for internal operator use. Recovery points are returned in descending order by end time. Repository, snapshot, and policy identifiers are not exposed.
46+
*/
47+
async getRecoveryPoints (this: That, params?: T.DataRecoveryGetRecoveryPointsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.DataRecoveryGetRecoveryPointsResponse>
48+
async getRecoveryPoints (this: That, params?: T.DataRecoveryGetRecoveryPointsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.DataRecoveryGetRecoveryPointsResponse, unknown>>
49+
async getRecoveryPoints (this: That, params?: T.DataRecoveryGetRecoveryPointsRequest, options?: TransportRequestOptions): Promise<T.DataRecoveryGetRecoveryPointsResponse>
50+
async getRecoveryPoints (this: That, params?: T.DataRecoveryGetRecoveryPointsRequest, options?: TransportRequestOptions): Promise<any> {
51+
const {
52+
path: acceptedPath
53+
} = this[kAcceptedParams]['data_recovery.get_recovery_points']
54+
55+
const userQuery = params?.querystring
56+
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
57+
58+
let body: Record<string, any> | string | undefined
59+
const userBody = params?.body
60+
if (userBody != null) {
61+
if (typeof userBody === 'string') {
62+
body = userBody
63+
} else {
64+
body = { ...userBody }
65+
}
66+
}
67+
68+
params = params ?? {}
69+
for (const key in params) {
70+
if (acceptedPath.includes(key)) {
71+
continue
72+
} else if (key !== 'body' && key !== 'querystring') {
73+
// @ts-expect-error
74+
querystring[key] = params[key]
75+
}
76+
}
77+
78+
const method = 'GET'
79+
const path = '/_data_recovery/points'
80+
const meta: TransportRequestMetadata = {
81+
name: 'data_recovery.get_recovery_points',
82+
acceptedParams: {
83+
path: [],
84+
body: [],
85+
query: ['end_time_before', 'master_timeout', 'size']
86+
}
87+
}
88+
return await this.transport.request({ path, method, querystring, body, meta }, options)
89+
}
90+
}

‎src/api/api/esql.ts‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ export default class Esql {
211211
'drop_null_columns',
212212
'allow_partial_results'
213213
]
214+
},
215+
'esql.test_data_source_connection': {
216+
path: [],
217+
body: [
218+
'type',
219+
'settings'
220+
],
221+
query: []
214222
}
215223
}
216224
}
@@ -1090,4 +1098,63 @@ export default class Esql {
10901098
}
10911099
return await this.transport.request({ path, method, querystring, body, meta }, options)
10921100
}
1101+
1102+
/**
1103+
* Test an ES|QL data source connection. Tests whether the supplied data source configuration can establish a live connection. The data source does not need to exist in cluster state: this endpoint is intended for validating a new configuration before saving it. The request body accepts the same `type` and `settings` fields as the create or update data source API.
1104+
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-data-source-test-connection | Elasticsearch API documentation}
1105+
*/
1106+
async testDataSourceConnection (this: That, params: T.EsqlTestDataSourceConnectionRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.EsqlTestDataSourceConnectionResponse>
1107+
async testDataSourceConnection (this: That, params: T.EsqlTestDataSourceConnectionRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.EsqlTestDataSourceConnectionResponse, unknown>>
1108+
async testDataSourceConnection (this: That, params: T.EsqlTestDataSourceConnectionRequest, options?: TransportRequestOptions): Promise<T.EsqlTestDataSourceConnectionResponse>
1109+
async testDataSourceConnection (this: That, params: T.EsqlTestDataSourceConnectionRequest, options?: TransportRequestOptions): Promise<any> {
1110+
const {
1111+
path: acceptedPath,
1112+
body: acceptedBody,
1113+
query: acceptedQuery
1114+
} = this[kAcceptedParams]['esql.test_data_source_connection']
1115+
1116+
const userQuery = params?.querystring
1117+
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
1118+
1119+
let body: Record<string, any> | string | undefined
1120+
const userBody = params?.body
1121+
if (userBody != null) {
1122+
if (typeof userBody === 'string') {
1123+
body = userBody
1124+
} else {
1125+
body = { ...userBody }
1126+
}
1127+
}
1128+
1129+
for (const key in params) {
1130+
if (acceptedBody.includes(key)) {
1131+
body = body ?? {}
1132+
// @ts-expect-error
1133+
body[key] = params[key]
1134+
} else if (acceptedPath.includes(key)) {
1135+
continue
1136+
} else if (key !== 'body' && key !== 'querystring') {
1137+
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
1138+
// @ts-expect-error
1139+
querystring[key] = params[key]
1140+
} else {
1141+
body = body ?? {}
1142+
// @ts-expect-error
1143+
body[key] = params[key]
1144+
}
1145+
}
1146+
}
1147+
1148+
const method = 'POST'
1149+
const path = '/_query/data_source/_test'
1150+
const meta: TransportRequestMetadata = {
1151+
name: 'esql.test_data_source_connection',
1152+
acceptedParams: {
1153+
path: [],
1154+
body: ['type', 'settings'],
1155+
query: []
1156+
}
1157+
}
1158+
return await this.transport.request({ path, method, querystring, body, meta }, options)
1159+
}
10931160
}

‎src/api/api/inference.ts‎

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,17 @@ export default class Inference {
109109
'timeout'
110110
]
111111
},
112+
'inference.non_streaming_chat_completion': {
113+
path: [
114+
'inference_id'
115+
],
116+
body: [
117+
'chat_completion_request'
118+
],
119+
query: [
120+
'timeout'
121+
]
122+
},
112123
'inference.put': {
113124
path: [
114125
'task_type',
@@ -573,7 +584,7 @@ export default class Inference {
573584
}
574585

575586
/**
576-
* Perform chat completion inference on the service. The chat completion inference API enables real-time responses for chat completion tasks by delivering answers incrementally, reducing response times during computation. It only works with the `chat_completion` task type. NOTE: The `chat_completion` task type is only available within the _stream API and only supports streaming. The Chat completion inference API and the Stream inference API differ in their response structure and capabilities. The Chat completion inference API provides more comprehensive customization options through more fields and function calling support. To determine whether a given inference service supports this task type, please see the page for that service.
587+
* Perform streaming chat completion inference on the service. The chat completion inference API enables real-time responses for chat completion tasks by delivering answers incrementally, reducing response times during computation. It only works with the `chat_completion` task type. NOTE: The `chat_completion` task type supports both streaming and non-streaming. The Chat completion inference API and the Stream inference API differ in their response structure and capabilities. The Chat completion inference API provides more comprehensive customization options through more fields and function calling support. To determine whether a given inference service supports this task type, please see the page for that service.
577588
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-unified-inference | Elasticsearch API documentation}
578589
*/
579590
async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceChatCompletionUnifiedResponse>
@@ -1027,6 +1038,58 @@ export default class Inference {
10271038
return await this.transport.request({ path, method, querystring, body, meta }, options)
10281039
}
10291040

1041+
/**
1042+
* Perform non-streaming chat completion inference on the service. The chat completion inference API enables rich responses for chat completion tasks. It only works with the `chat_completion` task type. NOTE: The `chat_completion` task type supports both streaming and non-streaming. The Chat completion inference API provides more comprehensive customization options through more fields and function calling support. To determine whether a given inference service supports this task type, please see the page for that service. These services support non-streaming chat completion inference: - AI21 - Azure OpenAI - Deepseek - Elastic - FireworksAI - Groq - Huggingface - IBMWatsonX - Llama - Mistral - NVIDIA - OpenAI - OpenShiftAI
1043+
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-non-streaming-chat-completion | Elasticsearch API documentation}
1044+
*/
1045+
async nonStreamingChatCompletion (this: That, params: T.InferenceNonStreamingChatCompletionRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceNonStreamingChatCompletionResponse>
1046+
async nonStreamingChatCompletion (this: That, params: T.InferenceNonStreamingChatCompletionRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceNonStreamingChatCompletionResponse, unknown>>
1047+
async nonStreamingChatCompletion (this: That, params: T.InferenceNonStreamingChatCompletionRequest, options?: TransportRequestOptions): Promise<T.InferenceNonStreamingChatCompletionResponse>
1048+
async nonStreamingChatCompletion (this: That, params: T.InferenceNonStreamingChatCompletionRequest, options?: TransportRequestOptions): Promise<any> {
1049+
const {
1050+
path: acceptedPath,
1051+
body: acceptedBody,
1052+
query: acceptedQuery
1053+
} = this[kAcceptedParams]['inference.non_streaming_chat_completion']
1054+
1055+
const userQuery = params?.querystring
1056+
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
1057+
1058+
let body: any = params.body ?? undefined
1059+
for (const key in params) {
1060+
if (acceptedBody.includes(key)) {
1061+
// @ts-expect-error
1062+
body = params[key]
1063+
} else if (acceptedPath.includes(key)) {
1064+
continue
1065+
} else if (key !== 'body' && key !== 'querystring') {
1066+
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
1067+
// @ts-expect-error
1068+
querystring[key] = params[key]
1069+
} else {
1070+
body = body ?? {}
1071+
// @ts-expect-error
1072+
body[key] = params[key]
1073+
}
1074+
}
1075+
}
1076+
1077+
const method = 'POST'
1078+
const path = `/_inference/chat_completion/${encodeURIComponent(params.inference_id.toString())}`
1079+
const meta: TransportRequestMetadata = {
1080+
name: 'inference.non_streaming_chat_completion',
1081+
pathParts: {
1082+
inference_id: params.inference_id
1083+
},
1084+
acceptedParams: {
1085+
path: ['inference_id'],
1086+
body: ['chat_completion_request'],
1087+
query: ['timeout']
1088+
}
1089+
}
1090+
return await this.transport.request({ path, method, querystring, body, meta }, options)
1091+
}
1092+
10301093
/**
10311094
* Create an inference endpoint. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. The following integrations are available through the inference API. You can find the available task types next to the integration name: * AI21 (`chat_completion`, `completion`) * AlibabaCloud AI Search (`completion`, `rerank`, `sparse_embedding`, `text_embedding`) * Amazon Bedrock (`chat_completion`, `completion`, `text_embedding`) * Amazon SageMaker (`chat_completion`, `completion`, `rerank`, `sparse_embedding`, `text_embedding`) * Anthropic (`chat_completion`, `completion`) * Azure AI Studio (`completion`, `rerank`, `text_embedding`) * Azure OpenAI (`chat_completion`, `completion`, `text_embedding`) * Cohere (`completion`, `rerank`, `text_embedding`) * DeepSeek (`chat_completion`, `completion`) * Elasticsearch (`rerank`, `sparse_embedding`, `text_embedding` - this service is for built-in models and models uploaded through Eland) * ELSER (`sparse_embedding`) * Fireworks AI (`chat_completion`, `completion`, `text_embedding`) * Google AI Studio (`completion`, `text_embedding`) * Google Vertex AI (`chat_completion`, `completion`, `rerank`, `text_embedding`) * Groq (`chat_completion`) * Hugging Face (`chat_completion`, `completion`, `rerank`, `text_embedding`) * JinaAI (`embedding`, `rerank`, `text_embedding`) * Llama (`chat_completion`, `completion`, `text_embedding`) * Mistral (`chat_completion`, `completion`, `text_embedding`) * Nvidia (`chat_completion`, `completion`, `text_embedding`, `rerank`) * OpenAI (`chat_completion`, `completion`, `text_embedding`) * OpenShift AI (`chat_completion`, `completion`, `rerank`, `text_embedding`) * VoyageAI (`rerank`, `text_embedding`) * Watsonx (`chat_completion`, `completion`, `rerank`, `text_embedding`)
10321095
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put | Elasticsearch API documentation}

‎src/api/api/ml.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ export default class Ml {
624624
'indices_options',
625625
'job_id',
626626
'max_empty_searches',
627+
'max_consecutive_extraction_failures',
627628
'query',
628629
'query_delay',
629630
'runtime_mappings',
@@ -878,6 +879,7 @@ export default class Ml {
878879
'indices_options',
879880
'job_id',
880881
'max_empty_searches',
882+
'max_consecutive_extraction_failures',
881883
'query',
882884
'query_delay',
883885
'runtime_mappings',
@@ -3846,7 +3848,7 @@ export default class Ml {
38463848
},
38473849
acceptedParams: {
38483850
path: ['datafeed_id'],
3849-
body: ['aggregations', 'aggs', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size', 'project_routing', 'headers'],
3851+
body: ['aggregations', 'aggs', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'max_consecutive_extraction_failures', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size', 'project_routing', 'headers'],
38503852
query: ['allow_no_indices', 'expand_wildcards', 'ignore_throttled', 'ignore_unavailable']
38513853
}
38523854
}
@@ -4865,7 +4867,7 @@ export default class Ml {
48654867
},
48664868
acceptedParams: {
48674869
path: ['datafeed_id'],
4868-
body: ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size', 'project_routing', '_force_rekeying'],
4870+
body: ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'max_consecutive_extraction_failures', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size', 'project_routing', '_force_rekeying'],
48694871
query: ['allow_no_indices', 'expand_wildcards', 'ignore_throttled', 'ignore_unavailable']
48704872
}
48714873
}

0 commit comments

Comments
 (0)