From d24355545f0031f83257740dc2793feecd4e3efe Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Thu, 24 Jul 2025 17:28:32 +0000 Subject: [PATCH] Auto-generated API code --- docs/reference/api-reference.md | 129 +++++------ src/api/api/cluster.ts | 10 +- src/api/api/get.ts | 1 - src/api/api/indices.ts | 120 +--------- src/api/api/inference.ts | 73 ++++++- src/api/api/knn_search.ts | 2 +- src/api/api/ml.ts | 2 +- src/api/api/msearch.ts | 1 + src/api/api/profiling.ts | 8 +- src/api/api/search.ts | 1 - src/api/api/snapshot.ts | 2 +- src/api/api/streams.ts | 6 +- src/api/api/transform.ts | 2 +- src/api/types.ts | 375 +++++++++++++++++++++++--------- 14 files changed, 434 insertions(+), 298 deletions(-) diff --git a/docs/reference/api-reference.md b/docs/reference/api-reference.md index 3af05ce88..6c1f8c1d9 100644 --- a/docs/reference/api-reference.md +++ b/docs/reference/api-reference.md @@ -751,7 +751,6 @@ client.get({ id, index }) - **`routing` (Optional, string)**: A custom value used to route operations to a specific shard. - **`_source` (Optional, boolean \| string \| string[])**: Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. - **`_source_excludes` (Optional, string \| string[])**: A list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. -- **`_source_exclude_vectors` (Optional, boolean)**: Whether vectors should be excluded from _source - **`_source_includes` (Optional, string \| string[])**: A list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. - **`stored_fields` (Optional, string \| string[])**: A list of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the `_source` parameter defaults to `false`. Only leaf fields can be retrieved with the `stored_fields` option. Object fields can't be returned; if specified, the request fails. - **`version` (Optional, number)**: The version number for concurrency control. It must match the current version of the document for the request to succeed. @@ -1557,7 +1556,6 @@ client.search({ ... }) - **`typed_keys` (Optional, boolean)**: If `true`, aggregation and suggester names are be prefixed by their respective types in the response. - **`rest_total_hits_as_int` (Optional, boolean)**: Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response. - **`_source_excludes` (Optional, string \| string[])**: A list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. -- **`_source_exclude_vectors` (Optional, boolean)**: Whether vectors should be excluded from _source - **`_source_includes` (Optional, string \| string[])**: A list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. - **`q` (Optional, string)**: A query in the Lucene query string syntax. Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing. IMPORTANT: This parameter overrides the query parameter in the request body. If both parameters are specified, documents matching the query request body parameter are not returned. - **`force_synthetic_source` (Optional, boolean)**: Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. @@ -3364,7 +3362,6 @@ It can also be set to `-1` to indicate that the request should never timeout. ## client.cluster.allocationExplain [_cluster.allocation_explain] Explain the shard allocations. Get explanations for shard allocations in the cluster. -This API accepts the current_node, index, primary and shard parameters in the request body or in query parameters, but not in both at the same time. For unassigned shards, it provides an explanation for why the shard is unassigned. For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. @@ -3379,10 +3376,10 @@ client.cluster.allocationExplain({ ... }) ### Arguments [_arguments_cluster.allocation_explain] #### Request (object) [_request_cluster.allocation_explain] -- **`index` (Optional, string)**: The name of the index that you would like an explanation for. -- **`shard` (Optional, number)**: An identifier for the shard that you would like an explanation for. -- **`primary` (Optional, boolean)**: If true, returns an explanation for the primary shard for the specified shard ID. -- **`current_node` (Optional, string)**: Explain a shard only if it is currently located on the specified node name or node ID. +- **`current_node` (Optional, string)**: Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node. +- **`index` (Optional, string)**: Specifies the name of the index that you would like an explanation for. +- **`primary` (Optional, boolean)**: If true, returns explanation for the primary shard for the given shard ID. +- **`shard` (Optional, number)**: Specifies the ID of the shard that you would like an explanation for. - **`include_disk_info` (Optional, boolean)**: If true, returns information about disk usage and shard sizes. - **`include_yes_decisions` (Optional, boolean)**: If true, returns YES decisions in explanation. - **`master_timeout` (Optional, string \| -1 \| 0)**: Period to wait for a connection to the master node. @@ -3780,7 +3777,7 @@ client.cluster.state({ ... }) - **`flat_settings` (Optional, boolean)**: Return settings in flat format (default: false) - **`ignore_unavailable` (Optional, boolean)**: Whether specified concrete indices should be ignored when unavailable (missing or closed) - **`local` (Optional, boolean)**: Return local information, do not retrieve the state from master node (default: false) -- **`master_timeout` (Optional, string \| -1 \| 0)**: Timeout for waiting for new cluster state in case it is blocked +- **`master_timeout` (Optional, string \| -1 \| 0)**: Specify timeout for connection to master - **`wait_for_metadata_version` (Optional, number)**: Wait for the metadata version to be equal or greater than the specified metadata version - **`wait_for_timeout` (Optional, string \| -1 \| 0)**: The maximum time to wait for wait_for_metadata_version before timing out @@ -6122,25 +6119,6 @@ Supports a list of values, such as `open,hidden`. - **`master_timeout` (Optional, string \| -1 \| 0)**: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - **`verbose` (Optional, boolean)**: Whether the maximum timestamp for each data stream should be calculated and returned. -## client.indices.getDataStreamMappings [_indices.get_data_stream_mappings] -Get data stream mappings. - -Get mapping information for one or more data streams. - -[Endpoint documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-mappings) - -```ts -client.indices.getDataStreamMappings({ name }) -``` - -### Arguments [_arguments_indices.get_data_stream_mappings] - -#### Request (object) [_request_indices.get_data_stream_mappings] -- **`name` (string \| string[])**: A list of data streams or data stream patterns. Supports wildcards (`*`). -- **`master_timeout` (Optional, string \| -1 \| 0)**: The period to wait for a connection to the master node. If no response is -received before the timeout expires, the request fails and returns an -error. - ## client.indices.getDataStreamOptions [_indices.get_data_stream_options] Get data stream options. @@ -6532,33 +6510,6 @@ error. - **`timeout` (Optional, string \| -1 \| 0)**: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. -## client.indices.putDataStreamMappings [_indices.put_data_stream_mappings] -Update data stream mappings. - -This API can be used to override mappings on specific data streams. These overrides will take precedence over what -is specified in the template that the data stream matches. The mapping change is only applied to new write indices -that are created during rollover after this API is called. No indices are changed by this API. - -[Endpoint documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-mappings) - -```ts -client.indices.putDataStreamMappings({ name }) -``` - -### Arguments [_arguments_indices.put_data_stream_mappings] - -#### Request (object) [_request_indices.put_data_stream_mappings] -- **`name` (string \| string[])**: A list of data streams or data stream patterns. -- **`mappings` (Optional, { all_field, date_detection, dynamic, dynamic_date_formats, dynamic_templates, _field_names, index_field, _meta, numeric_detection, properties, _routing, _size, _source, runtime, enabled, subobjects, _data_stream_timestamp })** -- **`dry_run` (Optional, boolean)**: If `true`, the request does not actually change the mappings on any data streams. Instead, it -simulates changing the settings and reports back to the user what would have happened had these settings -actually been applied. -- **`master_timeout` (Optional, string \| -1 \| 0)**: The period to wait for a connection to the master node. If no response is -received before the timeout expires, the request fails and returns an -error. -- **`timeout` (Optional, string \| -1 \| 0)**: The period to wait for a response. If no response is received before the - timeout expires, the request fails and returns an error. - ## client.indices.putDataStreamOptions [_indices.put_data_stream_options] Update data stream options. Update the data stream options of the specified data streams. @@ -6721,7 +6672,7 @@ a new date field is added instead of string. not used at all by Elasticsearch, but can be used to store application-specific metadata. - **`numeric_detection` (Optional, boolean)**: Automatically map strings into numeric data types for all fields. -- **`properties` (Optional, Record)**: Mapping for a field. For new fields, this mapping can include: +- **`properties` (Optional, Record)**: Mapping for a field. For new fields, this mapping can include: - Field name - Field data type @@ -7852,6 +7803,68 @@ These settings are specific to the `cohere` service. These settings are specific to the task type you specified. - **`timeout` (Optional, string \| -1 \| 0)**: Specifies the amount of time to wait for the inference endpoint to be created. +## client.inference.putCustom [_inference.put_custom] +Create a custom inference endpoint. + +The custom service gives more control over how to interact with external inference services that aren't explicitly supported through dedicated integrations. +The custom service gives you the ability to define the headers, url, query parameters, request body, and secrets. +The custom service supports the template replacement functionality, which enables you to define a template that can be replaced with the value associated with that key. +Templates are portions of a string that start with `${` and end with `}`. +The parameters `secret_parameters` and `task_settings` are checked for keys for template replacement. Template replacement is supported in the `request`, `headers`, `url`, and `query_parameters`. +If the definition (key) is not found for a template, an error message is returned. +In case of an endpoint definition like the following: +``` +PUT _inference/text_embedding/test-text-embedding +{ + "service": "custom", + "service_settings": { + "secret_parameters": { + "api_key": "" + }, + "url": "...endpoints.huggingface.cloud/v1/embeddings", + "headers": { + "Authorization": "Bearer ${api_key}", + "Content-Type": "application/json" + }, + "request": "{\"input\": ${input}}", + "response": { + "json_parser": { + "text_embeddings":"$.data[*].embedding[*]" + } + } + } +} +``` +To replace `${api_key}` the `secret_parameters` and `task_settings` are checked for a key named `api_key`. + +> info +> Templates should not be surrounded by quotes. + +Pre-defined templates: +* `${input}` refers to the array of input strings that comes from the `input` field of the subsequent inference requests. +* `${input_type}` refers to the input type translation values. +* `${query}` refers to the query field used specifically for reranking tasks. +* `${top_n}` refers to the `top_n` field available when performing rerank requests. +* `${return_documents}` refers to the `return_documents` field available when performing rerank requests. + +[Endpoint documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-custom) + +```ts +client.inference.putCustom({ task_type, custom_inference_id, service, service_settings }) +``` + +### Arguments [_arguments_inference.put_custom] + +#### Request (object) [_request_inference.put_custom] +- **`task_type` (Enum("text_embedding" \| "sparse_embedding" \| "rerank" \| "completion"))**: The type of the inference task that the model will perform. +- **`custom_inference_id` (string)**: The unique identifier of the inference endpoint. +- **`service` (Enum("custom"))**: The type of service supported for the specified task type. In this case, `custom`. +- **`service_settings` ({ headers, input_type, query_parameters, request, response, secret_parameters, url })**: Settings used to install the inference model. +These settings are specific to the `custom` service. +- **`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })**: The chunking configuration object. +- **`task_settings` (Optional, { parameters })**: Settings to configure the inference task. +These settings are specific to the task type you specified. + ## client.inference.putDeepseek [_inference.put_deepseek] Create a DeepSeek inference endpoint. @@ -14100,12 +14113,6 @@ If you omit the `` request path parameter, the request retrieves infor This usage is preferred. If needed, you can specify `` and `` to retrieve information for specific snapshots, even if they're not currently running. -Note that the stats will not be available for any shard snapshots in an ongoing snapshot completed by a node that (even momentarily) left the cluster. -Loading the stats from the repository is an expensive operation (see the WARNING below). -Therefore the stats values for such shards will be -1 even though the "stage" value will be "DONE", in order to minimize latency. -A "description" field will be present for a shard snapshot completed by a departed node explaining why the shard snapshot's stats results are invalid. -Consequently, the total stats for the index will be less than expected due to the missing values from these shards. - WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. The API requires a read from the repository for each shard in each snapshot. For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). diff --git a/src/api/api/cluster.ts b/src/api/api/cluster.ts index 9ecac681d..c7ca51911 100644 --- a/src/api/api/cluster.ts +++ b/src/api/api/cluster.ts @@ -38,16 +38,12 @@ export default class Cluster { 'cluster.allocation_explain': { path: [], body: [ + 'current_node', 'index', - 'shard', 'primary', - 'current_node' + 'shard' ], query: [ - 'index', - 'shard', - 'primary', - 'current_node', 'include_disk_info', 'include_yes_decisions', 'master_timeout' @@ -226,7 +222,7 @@ export default class Cluster { } /** - * Explain the shard allocations. Get explanations for shard allocations in the cluster. This API accepts the current_node, index, primary and shard parameters in the request body or in query parameters, but not in both at the same time. For unassigned shards, it provides an explanation for why the shard is unassigned. For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. Refer to the linked documentation for examples of how to troubleshoot allocation issues using this API. + * Explain the shard allocations. Get explanations for shard allocations in the cluster. For unassigned shards, it provides an explanation for why the shard is unassigned. For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. Refer to the linked documentation for examples of how to troubleshoot allocation issues using this API. * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-allocation-explain | Elasticsearch API documentation} */ async allocationExplain (this: That, params?: T.ClusterAllocationExplainRequest, options?: TransportRequestOptionsWithOutMeta): Promise diff --git a/src/api/api/get.ts b/src/api/api/get.ts index 5150eef02..6b8c79f55 100644 --- a/src/api/api/get.ts +++ b/src/api/api/get.ts @@ -41,7 +41,6 @@ const acceptedParams: Record async deleteDataStreamOptions (this: That, params: T.IndicesDeleteDataStreamOptionsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -2517,54 +2495,9 @@ export default class Indices { return await this.transport.request({ path, method, querystring, body, meta }, options) } - /** - * Get data stream mappings. Get mapping information for one or more data streams. - * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-mappings | Elasticsearch API documentation} - */ - async getDataStreamMappings (this: That, params: T.IndicesGetDataStreamMappingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise - async getDataStreamMappings (this: That, params: T.IndicesGetDataStreamMappingsRequest, options?: TransportRequestOptionsWithMeta): Promise> - async getDataStreamMappings (this: That, params: T.IndicesGetDataStreamMappingsRequest, options?: TransportRequestOptions): Promise - async getDataStreamMappings (this: That, params: T.IndicesGetDataStreamMappingsRequest, options?: TransportRequestOptions): Promise { - const { - path: acceptedPath - } = this.acceptedParams['indices.get_data_stream_mappings'] - - const userQuery = params?.querystring - const querystring: Record = userQuery != null ? { ...userQuery } : {} - - let body: Record | string | undefined - const userBody = params?.body - if (userBody != null) { - if (typeof userBody === 'string') { - body = userBody - } else { - body = { ...userBody } - } - } - - for (const key in params) { - if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body' && key !== 'querystring') { - // @ts-expect-error - querystring[key] = params[key] - } - } - - const method = 'GET' - const path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_mappings` - const meta: TransportRequestMetadata = { - name: 'indices.get_data_stream_mappings', - pathParts: { - name: params.name - } - } - return await this.transport.request({ path, method, querystring, body, meta }, options) - } - /** * Get data stream options. Get the data stream options configuration of one or more data streams. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/index.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.1/index.html | Elasticsearch API documentation} */ async getDataStreamOptions (this: That, params: T.IndicesGetDataStreamOptionsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getDataStreamOptions (this: That, params: T.IndicesGetDataStreamOptionsRequest, options?: TransportRequestOptionsWithMeta): Promise> @@ -3324,56 +3257,9 @@ export default class Indices { return await this.transport.request({ path, method, querystring, body, meta }, options) } - /** - * Update data stream mappings. This API can be used to override mappings on specific data streams. These overrides will take precedence over what is specified in the template that the data stream matches. The mapping change is only applied to new write indices that are created during rollover after this API is called. No indices are changed by this API. - * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-mappings | Elasticsearch API documentation} - */ - async putDataStreamMappings (this: That, params: T.IndicesPutDataStreamMappingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise - async putDataStreamMappings (this: That, params: T.IndicesPutDataStreamMappingsRequest, options?: TransportRequestOptionsWithMeta): Promise> - async putDataStreamMappings (this: That, params: T.IndicesPutDataStreamMappingsRequest, options?: TransportRequestOptions): Promise - async putDataStreamMappings (this: That, params: T.IndicesPutDataStreamMappingsRequest, options?: TransportRequestOptions): Promise { - const { - path: acceptedPath, - body: acceptedBody, - query: acceptedQuery - } = this.acceptedParams['indices.put_data_stream_mappings'] - - const userQuery = params?.querystring - const querystring: Record = userQuery != null ? { ...userQuery } : {} - - let body: any = params.body ?? undefined - for (const key in params) { - if (acceptedBody.includes(key)) { - // @ts-expect-error - body = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body' && key !== 'querystring') { - if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else { - body = body ?? {} - // @ts-expect-error - body[key] = params[key] - } - } - } - - const method = 'PUT' - const path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_mappings` - const meta: TransportRequestMetadata = { - name: 'indices.put_data_stream_mappings', - pathParts: { - name: params.name - } - } - return await this.transport.request({ path, method, querystring, body, meta }, options) - } - /** * Update data stream options. Update the data stream options of the specified data streams. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/index.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.1/index.html | Elasticsearch API documentation} */ async putDataStreamOptions (this: That, params: T.IndicesPutDataStreamOptionsRequest, options?: TransportRequestOptionsWithOutMeta): Promise async putDataStreamOptions (this: That, params: T.IndicesPutDataStreamOptionsRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/inference.ts b/src/api/api/inference.ts index 360364cc2..8cf8cdcad 100644 --- a/src/api/api/inference.ts +++ b/src/api/api/inference.ts @@ -202,6 +202,19 @@ export default class Inference { 'timeout' ] }, + 'inference.put_custom': { + path: [ + 'task_type', + 'custom_inference_id' + ], + body: [ + 'chunking_settings', + 'service', + 'service_settings', + 'task_settings' + ], + query: [] + }, 'inference.put_deepseek': { path: [ 'task_type', @@ -875,7 +888,7 @@ export default class Inference { /** * Configure a Amazon SageMaker inference endpoint - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/infer-service-amazon-sagemaker.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.1/infer-service-amazon-sagemaker.html | Elasticsearch API documentation} */ async putAmazonsagemaker (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async putAmazonsagemaker (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -1151,6 +1164,64 @@ export default class Inference { return await this.transport.request({ path, method, querystring, body, meta }, options) } + /** + * Create a custom inference endpoint. The custom service gives more control over how to interact with external inference services that aren't explicitly supported through dedicated integrations. The custom service gives you the ability to define the headers, url, query parameters, request body, and secrets. The custom service supports the template replacement functionality, which enables you to define a template that can be replaced with the value associated with that key. Templates are portions of a string that start with `${` and end with `}`. The parameters `secret_parameters` and `task_settings` are checked for keys for template replacement. Template replacement is supported in the `request`, `headers`, `url`, and `query_parameters`. If the definition (key) is not found for a template, an error message is returned. In case of an endpoint definition like the following: ``` PUT _inference/text_embedding/test-text-embedding { "service": "custom", "service_settings": { "secret_parameters": { "api_key": "" }, "url": "...endpoints.huggingface.cloud/v1/embeddings", "headers": { "Authorization": "Bearer ${api_key}", "Content-Type": "application/json" }, "request": "{\"input\": ${input}}", "response": { "json_parser": { "text_embeddings":"$.data[*].embedding[*]" } } } } ``` To replace `${api_key}` the `secret_parameters` and `task_settings` are checked for a key named `api_key`. > info > Templates should not be surrounded by quotes. Pre-defined templates: * `${input}` refers to the array of input strings that comes from the `input` field of the subsequent inference requests. * `${input_type}` refers to the input type translation values. * `${query}` refers to the query field used specifically for reranking tasks. * `${top_n}` refers to the `top_n` field available when performing rerank requests. * `${return_documents}` refers to the `return_documents` field available when performing rerank requests. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-custom | Elasticsearch API documentation} + */ + async putCustom (this: That, params: T.InferencePutCustomRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putCustom (this: That, params: T.InferencePutCustomRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putCustom (this: That, params: T.InferencePutCustomRequest, options?: TransportRequestOptions): Promise + async putCustom (this: That, params: T.InferencePutCustomRequest, options?: TransportRequestOptions): Promise { + const { + path: acceptedPath, + body: acceptedBody, + query: acceptedQuery + } = this.acceptedParams['inference.put_custom'] + + const userQuery = params?.querystring + const querystring: Record = userQuery != null ? { ...userQuery } : {} + + let body: Record | string | undefined + const userBody = params?.body + if (userBody != null) { + if (typeof userBody === 'string') { + body = userBody + } else { + body = { ...userBody } + } + } + + for (const key in params) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body' && key !== 'querystring') { + if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) { + // @ts-expect-error + querystring[key] = params[key] + } else { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } + } + } + + const method = 'PUT' + const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.custom_inference_id.toString())}` + const meta: TransportRequestMetadata = { + name: 'inference.put_custom', + pathParts: { + task_type: params.task_type, + custom_inference_id: params.custom_inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + /** * Create a DeepSeek inference endpoint. Create an inference endpoint to perform an inference task with the `deepseek` service. * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-deepseek | Elasticsearch API documentation} diff --git a/src/api/api/knn_search.ts b/src/api/api/knn_search.ts index 367a61d48..caea405b9 100644 --- a/src/api/api/knn_search.ts +++ b/src/api/api/knn_search.ts @@ -38,7 +38,7 @@ const acceptedParams: Record export default async function KnnSearchApi (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/ml.ts b/src/api/api/ml.ts index 55cec2dd8..c9c91db6c 100644 --- a/src/api/api/ml.ts +++ b/src/api/api/ml.ts @@ -4771,7 +4771,7 @@ export default class Ml { /** * Validate an anomaly detection job. - * @see {@link https://www.elastic.co/guide/en/machine-learning/master/ml-jobs.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/machine-learning/9.1/ml-jobs.html | Elasticsearch API documentation} */ async validate (this: That, params?: T.MlValidateRequest, options?: TransportRequestOptionsWithOutMeta): Promise async validate (this: That, params?: T.MlValidateRequest, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/msearch.ts b/src/api/api/msearch.ts index 59a71420b..6a0d5b078 100644 --- a/src/api/api/msearch.ts +++ b/src/api/api/msearch.ts @@ -43,6 +43,7 @@ const acceptedParams: Record async flamegraph (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -100,7 +100,7 @@ export default class Profiling { /** * Extracts raw stacktrace information from Universal Profiling. - * @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/observability/9.1/universal-profiling.html | Elasticsearch API documentation} */ async stacktraces (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async stacktraces (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -142,7 +142,7 @@ export default class Profiling { /** * Returns basic information about the status of Universal Profiling. - * @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/observability/9.1/universal-profiling.html | Elasticsearch API documentation} */ async status (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async status (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -184,7 +184,7 @@ export default class Profiling { /** * Extracts a list of topN functions from Universal Profiling. - * @see {@link https://www.elastic.co/guide/en/observability/master/universal-profiling.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/observability/9.1/universal-profiling.html | Elasticsearch API documentation} */ async topnFunctions (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async topnFunctions (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/search.ts b/src/api/api/search.ts index 34621db1e..11deb75c2 100644 --- a/src/api/api/search.ts +++ b/src/api/api/search.ts @@ -108,7 +108,6 @@ const acceptedParams: Record` request path parameter, the request retrieves information only for currently running snapshots. This usage is preferred. If needed, you can specify `` and `` to retrieve information for specific snapshots, even if they're not currently running. Note that the stats will not be available for any shard snapshots in an ongoing snapshot completed by a node that (even momentarily) left the cluster. Loading the stats from the repository is an expensive operation (see the WARNING below). Therefore the stats values for such shards will be -1 even though the "stage" value will be "DONE", in order to minimize latency. A "description" field will be present for a shard snapshot completed by a departed node explaining why the shard snapshot's stats results are invalid. Consequently, the total stats for the index will be less than expected due to the missing values from these shards. WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. The API requires a read from the repository for each shard in each snapshot. For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). Depending on the latency of your storage, such requests can take an extremely long time to return results. These requests can also tax machine resources and, when using cloud storage, incur high processing costs. + * Get the snapshot status. Get a detailed description of the current state for each shard participating in the snapshot. Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. If you omit the `` request path parameter, the request retrieves information only for currently running snapshots. This usage is preferred. If needed, you can specify `` and `` to retrieve information for specific snapshots, even if they're not currently running. WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. The API requires a read from the repository for each shard in each snapshot. For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). Depending on the latency of your storage, such requests can take an extremely long time to return results. These requests can also tax machine resources and, when using cloud storage, incur high processing costs. * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-snapshot-status | Elasticsearch API documentation} */ async status (this: That, params?: T.SnapshotStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise diff --git a/src/api/api/streams.ts b/src/api/api/streams.ts index e040401cd..00937b0be 100644 --- a/src/api/api/streams.ts +++ b/src/api/api/streams.ts @@ -53,7 +53,7 @@ export default class Streams { /** * Disable the Logs Streams feature for this cluster - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/streams-logs-disable.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.1/streams-logs-disable.html | Elasticsearch API documentation} */ async logsDisable (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async logsDisable (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -95,7 +95,7 @@ export default class Streams { /** * Enable the Logs Streams feature for this cluster - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/streams-logs-enable.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.1/streams-logs-enable.html | Elasticsearch API documentation} */ async logsEnable (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async logsEnable (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> @@ -137,7 +137,7 @@ export default class Streams { /** * Return the current status of the streams feature for each streams type - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/streams-status.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.1/streams-status.html | Elasticsearch API documentation} */ async status (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async status (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/api/transform.ts b/src/api/api/transform.ts index dc47023c8..f3e9a49a6 100644 --- a/src/api/api/transform.ts +++ b/src/api/api/transform.ts @@ -234,7 +234,7 @@ export default class Transform { /** * Retrieves transform usage information for transform nodes. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-transform-node-stats.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/9.1/get-transform-node-stats.html | Elasticsearch API documentation} */ async getNodeStats (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise async getNodeStats (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> diff --git a/src/api/types.ts b/src/api/types.ts index f3c0e660b..61265d6de 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -825,8 +825,6 @@ export interface GetRequest extends RequestBase { * You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. * If the `_source` parameter is `false`, this parameter is ignored. */ _source_excludes?: Fields - /** Whether vectors should be excluded from _source */ - _source_exclude_vectors?: boolean /** A comma-separated list of source fields to include in the response. * If this parameter is specified, only these source fields are returned. * You can exclude fields from this subset using the `_source_excludes` query parameter. @@ -844,9 +842,9 @@ export interface GetRequest extends RequestBase { /** The version type. */ version_type?: VersionType /** All values in `body` will be added to the request body. */ - body?: string | { [key: string]: any } & { id?: never, index?: never, force_synthetic_source?: never, preference?: never, realtime?: never, refresh?: never, routing?: never, _source?: never, _source_excludes?: never, _source_exclude_vectors?: never, _source_includes?: never, stored_fields?: never, version?: never, version_type?: never } + body?: string | { [key: string]: any } & { id?: never, index?: never, force_synthetic_source?: never, preference?: never, realtime?: never, refresh?: never, routing?: never, _source?: never, _source_excludes?: never, _source_includes?: never, stored_fields?: never, version?: never, version_type?: never } /** All values in `querystring` will be added to the request querystring. */ - querystring?: { [key: string]: any } & { id?: never, index?: never, force_synthetic_source?: never, preference?: never, realtime?: never, refresh?: never, routing?: never, _source?: never, _source_excludes?: never, _source_exclude_vectors?: never, _source_includes?: never, stored_fields?: never, version?: never, version_type?: never } + querystring?: { [key: string]: any } & { id?: never, index?: never, force_synthetic_source?: never, preference?: never, realtime?: never, refresh?: never, routing?: never, _source?: never, _source_excludes?: never, _source_includes?: never, stored_fields?: never, version?: never, version_type?: never } } export type GetResponse = GetGetResult @@ -2068,8 +2066,6 @@ export interface SearchRequest extends RequestBase { * You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. * If the `_source` parameter is `false`, this parameter is ignored. */ _source_excludes?: Fields - /** Whether vectors should be excluded from _source */ - _source_exclude_vectors?: boolean /** A comma-separated list of source fields to include in the response. * If this parameter is specified, only these source fields are returned. * You can exclude fields from this subset using the `_source_excludes` query parameter. @@ -2195,9 +2191,9 @@ export interface SearchRequest extends RequestBase { * You can retrieve these stats using the indices stats API. */ stats?: string[] /** All values in `body` will be added to the request body. */ - body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, allow_partial_search_results?: never, analyzer?: never, analyze_wildcard?: never, batched_reduce_size?: never, ccs_minimize_roundtrips?: never, default_operator?: never, df?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, include_named_queries_score?: never, lenient?: never, max_concurrent_shard_requests?: never, preference?: never, pre_filter_shard_size?: never, request_cache?: never, routing?: never, scroll?: never, search_type?: never, suggest_field?: never, suggest_mode?: never, suggest_size?: never, suggest_text?: never, typed_keys?: never, rest_total_hits_as_int?: never, _source_excludes?: never, _source_exclude_vectors?: never, _source_includes?: never, q?: never, force_synthetic_source?: never, aggregations?: never, aggs?: never, collapse?: never, explain?: never, ext?: never, from?: never, highlight?: never, track_total_hits?: never, indices_boost?: never, docvalue_fields?: never, knn?: never, rank?: never, min_score?: never, post_filter?: never, profile?: never, query?: never, rescore?: never, retriever?: never, script_fields?: never, search_after?: never, size?: never, slice?: never, sort?: never, _source?: never, fields?: never, suggest?: never, terminate_after?: never, timeout?: never, track_scores?: never, version?: never, seq_no_primary_term?: never, stored_fields?: never, pit?: never, runtime_mappings?: never, stats?: never } + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, allow_partial_search_results?: never, analyzer?: never, analyze_wildcard?: never, batched_reduce_size?: never, ccs_minimize_roundtrips?: never, default_operator?: never, df?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, include_named_queries_score?: never, lenient?: never, max_concurrent_shard_requests?: never, preference?: never, pre_filter_shard_size?: never, request_cache?: never, routing?: never, scroll?: never, search_type?: never, suggest_field?: never, suggest_mode?: never, suggest_size?: never, suggest_text?: never, typed_keys?: never, rest_total_hits_as_int?: never, _source_excludes?: never, _source_includes?: never, q?: never, force_synthetic_source?: never, aggregations?: never, aggs?: never, collapse?: never, explain?: never, ext?: never, from?: never, highlight?: never, track_total_hits?: never, indices_boost?: never, docvalue_fields?: never, knn?: never, rank?: never, min_score?: never, post_filter?: never, profile?: never, query?: never, rescore?: never, retriever?: never, script_fields?: never, search_after?: never, size?: never, slice?: never, sort?: never, _source?: never, fields?: never, suggest?: never, terminate_after?: never, timeout?: never, track_scores?: never, version?: never, seq_no_primary_term?: never, stored_fields?: never, pit?: never, runtime_mappings?: never, stats?: never } /** All values in `querystring` will be added to the request querystring. */ - querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, allow_partial_search_results?: never, analyzer?: never, analyze_wildcard?: never, batched_reduce_size?: never, ccs_minimize_roundtrips?: never, default_operator?: never, df?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, include_named_queries_score?: never, lenient?: never, max_concurrent_shard_requests?: never, preference?: never, pre_filter_shard_size?: never, request_cache?: never, routing?: never, scroll?: never, search_type?: never, suggest_field?: never, suggest_mode?: never, suggest_size?: never, suggest_text?: never, typed_keys?: never, rest_total_hits_as_int?: never, _source_excludes?: never, _source_exclude_vectors?: never, _source_includes?: never, q?: never, force_synthetic_source?: never, aggregations?: never, aggs?: never, collapse?: never, explain?: never, ext?: never, from?: never, highlight?: never, track_total_hits?: never, indices_boost?: never, docvalue_fields?: never, knn?: never, rank?: never, min_score?: never, post_filter?: never, profile?: never, query?: never, rescore?: never, retriever?: never, script_fields?: never, search_after?: never, size?: never, slice?: never, sort?: never, _source?: never, fields?: never, suggest?: never, terminate_after?: never, timeout?: never, track_scores?: never, version?: never, seq_no_primary_term?: never, stored_fields?: never, pit?: never, runtime_mappings?: never, stats?: never } + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, allow_partial_search_results?: never, analyzer?: never, analyze_wildcard?: never, batched_reduce_size?: never, ccs_minimize_roundtrips?: never, default_operator?: never, df?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, include_named_queries_score?: never, lenient?: never, max_concurrent_shard_requests?: never, preference?: never, pre_filter_shard_size?: never, request_cache?: never, routing?: never, scroll?: never, search_type?: never, suggest_field?: never, suggest_mode?: never, suggest_size?: never, suggest_text?: never, typed_keys?: never, rest_total_hits_as_int?: never, _source_excludes?: never, _source_includes?: never, q?: never, force_synthetic_source?: never, aggregations?: never, aggs?: never, collapse?: never, explain?: never, ext?: never, from?: never, highlight?: never, track_total_hits?: never, indices_boost?: never, docvalue_fields?: never, knn?: never, rank?: never, min_score?: never, post_filter?: never, profile?: never, query?: never, rescore?: never, retriever?: never, script_fields?: never, search_after?: never, size?: never, slice?: never, sort?: never, _source?: never, fields?: never, suggest?: never, terminate_after?: never, timeout?: never, track_scores?: never, version?: never, seq_no_primary_term?: never, stored_fields?: never, pit?: never, runtime_mappings?: never, stats?: never } } export type SearchResponse> = SearchResponseBody @@ -5518,9 +5514,10 @@ export interface AggregationsFiltersAggregation extends AggregationsBucketAggreg } export interface AggregationsFiltersBucketKeys extends AggregationsMultiBucketBase { + key?: string } export type AggregationsFiltersBucket = AggregationsFiltersBucketKeys -& { [property: string]: AggregationsAggregate | long } +& { [property: string]: AggregationsAggregate | string | long } export interface AggregationsFormatMetricAggregationBase extends AggregationsMetricAggregationBase { format?: string @@ -6988,7 +6985,7 @@ export interface AnalysisEdgeNGramTokenizer extends AnalysisTokenizerBase { custom_token_chars?: string max_gram?: integer min_gram?: integer - token_chars?: string | AnalysisTokenChar[] + token_chars?: AnalysisTokenChar[] } export interface AnalysisElisionTokenFilter extends AnalysisTokenFilterBase { @@ -8453,10 +8450,6 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase type: 'search_as_you_type' } -export interface MappingSemanticTextIndexOptions { - dense_vector?: MappingDenseVectorIndexOptions -} - export interface MappingSemanticTextProperty { type: 'semantic_text' meta?: Record @@ -8468,9 +8461,6 @@ export interface MappingSemanticTextProperty { * You can update this parameter by using the Update mapping API. Use the Create inference API to create the endpoint. * If not specified, the inference endpoint defined by inference_id will be used at both index and query time. */ search_inference_id?: Id - /** Settings for index_options that override any defaults used by semantic_text, for example - * specific quantization settings. */ - index_options?: MappingSemanticTextIndexOptions /** Settings for chunking text into smaller passages. If specified, these will override the * chunking settings sent in the inference endpoint associated with inference_id. If chunking settings are updated, * they will not be applied to existing documents until they are reindexed. */ @@ -15705,18 +15695,18 @@ export interface ClusterAllocationExplainRequest extends RequestBase { include_yes_decisions?: boolean /** Period to wait for a connection to the master node. */ master_timeout?: Duration - /** The name of the index that you would like an explanation for. */ + /** Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node. */ + current_node?: string + /** Specifies the name of the index that you would like an explanation for. */ index?: IndexName - /** An identifier for the shard that you would like an explanation for. */ - shard?: integer - /** If true, returns an explanation for the primary shard for the specified shard ID. */ + /** If true, returns explanation for the primary shard for the given shard ID. */ primary?: boolean - /** Explain a shard only if it is currently located on the specified node name or node ID. */ - current_node?: NodeId + /** Specifies the ID of the shard that you would like an explanation for. */ + shard?: integer /** All values in `body` will be added to the request body. */ - body?: string | { [key: string]: any } & { include_disk_info?: never, include_yes_decisions?: never, master_timeout?: never, index?: never, shard?: never, primary?: never, current_node?: never } + body?: string | { [key: string]: any } & { include_disk_info?: never, include_yes_decisions?: never, master_timeout?: never, current_node?: never, index?: never, primary?: never, shard?: never } /** All values in `querystring` will be added to the request querystring. */ - querystring?: { [key: string]: any } & { include_disk_info?: never, include_yes_decisions?: never, master_timeout?: never, index?: never, shard?: never, primary?: never, current_node?: never } + querystring?: { [key: string]: any } & { include_disk_info?: never, include_yes_decisions?: never, master_timeout?: never, current_node?: never, index?: never, primary?: never, shard?: never } } export interface ClusterAllocationExplainReservedSize { @@ -16262,7 +16252,7 @@ export interface ClusterStateRequest extends RequestBase { ignore_unavailable?: boolean /** Return local information, do not retrieve the state from master node (default: false) */ local?: boolean - /** Timeout for waiting for new cluster state in case it is blocked */ + /** Specify timeout for connection to master */ master_timeout?: Duration /** Wait for the metadata version to be equal or greater than the specified metadata version */ wait_for_metadata_version?: VersionNumber @@ -18947,9 +18937,6 @@ export interface IndicesDataStream { /** The settings specific to this data stream that will take precedence over the settings in the matching index * template. */ settings: IndicesIndexSettings - /** The mappings specific to this data stream that will take precedence over the mappings in the matching index - * template. */ - mappings?: MappingTypeMapping /** Health status of the data stream. * This health status is based on the state of the primary and replica shards of the stream’s backing indices. */ status: HealthStatus @@ -20559,33 +20546,6 @@ export interface IndicesGetDataStreamResponse { data_streams: IndicesDataStream[] } -export interface IndicesGetDataStreamMappingsDataStreamMappings { - /** The name of the data stream. */ - name: string - /** The settings specific to this data stream */ - mappings: MappingTypeMapping - /** The settings specific to this data stream merged with the settings from its template. These `effective_settings` - * are the settings that will be used when a new index is created for this data stream. */ - effective_mappings: MappingTypeMapping -} - -export interface IndicesGetDataStreamMappingsRequest extends RequestBase { - /** A comma-separated list of data streams or data stream patterns. Supports wildcards (`*`). */ - name: Indices - /** The period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an - * error. */ - master_timeout?: Duration - /** All values in `body` will be added to the request body. */ - body?: string | { [key: string]: any } & { name?: never, master_timeout?: never } - /** All values in `querystring` will be added to the request querystring. */ - querystring?: { [key: string]: any } & { name?: never, master_timeout?: never } -} - -export interface IndicesGetDataStreamMappingsResponse { - data_streams: IndicesGetDataStreamMappingsDataStreamMappings[] -} - export interface IndicesGetDataStreamOptionsDataStreamWithOptions { name: DataStreamName options?: IndicesDataStreamOptions @@ -21008,46 +20968,6 @@ export interface IndicesPutDataLifecycleRequest extends RequestBase { export type IndicesPutDataLifecycleResponse = AcknowledgedResponseBase -export interface IndicesPutDataStreamMappingsRequest extends RequestBase { - /** A comma-separated list of data streams or data stream patterns. */ - name: Indices - /** If `true`, the request does not actually change the mappings on any data streams. Instead, it - * simulates changing the settings and reports back to the user what would have happened had these settings - * actually been applied. */ - dry_run?: boolean - /** The period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an - * error. */ - master_timeout?: Duration - /** The period to wait for a response. If no response is received before the - * timeout expires, the request fails and returns an error. */ - timeout?: Duration - mappings?: MappingTypeMapping - /** All values in `body` will be added to the request body. */ - body?: string | { [key: string]: any } & { name?: never, dry_run?: never, master_timeout?: never, timeout?: never, mappings?: never } - /** All values in `querystring` will be added to the request querystring. */ - querystring?: { [key: string]: any } & { name?: never, dry_run?: never, master_timeout?: never, timeout?: never, mappings?: never } -} - -export interface IndicesPutDataStreamMappingsResponse { - data_streams: IndicesPutDataStreamMappingsUpdatedDataStreamMappings[] -} - -export interface IndicesPutDataStreamMappingsUpdatedDataStreamMappings { - /** The data stream name. */ - name: IndexName - /** If the mappings were successfully applied to the data stream (or would have been, if running in `dry_run` - * mode), it is `true`. If an error occurred, it is `false`. */ - applied_to_data_stream: boolean - /** A message explaining why the mappings could not be applied to the data stream. */ - error?: string - /** The mappings that are specfic to this data stream that will override any mappings from the matching index template. */ - mappings?: MappingTypeMapping - /** The mappings that are effective on this data stream, taking into account the mappings from the matching index - * template and the mappings specific to this data stream. */ - effective_mappings?: MappingTypeMapping -} - export interface IndicesPutDataStreamOptionsRequest extends RequestBase { /** Comma-separated list of data streams used to limit the request. * Supports wildcards (`*`). @@ -22592,8 +22512,10 @@ export interface InferenceCohereServiceSettings { * * * For the available `completion` models, refer to the [Cohere command docs](https://docs.cohere.com/docs/models#command). * * For the available `rerank` models, refer to the [Cohere rerank docs](https://docs.cohere.com/reference/rerank-1). - * * For the available `text_embedding` models, refer to [Cohere embed docs](https://docs.cohere.com/reference/embed). */ - model_id: string + * * For the available `text_embedding` models, refer to [Cohere embed docs](https://docs.cohere.com/reference/embed). + * + * The default value for a text embedding task is `embed-english-v2.0`. */ + model_id?: string /** This setting helps to minimize the number of rate limit errors returned from Cohere. * By default, the `cohere` service sets the number of requests allowed per minute to 10000. */ rate_limit?: InferenceRateLimitSetting @@ -22617,7 +22539,7 @@ export interface InferenceCohereTaskSettings { * * `search`: Use it for storing embeddings of search queries run against a vector database to find relevant documents. * * IMPORTANT: The `input_type` field is required when using embedding models `v3` and higher. */ - input_type: InferenceCohereInputType + input_type?: InferenceCohereInputType /** For a `rerank` task, return doc text within the results. */ return_documents?: boolean /** For a `rerank` task, the number of most relevant documents to return. @@ -22685,6 +22607,229 @@ export interface InferenceContentObject { type: string } +export interface InferenceCustomRequestParams { + /** The body structure of the request. It requires passing in the string-escaped result of the JSON format HTTP request body. + * For example: + * ``` + * "request": "{\"input\":${input}}" + * ``` + * > info + * > The content string needs to be a single line except when using the Kibana console. */ + content: string +} + +export interface InferenceCustomResponseParams { + /** Specifies the JSON parser that is used to parse the response from the custom service. + * Different task types require different json_parser parameters. + * For example: + * ``` + * # text_embedding + * # For a response like this: + * + * { + * "object": "list", + * "data": [ + * { + * "object": "embedding", + * "index": 0, + * "embedding": [ + * 0.014539449, + * -0.015288644 + * ] + * } + * ], + * "model": "text-embedding-ada-002-v2", + * "usage": { + * "prompt_tokens": 8, + * "total_tokens": 8 + * } + * } + * + * # the json_parser definition should look like this: + * + * "response":{ + * "json_parser":{ + * "text_embeddings":"$.data[*].embedding[*]" + * } + * } + * + * # sparse_embedding + * # For a response like this: + * + * { + * "request_id": "75C50B5B-E79E-4930-****-F48DBB392231", + * "latency": 22, + * "usage": { + * "token_count": 11 + * }, + * "result": { + * "sparse_embeddings": [ + * { + * "index": 0, + * "embedding": [ + * { + * "token_id": 6, + * "weight": 0.101 + * }, + * { + * "token_id": 163040, + * "weight": 0.28417 + * } + * ] + * } + * ] + * } + * } + * + * # the json_parser definition should look like this: + * + * "response":{ + * "json_parser":{ + * "token_path":"$.result.sparse_embeddings[*].embedding[*].token_id", + * "weight_path":"$.result.sparse_embeddings[*].embedding[*].weight" + * } + * } + * + * # rerank + * # For a response like this: + * + * { + * "results": [ + * { + * "index": 3, + * "relevance_score": 0.999071, + * "document": "abc" + * }, + * { + * "index": 4, + * "relevance_score": 0.7867867, + * "document": "123" + * }, + * { + * "index": 0, + * "relevance_score": 0.32713068, + * "document": "super" + * } + * ], + * } + * + * # the json_parser definition should look like this: + * + * "response":{ + * "json_parser":{ + * "reranked_index":"$.result.scores[*].index", // optional + * "relevance_score":"$.result.scores[*].score", + * "document_text":"xxx" // optional + * } + * } + * + * # completion + * # For a response like this: + * + * { + * "id": "chatcmpl-B9MBs8CjcvOU2jLn4n570S5qMJKcT", + * "object": "chat.completion", + * "created": 1741569952, + * "model": "gpt-4.1-2025-04-14", + * "choices": [ + * { + * "index": 0, + * "message": { + * "role": "assistant", + * "content": "Hello! How can I assist you today?", + * "refusal": null, + * "annotations": [] + * }, + * "logprobs": null, + * "finish_reason": "stop" + * } + * ] + * } + * + * # the json_parser definition should look like this: + * + * "response":{ + * "json_parser":{ + * "completion_result":"$.choices[*].message.content" + * } + * } */ + json_parser: any +} + +export interface InferenceCustomServiceSettings { + /** Specifies the HTTPS header parameters – such as `Authentication` or `Contet-Type` – that are required to access the custom service. + * For example: + * ``` + * "headers":{ + * "Authorization": "Bearer ${api_key}", + * "Content-Type": "application/json;charset=utf-8" + * } + * ``` */ + headers?: any + /** Specifies the input type translation values that are used to replace the `${input_type}` template in the request body. + * For example: + * ``` + * "input_type": { + * "translation": { + * "ingest": "do_ingest", + * "search": "do_search" + * }, + * "default": "a_default" + * }, + * ``` + * If the subsequent inference requests come from a search context, the `search` key will be used and the template will be replaced with `do_search`. + * If it comes from the ingest context `do_ingest` is used. If it's a different context that is not specified, the default value will be used. If no default is specified an empty string is used. + * `translation` can be: + * * `classification` + * * `clustering` + * * `ingest` + * * `search` */ + input_type?: any + /** Specifies the query parameters as a list of tuples. The arrays inside the `query_parameters` must have two items, a key and a value. + * For example: + * ``` + * "query_parameters":[ + * ["param_key", "some_value"], + * ["param_key", "another_value"], + * ["other_key", "other_value"] + * ] + * ``` + * If the base url is `https://www.elastic.co` it results in: `https://www.elastic.co?param_key=some_value¶m_key=another_value&other_key=other_value`. */ + query_parameters?: any + /** The request configuration object. */ + request: InferenceCustomRequestParams + /** The response configuration object. */ + response: InferenceCustomResponseParams + /** Specifies secret parameters, like `api_key` or `api_token`, that are required to access the custom service. + * For example: + * ``` + * "secret_parameters":{ + * "api_key":"" + * } + * ``` */ + secret_parameters: any + /** The URL endpoint to use for the requests. */ + url?: string +} + +export type InferenceCustomServiceType = 'custom' + +export interface InferenceCustomTaskSettings { + /** Specifies parameters that are required to run the custom service. The parameters depend on the model your custom service uses. + * For example: + * ``` + * "task_settings":{ + * "parameters":{ + * "input_type":"query", + * "return_token":true + * } + * } + * ``` */ + parameters?: any +} + +export type InferenceCustomTaskType = 'text_embedding' | 'sparse_embedding' | 'rerank' | 'completion' + export interface InferenceDeepSeekServiceSettings { /** A valid API key for your DeepSeek account. * You can find or create your DeepSeek API keys on the DeepSeek API key page. @@ -22926,6 +23071,13 @@ export interface InferenceInferenceEndpointInfoCohere extends InferenceInference task_type: InferenceTaskTypeCohere } +export interface InferenceInferenceEndpointInfoCustom extends InferenceInferenceEndpoint { + /** The inference Id */ + inference_id: string + /** The task type */ + task_type: InferenceTaskTypeCustom +} + export interface InferenceInferenceEndpointInfoDeepSeek extends InferenceInferenceEndpoint { /** The inference Id */ inference_id: string @@ -23286,6 +23438,8 @@ export type InferenceTaskTypeAzureOpenAI = 'text_embedding' | 'completion' export type InferenceTaskTypeCohere = 'text_embedding' | 'rerank' | 'completion' +export type InferenceTaskTypeCustom = 'text_embedding' | 'sparse_embedding' | 'rerank' | 'completion' + export type InferenceTaskTypeDeepSeek = 'completion' | 'chat_completion' export type InferenceTaskTypeELSER = 'sparse_embedding' @@ -23673,6 +23827,29 @@ export interface InferencePutCohereRequest extends RequestBase { export type InferencePutCohereResponse = InferenceInferenceEndpointInfoCohere +export interface InferencePutCustomRequest extends RequestBase { + /** The type of the inference task that the model will perform. */ + task_type: InferenceCustomTaskType + /** The unique identifier of the inference endpoint. */ + custom_inference_id: Id + /** The chunking configuration object. */ + chunking_settings?: InferenceInferenceChunkingSettings + /** The type of service supported for the specified task type. In this case, `custom`. */ + service: InferenceCustomServiceType + /** Settings used to install the inference model. + * These settings are specific to the `custom` service. */ + service_settings: InferenceCustomServiceSettings + /** Settings to configure the inference task. + * These settings are specific to the task type you specified. */ + task_settings?: InferenceCustomTaskSettings + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_type?: never, custom_inference_id?: never, chunking_settings?: never, service?: never, service_settings?: never, task_settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_type?: never, custom_inference_id?: never, chunking_settings?: never, service?: never, service_settings?: never, task_settings?: never } +} + +export type InferencePutCustomResponse = InferenceInferenceEndpointInfoCustom + export interface InferencePutDeepseekRequest extends RequestBase { /** The type of the inference task that the model will perform. */ task_type: InferenceTaskTypeDeepSeek