diff --git a/docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc b/docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc new file mode 100644 index 000000000..f6c1cb881 --- /dev/null +++ b/docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc @@ -0,0 +1,20 @@ +// 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.transport.request({ + method: "POST", + path: "/_inference/chat_completion/openai-completion/_stream", + body: { + model: "gpt-4o", + messages: [ + { + role: "user", + content: "What is Elastic?", + }, + ], + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/ddaadd91b7743a1c7e946ce1b593cd1b.asciidoc b/docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc similarity index 65% rename from docs/doc_examples/ddaadd91b7743a1c7e946ce1b593cd1b.asciidoc rename to docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc index bd9c35360..7d7aeab98 100644 --- a/docs/doc_examples/ddaadd91b7743a1c7e946ce1b593cd1b.asciidoc +++ b/docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc @@ -3,11 +3,13 @@ [source, js] ---- -const response = await client.inference.inference({ +const response = await client.inference.put({ task_type: "my-inference-endpoint", inference_id: "_update", - service_settings: { - api_key: "", + inference_config: { + service_settings: { + api_key: "", + }, }, }); console.log(response); diff --git a/docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc b/docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc new file mode 100644 index 000000000..e1edb8658 --- /dev/null +++ b/docs/doc_examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.indices.create({ + index: "test-index", + mappings: { + properties: { + source_field: { + type: "text", + fields: { + infer_field: { + type: "semantic_text", + inference_id: ".elser-2-elasticsearch", + }, + }, + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc b/docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc deleted file mode 100644 index 36c1c5a79..000000000 --- a/docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// Use `node scripts/generate-docs-examples.js` to generate the docs examples - -[source, js] ----- -const response = await client.indices.unfreeze({ - index: "my-index-000001", -}); -console.log(response); ----- diff --git a/docs/doc_examples/38ba93890494bfa7beece58dffa44f98.asciidoc b/docs/doc_examples/38ba93890494bfa7beece58dffa44f98.asciidoc deleted file mode 100644 index f9dca64fb..000000000 --- a/docs/doc_examples/38ba93890494bfa7beece58dffa44f98.asciidoc +++ /dev/null @@ -1,23 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// Use `node scripts/generate-docs-examples.js` to generate the docs examples - -[source, js] ----- -const response = await client.bulk({ - index: "test-index", - operations: [ - { - update: { - _id: "1", - }, - }, - { - doc: { - infer_field: "updated inference field", - source_field: "updated source field", - }, - }, - ], -}); -console.log(response); ----- diff --git a/docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc b/docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc new file mode 100644 index 000000000..a2ff623e6 --- /dev/null +++ b/docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc @@ -0,0 +1,47 @@ +// 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.transport.request({ + method: "POST", + path: "/_inference/chat_completion/openai-completion/_stream", + body: { + messages: [ + { + role: "user", + content: [ + { + type: "text", + text: "What's the price of a scarf?", + }, + ], + }, + ], + tools: [ + { + type: "function", + function: { + name: "get_current_price", + description: "Get the current price of a item", + parameters: { + type: "object", + properties: { + item: { + id: "123", + }, + }, + }, + }, + }, + ], + tool_choice: { + type: "function", + function: { + name: "get_current_price", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc b/docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc new file mode 100644 index 000000000..3c92986f6 --- /dev/null +++ b/docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc @@ -0,0 +1,20 @@ +// 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: "image-index", + knn: { + field: "image-vector", + query_vector: [-5, 9, -12], + k: 10, + num_candidates: 100, + rescore_vector: { + oversample: 2, + }, + }, + fields: ["title", "file-type"], +}); +console.log(response); +---- diff --git a/docs/doc_examples/ee05714a83d75fb6858e3b9fcbeb8f8b.asciidoc b/docs/doc_examples/681d24c2633f598fc43d6afff8996dbb.asciidoc similarity index 96% rename from docs/doc_examples/ee05714a83d75fb6858e3b9fcbeb8f8b.asciidoc rename to docs/doc_examples/681d24c2633f598fc43d6afff8996dbb.asciidoc index abb8e0b60..bfb21cf32 100644 --- a/docs/doc_examples/ee05714a83d75fb6858e3b9fcbeb8f8b.asciidoc +++ b/docs/doc_examples/681d24c2633f598fc43d6afff8996dbb.asciidoc @@ -5,6 +5,9 @@ ---- const response = await client.indices.create({ index: "retrievers_example", + settings: { + number_of_shards: 1, + }, mappings: { properties: { vector: { @@ -12,6 +15,9 @@ const response = await client.indices.create({ dims: 3, similarity: "l2_norm", index: true, + index_options: { + type: "flat", + }, }, text: { type: "text", diff --git a/docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc b/docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc similarity index 66% rename from docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc rename to docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc index b10da9a05..a09e089bb 100644 --- a/docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc +++ b/docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc @@ -5,7 +5,8 @@ ---- const response = await client.cluster.putSettings({ persistent: { - "cluster.routing.allocation.disk.watermark.low": "30gb", + "cluster.routing.allocation.disk.watermark.low": "90%", + "cluster.routing.allocation.disk.watermark.high": "95%", }, }); console.log(response); diff --git a/docs/doc_examples/93c77c65f1e11382f8043d0300e87b89.asciidoc b/docs/doc_examples/7bdc283b96c7a965fae23013647b8578.asciidoc similarity index 100% rename from docs/doc_examples/93c77c65f1e11382f8043d0300e87b89.asciidoc rename to docs/doc_examples/7bdc283b96c7a965fae23013647b8578.asciidoc index 7a9809243..7f416d2de 100644 --- a/docs/doc_examples/93c77c65f1e11382f8043d0300e87b89.asciidoc +++ b/docs/doc_examples/7bdc283b96c7a965fae23013647b8578.asciidoc @@ -7,14 +7,14 @@ const response = await client.indices.create({ index: "test-index", mappings: { properties: { - infer_field: { - type: "semantic_text", - inference_id: ".elser-2-elasticsearch", - }, source_field: { type: "text", copy_to: "infer_field", }, + infer_field: { + type: "semantic_text", + inference_id: ".elser-2-elasticsearch", + }, }, }, }); diff --git a/docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc b/docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc new file mode 100644 index 000000000..7c7a7cba1 --- /dev/null +++ b/docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc @@ -0,0 +1,34 @@ +// 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.transport.request({ + method: "POST", + path: "/_inference/chat_completion/openai-completion/_stream", + body: { + messages: [ + { + role: "assistant", + content: "Let's find out what the weather is", + tool_calls: [ + { + id: "call_KcAjWtAww20AihPHphUh46Gd", + type: "function", + function: { + name: "get_current_weather", + arguments: '{"location":"Boston, MA"}', + }, + }, + ], + }, + { + role: "tool", + content: "The weather is cold", + tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd", + }, + ], + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/bee3fda7bb07086243424b62e5b16ca7.asciidoc b/docs/doc_examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc similarity index 93% rename from docs/doc_examples/bee3fda7bb07086243424b62e5b16ca7.asciidoc rename to docs/doc_examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc index 9ab13275d..5a4bb2510 100644 --- a/docs/doc_examples/bee3fda7bb07086243424b62e5b16ca7.asciidoc +++ b/docs/doc_examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc @@ -5,6 +5,9 @@ ---- const response = await client.indices.create({ index: "retrievers_example_nested", + settings: { + number_of_shards: 1, + }, mappings: { properties: { nested_field: { @@ -18,6 +21,9 @@ const response = await client.indices.create({ dims: 3, similarity: "l2_norm", index: true, + index_options: { + type: "flat", + }, }, }, }, diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 449cc261c..0b10c7f14 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -28,9 +28,116 @@ [discrete] === bulk Bulk index or delete documents. -Performs multiple indexing or delete operations in a single API call. +Perform multiple `index`, `create`, `delete`, and `update` actions in a single request. This reduces overhead and can greatly increase indexing speed. +If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: + +* To use the `create` action, you must have the `create_doc`, `create`, `index`, or `write` index privilege. Data streams support only the `create` action. +* To use the `index` action, you must have the `create`, `index`, or `write` index privilege. +* To use the `delete` action, you must have the `delete` or `write` index privilege. +* To use the `update` action, you must have the `index` or `write` index privilege. +* To automatically create a data stream or index with a bulk API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. +* To make the result of a bulk operation visible to search using the `refresh` parameter, you must have the `maintenance` or `manage` index privilege. + +Automatic data stream creation requires a matching index template with data stream enabled. + +The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: + +``` +action_and_meta_data\n +optional_source\n +action_and_meta_data\n +optional_source\n +.... +action_and_meta_data\n +optional_source\n +``` + +The `index` and `create` actions expect a source on the next line and have the same semantics as the `op_type` parameter in the standard index API. +A `create` action fails if a document with the same ID already exists in the target +An `index` action adds or replaces a document as necessary. + +NOTE: Data streams support only the `create` action. +To update or delete a document in a data stream, you must target the backing index containing the document. + +An `update` action expects that the partial doc, upsert, and script and its options are specified on the next line. + +A `delete` action does not expect a source on the next line and has the same semantics as the standard delete API. + +NOTE: The final line of data must end with a newline character (`\n`). +Each newline character may be preceded by a carriage return (`\r`). +When sending NDJSON data to the `_bulk` endpoint, use a `Content-Type` header of `application/json` or `application/x-ndjson`. +Because this format uses literal newline characters (`\n`) as delimiters, make sure that the JSON actions and sources are not pretty printed. + +If you provide a target in the request path, it is used for any actions that don't explicitly specify an `_index` argument. + +A note on the format: the idea here is to make processing as fast as possible. +As some of the actions are redirected to other shards on other nodes, only `action_meta_data` is parsed on the receiving node side. + +Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. + +There is no "correct" number of actions to perform in a single bulk request. +Experiment with different settings to find the optimal size for your particular workload. +Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. +It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. +For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. + +**Client suppport for bulk requests** + +Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: + +* Go: Check out `esutil.BulkIndexer` +* Perl: Check out `Search::Elasticsearch::Client::5_0::Bulk` and `Search::Elasticsearch::Client::5_0::Scroll` +* Python: Check out `elasticsearch.helpers.*` +* JavaScript: Check out `client.helpers.*` +* .NET: Check out `BulkAllObservable` +* PHP: Check out bulk indexing. + +**Submitting bulk requests with cURL** + +If you're providing text file input to `curl`, you must use the `--data-binary` flag instead of plain `-d`. +The latter doesn't preserve newlines. For example: + +``` +$ cat requests +{ "index" : { "_index" : "test", "_id" : "1" } } +{ "field1" : "value1" } +$ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo +{"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} +``` + +**Optimistic concurrency control** + +Each `index` and `delete` action within a bulk API call may include the `if_seq_no` and `if_primary_term` parameters in their respective action and meta data lines. +The `if_seq_no` and `if_primary_term` parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. + +**Versioning** + +Each bulk item can include the version value using the `version` field. +It automatically follows the behavior of the index or delete operation based on the `_version` mapping. +It also support the `version_type`. + +**Routing** + +Each bulk item can include the routing value using the `routing` field. +It automatically follows the behavior of the index or delete operation based on the `_routing` mapping. + +NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. + +**Wait for active shards** + +When making bulk calls, you can set the `wait_for_active_shards` parameter to require a minimum number of shard copies to be active before starting to process the bulk request. + +**Refresh** + +Control when the changes made by this request are visible to search. + +NOTE: Only the shards that receive the bulk request will be affected by refresh. +Imagine a `_bulk?refresh=wait_for` request with three documents in it that happen to be routed to different shards in an index with five shards. +The request will only wait for those three shards to refresh. +The other two shards that make up the index do not participate in the `_bulk` request at all. + {ref}/docs-bulk.html[Endpoint documentation] [source,ts] ---- @@ -40,28 +147,37 @@ client.bulk({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string)*: Name of the data stream, index, or index alias to perform bulk actions on. +** *`index` (Optional, string)*: The name of the data stream, index, or index alias to perform bulk actions on. ** *`operations` (Optional, { index, create, update, delete } | { detect_noop, doc, doc_as_upsert, script, scripted_upsert, _source, upsert } | object[])* -** *`list_executed_pipelines` (Optional, boolean)*: If `true`, the response will include the ingest pipelines that were executed for each index or create. -** *`pipeline` (Optional, string)*: ID of the pipeline to use to preprocess incoming documents. -If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. -If a final pipeline is configured it will always run, regardless of the value of this parameter. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. +** *`list_executed_pipelines` (Optional, boolean)*: If `true`, the response will include the ingest pipelines that were run for each index or create. +** *`pipeline` (Optional, string)*: The pipeline identifier to use to preprocess incoming documents. +If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. +If a final pipeline is configured, it will always run regardless of the value of this parameter. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. +If `wait_for`, wait for a refresh to make this operation visible to search. +If `false`, do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`_source` (Optional, boolean | string | string[])*: `true` or `false` to return the `_source` field or not, or a list of fields to return. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`_source` (Optional, boolean | string | string[])*: Indicates whether to return the `_source` field (`true` or `false`) or contains a list of 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_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`timeout` (Optional, string | -1 | 0)*: Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. +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. +** *`timeout` (Optional, string | -1 | 0)*: The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards. +The default is `1m` (one minute), which guarantees Elasticsearch waits for at least the timeout before failing. +The actual wait time could be longer, particularly when multiple waits occur. ** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). -** *`require_alias` (Optional, boolean)*: If `true`, the request’s actions must target an index alias. -** *`require_data_stream` (Optional, boolean)*: If `true`, the request's actions must target a data stream (existing or to-be-created). +Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +The default is `1`, which waits for each primary shard to be active. +** *`require_alias` (Optional, boolean)*: If `true`, the request's actions must target an index alias. +** *`require_data_stream` (Optional, boolean)*: If `true`, the request's actions must target a data stream (existing or to be created). [discrete] === clear_scroll Clear a scrolling search. - Clear the search context and results for a scrolling search. {ref}/clear-scroll-api.html[Endpoint documentation] @@ -73,13 +189,13 @@ client.clearScroll({ ... }) ==== Arguments * *Request (object):* -** *`scroll_id` (Optional, string | string[])*: List of scroll IDs to clear. +** *`scroll_id` (Optional, string | string[])*: A list of scroll IDs to clear. To clear all scroll IDs, use `_all`. +IMPORTANT: Scroll IDs can be long. It is recommended to specify scroll IDs in the request body parameter. [discrete] === close_point_in_time Close a point in time. - A point in time must be opened explicitly before being used in search requests. The `keep_alive` parameter tells Elasticsearch how long it should persist. A point in time is automatically closed when the `keep_alive` period has elapsed. @@ -101,6 +217,15 @@ client.closePointInTime({ id }) Count search results. Get the number of documents matching a query. +The query can either be provided using a simple query string as a parameter or using the Query DSL defined within the request body. +The latter must be nested in a `query` key, which is the same as the search API. + +The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. + +The operation is broadcast across all shards. +For each shard ID group, a replica is chosen and the search is run against it. +This means that replicas increase the scalability of the count. + {ref}/search-count.html[Endpoint documentation] [source,ts] ---- @@ -110,40 +235,117 @@ client.count({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases to search. -Supports wildcards (`*`). +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases to search. +It supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*` or `_all`. ** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. +The query is optional, and when not provided, it will use `match_all` to count all the docs. ** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. -** *`analyzer` (Optional, string)*: Analyzer to use for the query string. -This parameter can only be used when the `q` query string parameter is specified. +For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. +** *`analyzer` (Optional, string)*: The analyzer to use for the query string. +This parameter can be used only when the `q` query string parameter is specified. ** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. -This parameter can only be used when the `q` query string parameter is specified. +This parameter can be used only when the `q` query string parameter is specified. ** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. -This parameter can only be used when the `q` query string parameter is specified. -** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. -This parameter can only be used when the `q` query string parameter is specified. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. +This parameter can be used only when the `q` query string parameter is specified. +** *`df` (Optional, string)*: The field to use as a default when no field prefix is given in the query string. +This parameter can be used only when the `q` query string parameter is specified. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. -** *`ignore_throttled` (Optional, boolean)*: If `true`, concrete, expanded or aliased indices are ignored when frozen. +It supports a list of values, such as `open,hidden`. +** *`ignore_throttled` (Optional, boolean)*: If `true`, concrete, expanded, or aliased indices are ignored when frozen. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. ** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. -** *`min_score` (Optional, number)*: Sets the minimum `_score` value that documents must have to be included in the result. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`terminate_after` (Optional, number)*: Maximum number of documents to collect for each shard. +This parameter can be used only when the `q` query string parameter is specified. +** *`min_score` (Optional, number)*: The minimum `_score` value that documents must have to be included in the result. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. +By default, it is random. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`terminate_after` (Optional, number)*: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. -** *`q` (Optional, string)*: Query in the Lucene query string syntax. + +IMPORTANT: Use with caution. +Elasticsearch applies this parameter to each shard handling the request. +When possible, let Elasticsearch perform early termination automatically. +Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. +** *`q` (Optional, string)*: The query in Lucene query string syntax. [discrete] === create -Index a document. -Adds a JSON document to the specified data stream or index and makes it searchable. -If the target is an index and the document already exists, the request updates the document and increments its version. +Create a new document in the index. + +You can index a new JSON document with the `//_doc/` or `//_create/<_id>` APIs +Using `_create` guarantees that the document is indexed only if it does not already exist. +It returns a 409 response when a document with a same ID already exists in the index. +To update an existing document, you must use the `//_doc/` API. + +If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: + +* To add a document using the `PUT //_create/<_id>` or `POST //_create/<_id>` request formats, you must have the `create_doc`, `create`, `index`, or `write` index privilege. +* To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. + +Automatic data stream creation requires a matching index template with data stream enabled. + +**Automatically create data streams and indices** + +If the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream. + +If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. + +NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. + +If no mapping exists, the index operation creates a dynamic mapping. +By default, new fields and objects are automatically added to the mapping if needed. + +Automatic index creation is controlled by the `action.auto_create_index` setting. +If it is `true`, any index can be created automatically. +You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely. +Specify a list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. +When a list is specified, the default behaviour is to disallow. + +NOTE: The `action.auto_create_index` setting affects the automatic creation of indices only. +It does not affect the creation of data streams. + +**Routing** + +By default, shard placement — or routing — is controlled by using a hash of the document's ID value. +For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter. + +When setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself. +This does come at the (very minimal) cost of an additional document parsing pass. +If the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. + +NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. + +**Distributed** + +The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. +After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. + +**Active shards** + +To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. +If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. +By default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`). +This default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`. +To alter this behavior per operation, use the `wait_for_active_shards request` parameter. + +Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1). +Specifying a negative value or a number greater than the number of shard copies will throw an error. + +For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). +If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. +This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. +If `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. +This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. +However, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. +The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. + +It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. +After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. +The `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed. {ref}/docs-index_.html[Endpoint documentation] [source,ts] @@ -154,28 +356,75 @@ client.create({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Unique identifier for the document. -** *`index` (string)*: Name of the data stream or index to target. -If the target doesn’t exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. -If the target doesn’t exist and doesn’t match a data stream template, this request creates the index. +** *`id` (string)*: A unique identifier for the document. +To automatically generate a document ID, use the `POST //_doc/` request format. +** *`index` (string)*: The name of the data stream or index to target. +If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. +If the target doesn't exist and doesn’t match a data stream template, this request creates the index. ** *`document` (Optional, object)*: A document. -** *`pipeline` (Optional, string)*: ID of the pipeline to use to preprocess incoming documents. -If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. -If a final pipeline is configured it will always run, regardless of the value of this parameter. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. -Valid values: `true`, `false`, `wait_for`. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`timeout` (Optional, string | -1 | 0)*: Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. -** *`version` (Optional, number)*: Explicit version number for concurrency control. -The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. +** *`pipeline` (Optional, string)*: The ID of the pipeline to use to preprocess incoming documents. +If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. +If a final pipeline is configured, it will always run regardless of the value of this parameter. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. +If `wait_for`, it waits for a refresh to make this operation visible to search. +If `false`, it does nothing with refreshes. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`timeout` (Optional, string | -1 | 0)*: The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. +Elasticsearch waits for at least the specified timeout period before failing. +The actual wait time could be longer, particularly when multiple waits occur. + +This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. +Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. +By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. +The actual wait time could be longer, particularly when multiple waits occur. +** *`version` (Optional, number)*: The explicit version number for concurrency control. +It must be a non-negative long number. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. ** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +The default value of `1` means it waits for each primary shard to be active. [discrete] === delete Delete a document. -Removes a JSON document from the specified index. + +Remove a JSON document from the specified index. + +NOTE: You cannot send deletion requests directly to a data stream. +To delete a document in a data stream, you must target the backing index containing the document. + +**Optimistic concurrency control** + +Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters. +If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`. + +**Versioning** + +Each document indexed is versioned. +When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. +Every write operation run on a document, deletes included, causes its version to be incremented. +The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. +The length of time for which a deleted document's version remains available is determined by the `index.gc_deletes` index setting. + +**Routing** + +If routing is used during indexing, the routing value also needs to be specified to delete a document. + +If the `_routing` mapping is set to `required` and no routing value is specified, the delete API throws a `RoutingMissingException` and rejects the request. + +For example: + +``` +DELETE /my-index-000001/_doc/1?routing=shard-1 +``` + +This request deletes the document with ID 1, but it is routed based on the user. +The document is not deleted if the correct routing is not specified. + +**Distributed** + +The delete operation gets hashed into a specific shard ID. +It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. {ref}/docs-delete.html[Endpoint documentation] [source,ts] @@ -186,25 +435,109 @@ client.delete({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Unique identifier for the document. -** *`index` (string)*: Name of the target index. +** *`id` (string)*: A unique identifier for the document. +** *`index` (string)*: The name of the target index. ** *`if_primary_term` (Optional, number)*: Only perform the operation if the document has this primary term. ** *`if_seq_no` (Optional, number)*: Only perform the operation if the document has this sequence number. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. -Valid values: `true`, `false`, `wait_for`. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for active shards. -** *`version` (Optional, number)*: Explicit version number for concurrency control. -The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. +If `wait_for`, it waits for a refresh to make this operation visible to search. +If `false`, it does nothing with refreshes. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for active shards. + +This parameter is useful for situations where the primary shard assigned to perform the delete operation might not be available when the delete operation runs. +Some reasons for this might be that the primary shard is currently recovering from a store or undergoing relocation. +By default, the delete operation will wait on the primary shard to become available for up to 1 minute before failing and responding with an error. +** *`version` (Optional, number)*: An explicit version number for concurrency control. +It must match the current version of the document for the request to succeed. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The minimum number of shard copies that must be active before proceeding with the operation. +You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +The default value of `1` means it waits for each primary shard to be active. [discrete] === delete_by_query Delete documents. + Deletes documents that match the specified query. +If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: + +* `read` +* `delete` or `write` + +You can specify the query criteria in the request URI or the request body using the same syntax as the search API. +When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. +If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. + +NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. + +While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. +A bulk delete request is performed for each batch of matching documents. +If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. +If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. +Any delete requests that completed successfully still stick, they are not rolled back. + +You can opt to count version conflicts instead of halting and returning by setting `conflicts` to `proceed`. +Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than `max_docs` until it has successfully deleted `max_docs documents`, or it has gone through every document in the source query. + +**Throttling delete requests** + +To control the rate at which delete by query issues batches of delete operations, you can set `requests_per_second` to any positive decimal number. +This pads each batch with a wait time to throttle the rate. +Set `requests_per_second` to `-1` to disable throttling. + +Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. +The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. +By default the batch size is `1000`, so if `requests_per_second` is set to `500`: + +``` +target_time = 1000 / 500 per second = 2 seconds +wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds +``` + +Since the batch is issued as a single `_bulk` request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. +This is "bursty" instead of "smooth". + +**Slicing** + +Delete by query supports sliced scroll to parallelize the delete process. +This can improve efficiency and provide a convenient way to break the request down into smaller parts. + +Setting `slices` to `auto` lets Elasticsearch choose the number of slices to use. +This setting will use one slice per shard, up to a certain limit. +If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. +Adding slices to the delete by query operation creates sub-requests which means it has some quirks: + +* You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. +* Fetching the status of the task for the request with slices only contains the status of completed slices. +* These sub-requests are individually addressable for things like cancellation and rethrottling. +* Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. +* Canceling the request with `slices` will cancel each sub-request. +* Due to the nature of `slices` each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. +* Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being deleted. +* Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. + +If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: + +* Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many `slices` hurts performance. Setting `slices` higher than the number of shards generally does not improve efficiency and adds overhead. +* Delete performance scales linearly across available resources with the number of slices. + +Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. + +**Cancel a delete by query operation** + +Any delete by query can be canceled using the task cancel API. For example: + +``` +POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel +``` + +The task ID can be found by using the get tasks API. + +Cancellation should happen quickly but might take a few seconds. +The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. + {ref}/docs-delete-by-query.html[Endpoint documentation] [source,ts] ---- @@ -214,55 +547,65 @@ client.deleteByQuery({ index }) ==== Arguments * *Request (object):* -** *`index` (string | string[])*: List of data streams, indices, and aliases to search. -Supports wildcards (`*`). +** *`index` (string | string[])*: A list of data streams, indices, and aliases to search. +It supports wildcards (`*`). To search all data streams or indices, omit this parameter or use `*` or `_all`. ** *`max_docs` (Optional, number)*: The maximum number of documents to delete. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Specifies the documents to delete using the Query DSL. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The documents to delete specified with Query DSL. ** *`slice` (Optional, { field, id, max })*: Slice the request manually using the provided slice ID and total number of slices. ** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. ** *`analyzer` (Optional, string)*: Analyzer to use for the query string. +This parameter can be used only when the `q` query string parameter is specified. ** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. +This parameter can be used only when the `q` query string parameter is specified. ** *`conflicts` (Optional, Enum("abort" | "proceed"))*: What to do if delete by query hits version conflicts: `abort` or `proceed`. ** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: `AND` or `OR`. -** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. +This parameter can be used only when the `q` query string parameter is specified. +** *`df` (Optional, string)*: The field to use as default where no field prefix is given in the query string. +This parameter can be used only when the `q` query string parameter is specified. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +It supports a list of values, such as `open,hidden`. ** *`from` (Optional, number)*: Starting offset (default: 0) ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. ** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. +This parameter can be used only when the `q` query string parameter is specified. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. +It is random by default. ** *`refresh` (Optional, boolean)*: If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. +This is different than the delete API's `refresh` parameter, which causes just the shard that received the delete request to be refreshed. +Unlike the delete API, it does not support `wait_for`. ** *`request_cache` (Optional, boolean)*: If `true`, the request cache is used for this request. Defaults to the index-level setting. ** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`q` (Optional, string)*: Query in the Lucene query string syntax. -** *`scroll` (Optional, string | -1 | 0)*: Period to retain the search context for scrolling. -** *`scroll_size` (Optional, number)*: Size of the scroll request that powers the operation. -** *`search_timeout` (Optional, string | -1 | 0)*: Explicit timeout for each search request. -Defaults to no timeout. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`q` (Optional, string)*: A query in the Lucene query string syntax. +** *`scroll` (Optional, string | -1 | 0)*: The period to retain the search context for scrolling. +** *`scroll_size` (Optional, number)*: The size of the scroll request that powers the operation. +** *`search_timeout` (Optional, string | -1 | 0)*: The explicit timeout for each search request. +It defaults to no timeout. ** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: The type of the search operation. -Available options: `query_then_fetch`, `dfs_query_then_fetch`. +Available options include `query_then_fetch` and `dfs_query_then_fetch`. ** *`slices` (Optional, number | Enum("auto"))*: The number of slices this task should be divided into. -** *`sort` (Optional, string[])*: A list of : pairs. -** *`stats` (Optional, string[])*: Specific `tag` of the request for logging and statistical purposes. -** *`terminate_after` (Optional, number)*: Maximum number of documents to collect for each shard. +** *`sort` (Optional, string[])*: A list of `:` pairs. +** *`stats` (Optional, string[])*: The specific `tag` of the request for logging and statistical purposes. +** *`terminate_after` (Optional, number)*: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. + Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. -** *`timeout` (Optional, string | -1 | 0)*: Period each deletion request waits for active shards. +** *`timeout` (Optional, string | -1 | 0)*: The period each deletion request waits for active shards. ** *`version` (Optional, boolean)*: If `true`, returns the document version as part of a hit. ** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +The `timeout` value controls how long each write request waits for unavailable shards to become available. ** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the operation is complete. +If `false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. [discrete] === delete_by_query_rethrottle @@ -282,6 +625,7 @@ client.deleteByQueryRethrottle({ task_id }) * *Request (object):* ** *`task_id` (string | number)*: The ID for the task. ** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. +To disable throttling, set it to `-1`. [discrete] === delete_script @@ -306,7 +650,24 @@ If no response is received before the timeout expires, the request fails and ret [discrete] === exists Check a document. -Checks if a specified document exists. + +Verify that a document exists. +For example, check to see if a document with the `_id` 0 exists: + +``` +HEAD my-index-000001/_doc/0 +``` + +If the document exists, the API returns a status code of `200 - OK`. +If the document doesn’t exist, the API returns `404 - Not Found`. + +**Versioning support** + +You can use the `version` parameter to check the document only if its current version is equal to the specified one. + +Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. +The old version of the document doesn't disappear immediately, although you won't be able to access it. +Elasticsearch cleans up deleted documents in the background as you continue to index more data. {ref}/docs-get.html[Endpoint documentation] [source,ts] @@ -317,28 +678,47 @@ client.exists({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier of the document. -** *`index` (string)*: List of data streams, indices, and aliases. -Supports wildcards (`*`). -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. +** *`id` (string)*: A unique document identifier. +** *`index` (string)*: A list of data streams, indices, and aliases. +It supports wildcards (`*`). +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. +By default, the operation is randomized between the shard replicas. + +If it is set to `_local`, the operation will prefer to be run on a local allocated shard when possible. +If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. +This can help with "jumping values" when hitting different shards in different refresh states. +A sample value can be something like the web session ID or the user name. ** *`realtime` (Optional, boolean)*: If `true`, the request is real-time as opposed to near-real-time. -** *`refresh` (Optional, boolean)*: If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. -** *`routing` (Optional, string)*: Target the specified primary shard. -** *`_source` (Optional, boolean | string | string[])*: `true` or `false` to return the `_source` field or not, or a list of fields to return. -** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude in the response. +** *`refresh` (Optional, boolean)*: If `true`, the request refreshes the relevant shards before retrieving the document. +Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). +** *`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_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`stored_fields` (Optional, string | string[])*: List of stored fields to return as part of a hit. +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. +If this field is specified, the `_source` parameter defaults to `false`. ** *`version` (Optional, number)*: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. [discrete] === exists_source Check for a document source. -Checks if a document's `_source` is stored. + +Check whether a document source exists in an index. +For example: + +``` +HEAD my-index-000001/_source/1 +``` + +A document's source is not available if it is disabled in the mapping. {ref}/docs-get.html[Endpoint documentation] [source,ts] @@ -349,20 +729,21 @@ client.existsSource({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Identifier of the document. -** *`index` (string)*: List of data streams, indices, and aliases. -Supports wildcards (`*`). -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`realtime` (Optional, boolean)*: If true, the request is real-time as opposed to near-real-time. -** *`refresh` (Optional, boolean)*: If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. -** *`routing` (Optional, string)*: Target the specified primary shard. -** *`_source` (Optional, boolean | string | string[])*: `true` or `false` to return the `_source` field or not, or a list of fields to return. +** *`id` (string)*: A unique identifier for the document. +** *`index` (string)*: A list of data streams, indices, and aliases. +It supports wildcards (`*`). +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. +By default, the operation is randomized between the shard replicas. +** *`realtime` (Optional, boolean)*: If `true`, the request is real-time as opposed to near-real-time. +** *`refresh` (Optional, boolean)*: If `true`, the request refreshes the relevant shards before retrieving the document. +Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). +** *`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 in the response. ** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`version` (Optional, number)*: Explicit version number for concurrency control. -The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. +** *`version` (Optional, number)*: The version number for concurrency control. +It must match the current version of the document for the request to succeed. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. [discrete] === explain @@ -434,7 +815,63 @@ targeting `foo*,bar*` returns an error if an index starts with foo but no index [discrete] === get Get a document by its ID. -Retrieves the document with the specified ID from an index. + +Get a document and its source or stored fields from an index. + +By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). +In the case where stored fields are requested with the `stored_fields` parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. +To turn off realtime behavior, set the `realtime` parameter to false. + +**Source filtering** + +By default, the API returns the contents of the `_source` field unless you have used the `stored_fields` parameter or the `_source` field is turned off. +You can turn off `_source` retrieval by using the `_source` parameter: + +``` +GET my-index-000001/_doc/0?_source=false +``` + +If you only need one or two fields from the `_source`, use the `_source_includes` or `_source_excludes` parameters to include or filter out particular fields. +This can be helpful with large documents where partial retrieval can save on network overhead +Both parameters take a comma separated list of fields or wildcard expressions. +For example: + +``` +GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities +``` + +If you only want to specify includes, you can use a shorter notation: + +``` +GET my-index-000001/_doc/0?_source=*.id +``` + +**Routing** + +If routing is used during indexing, the routing value also needs to be specified to retrieve a document. +For example: + +``` +GET my-index-000001/_doc/2?routing=user1 +``` + +This request gets the document with ID 2, but it is routed based on the user. +The document is not fetched if the correct routing is not specified. + +**Distributed** + +The GET operation is hashed into a specific shard ID. +It is then redirected to one of the replicas within that shard ID and returns the result. +The replicas are the primary shard and its replicas within that shard ID group. +This means that the more replicas you have, the better your GET scaling will be. + +**Versioning support** + +You can use the `version` parameter to retrieve the document only if its current version is equal to the specified one. + +Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. +The old version of the document doesn't disappear immediately, although you won't be able to access it. +Elasticsearch cleans up deleted documents in the background as you continue to index more data. {ref}/docs-get.html[Endpoint documentation] [source,ts] @@ -445,23 +882,38 @@ client.get({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Unique identifier of the document. -** *`index` (string)*: Name of the index that contains the document. -** *`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. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. Random by default. +** *`id` (string)*: A unique document identifier. +** *`index` (string)*: The name of the index that contains the document. +** *`force_synthetic_source` (Optional, boolean)*: Indicates whether the request forces synthetic `_source`. +Use this paramater to test if the mapping supports synthetic `_source` and to get a sense of the worst case performance. +Fetches with this parameter enabled will be slower than enabling synthetic source natively in the index. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. +By default, the operation is randomized between the shard replicas. + +If it is set to `_local`, the operation will prefer to be run on a local allocated shard when possible. +If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. +This can help with "jumping values" when hitting different shards in different refresh states. +A sample value can be something like the web session ID or the user name. ** *`realtime` (Optional, boolean)*: If `true`, the request is real-time as opposed to near-real-time. -** *`refresh` (Optional, boolean)*: If true, Elasticsearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes. -** *`routing` (Optional, string)*: Target the specified primary shard. -** *`_source` (Optional, boolean | string | string[])*: True or false to return the _source field or not, or a list of fields to return. -** *`_source_excludes` (Optional, string | string[])*: A list of source fields to exclude in the response. +** *`refresh` (Optional, boolean)*: If `true`, the request refreshes the relevant shards before retrieving the document. +Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). +** *`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_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`stored_fields` (Optional, string | string[])*: List of stored fields to return as part of a hit. +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. -** *`version` (Optional, number)*: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: internal, external, external_gte. +If this field is specified, the `_source` parameter defaults to `false`. +Only leaf fields can be retrieved with the `stored_field` 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. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. [discrete] === get_script @@ -507,7 +959,19 @@ client.getScriptLanguages() [discrete] === get_source Get a document's source. -Returns the source of a document. + +Get the source of a document. +For example: + +``` +GET my-index-000001/_source/1 +``` + +You can use the source filtering parameters to control which parts of the `_source` are returned: + +``` +GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities +``` {ref}/docs-get.html[Endpoint documentation] [source,ts] @@ -518,18 +982,21 @@ client.getSource({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Unique identifier of the document. -** *`index` (string)*: Name of the index that contains the document. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. Random by default. -** *`realtime` (Optional, boolean)*: Boolean) If true, the request is real-time as opposed to near-real-time. -** *`refresh` (Optional, boolean)*: If true, Elasticsearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes. -** *`routing` (Optional, string)*: Target the specified primary shard. -** *`_source` (Optional, boolean | string | string[])*: True or false to return the _source field or not, or a list of fields to return. +** *`id` (string)*: A unique document identifier. +** *`index` (string)*: The name of the index that contains the document. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. +By default, the operation is randomized between the shard replicas. +** *`realtime` (Optional, boolean)*: If `true`, the request is real-time as opposed to near-real-time. +** *`refresh` (Optional, boolean)*: If `true`, the request refreshes the relevant shards before retrieving the document. +Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). +** *`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 in the response. ** *`_source_includes` (Optional, string | string[])*: A list of source fields to include in the response. -** *`stored_fields` (Optional, string | string[])* -** *`version` (Optional, number)*: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: internal, external, external_gte. +** *`stored_fields` (Optional, string | string[])*: A list of stored fields to return as part of a hit. +** *`version` (Optional, number)*: The version number for concurrency control. +It must match the current version of the document for the request to succeed. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. [discrete] === health_report @@ -568,10 +1035,126 @@ client.healthReport({ ... }) [discrete] === index -Index a document. -Adds a JSON document to the specified data stream or index and makes it searchable. +Create or update a document in an index. + +Add a JSON document to the specified data stream or index and make it searchable. If the target is an index and the document already exists, the request updates the document and increments its version. +NOTE: You cannot use this API to send update requests for existing documents in a data stream. + +If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: + +* To add or overwrite a document using the `PUT //_doc/<_id>` request format, you must have the `create`, `index`, or `write` index privilege. +* To add a document using the `POST //_doc/` request format, you must have the `create_doc`, `create`, `index`, or `write` index privilege. +* To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. + +Automatic data stream creation requires a matching index template with data stream enabled. + +NOTE: Replica shards might not all be started when an indexing operation returns successfully. +By default, only the primary is required. Set `wait_for_active_shards` to change this default behavior. + +**Automatically create data streams and indices** + +If the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream. + +If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. + +NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. + +If no mapping exists, the index operation creates a dynamic mapping. +By default, new fields and objects are automatically added to the mapping if needed. + +Automatic index creation is controlled by the `action.auto_create_index` setting. +If it is `true`, any index can be created automatically. +You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely. +Specify a list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. +When a list is specified, the default behaviour is to disallow. + +NOTE: The `action.auto_create_index` setting affects the automatic creation of indices only. +It does not affect the creation of data streams. + +**Optimistic concurrency control** + +Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters. +If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`. + +**Routing** + +By default, shard placement — or routing — is controlled by using a hash of the document's ID value. +For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter. + +When setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself. +This does come at the (very minimal) cost of an additional document parsing pass. +If the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. + +NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. + +**Distributed** + +The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. +After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. + +**Active shards** + +To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. +If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. +By default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`). +This default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`. +To alter this behavior per operation, use the `wait_for_active_shards request` parameter. + +Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1). +Specifying a negative value or a number greater than the number of shard copies will throw an error. + +For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). +If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. +This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. +If `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. +This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. +However, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. +The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. + +It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. +After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. +The `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed. + +**No operation (noop) updates** + +When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. +If this isn't acceptable use the `_update` API with `detect_noop` set to `true`. +The `detect_noop` option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. + +There isn't a definitive rule for when noop updates aren't acceptable. +It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. + +**Versioning** + +Each indexed document is given a version number. +By default, internal versioning is used that starts at 1 and increments with each update, deletes included. +Optionally, the version number can be set to an external value (for example, if maintained in a database). +To enable this functionality, `version_type` should be set to `external`. +The value provided must be a numeric, long value greater than or equal to 0, and less than around `9.2e+18`. + +NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. +If no version is provided, the operation runs without any version checks. + +When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. +If true, the document will be indexed and the new version number used. +If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: + +``` +PUT my-index-000001/_doc/1?version=2&version_type=external +{ + "user": { + "id": "elkbee" + } +} + +In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. +If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). + +A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. +Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. + {ref}/docs-index_.html[Endpoint documentation] [source,ts] ---- @@ -581,29 +1164,40 @@ client.index({ index }) ==== Arguments * *Request (object):* -** *`index` (string)*: Name of the data stream or index to target. -** *`id` (Optional, string)*: Unique identifier for the document. +** *`index` (string)*: The name of the data stream or index to target. +If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. +If the target doesn't exist and doesn't match a data stream template, this request creates the index. +You can check for existing targets with the resolve index API. +** *`id` (Optional, string)*: A unique identifier for the document. +To automatically generate a document ID, use the `POST //_doc/` request format and omit this parameter. ** *`document` (Optional, object)*: A document. ** *`if_primary_term` (Optional, number)*: Only perform the operation if the document has this primary term. ** *`if_seq_no` (Optional, number)*: Only perform the operation if the document has this sequence number. -** *`op_type` (Optional, Enum("index" | "create"))*: Set to create to only index the document if it does not already exist (put if absent). +** *`op_type` (Optional, Enum("index" | "create"))*: Set to `create` to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. -Same as using the `/_create` endpoint. -Valid values: `index`, `create`. -If document id is specified, it defaults to `index`. +The behavior is the same as using the `/_create` endpoint. +If a document ID is specified, this paramater defaults to `index`. Otherwise, it defaults to `create`. -** *`pipeline` (Optional, string)*: ID of the pipeline to use to preprocess incoming documents. +If the request targets a data stream, an `op_type` of `create` is required. +** *`pipeline` (Optional, string)*: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. -Valid values: `true`, `false`, `wait_for`. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`timeout` (Optional, string | -1 | 0)*: Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. -** *`version` (Optional, number)*: Explicit version number for concurrency control. -The specified version must match the current version of the document for the request to succeed. -** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: Specific version type: `external`, `external_gte`. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. +If `wait_for`, it waits for a refresh to make this operation visible to search. +If `false`, it does nothing with refreshes. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`timeout` (Optional, string | -1 | 0)*: The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. + +This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. +Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. +By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. +The actual wait time could be longer, particularly when multiple waits occur. +** *`version` (Optional, number)*: An explicit version number for concurrency control. +It must be a non-negative long number. +** *`version_type` (Optional, Enum("internal" | "external" | "external_gte" | "force"))*: The version type. ** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +The default value of `1` means it waits for each primary shard to be active. ** *`require_alias` (Optional, boolean)*: If `true`, the destination must be an index alias. [discrete] @@ -816,8 +1410,34 @@ search requests using the same point in time. For example, if refreshes happen b `search_after` requests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time. -A point in time must be opened explicitly before being used in search requests. -The `keep_alive` parameter tells Elasticsearch how long it should persist. +A point in time must be opened explicitly before being used in search requests. + +A subsequent search request with the `pit` parameter must not specify `index`, `routing`, or `preference` values as these parameters are copied from the point in time. + +Just like regular searches, you can use `from` and `size` to page through point in time search results, up to the first 10,000 hits. +If you want to retrieve more hits, use PIT with `search_after`. + +IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. + +When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a `NoShardAvailableActionException` exception. +To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. + +**Keeping point in time alive** + +The `keep_alive` parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. +The value does not need to be long enough to process all data — it just needs to be long enough for the next request. + +Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. +Once the smaller segments are no longer needed they are deleted. +However, open point-in-times prevent the old segments from being deleted since they are still in use. + +TIP: Keeping older segments alive means that more disk space and file handles are needed. +Ensure that you have configured your nodes to have ample free file handles. + +Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. +Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. +Note that a point-in-time doesn't prevent its associated indices from being deleted. +You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. {ref}/point-in-time-api.html[Endpoint documentation] [source,ts] @@ -829,16 +1449,17 @@ client.openPointInTime({ index, keep_alive }) * *Request (object):* ** *`index` (string | string[])*: A list of index names to open point in time; use `_all` or empty string to perform the operation on all indices -** *`keep_alive` (string | -1 | 0)*: Extends the time to live of the corresponding point in time. -** *`index_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Allows to filter indices if the provided query rewrites to `match_none` on every shard. +** *`keep_alive` (string | -1 | 0)*: Extend the length of time that the point in time persists. +** *`index_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Filter indices if the provided query rewrites to `match_none` on every shard. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`preference` (Optional, string)*: Specifies the node or shard the operation should be performed on. -Random by default. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. +** *`preference` (Optional, string)*: The node or shard the operation should be performed on. +By default, it is random. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. -** *`allow_partial_search_results` (Optional, boolean)*: If `false`, creating a point in time request when a shard is missing or unavailable will throw an exception. +It supports a list of values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. +** *`allow_partial_search_results` (Optional, boolean)*: Indicates whether the point in time tolerates unavailable shards or shard failures when initially creating the PIT. +If `false`, creating a point in time request when a shard is missing or unavailable will throw an exception. If `true`, the point in time will contain all the shards that are available at the time of the request. [discrete] @@ -903,7 +1524,187 @@ To target all data streams and indices in a cluster, omit this parameter or use [discrete] === reindex Reindex documents. -Copies documents from a source to a destination. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself. + +Copy documents from a source to a destination. +You can copy all documents to the destination index or reindex a subset of the documents. +The source can be any existing index, alias, or data stream. +The destination must differ from the source. +For example, you cannot reindex a data stream into itself. + +IMPORTANT: Reindex requires `_source` to be enabled for all documents in the source. +The destination should be configured as wanted before calling the reindex API. +Reindex does not copy the settings from the source or its associated template. +Mappings, shard counts, and replicas, for example, must be configured ahead of time. + +If the Elasticsearch security features are enabled, you must have the following security privileges: + +* The `read` index privilege for the source data stream, index, or alias. +* The `write` index privilege for the destination data stream, index, or index alias. +* To automatically create a data stream or index with a reindex API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege for the destination data stream, index, or alias. +* If reindexing from a remote cluster, the `source.remote.user` must have the `monitor` cluster privilege and the `read` index privilege for the source data stream, index, or alias. + +If reindexing from a remote cluster, you must explicitly allow the remote host in the `reindex.remote.whitelist` setting. +Automatic data stream creation requires a matching index template with data stream enabled. + +The `dest` element can be configured like the index API to control optimistic concurrency control. +Omitting `version_type` or setting it to `internal` causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. + +Setting `version_type` to `external` causes Elasticsearch to preserve the `version` from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. + +Setting `op_type` to `create` causes the reindex API to create only missing documents in the destination. +All existing documents will cause a version conflict. + +IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an `op_type` of `create`. +A reindex can only add new documents to a destination data stream. +It cannot update existing documents in a destination data stream. + +By default, version conflicts abort the reindex process. +To continue reindexing if there are conflicts, set the `conflicts` request body property to `proceed`. +In this case, the response includes a count of the version conflicts that were encountered. +Note that the handling of other error types is unaffected by the `conflicts` property. +Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query. + +NOTE: The reindex API makes no effort to handle ID collisions. +The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. +Instead, make sure that IDs are unique by using a script. + +**Running reindex asynchronously** + +If the request contains `wait_for_completion=false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. +Elasticsearch creates a record of this task as a document at `_tasks/`. + +**Reindex from multiple sources** + +If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. +That way you can resume the process if there are any errors by removing the partially completed source and starting over. +It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. + +For example, you can use a bash script like this: + +``` +for index in i1 i2 i3 i4 i5; do + curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ + "source": { + "index": "'$index'" + }, + "dest": { + "index": "'$index'-reindexed" + } + }' +done +``` + +**Throttling** + +Set `requests_per_second` to any positive decimal number (`1.4`, `6`, `1000`, for example) to throttle the rate at which reindex issues batches of index operations. +Requests are throttled by padding each batch with a wait time. +To turn off throttling, set `requests_per_second` to `-1`. + +The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. +The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. +By default the batch size is `1000`, so if `requests_per_second` is set to `500`: + +``` +target_time = 1000 / 500 per second = 2 seconds +wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds +``` + +Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. +This is "bursty" instead of "smooth". + +**Slicing** + +Reindex supports sliced scroll to parallelize the reindexing process. +This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. + +NOTE: Reindexing from remote clusters does not support manual or automatic slicing. + +You can slice a reindex request manually by providing a slice ID and total number of slices to each request. +You can also let reindex automatically parallelize by using sliced scroll to slice on `_id`. +The `slices` parameter specifies the number of slices to use. + +Adding `slices` to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: + +* You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. +* Fetching the status of the task for the request with `slices` only contains the status of completed slices. +* These sub-requests are individually addressable for things like cancellation and rethrottling. +* Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. +* Canceling the request with `slices` will cancel each sub-request. +* Due to the nature of `slices`, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. +* Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being reindexed. +* Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. + +If slicing automatically, setting `slices` to `auto` will choose a reasonable number for most indices. +If slicing manually or otherwise tuning automatic slicing, use the following guidelines. + +Query performance is most efficient when the number of slices is equal to the number of shards in the index. +If that number is large (for example, `500`), choose a lower number as too many slices will hurt performance. +Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. + +Indexing performance scales linearly across available resources with the number of slices. + +Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. + +**Modify documents during reindexing** + +Like `_update_by_query`, reindex operations support a script that modifies the document. +Unlike `_update_by_query`, the script is allowed to modify the document's metadata. + +Just as in `_update_by_query`, you can set `ctx.op` to change the operation that is run on the destination. +For example, set `ctx.op` to `noop` if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the `noop` counter in the response body. +Set `ctx.op` to `delete` if your script decides that the document must be deleted from the destination. +The deletion will be reported in the `deleted` counter in the response body. +Setting `ctx.op` to anything else will return an error, as will setting any other field in `ctx`. + +Think of the possibilities! Just be careful; you are able to change: + +* `_id` +* `_index` +* `_version` +* `_routing` + +Setting `_version` to `null` or clearing it from the `ctx` map is just like not sending the version in an indexing request. +It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. + +**Reindex from remote** + +Reindex supports reindexing from a remote Elasticsearch cluster. +The `host` parameter must contain a scheme, host, port, and optional path. +The `username` and `password` parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. +Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. +There are a range of settings available to configure the behavior of the HTTPS connection. + +When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. +Remote hosts must be explicitly allowed with the `reindex.remote.whitelist` setting. +It can be set to a comma delimited list of allowed remote host and port combinations. +Scheme is ignored; only the host and port are used. +For example: + +``` +reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] +``` + +The list of allowed hosts must be configured on any nodes that will coordinate the reindex. +This feature should work with remote clusters of any version of Elasticsearch. +This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. + +WARNING: Elasticsearch does not support forward compatibility across major versions. +For example, you cannot reindex from a 7.x cluster into a 6.x cluster. + +To enable queries sent to older versions of Elasticsearch, the `query` parameter is sent directly to the remote host without validation or modification. + +NOTE: Reindexing from remote clusters does not support manual or automatic slicing. + +Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. +If the remote index includes very large documents you'll need to use a smaller batch size. +It is also possible to set the socket read timeout on the remote connection with the `socket_timeout` field and the connection timeout with the `connect_timeout` field. +Both default to 30 seconds. + +**Configuring SSL parameters** + +Reindex from remote supports configurable SSL settings. +These must be specified in the `elasticsearch.yml` file, with the exception of the secure settings, which you add in the Elasticsearch keystore. +It is not possible to configure SSL in the body of the reindex request. {ref}/docs-reindex.html[Endpoint documentation] [source,ts] @@ -916,19 +1717,35 @@ client.reindex({ dest, source }) * *Request (object):* ** *`dest` ({ index, op_type, pipeline, routing, version_type })*: The destination you are copying to. ** *`source` ({ index, query, remote, size, slice, sort, _source, runtime_mappings })*: The source you are copying from. -** *`conflicts` (Optional, Enum("abort" | "proceed"))*: Set to proceed to continue reindexing even if there are conflicts. +** *`conflicts` (Optional, Enum("abort" | "proceed"))*: Indicates whether to continue reindexing even when there are conflicts. ** *`max_docs` (Optional, number)*: The maximum number of documents to reindex. +By default, all documents are reindexed. +If it is a value less then or equal to `scroll_size`, a scroll will not be used to retrieve the results for the operation. + +If `conflicts` is set to `proceed`, the reindex operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query. ** *`script` (Optional, { source, id, params, lang, options })*: The script to run to update the document source or metadata when reindexing. ** *`size` (Optional, number)* ** *`refresh` (Optional, boolean)*: If `true`, the request refreshes affected shards to make this operation visible to search. ** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. -Defaults to no throttle. -** *`scroll` (Optional, string | -1 | 0)*: Specifies how long a consistent view of the index should be maintained for scrolled search. +By default, there is no throttle. +** *`scroll` (Optional, string | -1 | 0)*: The period of time that a consistent view of the index should be maintained for scrolled search. ** *`slices` (Optional, number | Enum("auto"))*: The number of slices this task should be divided into. -Defaults to 1 slice, meaning the task isn’t sliced into subtasks. -** *`timeout` (Optional, string | -1 | 0)*: Period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. +It defaults to one slice, which means the task isn't sliced into subtasks. + +Reindex supports sliced scroll to parallelize the reindexing process. +This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. + +NOTE: Reindexing from remote clusters does not support manual or automatic slicing. + +If set to `auto`, Elasticsearch chooses the number of slices to use. +This setting will use one slice per shard, up to a certain limit. +If there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards. +** *`timeout` (Optional, string | -1 | 0)*: The period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. +By default, Elasticsearch waits for at least one minute before failing. +The actual wait time could be longer, particularly when multiple waits occur. ** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operation. -Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +Set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). +The default value is one, which means it waits for each primary shard to be active. ** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the operation is complete. ** *`require_alias` (Optional, boolean)*: If `true`, the destination must be an index alias. @@ -937,6 +1754,15 @@ Set to `all` or any positive integer up to the total number of shards in the ind Throttle a reindex operation. Change the number of requests per second for a particular reindex operation. +For example: + +``` +POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 +``` + +Rethrottling that speeds up the query takes effect immediately. +Rethrottling that slows down the query will take effect after completing the current batch. +This behavior prevents scroll timeouts. {ref}/docs-reindex.html[Endpoint documentation] [source,ts] @@ -947,8 +1773,9 @@ client.reindexRethrottle({ task_id }) ==== Arguments * *Request (object):* -** *`task_id` (string)*: Identifier for the task. +** *`task_id` (string)*: The task identifier, which can be found by using the tasks API. ** *`requests_per_second` (Optional, float)*: The throttle for this request in sub-requests per second. +It can be either `-1` to turn off throttling or any decimal number like `1.7` or `12` to throttle to that level. [discrete] === render_search_template @@ -979,7 +1806,14 @@ If no `id` or `` is specified, this parameter is required. [discrete] === scripts_painless_execute Run a script. + Runs a script and returns a result. +Use this API to build and test scripts, such as when defining a script for a runtime field. +This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster. + +The API uses several _contexts_, which control how scripts are run, what variables are available at runtime, and what the return type is. + +Each context requires a script, but additional parameters depend on the context you're using for that script. {painless}/painless-execute-api.html[Endpoint documentation] [source,ts] @@ -990,9 +1824,11 @@ client.scriptsPainlessExecute({ ... }) ==== Arguments * *Request (object):* -** *`context` (Optional, string)*: The context that the script should run in. +** *`context` (Optional, Enum("painless_test" | "filter" | "score" | "boolean_field" | "date_field" | "double_field" | "geo_point_field" | "ip_field" | "keyword_field" | "long_field" | "composite_field"))*: The context that the script should run in. +NOTE: Result ordering in the field contexts is not guaranteed. ** *`context_setup` (Optional, { document, index, query })*: Additional parameters for the `context`. -** *`script` (Optional, { source, id, params, lang, options })*: The Painless script to execute. +NOTE: This parameter is required for all contexts except `painless_test`, which is the default if no value is provided for `context`. +** *`script` (Optional, { source, id, params, lang, options })*: The Painless script to run. [discrete] === scroll @@ -1032,6 +1868,21 @@ Get search hits that match the query defined in the request. You can provide search queries using the `q` query string parameter or the request body. If both are specified, only the query parameter is used. +If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. +To search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices. + +**Search slicing** + +When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties. +By default the splitting is done first on the shards, then locally on each shard. +The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. + +For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. + +IMPORTANT: The same point-in-time ID should be used for all slices. +If different PIT IDs are used, slices can overlap and miss documents. +This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. + {ref}/search-search.html[Endpoint documentation] [source,ts] ---- @@ -1041,131 +1892,143 @@ client.search({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases to search. -Supports wildcards (`*`). +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases to search. +It supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*` or `_all`. ** *`aggregations` (Optional, Record)*: Defines the aggregations that are run as part of the search request. ** *`collapse` (Optional, { field, inner_hits, max_concurrent_group_searches, collapse })*: Collapses search results the values of the specified field. -** *`explain` (Optional, boolean)*: If true, returns detailed information about score computation as part of a hit. +** *`explain` (Optional, boolean)*: If `true`, the request returns detailed information about score computation as part of a hit. ** *`ext` (Optional, Record)*: Configuration of search extensions defined by Elasticsearch plugins. -** *`from` (Optional, number)*: Starting document offset. -Needs to be non-negative. +** *`from` (Optional, number)*: The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. ** *`highlight` (Optional, { encoder, fields })*: Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. ** *`track_total_hits` (Optional, boolean | number)*: Number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. -** *`indices_boost` (Optional, Record[])*: Boosts the _score of documents from specified indices. -** *`docvalue_fields` (Optional, { field, format, include_unmapped }[])*: Array of wildcard (`*`) patterns. +** *`indices_boost` (Optional, Record[])*: Boost the `_score` of documents from specified indices. +The boost value is the factor by which scores are multiplied. +A boost value greater than `1.0` increases the score. +A boost value between `0` and `1.0` decreases the score. +** *`docvalue_fields` (Optional, { field, format, include_unmapped }[])*: An array of wildcard (`*`) field patterns. The request returns doc values for field names matching these patterns in the `hits.fields` property of the response. -** *`knn` (Optional, { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits } | { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits }[])*: Defines the approximate kNN search to run. -** *`rank` (Optional, { rrf })*: Defines the Reciprocal Rank Fusion (RRF) to use. -** *`min_score` (Optional, number)*: Minimum `_score` for matching documents. +** *`knn` (Optional, { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits, rescore_vector } | { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits, rescore_vector }[])*: The approximate kNN search to run. +** *`rank` (Optional, { rrf })*: The Reciprocal Rank Fusion (RRF) to use. +** *`min_score` (Optional, number)*: The minimum `_score` for matching documents. Documents with a lower `_score` are not included in the search results. ** *`post_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Use the `post_filter` parameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results. ** *`profile` (Optional, boolean)*: Set to `true` to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. -** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Defines the search definition using the Query DSL. +** *`query` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: The search definition using the Query DSL. ** *`rescore` (Optional, { window_size, query, learning_to_rank } | { window_size, query, learning_to_rank }[])*: Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases. -** *`retriever` (Optional, { standard, knn, rrf, text_similarity_reranker, rule })*: A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such as query and knn. +** *`retriever` (Optional, { standard, knn, rrf, text_similarity_reranker, rule })*: A retriever is a specification to describe top documents returned from a search. +A retriever replaces other elements of the search API that also return top documents such as `query` and `knn`. ** *`script_fields` (Optional, Record)*: Retrieve a script evaluation (based on different fields) for each hit. ** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Used to retrieve the next page of hits using a set of sort values from the previous page. -** *`size` (Optional, number)*: The number of hits to return. +** *`size` (Optional, number)*: The number of hits to return, which must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. -To page through more hits, use the `search_after` parameter. -** *`slice` (Optional, { field, id, max })*: Can be used to split a scrolled search into multiple slices that can be consumed independently. +To page through more hits, use the `search_after` property. +** *`slice` (Optional, { field, id, max })*: Split a scrolled search into multiple slices that can be consumed independently. ** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: A list of : pairs. -** *`_source` (Optional, boolean | { excludes, includes })*: Indicates which source fields are returned for matching documents. -These fields are returned in the hits._source property of the search response. -** *`fields` (Optional, { field, format, include_unmapped }[])*: Array of wildcard (`*`) patterns. +** *`_source` (Optional, boolean | { excludes, includes })*: The source fields that are returned for matching documents. +These fields are returned in the `hits._source` property of the search response. +If the `stored_fields` property is specified, the `_source` property defaults to `false`. +Otherwise, it defaults to `true`. +** *`fields` (Optional, { field, format, include_unmapped }[])*: An array of wildcard (`*`) field patterns. The request returns values for field names matching these patterns in the `hits.fields` property of the response. ** *`suggest` (Optional, { text })*: Defines a suggester that provides similar looking terms based on a provided text. -** *`terminate_after` (Optional, number)*: Maximum number of documents to collect for each shard. +** *`terminate_after` (Optional, number)*: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. -Use with caution. -Elasticsearch applies this parameter to each shard handling the request. + +IMPORTANT: Use with caution. +Elasticsearch applies this property to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. -Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. +Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers. + If set to `0` (default), the query does not terminate early. -** *`timeout` (Optional, string)*: Specifies the period of time to wait for a response from each shard. +** *`timeout` (Optional, string)*: The period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout. -** *`track_scores` (Optional, boolean)*: If true, calculate and return document scores, even if the scores are not used for sorting. -** *`version` (Optional, boolean)*: If true, returns document version as part of a hit. -** *`seq_no_primary_term` (Optional, boolean)*: If `true`, returns sequence number and primary term of the last modification of each hit. -** *`stored_fields` (Optional, string | string[])*: List of stored fields to return as part of a hit. +** *`track_scores` (Optional, boolean)*: If `true`, calculate and return document scores, even if the scores are not used for sorting. +** *`version` (Optional, boolean)*: If `true`, the request returns the document version as part of a hit. +** *`seq_no_primary_term` (Optional, boolean)*: If `true`, the request returns sequence number and primary term of the last modification of each hit. +** *`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`. +If this field is specified, the `_source` property defaults to `false`. You can pass `_source: true` to return both source fields and stored fields in the search response. -** *`pit` (Optional, { id, keep_alive })*: Limits the search to a point in time (PIT). +** *`pit` (Optional, { id, keep_alive })*: Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an `` in the request path. -** *`runtime_mappings` (Optional, Record)*: Defines one or more runtime fields in the search request. +** *`runtime_mappings` (Optional, Record)*: One or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. -** *`stats` (Optional, string[])*: Stats groups to associate with the search. +** *`stats` (Optional, string[])*: The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API. ** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. -** *`allow_partial_search_results` (Optional, boolean)*: If true, returns partial results if there are shard request timeouts or shard failures. If false, returns an error with no partial results. -** *`analyzer` (Optional, string)*: Analyzer to use for the query string. -This parameter can only be used when the q query string parameter is specified. -** *`analyze_wildcard` (Optional, boolean)*: If true, wildcard and prefix queries are analyzed. -This parameter can only be used when the q query string parameter is specified. +** *`allow_partial_search_results` (Optional, boolean)*: If `true` and there are shard request timeouts or shard failures, the request returns partial results. +If `false`, it returns an error with no partial results. + +To override the default behavior, you can set the `search.default_allow_partial_results` cluster setting to `false`. +** *`analyzer` (Optional, string)*: The analyzer to use for the query string. +This parameter can be used only when the `q` query string parameter is specified. +** *`analyze_wildcard` (Optional, boolean)*: If `true`, wildcard and prefix queries are analyzed. +This parameter can be used only when the `q` query string parameter is specified. ** *`batched_reduce_size` (Optional, number)*: The number of shard results that should be reduced at once on the coordinating node. -This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. -** *`ccs_minimize_roundtrips` (Optional, boolean)*: If true, network round-trips between the coordinating node and the remote clusters are minimized when executing cross-cluster search (CCS) requests. -** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for query string query: AND or OR. -This parameter can only be used when the `q` query string parameter is specified. -** *`df` (Optional, string)*: Field to use as default where no field prefix is given in the query string. -This parameter can only be used when the q query string parameter is specified. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. +If the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request. +** *`ccs_minimize_roundtrips` (Optional, boolean)*: If `true`, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests. +** *`default_operator` (Optional, Enum("and" | "or"))*: The default operator for the query string query: `AND` or `OR`. +This parameter can be used only when the `q` query string parameter is specified. +** *`df` (Optional, string)*: The field to use as a default when no field prefix is given in the query string. +This parameter can be used only when the `q` query string parameter is specified. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. +It supports a list of values such as `open,hidden`. ** *`ignore_throttled` (Optional, boolean)*: If `true`, concrete, expanded or aliased indices will be ignored when frozen. ** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`include_named_queries_score` (Optional, boolean)*: Indicates whether hit.matched_queries should be rendered as a map that includes -the name of the matched query associated with its score (true) -or as an array containing the name of the matched queries (false) +** *`include_named_queries_score` (Optional, boolean)*: If `true`, the response includes the score contribution from any named queries. + This functionality reruns each named query on every hit in a search response. Typically, this adds a small overhead to a request. However, using computationally expensive named queries on a large number of hits may add significant overhead. ** *`lenient` (Optional, boolean)*: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. -This parameter can only be used when the `q` query string parameter is specified. -** *`max_concurrent_shard_requests` (Optional, number)*: Defines the number of concurrent shard requests per node this search executes concurrently. +This parameter can be used only when the `q` query string parameter is specified. +** *`max_concurrent_shard_requests` (Optional, number)*: The number of concurrent shard requests per node that the search runs concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. -** *`preference` (Optional, string)*: Nodes and shards used for the search. -By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are: -`_only_local` to run the search only on shards on the local node; -`_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method; -`_only_nodes:,` to run the search on only the specified nodes IDs, where, if suitable shards exist on more than one selected node, use shards on those nodes using the default method, or if none of the specified nodes are available, select shards from any available node using the default method; -`_prefer_nodes:,` to if possible, run the search on the specified nodes IDs, or if not, select shards using the default method; -`_shards:,` to run the search only on the specified shards; +** *`preference` (Optional, string)*: The nodes and shards used for the search. +By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. +Valid values are: + +* `_only_local` to run the search only on shards on the local node. +* `_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method. +* `_only_nodes:,` to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method. +* `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs. If not, select shards using the default method. +`_shards:,` to run the search only on the specified shards. You can combine this value with other `preference` values. However, the `_shards` value must come first. For example: `_shards:2,3|_local`. `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order. -** *`pre_filter_shard_size` (Optional, number)*: Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. +** *`pre_filter_shard_size` (Optional, number)*: A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint). When unspecified, the pre-filter phase is executed if any of these conditions is met: -the request targets more than 128 shards; -the request targets one or more read-only index; -the primary sort of the query targets an indexed field. + +* The request targets more than 128 shards. +* The request targets one or more read-only index. +* The primary sort of the query targets an indexed field. ** *`request_cache` (Optional, boolean)*: If `true`, the caching of search results is enabled for requests where `size` is `0`. -Defaults to index level settings. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`scroll` (Optional, string | -1 | 0)*: Period to retain the search context for scrolling. See Scroll search results. +It defaults to index level settings. +** *`routing` (Optional, string)*: A custom value that is used to route operations to a specific shard. +** *`scroll` (Optional, string | -1 | 0)*: The period to retain the search context for scrolling. By default, this value cannot exceed `1d` (24 hours). -You can change this limit using the `search.max_keep_alive` cluster-level setting. -** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: How distributed term frequencies are calculated for relevance scoring. -** *`suggest_field` (Optional, string)*: Specifies which field to use for suggestions. -** *`suggest_mode` (Optional, Enum("missing" | "popular" | "always"))*: Specifies the suggest mode. -This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. -** *`suggest_size` (Optional, number)*: Number of suggestions to return. -This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. +You can change this limit by using the `search.max_keep_alive` cluster-level setting. +** *`search_type` (Optional, Enum("query_then_fetch" | "dfs_query_then_fetch"))*: Indicates how distributed term frequencies are calculated for relevance scoring. +** *`suggest_field` (Optional, string)*: The field to use for suggestions. +** *`suggest_mode` (Optional, Enum("missing" | "popular" | "always"))*: The suggest mode. +This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. +** *`suggest_size` (Optional, number)*: The number of suggestions to return. +This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. ** *`suggest_text` (Optional, string)*: The source text for which the suggestions should be returned. -This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. +This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. ** *`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. @@ -1175,8 +2038,11 @@ If the `_source` parameter is `false`, this parameter is ignored. 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)*: Query in the Lucene query string syntax using query parameter search. +** *`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. @@ -1385,7 +2251,24 @@ Random by default. [discrete] === update Update a document. -Updates a document by running a script or passing a partial document. + +Update a document by running a script or passing a partial document. + +If the Elasticsearch security features are enabled, you must have the `index` or `write` index privilege for the target index or index alias. + +The script can update, delete, or skip modifying the document. +The API also supports passing a partial document, which is merged into the existing document. +To fully replace an existing document, use the index API. +This operation: + +* Gets the document (collocated with the shard) from the index. +* Runs the specified script. +* Indexes the result. + +The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. + +The `_source` field must be enabled to use this API. +In addition to `_source`, you can access the following variables through the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing`, and `_now` (the current timestamp). {ref}/docs-update.html[Endpoint documentation] [source,ts] @@ -1396,35 +2279,37 @@ client.update({ id, index }) ==== Arguments * *Request (object):* -** *`id` (string)*: Document ID -** *`index` (string)*: The name of the index -** *`detect_noop` (Optional, boolean)*: Set to false to disable setting 'result' in the response -to 'noop' if no change to the document occurred. +** *`id` (string)*: A unique identifier for the document to be updated. +** *`index` (string)*: The name of the target index. +By default, the index is created automatically if it doesn't exist. +** *`detect_noop` (Optional, boolean)*: If `true`, the `result` in the response is set to `noop` (no operation) when there are no changes to the document. ** *`doc` (Optional, object)*: A partial update to an existing document. -** *`doc_as_upsert` (Optional, boolean)*: Set to true to use the contents of 'doc' as the value of 'upsert' -** *`script` (Optional, { source, id, params, lang, options })*: Script to execute to update the document. -** *`scripted_upsert` (Optional, boolean)*: Set to true to execute the script whether or not the document exists. -** *`_source` (Optional, boolean | { excludes, includes })*: Set to false to disable source retrieval. You can also specify a comma-separated -list of the fields you want to retrieve. -** *`upsert` (Optional, object)*: If the document does not already exist, the contents of 'upsert' are inserted as a -new document. If the document exists, the 'script' is executed. +If both `doc` and `script` are specified, `doc` is ignored. +** *`doc_as_upsert` (Optional, boolean)*: If `true`, use the contents of 'doc' as the value of 'upsert'. +NOTE: Using ingest pipelines with `doc_as_upsert` is not supported. +** *`script` (Optional, { source, id, params, lang, options })*: The script to run to update the document. +** *`scripted_upsert` (Optional, boolean)*: If `true`, run the script whether or not the document exists. +** *`_source` (Optional, boolean | { excludes, includes })*: If `false`, turn off source retrieval. +You can also specify a list of the fields you want to retrieve. +** *`upsert` (Optional, object)*: If the document does not already exist, the contents of 'upsert' are inserted as a new document. +If the document exists, the 'script' is run. ** *`if_primary_term` (Optional, number)*: Only perform the operation if the document has this primary term. ** *`if_seq_no` (Optional, number)*: Only perform the operation if the document has this sequence number. ** *`lang` (Optional, string)*: The script language. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation -visible to search, if 'wait_for' then wait for a refresh to make this operation -visible to search, if 'false' do nothing with refreshes. -** *`require_alias` (Optional, boolean)*: If true, the destination must be an index alias. -** *`retry_on_conflict` (Optional, number)*: Specify how many times should the operation be retried when a conflict occurs. -** *`routing` (Optional, string)*: Custom value used to route operations to a specific shard. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for dynamic mapping updates and active shards. -This guarantees Elasticsearch waits for at least the timeout before failing. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. +If 'wait_for', it waits for a refresh to make this operation visible to search. +If 'false', it does nothing with refreshes. +** *`require_alias` (Optional, boolean)*: If `true`, the destination must be an index alias. +** *`retry_on_conflict` (Optional, number)*: The number of times the operation should be retried when a conflict occurs. +** *`routing` (Optional, string)*: A custom value used to route operations to a specific shard. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for the following operations: dynamic mapping updates and waiting for active shards. +Elasticsearch waits for at least the timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur. -** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of shard copies that must be active before proceeding with the operations. -Set to 'all' or any positive integer up to the total number of shards in the index -(number_of_replicas+1). Defaults to 1 meaning the primary shard. -** *`_source_excludes` (Optional, string | string[])*: Specify the source fields you want to exclude. -** *`_source_includes` (Optional, string | string[])*: Specify the source fields you want to retrieve. +** *`wait_for_active_shards` (Optional, number | Enum("all" | "index-setting"))*: The number of copies of each shard that must be active before proceeding with the operation. +Set to 'all' or any positive integer up to the total number of shards in the index (`number_of_replicas`+1). +The default value of `1` means it waits for each primary shard to be active. +** *`_source_excludes` (Optional, string | string[])*: The source fields you want to exclude. +** *`_source_includes` (Optional, string | string[])*: The source fields you want to retrieve. [discrete] === update_by_query @@ -1621,7 +2506,7 @@ Defaults to 10,000 hits. ** *`indices_boost` (Optional, Record[])*: Boosts the _score of documents from specified indices. ** *`docvalue_fields` (Optional, { field, format, include_unmapped }[])*: Array of wildcard (*) patterns. The request returns doc values for field names matching these patterns in the hits.fields property of the response. -** *`knn` (Optional, { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits } | { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits }[])*: Defines the approximate kNN search to run. +** *`knn` (Optional, { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits, rescore_vector } | { field, query_vector, query_vector_builder, k, num_candidates, boost, filter, similarity, inner_hits, rescore_vector }[])*: Defines the approximate kNN search to run. ** *`min_score` (Optional, number)*: Minimum _score for matching documents. Documents with a lower _score are not included in the search results. ** *`post_filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })* @@ -1663,6 +2548,8 @@ aggregation for its associated searches. You can retrieve these stats using the indices stats API. ** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: Blocks and waits until the search is completed up to a certain timeout. When the async search completes within the timeout, the response won’t include the ID as the results are not stored in the cluster. +** *`keep_alive` (Optional, string | -1 | 0)*: Specifies how long the async search needs to be available. +Ongoing async searches and any saved search results are deleted after this period. ** *`keep_on_completion` (Optional, boolean)*: If `true`, results are stored for later retrieval when the search completes within the `wait_for_completion_timeout`. ** *`allow_no_indices` (Optional, boolean)*: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) ** *`allow_partial_search_results` (Optional, boolean)*: Indicate if an error should be returned if there is a partial search failure or timeout @@ -1792,10 +2679,11 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== aliases Get aliases. -Retrieves the cluster’s index aliases, including filter and routing information. -The API does not return data stream aliases. -CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API. +Get the cluster's index aliases, including filter and routing information. +This API does not return data stream aliases. + +IMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API. {ref}/cat-alias.html[Endpoint documentation] [source,ts] @@ -1808,14 +2696,20 @@ client.cat.aliases({ ... }) * *Request (object):* ** *`name` (Optional, string | string[])*: A list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Whether to expand wildcard expression to concrete indices that are open, closed or both. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: The type of index that wildcard patterns can match. +If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. +It supports a list of values, such as `open,hidden`. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. +If the master node is not available before the timeout expires, the request fails and returns an error. +To indicated that the request should never timeout, you can set it to `-1`. [discrete] ==== allocation Get shard allocation information. + Get a snapshot of the number of shards allocated to each data node and their disk space. -IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. + +IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. {ref}/cat-allocation.html[Endpoint documentation] [source,ts] @@ -1827,7 +2721,7 @@ client.cat.allocation({ ... }) ==== Arguments * *Request (object):* -** *`node_id` (Optional, string | string[])*: List of node identifiers or names used to limit the returned information. +** *`node_id` (Optional, string | string[])*: A list of node identifiers or names used to limit the returned information. ** *`bytes` (Optional, Enum("b" | "kb" | "mb" | "gb" | "tb" | "pb"))*: The unit used to display byte values. ** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed @@ -1838,10 +2732,11 @@ node will send requests for further information to each selected node. [discrete] ==== component_templates Get component templates. -Returns information about component templates in a cluster. + +Get information about component templates in a cluster. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. -CAT APIs are only intended for human consumption using the command line or Kibana console. +IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get component template API. {ref}/cat-component-templates.html[Endpoint documentation] @@ -1854,20 +2749,23 @@ client.cat.componentTemplates({ ... }) ==== Arguments * *Request (object):* -** *`name` (Optional, string)*: The name of the component template. Accepts wildcard expressions. If omitted, all component templates are returned. +** *`name` (Optional, string)*: The name of the component template. +It accepts wildcard expressions. +If it is omitted, all component templates are returned. ** *`local` (Optional, boolean)*: If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. -** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. +** *`master_timeout` (Optional, string | -1 | 0)*: The period to wait for a connection to the master node. [discrete] ==== count Get a document count. -Provides quick access to a document count for a data stream, an index, or an entire cluster. + +Get quick access to a document count for a data stream, an index, or an entire cluster. The document count only includes live documents, not deleted documents which have not yet been removed by the merge process. -CAT APIs are only intended for human consumption using the command line or Kibana console. +IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the count API. {ref}/cat-count.html[Endpoint documentation] @@ -1880,13 +2778,16 @@ client.cat.count({ ... }) ==== Arguments * *Request (object):* -** *`index` (Optional, string | string[])*: List of data streams, indices, and aliases used to limit the request. -Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. +** *`index` (Optional, string | string[])*: A list of data streams, indices, and aliases used to limit the request. +It supports wildcards (`*`). +To target all data streams and indices, omit this parameter or use `*` or `_all`. [discrete] ==== fielddata Get field data cache information. + Get the amount of heap memory currently used by the field data cache on every data node in the cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes stats API. @@ -1907,7 +2808,8 @@ To retrieve all fields, omit this parameter. [discrete] ==== health Get the cluster health status. -IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. + +IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the cluster health API. This API is often used to check malfunctioning clusters. To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: @@ -1933,7 +2835,8 @@ client.cat.health({ ... }) [discrete] ==== help Get CAT help. -Returns help for the CAT APIs. + +Get help for the CAT APIs. {ref}/cat.html[Endpoint documentation] [source,ts] @@ -1945,7 +2848,8 @@ client.cat.help() [discrete] ==== indices Get index information. -Returns high-level information about indices in a cluster, including backing indices for data streams. + +Get high-level information about indices in a cluster, including backing indices for data streams. Use this request to get the following information for each index in a cluster: - shard count @@ -1983,7 +2887,9 @@ Supports wildcards (`*`). To target all data streams and indices, omit this para [discrete] ==== master Get master node information. + Get information about the master node, including the ID, bound IP address, and name. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. {ref}/cat-master.html[Endpoint documentation] @@ -2005,9 +2911,10 @@ node will send requests for further information to each selected node. [discrete] ==== ml_data_frame_analytics Get data frame analytics jobs. -Returns configuration and usage information about data frame analytics jobs. -CAT APIs are only intended for human consumption using the Kibana +Get configuration and usage information about data frame analytics jobs. + +IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get data frame analytics jobs statistics API. @@ -2032,12 +2939,13 @@ response. [discrete] ==== ml_datafeeds Get datafeeds. -Returns configuration and usage information about datafeeds. + +Get configuration and usage information about datafeeds. This API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. -CAT APIs are only intended for human consumption using the Kibana +IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get datafeed statistics API. @@ -2068,12 +2976,13 @@ partial matches. [discrete] ==== ml_jobs Get anomaly detection jobs. -Returns configuration and usage information for anomaly detection jobs. + +Get configuration and usage information for anomaly detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. -CAT APIs are only intended for human consumption using the Kibana +IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get anomaly detection job statistics API. @@ -2105,9 +3014,10 @@ matches. [discrete] ==== ml_trained_models Get trained models. -Returns configuration and usage information about inference trained models. -CAT APIs are only intended for human consumption using the Kibana +Get configuration and usage information about inference trained models. + +IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get trained models statistics API. @@ -2135,6 +3045,7 @@ If `false`, the API returns a 404 status code when there are no matches or only [discrete] ==== nodeattrs Get node attribute information. + Get information about custom node attributes. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. @@ -2157,6 +3068,7 @@ node will send requests for further information to each selected node. [discrete] ==== nodes Get node information. + Get information about the nodes in a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. @@ -2179,6 +3091,7 @@ client.cat.nodes({ ... }) [discrete] ==== pending_tasks Get pending task information. + Get information about cluster-level changes that have not yet taken effect. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the pending cluster tasks API. @@ -2202,6 +3115,7 @@ node will send requests for further information to each selected node. [discrete] ==== plugins Get plugin information. + Get a list of plugins running on each node of a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. @@ -2225,6 +3139,7 @@ node will send requests for further information to each selected node. [discrete] ==== recovery Get shard recovery information. + Get information about ongoing and completed shard recoveries. Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or syncing a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing. For data streams, the API returns information about the stream’s backing indices. @@ -2250,6 +3165,7 @@ Supports wildcards (`*`). To target all data streams and indices, omit this para [discrete] ==== repositories Get snapshot repository information. + Get a list of snapshot repositories for a cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot repository API. @@ -2272,6 +3188,7 @@ node will send requests for further information to each selected node. [discrete] ==== segments Get segment information. + Get low-level information about the Lucene segments in index shards. For data streams, the API returns information about the backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index segments API. @@ -2299,6 +3216,7 @@ node will send requests for further information to each selected node. [discrete] ==== shards Get shard information. + Get information about the shards in a cluster. For data streams, the API returns information about the backing indices. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. @@ -2322,7 +3240,8 @@ To target all data streams and indices, omit this parameter or use `*` or `_all` [discrete] ==== snapshots -Get snapshot information +Get snapshot information. + Get information about the snapshots stored in one or more repositories. A snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API. @@ -2348,6 +3267,7 @@ If any repository fails during the request, Elasticsearch returns an error. [discrete] ==== tasks Get task information. + Get information about tasks currently running in the cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the task management API. @@ -2373,6 +3293,7 @@ If no response is received before the timeout expires, the request fails and ret [discrete] ==== templates Get index template information. + Get information about the index templates in a cluster. You can use index templates to apply index settings and field mappings to new indices at creation. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API. @@ -2398,6 +3319,7 @@ node will send requests for further information to each selected node. [discrete] ==== thread_pool Get thread pool statistics. + Get thread pool statistics for each node in a cluster. Returned information includes all built-in thread pools and custom thread pools. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API. @@ -2424,6 +3346,7 @@ node will send requests for further information to each selected node. [discrete] ==== transforms Get transform information. + Get configuration and usage information about transforms. CAT APIs are only intended for human consumption using the Kibana @@ -3277,6 +4200,7 @@ client.connector.delete({ connector_id }) * *Request (object):* ** *`connector_id` (string)*: The unique identifier of the connector to be deleted ** *`delete_sync_jobs` (Optional, boolean)*: A flag indicating if associated sync jobs should be also removed. Defaults to false. +** *`hard` (Optional, boolean)*: A flag indicating if the connector should be hard deleted. [discrete] ==== get @@ -3295,6 +4219,7 @@ client.connector.get({ connector_id }) * *Request (object):* ** *`connector_id` (string)*: The unique identifier of the connector +** *`include_deleted` (Optional, boolean)*: A flag to indicate if the desired connector should be fetched, even if it was soft-deleted. [discrete] ==== list @@ -3317,6 +4242,7 @@ client.connector.list({ ... }) ** *`index_name` (Optional, string | string[])*: A list of connector index names to fetch connector documents for ** *`connector_name` (Optional, string | string[])*: A list of connector names to fetch connector documents for ** *`service_type` (Optional, string | string[])*: A list of connector service types to fetch connector documents for +** *`include_deleted` (Optional, boolean)*: A flag to indicate if the desired connector should be fetched, even if it was soft-deleted. ** *`query` (Optional, string)*: A wildcard query string that filters connectors with matching name, description or index name [discrete] @@ -4092,25 +5018,100 @@ parameter to get a smaller or larger set of samples. To retrieve more than one s === esql [discrete] ==== async_query -Executes an ESQL request asynchronously +Run an async ES|QL query. +Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. + +The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. {ref}/esql-async-query-api.html[Endpoint documentation] [source,ts] ---- -client.esql.asyncQuery() +client.esql.asyncQuery({ query }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`query` (string)*: The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. +** *`columnar` (Optional, boolean)*: By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. +** *`filter` (Optional, { bool, boosting, common, combined_fields, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule, script, script_score, semantic, shape, simple_query_string, span_containing, span_field_masking, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, sparse_vector, term, terms, terms_set, text_expansion, weighted_tokens, wildcard, wrapper, type })*: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. +** *`locale` (Optional, string)* +** *`params` (Optional, number | number | string | boolean | null | User-defined value[])*: To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. +** *`profile` (Optional, boolean)*: If provided and `true` the response will include an extra `profile` object +with information on how the query was executed. This information is for human debugging +and its format can change at any time but it can give some insight into the performance +of each part of the query. +** *`tables` (Optional, Record>)*: Tables to use with the LOOKUP operation. The top level key is the table +name and the next level key is the column name. +** *`delimiter` (Optional, string)*: The character to use between values within a CSV row. +It is valid only for the CSV format. +** *`drop_null_columns` (Optional, boolean)*: Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results. +If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns. +** *`format` (Optional, Enum("csv" | "json" | "tsv" | "txt" | "yaml" | "cbor" | "smile" | "arrow"))*: A short version of the Accept header, for example `json` or `yaml`. +** *`keep_alive` (Optional, string | -1 | 0)*: The period for which the query and its results are stored in the cluster. +The default period is five days. +When this period expires, the query and its results are deleted, even if the query is still ongoing. +If the `keep_on_completion` parameter is false, Elasticsearch only stores async queries that do not complete within the period set by the `wait_for_completion_timeout` parameter, regardless of this value. +** *`keep_on_completion` (Optional, boolean)*: Indicates whether the query and its results are stored in the cluster. +If false, the query and its results are stored in the cluster only if the request does not complete during the period set by the `wait_for_completion_timeout` parameter. +** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: The period to wait for the request to finish. +By default, the request waits for 1 second for the query results. +If the query completes during this period, results are returned +Otherwise, a query ID is returned that can later be used to retrieve the results. + +[discrete] +==== async_query_delete +Delete an async ES|QL query. +If the query is still running, it is cancelled. +Otherwise, the stored results are deleted. + +If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: + +* The authenticated user that submitted the original query request +* Users with the `cancel_task` cluster privilege + +{ref}/esql-async-query-delete-api.html[Endpoint documentation] +[source,ts] +---- +client.esql.asyncQueryDelete({ id }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`id` (string)*: The unique identifier of the query. +A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. +A query ID is also provided when the request was submitted with the `keep_on_completion` parameter set to `true`. [discrete] ==== async_query_get -Retrieves the results of a previously submitted async query request given its ID. +Get async ES|QL query results. +Get the current status and available results or stored results for an ES|QL asynchronous query. +If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. {ref}/esql-async-query-get-api.html[Endpoint documentation] [source,ts] ---- -client.esql.asyncQueryGet() +client.esql.asyncQueryGet({ id }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`id` (string)*: The unique identifier of the query. +A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. +A query ID is also provided when the request was submitted with the `keep_on_completion` parameter set to `true`. +** *`drop_null_columns` (Optional, boolean)*: Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results. +If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns. +** *`keep_alive` (Optional, string | -1 | 0)*: The period for which the query and its results are stored in the cluster. +When this period expires, the query and its results are deleted, even if the query is still ongoing. +** *`wait_for_completion_timeout` (Optional, string | -1 | 0)*: The period to wait for the request to finish. +By default, the request waits for complete query results. +If the request completes during the period specified in this parameter, complete query results are returned. +Otherwise, the response returns an `is_running` value of `true` and no results. [discrete] ==== query @@ -4484,9 +5485,9 @@ Using node roles enables ILM to automatically move the indices between data tier Migrating away from custom node attributes routing can be manually performed. This API provides an automated way of performing three out of the four manual steps listed in the migration guide: -1. Stop setting the custom hot attribute on new indices. -2. Remove custom allocation settings from existing ILM policies. -3. Replace custom allocation settings from existing indices with the corresponding tier preference. +. Stop setting the custom hot attribute on new indices. +. Remove custom allocation settings from existing ILM policies. +. Replace custom allocation settings from existing indices with the corresponding tier preference. ILM must be stopped before performing the migration. Use the stop ILM and get ILM status APIs to wait until the reported operation mode is `STOPPED`. @@ -4699,6 +5700,24 @@ If specified, the `analyzer` parameter overrides this value. If an array of strings is provided, it is analyzed as a multi-value field. ** *`tokenizer` (Optional, string | { type, tokenize_on_chars, max_token_length } | { type, max_token_length } | { type, custom_token_chars, max_gram, min_gram, token_chars } | { type, buffer_size } | { type } | { type } | { type, custom_token_chars, max_gram, min_gram, token_chars } | { type, buffer_size, delimiter, replacement, reverse, skip } | { type, flags, group, pattern } | { type, pattern } | { type, pattern } | { type, max_token_length } | { type } | { type, max_token_length } | { type, max_token_length } | { type, rule_files } | { type, discard_punctuation, mode, nbest_cost, nbest_examples, user_dictionary, user_dictionary_rules, discard_compound_token } | { type, decompound_mode, discard_punctuation, user_dictionary, user_dictionary_rules })*: Tokenizer to use to convert text into tokens. +[discrete] +==== cancel_migrate_reindex +Cancel a migration reindex operation. + +Cancel a migration reindex attempt for a data stream or index. + +{ref}/migrate-data-stream.html[Endpoint documentation] +[source,ts] +---- +client.indices.cancelMigrateReindex({ index }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`index` (string | string[])*: The index or data stream name + [discrete] ==== clear_cache Clear the cache. @@ -4922,6 +5941,26 @@ Cannot be longer than 255 bytes. Multi-byte characters count towards this limit ** *`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. ** *`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. +[discrete] +==== create_from +Create an index from a source index. + +Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values. + +{ref}/migrate-data-stream.html[Endpoint documentation] +[source,ts] +---- +client.indices.createFrom({ source, dest }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`source` (string)*: The source index or data stream name +** *`dest` (string)*: The destination index or data stream name +** *`create_from` (Optional, { mappings_override, settings_override, remove_index_blocks })* + [discrete] ==== data_streams_stats Get data stream stats. @@ -5442,6 +6481,8 @@ such as open,hidden. ==== get_alias Get aliases. Retrieves information for one or more data stream or index aliases. + +{ref}/indices-get-alias.html[Endpoint documentation] [source,ts] ---- client.indices.getAlias({ ... }) @@ -5609,6 +6650,24 @@ Valid values are: `all`, `open`, `closed`, `hidden`, `none`. ** *`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. +[discrete] +==== get_migrate_reindex_status +Get the migration reindexing status. + +Get the status of a migration reindex attempt for a data stream or index. + +{ref}/migrate-data-stream.html[Endpoint documentation] +[source,ts] +---- +client.indices.getMigrateReindexStatus({ index }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`index` (string | string[])*: The index or data stream name. + [discrete] ==== get_settings Get index settings. @@ -5671,6 +6730,26 @@ To return all index templates, omit this parameter or use a value of `_all` or ` ** *`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. +[discrete] +==== migrate_reindex +Reindex legacy backing indices. + +Reindex all legacy backing indices for a data stream. +This operation occurs in a persistent task. +The persistent task ID is returned immediately and the reindexing work is completed in that task. + +{ref}/migrate-data-stream.html[Endpoint documentation] +[source,ts] +---- +client.indices.migrateReindex({ ... }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`reindex` (Optional, { mode, source })* + [discrete] ==== migrate_to_data_stream Convert an index alias to a data stream. @@ -5994,7 +7073,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 @@ -6662,36 +7741,6 @@ such as `open,hidden`. ** *`include_unloaded_segments` (Optional, boolean)*: If true, the response includes information from segments that are not loaded into memory. ** *`level` (Optional, Enum("cluster" | "indices" | "shards"))*: Indicates whether statistics are aggregated at the cluster, index, or shard level. -[discrete] -==== unfreeze -Unfreeze an index. -When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again. - -{ref}/unfreeze-index-api.html[Endpoint documentation] -[source,ts] ----- -client.indices.unfreeze({ index }) ----- - -[discrete] -==== Arguments - -* *Request (object):* -** *`index` (string)*: Identifier for the index. -** *`allow_no_indices` (Optional, boolean)*: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. -This behavior applies even if the request targets other open indices. -** *`expand_wildcards` (Optional, Enum("all" | "open" | "closed" | "hidden" | "none") | Enum("all" | "open" | "closed" | "hidden" | "none")[])*: Type of index that wildcard patterns can match. -If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. -Supports a list of values, such as `open,hidden`. -Valid values are: `all`, `open`, `closed`, `hidden`, `none`. -** *`ignore_unavailable` (Optional, boolean)*: If `false`, the request returns an error if it targets a missing or closed index. -** *`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. -** *`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. -** *`wait_for_active_shards` (Optional, string)*: The number of shard copies that must be active before proceeding with the operation. -Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). - [discrete] ==== update_aliases Create or update an alias. @@ -6841,12 +7890,80 @@ client.inference.put({ inference_id }) [discrete] ==== stream_inference -Perform streaming inference +Perform streaming inference. +Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. +This API works only with the completion task type. + +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, Azure, 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. + +This API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege). You must use a client that supports streaming. + +{ref}/stream-inference-api.html[Endpoint documentation] +[source,ts] +---- +client.inference.streamInference({ inference_id, input }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`inference_id` (string)*: The unique identifier for the inference endpoint. +** *`input` (string | string[])*: The text on which you want to perform the inference task. +It can be a single string or an array. + +NOTE: Inference endpoints for the completion task type currently only support a single string as input. +** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion"))*: The type of task that the model performs. + +[discrete] +==== unified_inference +Perform inference on the service using the Unified Schema + +{ref}/unified-inference-api.html[Endpoint documentation] +[source,ts] +---- +client.inference.unifiedInference({ inference_id, messages }) +---- + +[discrete] +==== Arguments + +* *Request (object):* +** *`inference_id` (string)*: The inference Id +** *`messages` ({ content, role, tool_call_id, tool_calls }[])*: A list of objects representing the conversation. +** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion"))*: The task type +** *`model` (Optional, string)*: The ID of the model to use. +** *`max_completion_tokens` (Optional, number)*: The upper bound limit for the number of tokens that can be generated for a completion request. +** *`stop` (Optional, string[])*: A sequence of strings to control when the model should stop generating additional tokens. +** *`temperature` (Optional, float)*: The sampling temperature to use. +** *`tool_choice` (Optional, string | { type, function })*: Controls which tool is called by the model. +** *`tools` (Optional, { type, function }[])*: A list of tools that the model can call. +** *`top_p` (Optional, float)*: Nucleus sampling, an alternative to sampling with temperature. +** *`timeout` (Optional, string | -1 | 0)*: Specifies the amount of time to wait for the inference request to complete. + +[discrete] +==== update +Update an inference endpoint. + +Modify `task_settings`, secrets (within `service_settings`), or `num_allocations` for an inference endpoint, depending on the specific endpoint service and `task_type`. + +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, Azure, 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. + +{ref}/update-inference-api.html[Endpoint documentation] [source,ts] ---- -client.inference.streamInference() +client.inference.update({ inference_id }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`inference_id` (string)*: The unique identifier of the inference endpoint. +** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion"))*: The type of inference task that the model performs. +** *`inference_config` (Optional, { service, service_settings, task_settings })* [discrete] === ingest @@ -7929,10 +9046,10 @@ option, the API returns information for the first hundred data frame analytics jobs. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no data frame analytics +. Contains wildcard expressions and there are no data frame analytics jobs that match. -2. Contains the `_all` string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains the `_all` string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. @@ -7963,10 +9080,10 @@ option, the API returns information for the first hundred data frame analytics jobs. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no data frame analytics +. Contains wildcard expressions and there are no data frame analytics jobs that match. -2. Contains the `_all` string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains the `_all` string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. @@ -8001,9 +9118,9 @@ wildcard expression. If you do not specify one of these options, the API returns information about all datafeeds. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no datafeeds that match. -2. Contains the `_all` string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no datafeeds that match. +. Contains the `_all` string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value is `true`, which returns an empty `datafeeds` array when there are no matches and the subset of results when there are @@ -8034,9 +9151,9 @@ wildcard expression. If you do not specify one of these options, the API returns information about all datafeeds. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no datafeeds that match. -2. Contains the `_all` string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no datafeeds that match. +. Contains the `_all` string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value is `true`, which returns an empty `datafeeds` array when there are no matches and the subset of results when there are @@ -8120,9 +9237,9 @@ you do not specify one of these options, the API returns information for all anomaly detection jobs. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no jobs that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no jobs that match. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. If `true`, the API returns an empty `jobs` array when there are no matches and the subset of results when there are partial @@ -8152,9 +9269,9 @@ group name, or a wildcard expression. If you do not specify one of these options, the API returns information for all anomaly detection jobs. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no jobs that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no jobs that match. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value is `true`, which returns an empty `jobs` array when there are no matches and the subset of results when there are partial @@ -9129,10 +10246,10 @@ lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no data frame analytics +. Contains wildcard expressions and there are no data frame analytics jobs that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. The default value is true, which returns an empty data_frame_analytics array when there are no matches and the subset of results when there are @@ -9848,8 +10965,8 @@ This API is useful because a rollup job is often configured to rollup only a sub Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. This API enables you to inspect an index and determine: -1. Does this index have associated rollup data somewhere in the cluster? -2. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? +. Does this index have associated rollup data somewhere in the cluster? +. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? {ref}/rollup-get-rollup-caps.html[Endpoint documentation] [source,ts] @@ -10326,6 +11443,17 @@ Activate a user profile. Create or update a user profile on behalf of another user. +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +The calling application must have either an `access_token` or a combination of `username` and `password` for the user that the profile document is intended for. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + +This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including `username`, `full_name,` `roles`, and the authentication realm. +For example, in the JWT `access_token` case, the profile user's `username` is extracted from the JWT token claim pointed to by the `claims.principal` setting of the JWT realm that authenticated the token. + +When updating a profile document, the API enables the document if it was disabled. +Any updates do not change existing content for either the `labels` or `data` fields. + {ref}/security-api-activate-user-profile.html[Endpoint documentation] [source,ts] ---- @@ -10336,10 +11464,17 @@ client.security.activateUserProfile({ grant_type }) ==== Arguments * *Request (object):* -** *`grant_type` (Enum("password" | "access_token"))* -** *`access_token` (Optional, string)* -** *`password` (Optional, string)* -** *`username` (Optional, string)* +** *`grant_type` (Enum("password" | "access_token"))*: The type of grant. +** *`access_token` (Optional, string)*: The user's Elasticsearch access token or JWT. +Both `access` and `id` JWT token types are supported and they depend on the underlying JWT realm configuration. +If you specify the `access_token` grant type, this parameter is required. +It is not valid with other grant types. +** *`password` (Optional, string)*: The user's password. +If you specify the `password` grant type, this parameter is required. +It is not valid with other grant types. +** *`username` (Optional, string)*: The username that identifies the user. +If you specify the `password` grant type, this parameter is required. +It is not valid with other grant types. [discrete] ==== authenticate @@ -10504,13 +11639,20 @@ client.security.clearCachedPrivileges({ application }) ==== Arguments * *Request (object):* -** *`application` (string)*: A list of application names +** *`application` (string)*: A list of applications. +To clear all applications, use an asterism (`*`). +It does not support other wildcard patterns. [discrete] ==== clear_cached_realms Clear the user cache. -Evict users from the user cache. You can completely clear the cache or evict specific users. +Evict users from the user cache. +You can completely clear the cache or evict specific users. + +User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. +There are realm settings that you can use to configure the user cache. +For more information, refer to the documentation about controlling the user cache. {ref}/security-api-clear-cache.html[Endpoint documentation] [source,ts] @@ -10522,8 +11664,11 @@ client.security.clearCachedRealms({ realms }) ==== Arguments * *Request (object):* -** *`realms` (string | string[])*: List of realms to clear -** *`usernames` (Optional, string[])*: List of usernames to clear from the cache +** *`realms` (string | string[])*: A list of realms. +To clear all realms, use an asterisk (`*`). +It does not support other wildcard patterns. +** *`usernames` (Optional, string[])*: A list of the users to clear from the cache. +If you do not specify this parameter, the API evicts all users from the user cache. [discrete] ==== clear_cached_roles @@ -10541,13 +11686,20 @@ client.security.clearCachedRoles({ name }) ==== Arguments * *Request (object):* -** *`name` (string | string[])*: Role name +** *`name` (string | string[])*: A list of roles to evict from the role cache. +To evict all roles, use an asterisk (`*`). +It does not support other wildcard patterns. [discrete] ==== clear_cached_service_tokens Clear service account token caches. Evict a subset of all entries from the service account token caches. +Two separate caches exist for service account tokens: one cache for tokens backed by the `service_tokens` file, and another for tokens backed by the `.security` index. +This API clears matching entries from both caches. + +The cache for service account tokens backed by the `.security` index is cleared automatically on state changes of the security index. +The cache for tokens backed by the `service_tokens` file is cleared automatically on file changes. {ref}/security-api-clear-service-token-caches.html[Endpoint documentation] [source,ts] @@ -10559,19 +11711,29 @@ client.security.clearCachedServiceTokens({ namespace, service, name }) ==== Arguments * *Request (object):* -** *`namespace` (string)*: An identifier for the namespace -** *`service` (string)*: An identifier for the service name -** *`name` (string | string[])*: A list of service token names +** *`namespace` (string)*: The namespace, which is a top-level grouping of service accounts. +** *`service` (string)*: The name of the service, which must be unique within its namespace. +** *`name` (string | string[])*: A list of token names to evict from the service account token caches. +Use a wildcard (`*`) to evict all tokens that belong to a service account. +It does not support other wildcard patterns. [discrete] ==== create_api_key Create an API key. Create an API key for access without requiring basic authentication. + +IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. +If you specify privileges, the API returns an error. + A successful request returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. + NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. +The API keys are created by the Elasticsearch API key service, which is automatically enabled. +To configure or turn off the API key service, refer to API key service setting documentation. + {ref}/security-api-create-api-key.html[Endpoint documentation] [source,ts] ---- @@ -10582,9 +11744,18 @@ client.security.createApiKey({ ... }) ==== Arguments * *Request (object):* -** *`expiration` (Optional, string | -1 | 0)*: Expiration time for the API key. By default, API keys never expire. -** *`name` (Optional, string)*: Specifies the name for this API key. -** *`role_descriptors` (Optional, Record)*: An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. +** *`expiration` (Optional, string | -1 | 0)*: The expiration time for the API key. +By default, API keys never expire. +** *`name` (Optional, string)*: A name for the API key. +** *`role_descriptors` (Optional, Record)*: An array of role descriptors for this API key. +When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. +If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. +The structure of role descriptor is the same as the request for the create role API. +For more details, refer to the create or update roles API. + +NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. +In this case, you must explicitly specify a role descriptor with no privileges. +The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. ** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -10637,6 +11808,9 @@ Create a service account token. Create a service accounts token for access without requiring basic authentication. +NOTE: Service account tokens never expire. +You must actively delete them if they are no longer needed. + {ref}/security-api-create-service-token.html[Endpoint documentation] [source,ts] ---- @@ -10647,14 +11821,22 @@ client.security.createServiceToken({ namespace, service }) ==== Arguments * *Request (object):* -** *`namespace` (string)*: An identifier for the namespace -** *`service` (string)*: An identifier for the service name -** *`name` (Optional, string)*: An identifier for the token name +** *`namespace` (string)*: The name of the namespace, which is a top-level grouping of service accounts. +** *`service` (string)*: The name of the service. +** *`name` (Optional, string)*: The name for the service account token. +If omitted, a random name will be generated. + +Token names must be at least one and no more than 256 characters. +They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes (`-`), and underscores (`_`), but cannot begin with an underscore. + +NOTE: Token names must be unique in the context of the associated service account. +They must also be globally unique with their fully qualified names, which are comprised of the service account principal and token name, such as `//`. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== delegate_pki Delegate PKI authentication. + This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has `delegation.enabled` set to `true`. A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw `username_pattern` of the respective realm. @@ -10685,6 +11867,11 @@ This may be followed by additional certificates; each subsequent certificate is ==== delete_privileges Delete application privileges. +To use this API, you must have one of the following privileges: + +* The `manage_security` cluster privilege (or a greater privilege such as `all`). +* The "Manage Application Privileges" global privilege for the application being referenced in the request. + {ref}/security-api-delete-privilege.html[Endpoint documentation] [source,ts] ---- @@ -10695,8 +11882,9 @@ client.security.deletePrivileges({ application, name }) ==== Arguments * *Request (object):* -** *`application` (string)*: Application name -** *`name` (string | string[])*: Privilege name +** *`application` (string)*: The name of the application. +Application privileges are always associated with exactly one application. +** *`name` (string | string[])*: The name of the privilege. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] @@ -10704,6 +11892,8 @@ client.security.deletePrivileges({ application, name }) Delete roles. Delete roles in the native realm. +The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +The delete roles API cannot remove roles that are defined in roles files. {ref}/security-api-delete-role.html[Endpoint documentation] [source,ts] @@ -10715,13 +11905,17 @@ client.security.deleteRole({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: Role name +** *`name` (string)*: The name of the role. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] ==== delete_role_mapping Delete role mappings. +Role mappings define which roles are assigned to each user. +The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. +The delete role mappings API cannot remove role mappings that are defined in role mapping files. + {ref}/security-api-delete-role-mapping.html[Endpoint documentation] [source,ts] ---- @@ -10732,7 +11926,8 @@ client.security.deleteRoleMapping({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: Role-mapping name +** *`name` (string)*: The distinct name that identifies the role mapping. +The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] @@ -10751,9 +11946,9 @@ client.security.deleteServiceToken({ namespace, service, name }) ==== Arguments * *Request (object):* -** *`namespace` (string)*: An identifier for the namespace -** *`service` (string)*: An identifier for the service name -** *`name` (string)*: An identifier for the token name +** *`namespace` (string)*: The namespace, which is a top-level grouping of service accounts. +** *`service` (string)*: The service name. +** *`name` (string)*: The name of the service account token. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] @@ -10772,7 +11967,7 @@ client.security.deleteUser({ username }) ==== Arguments * *Request (object):* -** *`username` (string)*: username +** *`username` (string)*: An identifier for the user. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] @@ -10780,6 +11975,8 @@ client.security.deleteUser({ username }) Disable users. Disable users in the native realm. +By default, when you create users, they are enabled. +You can use this API to revoke a user's access to Elasticsearch. {ref}/security-api-disable-user.html[Endpoint documentation] [source,ts] @@ -10791,7 +11988,7 @@ client.security.disableUser({ username }) ==== Arguments * *Request (object):* -** *`username` (string)*: The username of the user to disable +** *`username` (string)*: An identifier for the user. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] @@ -10800,6 +11997,13 @@ Disable a user profile. Disable user profiles so that they are not visible in user profile searches. +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + +When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. +To re-enable a disabled user profile, use the enable user profile API . + {ref}/security-api-disable-user-profile.html[Endpoint documentation] [source,ts] ---- @@ -10811,15 +12015,16 @@ client.security.disableUserProfile({ uid }) * *Request (object):* ** *`uid` (string)*: Unique identifier for the user profile. -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation -visible to search, if 'wait_for' then wait for a refresh to make this operation -visible to search, if 'false' do nothing with refreshes. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. +If 'wait_for', it waits for a refresh to make this operation visible to search. +If 'false', it does nothing with refreshes. [discrete] ==== enable_user Enable users. Enable users in the native realm. +By default, when you create users, they are enabled. {ref}/security-api-enable-user.html[Endpoint documentation] [source,ts] @@ -10831,7 +12036,7 @@ client.security.enableUser({ username }) ==== Arguments * *Request (object):* -** *`username` (string)*: The username of the user to enable +** *`username` (string)*: An identifier for the user. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. [discrete] @@ -10840,6 +12045,13 @@ Enable a user profile. Enable user profiles to make them visible in user profile searches. +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + +When you activate a user profile, it's automatically enabled and visible in user profile searches. +If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. + {ref}/security-api-enable-user-profile.html[Endpoint documentation] [source,ts] ---- @@ -10850,10 +12062,11 @@ client.security.enableUserProfile({ uid }) ==== Arguments * *Request (object):* -** *`uid` (string)*: Unique identifier for the user profile. +** *`uid` (string)*: A unique identifier for the user profile. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation -visible to search, if 'wait_for' then wait for a refresh to make this operation -visible to search, if 'false' do nothing with refreshes. +visible to search. +If 'wait_for', it waits for a refresh to make this operation visible to search. +If 'false', nothing is done with refreshes. [discrete] ==== enroll_kibana @@ -10861,6 +12074,9 @@ Enroll Kibana. Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. +NOTE: This API is currently intended for internal use only by Kibana. +Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. + {ref}/security-api-kibana-enrollment.html[Endpoint documentation] [source,ts] ---- @@ -10874,6 +12090,9 @@ Enroll a node. Enroll a new node to allow it to join an existing cluster with security features enabled. +The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. +The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. + {ref}/security-api-node-enrollment.html[Endpoint documentation] [source,ts] ---- @@ -10934,6 +12153,11 @@ client.security.getBuiltinPrivileges() ==== get_privileges Get application privileges. +To use this API, you must have one of the following privileges: + +* The `read_security` cluster privilege (or a greater privilege such as `manage_security` or `all`). +* The "Manage Application Privileges" global privilege for the application being referenced in the request. + {ref}/security-api-get-privileges.html[Endpoint documentation] [source,ts] ---- @@ -10944,14 +12168,19 @@ client.security.getPrivileges({ ... }) ==== Arguments * *Request (object):* -** *`application` (Optional, string)*: Application name -** *`name` (Optional, string | string[])*: Privilege name +** *`application` (Optional, string)*: The name of the application. +Application privileges are always associated with exactly one application. +If you do not specify this parameter, the API returns information about all privileges for all applications. +** *`name` (Optional, string | string[])*: The name of the privilege. +If you do not specify this parameter, the API returns information about all privileges for the requested application. [discrete] ==== get_role Get roles. Get roles in the native realm. +The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +The get roles API cannot retrieve roles that are defined in roles files. {ref}/security-api-get-role.html[Endpoint documentation] [source,ts] @@ -10963,7 +12192,9 @@ client.security.getRole({ ... }) ==== Arguments * *Request (object):* -** *`name` (Optional, string | string[])*: The name of the role. You can specify multiple roles as a list. If you do not specify this parameter, the API returns information about all roles. +** *`name` (Optional, string | string[])*: The name of the role. +You can specify multiple roles as a list. +If you do not specify this parameter, the API returns information about all roles. [discrete] ==== get_role_mapping @@ -10991,6 +12222,8 @@ Get service accounts. Get a list of service accounts that match the provided path parameters. +NOTE: Currently, only the `elastic/fleet-server` service account is available. + {ref}/security-api-get-service-accounts.html[Endpoint documentation] [source,ts] ---- @@ -11001,13 +12234,23 @@ client.security.getServiceAccounts({ ... }) ==== Arguments * *Request (object):* -** *`namespace` (Optional, string)*: Name of the namespace. Omit this parameter to retrieve information about all service accounts. If you omit this parameter, you must also omit the `service` parameter. -** *`service` (Optional, string)*: Name of the service name. Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. +** *`namespace` (Optional, string)*: The name of the namespace. +Omit this parameter to retrieve information about all service accounts. +If you omit this parameter, you must also omit the `service` parameter. +** *`service` (Optional, string)*: The service name. +Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. [discrete] ==== get_service_credentials Get service account credentials. +To use this API, you must have at least the `read_security` cluster privilege (or a greater privilege such as `manage_service_account` or `manage_security`). + +The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. + +NOTE: For tokens backed by the `service_tokens` file, the API collects them from all nodes of the cluster. +Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. + {ref}/security-api-get-service-credentials.html[Endpoint documentation] [source,ts] ---- @@ -11018,13 +12261,19 @@ client.security.getServiceCredentials({ namespace, service }) ==== Arguments * *Request (object):* -** *`namespace` (string)*: Name of the namespace. -** *`service` (string)*: Name of the service name. +** *`namespace` (string)*: The name of the namespace. +** *`service` (string)*: The service name. [discrete] ==== get_settings Get security index settings. + Get the user-configurable settings for the security internal index (`.security` and associated indices). +Only a subset of the index settings — those that are user-configurable—will be shown. +This includes: + +* `index.auto_expand_replicas` +* `index.number_of_replicas` {ref}/security-api-get-settings.html[Endpoint documentation] [source,ts] @@ -11044,6 +12293,17 @@ If no response is received before the timeout expires, the request fails and ret Get a token. Create a bearer token for access without requiring basic authentication. +The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. +Alternatively, you can explicitly enable the `xpack.security.authc.token.enabled` setting. +When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. + +The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. + +A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. + +The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. +That time period is defined by the `xpack.security.authc.token.timeout` setting. +If you want to invalidate a token immediately, you can do so by using the invalidate token API. {ref}/security-api-get-token.html[Endpoint documentation] [source,ts] @@ -11055,12 +12315,22 @@ client.security.getToken({ ... }) ==== Arguments * *Request (object):* -** *`grant_type` (Optional, Enum("password" | "client_credentials" | "_kerberos" | "refresh_token"))* -** *`scope` (Optional, string)* -** *`password` (Optional, string)* -** *`kerberos_ticket` (Optional, string)* -** *`refresh_token` (Optional, string)* -** *`username` (Optional, string)* +** *`grant_type` (Optional, Enum("password" | "client_credentials" | "_kerberos" | "refresh_token"))*: The type of grant. +Supported grant types are: `password`, `_kerberos`, `client_credentials`, and `refresh_token`. +** *`scope` (Optional, string)*: The scope of the token. +Currently tokens are only issued for a scope of FULL regardless of the value sent with the request. +** *`password` (Optional, string)*: The user's password. +If you specify the `password` grant type, this parameter is required. +This parameter is not valid with any other supported grant type. +** *`kerberos_ticket` (Optional, string)*: The base64 encoded kerberos ticket. +If you specify the `_kerberos` grant type, this parameter is required. +This parameter is not valid with any other supported grant type. +** *`refresh_token` (Optional, string)*: The string that was returned when you created the token, which enables you to extend its life. +If you specify the `refresh_token` grant type, this parameter is required. +This parameter is not valid with any other supported grant type. +** *`username` (Optional, string)*: The username that identifies the user. +If you specify the `password` grant type, this parameter is required. +This parameter is not valid with any other supported grant type. [discrete] ==== get_user @@ -11079,12 +12349,17 @@ client.security.getUser({ ... }) * *Request (object):* ** *`username` (Optional, string | string[])*: An identifier for the user. You can specify multiple usernames as a list. If you omit this parameter, the API retrieves information about all users. -** *`with_profile_uid` (Optional, boolean)*: If true will return the User Profile ID for a user, if any. +** *`with_profile_uid` (Optional, boolean)*: Determines whether to retrieve the user profile UID, if it exists, for the users. [discrete] ==== get_user_privileges Get user privileges. +Get the security privileges for the logged in user. +All users can use this API, but only to determine their own privileges. +To check the privileges of other users, you must use the run as feature. +To check whether a user has a specific list of privileges, use the has privileges API. + {ref}/security-api-get-user-privileges.html[Endpoint documentation] [source,ts] ---- @@ -11105,6 +12380,10 @@ Get a user profile. Get a user's profile using the unique profile ID. +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + {ref}/security-api-get-user-profile.html[Endpoint documentation] [source,ts] ---- @@ -11116,9 +12395,9 @@ client.security.getUserProfile({ uid }) * *Request (object):* ** *`uid` (string | string[])*: A unique identifier for the user profile. -** *`data` (Optional, string | string[])*: List of filters for the `data` field of the profile document. -To return all content use `data=*`. To return a subset of content -use `data=` to retrieve content nested under the specified ``. +** *`data` (Optional, string | string[])*: A list of filters for the `data` field of the profile document. +To return all content use `data=*`. +To return a subset of content use `data=` to retrieve content nested under the specified ``. By default returns no `data` content. [discrete] @@ -11127,12 +12406,19 @@ Grant an API key. Create an API key on behalf of another user. This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. -The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. -It is not possible to use this API to create an API key without that user’s credentials. +The caller must have authentication credentials for the user on whose behalf the API key will be created. +It is not possible to use this API to create an API key without that user's credentials. +The supported user authentication credential types are: + +* username and password +* Elasticsearch access tokens +* JWTs + The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. In this case, the API key will be created on behalf of the impersonated user. This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. +The API keys are created by the Elasticsearch API key service, which is automatically enabled. A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. @@ -11149,15 +12435,16 @@ client.security.grantApiKey({ api_key, grant_type }) ==== Arguments * *Request (object):* -** *`api_key` ({ name, expiration, role_descriptors, metadata })*: Defines the API key. +** *`api_key` ({ name, expiration, role_descriptors, metadata })*: The API key. ** *`grant_type` (Enum("access_token" | "password"))*: The type of grant. Supported grant types are: `access_token`, `password`. -** *`access_token` (Optional, string)*: The user’s access token. +** *`access_token` (Optional, string)*: The user's access token. If you specify the `access_token` grant type, this parameter is required. It is not valid with other grant types. ** *`username` (Optional, string)*: The user name that identifies the user. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. -** *`password` (Optional, string)*: The user’s password. If you specify the `password` grant type, this parameter is required. +** *`password` (Optional, string)*: The user's password. +If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. ** *`run_as` (Optional, string)*: The name of the user to be impersonated. @@ -11166,6 +12453,8 @@ It is not valid with other grant types. Check user privileges. Determine whether the specified user has a specified list of privileges. +All users can use this API, but only to determine their own privileges. +To check the privileges of other users, you must use the run as feature. {ref}/security-api-has-privileges.html[Endpoint documentation] [source,ts] @@ -11188,6 +12477,9 @@ Check user profile privileges. Determine whether the users associated with the specified user profile IDs have all the requested privileges. +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + {ref}/security-api-has-privileges-user-profile.html[Endpoint documentation] [source,ts] ---- @@ -11199,7 +12491,7 @@ client.security.hasPrivilegesUserProfile({ uids, privileges }) * *Request (object):* ** *`uids` (string[])*: A list of profile IDs. The privileges are checked for associated users of the profiles. -** *`privileges` ({ application, cluster, index })* +** *`privileges` ({ application, cluster, index })*: An object containing all the privileges to be checked. [discrete] ==== invalidate_api_key @@ -11207,11 +12499,15 @@ Invalidate API keys. This API invalidates API keys created by the create API key or grant API key APIs. Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. -The `manage_api_key` privilege allows deleting any API keys. -The `manage_own_api_key` only allows deleting API keys that are owned by the user. + +To use this API, you must have at least the `manage_security`, `manage_api_key`, or `manage_own_api_key` cluster privileges. +The `manage_security` privilege allows deleting any API key, including both REST and cross cluster API keys. +The `manage_api_key` privilege allows deleting any REST API key, but not cross cluster API keys. +The `manage_own_api_key` only allows deleting REST API keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, an invalidation request must be issued in one of the three formats: + - Set the parameter `owner=true`. -- Or, set both `username` and `realm_name` to match the user’s identity. +- Or, set both `username` and `realm_name` to match the user's identity. - Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the `ids` field. {ref}/security-api-invalidate-api-key.html[Endpoint documentation] @@ -11229,12 +12525,14 @@ client.security.invalidateApiKey({ ... }) This parameter cannot be used with any of `name`, `realm_name`, or `username`. ** *`name` (Optional, string)*: An API key name. This parameter cannot be used with any of `ids`, `realm_name` or `username`. -** *`owner` (Optional, boolean)*: Can be used to query API keys owned by the currently authenticated user. +** *`owner` (Optional, boolean)*: Query API keys owned by the currently authenticated user. The `realm_name` or `username` parameters cannot be specified when this parameter is set to `true` as they are assumed to be the currently authenticated ones. + +NOTE: At least one of `ids`, `name`, `username`, and `realm_name` must be specified if `owner` is `false`. ** *`realm_name` (Optional, string)*: The name of an authentication realm. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. ** *`username` (Optional, string)*: The username of a user. -This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. +This parameter cannot be used with either `ids` or `name` or when `owner` flag is set to `true`. [discrete] ==== invalidate_token @@ -11244,9 +12542,14 @@ The access tokens returned by the get token API have a finite period of time for After that time period, they can no longer be used. The time period is defined by the `xpack.security.authc.token.timeout` setting. -The refresh tokens returned by the get token API are only valid for 24 hours. They can also be used exactly once. +The refresh tokens returned by the get token API are only valid for 24 hours. +They can also be used exactly once. If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. +NOTE: While all parameters are optional, at least one of them is required. +More specifically, either one of `token` or `refresh_token` parameters is required. +If none of these two are specified, then `realm_name` and/or `username` need to be specified. + {ref}/security-api-invalidate-token.html[Endpoint documentation] [source,ts] ---- @@ -11257,14 +12560,19 @@ client.security.invalidateToken({ ... }) ==== Arguments * *Request (object):* -** *`token` (Optional, string)* -** *`refresh_token` (Optional, string)* -** *`realm_name` (Optional, string)* -** *`username` (Optional, string)* +** *`token` (Optional, string)*: An access token. +This parameter cannot be used if any of `refresh_token`, `realm_name`, or `username` are used. +** *`refresh_token` (Optional, string)*: A refresh token. +This parameter cannot be used if any of `refresh_token`, `realm_name`, or `username` are used. +** *`realm_name` (Optional, string)*: The name of an authentication realm. +This parameter cannot be used with either `refresh_token` or `token`. +** *`username` (Optional, string)*: The username of a user. +This parameter cannot be used with either `refresh_token` or `token`. [discrete] ==== oidc_authenticate Authenticate OpenID Connect. + Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. @@ -11292,6 +12600,7 @@ This property is useful in cases where multiple realms are defined. [discrete] ==== oidc_logout Logout of OpenID Connect. + Invalidate an access token and a refresh token that were generated as a response to the `/_security/oidc/authenticate` API. If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. @@ -11315,6 +12624,7 @@ client.security.oidcLogout({ access_token }) [discrete] ==== oidc_prepare_authentication Prepare OpenID connect authentication. + Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. @@ -11349,6 +12659,24 @@ If the caller of the API does not provide a value, Elasticsearch will generate o ==== put_privileges Create or update application privileges. +To use this API, you must have one of the following privileges: + +* The `manage_security` cluster privilege (or a greater privilege such as `all`). +* The "Manage Application Privileges" global privilege for the application being referenced in the request. + +Application names are formed from a prefix, with an optional suffix that conform to the following rules: + +* The prefix must begin with a lowercase ASCII letter. +* The prefix must contain only ASCII letters or digits. +* The prefix must be at least 3 characters long. +* If the suffix exists, it must begin with either a dash `-` or `_`. +* The suffix cannot contain any of the following characters: `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, `*`. +* No part of the name can contain whitespace. + +Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters `_`, `-`, and `.`. + +Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: `/`, `*`, `:`. + {ref}/security-api-put-privileges.html[Endpoint documentation] [source,ts] ---- @@ -11386,6 +12714,9 @@ client.security.putRole({ name }) ** *`global` (Optional, Record)*: An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. ** *`indices` (Optional, { field_security, names, privileges, query, allow_restricted_indices }[])*: A list of indices permissions entries. ** *`remote_indices` (Optional, { clusters, field_security, names, privileges, query, allow_restricted_indices }[])*: A list of remote indices permissions entries. + +NOTE: Remote indices are effective for remote clusters configured with the API key based model. +They have no effect for remote clusters configured with the certificate based model. ** *`remote_cluster` (Optional, { clusters, privileges }[])*: A list of remote cluster permissions entries. ** *`metadata` (Optional, Record)*: Optional metadata. Within the metadata object, keys that begin with an underscore (`_`) are reserved for system use. ** *`run_as` (Optional, string[])*: A list of users that the owners of this role can impersonate. *Note*: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will be rejected. @@ -11401,9 +12732,27 @@ Role mappings define which roles are assigned to each user. Each mapping has rules that identify users and a list of roles that are granted to those users. The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. -This API does not create roles. Rather, it maps users to existing roles. +NOTE: This API does not create roles. Rather, it maps users to existing roles. Roles can be created by using the create or update roles API or roles files. +**Role templates** + +The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. +For example, all users in the `cn=admin,dc=example,dc=com` LDAP group should be given the superuser role in Elasticsearch. +The `roles` field is used for this purpose. + +For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. +The `role_templates` field is used for this purpose. + +NOTE: To use role templates successfully, the relevant scripting feature must be enabled. +Otherwise, all attempts to create a role mapping with role templates fail. + +All of the user fields that are available in the role mapping rules are also available in the role templates. +Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. + +By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. +If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. + {ref}/security-api-put-role-mapping.html[Endpoint documentation] [source,ts] ---- @@ -11414,12 +12763,17 @@ client.security.putRoleMapping({ name }) ==== Arguments * *Request (object):* -** *`name` (string)*: Role-mapping name -** *`enabled` (Optional, boolean)* -** *`metadata` (Optional, Record)* -** *`roles` (Optional, string[])* -** *`role_templates` (Optional, { format, template }[])* -** *`rules` (Optional, { any, all, field, except })* +** *`name` (string)*: The distinct name that identifies the role mapping. +The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. +** *`enabled` (Optional, boolean)*: Mappings that have `enabled` set to `false` are ignored when role mapping is performed. +** *`metadata` (Optional, Record)*: Additional metadata that helps define which roles are assigned to each user. +Within the metadata object, keys beginning with `_` are reserved for system usage. +** *`roles` (Optional, string[])*: A list of role names that are granted to the users that match the role mapping rules. +Exactly one of `roles` or `role_templates` must be specified. +** *`role_templates` (Optional, { format, template }[])*: A list of Mustache templates that will be evaluated to determine the roles names that should granted to the users that match the role mapping rules. +Exactly one of `roles` or `role_templates` must be specified. +** *`rules` (Optional, { any, all, field, except })*: The rules that determine which users should be matched by the mapping. +A rule is a logical condition that is expressed by using a JSON DSL. ** *`run_as` (Optional, string[])* ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -11427,8 +12781,9 @@ client.security.putRoleMapping({ name }) ==== put_user Create or update users. +Add and update users in the native realm. A password is required for adding a new user but is optional when updating an existing user. -To change a user’s password without updating any other fields, use the change password API. +To change a user's password without updating any other fields, use the change password API. {ref}/security-api-put-user.html[Endpoint documentation] [source,ts] @@ -11440,21 +12795,40 @@ client.security.putUser({ username }) ==== Arguments * *Request (object):* -** *`username` (string)*: The username of the User -** *`email` (Optional, string | null)* -** *`full_name` (Optional, string | null)* -** *`metadata` (Optional, Record)* -** *`password` (Optional, string)* -** *`password_hash` (Optional, string)* -** *`roles` (Optional, string[])* -** *`enabled` (Optional, boolean)* -** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. +** *`username` (string)*: An identifier for the user. + +NOTE: Usernames must be at least 1 and no more than 507 characters. +They can contain alphanumeric characters (a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic Latin (ASCII) block. +Leading or trailing whitespace is not allowed. +** *`email` (Optional, string | null)*: The email of the user. +** *`full_name` (Optional, string | null)*: The full name of the user. +** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the user. +** *`password` (Optional, string)*: The user's password. +Passwords must be at least 6 characters long. +When adding a user, one of `password` or `password_hash` is required. +When updating an existing user, the password is optional, so that other fields on the user (such as their roles) may be updated without modifying the user's password +** *`password_hash` (Optional, string)*: A hash of the user's password. +This must be produced using the same hashing algorithm as has been configured for password storage. +For more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm` setting in the user cache and password hash algorithm documentation. +Using this parameter allows the client to pre-hash the password for performance and/or confidentiality reasons. +The `password` parameter and the `password_hash` parameter cannot be used in the same request. +** *`roles` (Optional, string[])*: A set of roles the user has. +The roles determine the user's access permissions. +To create a user without any roles, specify an empty list (`[]`). +** *`enabled` (Optional, boolean)*: Specifies whether the user is enabled. +** *`refresh` (Optional, Enum(true | false | "wait_for"))*: Valid values are `true`, `false`, and `wait_for`. +These values have the same meaning as in the index API, but the default value for this API is true. [discrete] ==== query_api_keys Find API keys with a query. -Get a paginated list of API keys and their information. You can optionally filter the results with a query. +Get a paginated list of API keys and their information. +You can optionally filter the results with a query. + +To use this API, you must have at least the `manage_own_api_key` or the `read_security` cluster privileges. +If you have only the `manage_own_api_key` privilege, this API returns only the API keys that you own. +If you have the `read_security`, `manage_api_key`, or greater privileges (including `manage_security`), this API returns all API keys regardless of ownership. {ref}/security-api-query-api-key.html[Endpoint documentation] [source,ts] @@ -11477,25 +12851,39 @@ The query supports a subset of query types, including `match_all`, `bool`, `term `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following public information associated with an API key: `id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`, `username`, `realm`, and `metadata`. -** *`from` (Optional, number)*: Starting document offset. -By default, you cannot page through more than 10,000 hits using the from and size parameters. + +NOTE: The queryable string values associated with API keys are internally mapped as keywords. +Consequently, if no `analyzer` parameter is specified for a `match` query, then the provided match query string is interpreted as a single keyword value. +Such a match query is hence equivalent to a `term` query. +** *`from` (Optional, number)*: The starting document offset. +It must not be negative. +By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: Other than `id`, all public fields of an API key are eligible for sorting. +** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: The sort definition. +Other than `id`, all public fields of an API key are eligible for sorting. In addition, sort can also be applied to the `_doc` field to sort by index order. ** *`size` (Optional, number)*: The number of hits to return. +It must not be negative. +The `size` parameter can be set to `0`, in which case no API key matches are returned, only the aggregation results. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Search after definition +** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: The search after definition. ** *`with_limited_by` (Optional, boolean)*: Return the snapshot of the owner user's role descriptors associated with the API key. -An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. -** *`with_profile_uid` (Optional, boolean)*: Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. +An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors (effectively limited by it). +An API key cannot retrieve any API key’s limited-by role descriptors (including itself) unless it has `manage_api_key` or higher privileges. +** *`with_profile_uid` (Optional, boolean)*: Determines whether to also retrieve the profile UID for the API key owner principal. +If it exists, the profile UID is returned under the `profile_uid` response field for each API key. ** *`typed_keys` (Optional, boolean)*: Determines whether aggregation names are prefixed by their respective types in the response. [discrete] ==== query_role Find roles with a query. -Get roles in a paginated manner. You can optionally filter the results with a query. +Get roles in a paginated manner. +The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. +You can optionally filter the results with a query. +Also, the results can be paginated and sorted. {ref}/security-api-query-role.html[Endpoint documentation] [source,ts] @@ -11512,16 +12900,19 @@ If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with roles: `name`, `description`, `metadata`, -`applications.application`, `applications.privileges`, `applications.resources`. -** *`from` (Optional, number)*: Starting document offset. -By default, you cannot page through more than 10,000 hits using the from and size parameters. +`applications.application`, `applications.privileges`, and `applications.resources`. +** *`from` (Optional, number)*: The starting document offset. +It must not be negative. +By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: All public fields of a role are eligible for sorting. +** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: The sort definition. +You can sort on `username`, `roles`, or `enabled`. In addition, sort can also be applied to the `_doc` field to sort by index order. ** *`size` (Optional, number)*: The number of hits to return. +It must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Search after definition +** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: The search after definition. [discrete] ==== query_user @@ -11530,6 +12921,9 @@ Find users with a query. Get information for users in a paginated manner. You can optionally filter the results with a query. +NOTE: As opposed to the get user API, built-in users are excluded from the result. +This API is only for native users. + {ref}/security-api-query-user.html[Endpoint documentation] [source,ts] ---- @@ -11544,23 +12938,39 @@ client.security.queryUser({ ... }) If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. -You can query the following information associated with user: `username`, `roles`, `enabled` -** *`from` (Optional, number)*: Starting document offset. -By default, you cannot page through more than 10,000 hits using the from and size parameters. +You can query the following information associated with user: `username`, `roles`, `enabled`, `full_name`, and `email`. +** *`from` (Optional, number)*: The starting document offset. +It must not be negative. +By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: Fields eligible for sorting are: username, roles, enabled +** *`sort` (Optional, string | { _score, _doc, _geo_distance, _script } | string | { _score, _doc, _geo_distance, _script }[])*: The sort definition. +Fields eligible for sorting are: `username`, `roles`, `enabled`. In addition, sort can also be applied to the `_doc` field to sort by index order. ** *`size` (Optional, number)*: The number of hits to return. +It must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. -** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: Search after definition -** *`with_profile_uid` (Optional, boolean)*: If true will return the User Profile ID for the users in the query result, if any. +** *`search_after` (Optional, number | number | string | boolean | null | User-defined value[])*: The search after definition +** *`with_profile_uid` (Optional, boolean)*: Determines whether to retrieve the user profile UID, if it exists, for the users. [discrete] ==== saml_authenticate Authenticate SAML. -Submits a SAML response message to Elasticsearch for consumption. +Submit a SAML response message to Elasticsearch for consumption. + +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +The SAML message that is submitted can be: + +* A response to a SAML authentication request that was previously created using the SAML prepare authentication API. +* An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. + +In either case, the SAML message needs to be a base64 encoded XML document with a root element of ``. + +After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. +This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. {ref}/security-api-saml-authenticate.html[Endpoint documentation] [source,ts] @@ -11572,8 +12982,8 @@ client.security.samlAuthenticate({ content, ids }) ==== Arguments * *Request (object):* -** *`content` (string)*: The SAML response as it was sent by the user’s browser, usually a Base64 encoded XML document. -** *`ids` (string | string[])*: A json array with all the valid SAML Request Ids that the caller of the API has for the current user. +** *`content` (string)*: The SAML response as it was sent by the user's browser, usually a Base64 encoded XML document. +** *`ids` (string | string[])*: A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. ** *`realm` (Optional, string)*: The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. [discrete] @@ -11582,6 +12992,15 @@ Logout of SAML completely. Verifies the logout response sent from the SAML IdP. +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. +This API verifies the response by ensuring the content is relevant and validating its signature. +An empty response is returned if the verification process is successful. +The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. +The caller of this API must prepare the request accordingly so that this API can handle either of them. + {ref}/security-api-saml-complete-logout.html[Endpoint documentation] [source,ts] ---- @@ -11593,7 +13012,7 @@ client.security.samlCompleteLogout({ realm, ids }) * *Request (object):* ** *`realm` (string)*: The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. -** *`ids` (string | string[])*: A json array with all the valid SAML Request Ids that the caller of the API has for the current user. +** *`ids` (string | string[])*: A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. ** *`query_string` (Optional, string)*: If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI. ** *`content` (Optional, string)*: If the SAML IdP sends the logout response with the HTTP-Post binding, this field must be set to the value of the SAMLResponse form parameter from the logout response. @@ -11601,7 +13020,15 @@ client.security.samlCompleteLogout({ realm, ids }) ==== saml_invalidate Invalidate SAML. -Submits a SAML LogoutRequest message to Elasticsearch for consumption. +Submit a SAML LogoutRequest message to Elasticsearch for consumption. + +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +The logout request comes from the SAML IdP during an IdP initiated Single Logout. +The custom web application can use this API to have Elasticsearch process the `LogoutRequest`. +After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. +Thus the user can be redirected back to their IdP. {ref}/security-api-saml-invalidate.html[Endpoint documentation] [source,ts] @@ -11614,12 +13041,12 @@ client.security.samlInvalidate({ query_string }) * *Request (object):* ** *`query_string` (string)*: The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. -This query should include a single parameter named SAMLRequest that contains a SAML logout request that is deflated and Base64 encoded. -If the SAML IdP has signed the logout request, the URL should include two extra parameters named SigAlg and Signature that contain the algorithm used for the signature and the signature value itself. -In order for Elasticsearch to be able to verify the IdP’s signature, the value of the query_string field must be an exact match to the string provided by the browser. +This query should include a single parameter named `SAMLRequest` that contains a SAML logout request that is deflated and Base64 encoded. +If the SAML IdP has signed the logout request, the URL should include two extra parameters named `SigAlg` and `Signature` that contain the algorithm used for the signature and the signature value itself. +In order for Elasticsearch to be able to verify the IdP's signature, the value of the `query_string` field must be an exact match to the string provided by the browser. The client application must not attempt to parse or process the string in any way. -** *`acs` (Optional, string)*: The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the realm parameter. -** *`realm` (Optional, string)*: The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the acs parameter. +** *`acs` (Optional, string)*: The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the `realm` parameter. +** *`realm` (Optional, string)*: The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the `acs` parameter. [discrete] ==== saml_logout @@ -11627,6 +13054,12 @@ Logout of SAML. Submits a request to invalidate an access token and refresh token. +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +This API invalidates the tokens that were generated for a user by the SAML authenticate API. +If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). + {ref}/security-api-saml-logout.html[Endpoint documentation] [source,ts] ---- @@ -11638,7 +13071,7 @@ client.security.samlLogout({ token }) * *Request (object):* ** *`token` (string)*: The access token that was returned as a response to calling the SAML authenticate API. -Alternatively, the most recent token that was received after refreshing the original one by using a refresh_token. +Alternatively, the most recent token that was received after refreshing the original one by using a `refresh_token`. ** *`refresh_token` (Optional, string)*: The refresh token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent refresh token that was received after refreshing the original access token. @@ -11646,7 +13079,18 @@ Alternatively, the most recent refresh token that was received after refreshing ==== saml_prepare_authentication Prepare SAML authentication. -Creates a SAML authentication request (``) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. +Create a SAML authentication request (``) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. + +NOTE: This API is intended for use by custom web applications other than Kibana. +If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. + +This API returns a URL pointing to the SAML Identity Provider. +You can use the URL to redirect the browser of the user in order to continue the authentication process. +The URL includes a single parameter named `SAMLRequest`, which contains a SAML Authentication request that is deflated and Base64 encoded. +If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named `SigAlg` and `Signature`. +These parameters contain the algorithm used for the signature and the signature value itself. +It also returns a random string that uniquely identifies this SAML Authentication request. +The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. {ref}/security-api-saml-prepare-authentication.html[Endpoint documentation] [source,ts] @@ -11659,10 +13103,10 @@ client.security.samlPrepareAuthentication({ ... }) * *Request (object):* ** *`acs` (Optional, string)*: The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. -The realm is used to generate the authentication request. You must specify either this parameter or the realm parameter. +The realm is used to generate the authentication request. You must specify either this parameter or the `realm` parameter. ** *`realm` (Optional, string)*: The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. -You must specify either this parameter or the acs parameter. -** *`relay_state` (Optional, string)*: A string that will be included in the redirect URL that this API returns as the RelayState query parameter. +You must specify either this parameter or the `acs` parameter. +** *`relay_state` (Optional, string)*: A string that will be included in the redirect URL that this API returns as the `RelayState` query parameter. If the Authentication Request is signed, this value is used as part of the signature computation. [discrete] @@ -11671,6 +13115,9 @@ Create SAML service provider metadata. Generate SAML metadata for a SAML 2.0 Service Provider. +The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. +This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. + {ref}/security-api-saml-sp-metadata.html[Endpoint documentation] [source,ts] ---- @@ -11689,6 +13136,10 @@ Suggest a user profile. Get suggestions for user profiles that match specified search criteria. +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + {ref}/security-api-suggest-user-profile.html[Endpoint documentation] [source,ts] ---- @@ -11699,35 +13150,40 @@ client.security.suggestUserProfiles({ ... }) ==== Arguments * *Request (object):* -** *`name` (Optional, string)*: Query string used to match name-related fields in user profile documents. +** *`name` (Optional, string)*: A query string used to match name-related fields in user profile documents. Name-related fields are the user's `username`, `full_name`, and `email`. -** *`size` (Optional, number)*: Number of profiles to return. -** *`data` (Optional, string | string[])*: List of filters for the `data` field of the profile document. -To return all content use `data=*`. To return a subset of content -use `data=` to retrieve content nested under the specified ``. -By default returns no `data` content. +** *`size` (Optional, number)*: The number of profiles to return. +** *`data` (Optional, string | string[])*: A list of filters for the `data` field of the profile document. +To return all content use `data=*`. +To return a subset of content, use `data=` to retrieve content nested under the specified ``. +By default, the API returns no `data` content. +It is an error to specify `data` as both the query parameter and the request body field. ** *`hint` (Optional, { uids, labels })*: Extra search criteria to improve relevance of the suggestion result. Profiles matching the spcified hint are ranked higher in the response. -Profiles not matching the hint don't exclude the profile from the response -as long as the profile matches the `name` field query. +Profiles not matching the hint aren't excluded from the response as long as the profile matches the `name` field query. [discrete] ==== update_api_key Update an API key. -Updates attributes of an existing API key. +Update attributes of an existing API key. +This API supports updates to an API key's access scope, expiration, and metadata. + +To use this API, you must have at least the `manage_own_api_key` cluster privilege. Users can only update API keys that they created or that were granted to them. -Use this API to update API keys created by the create API Key or grant API Key APIs. -If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. -It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. -This API supports updates to an API key’s access scope and metadata. -The access scope of an API key is derived from the `role_descriptors` you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. -The snapshot of the owner’s permissions is updated automatically on every call. -If you don’t specify `role_descriptors` in the request, a call to this API might still change the API key’s access scope. -This change can occur if the owner user’s permissions have changed since the API key was created or last modified. To update another user’s API key, use the `run_as` feature to submit a request on behalf of another user. -IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. -To update an API key, the owner user’s credentials are required. + +IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. + +Use this API to update API keys created by the create API key or grant API Key APIs. +If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. +It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. + +The access scope of an API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request. +The snapshot of the owner's permissions is updated automatically on every call. + +IMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change the API key's access scope. +This change can occur if the owner user's permissions have changed since the API key was created or last modified. {ref}/security-api-update-api-key.html[Endpoint documentation] [source,ts] @@ -11740,9 +13196,20 @@ client.security.updateApiKey({ id }) * *Request (object):* ** *`id` (string)*: The ID of the API key to update. -** *`role_descriptors` (Optional, Record)*: An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. -** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. -** *`expiration` (Optional, string | -1 | 0)*: Expiration time for the API key. +** *`role_descriptors` (Optional, Record)*: The role descriptors to assign to this API key. +The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. +You can assign new privileges by specifying them in this parameter. +To remove assigned privileges, you can supply an empty `role_descriptors` parameter, that is to say, an empty object `{}`. +If an API key has no assigned privileges, it inherits the owner user's full permissions. +The snapshot of the owner's permissions is always updated, whether you supply the `role_descriptors` parameter or not. +The structure of a role descriptor is the same as the request for the create API keys API. +** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the API key. +It supports a nested data structure. +Within the metadata object, keys beginning with `_` are reserved for system usage. +When specified, this value fully replaces the metadata previously associated with the API key. +** *`expiration` (Optional, string | -1 | 0)*: The expiration time for the API key. +By default, API keys never expire. +This property can be omitted to leave the expiration unchanged. [discrete] ==== update_cross_cluster_api_key @@ -11750,6 +13217,20 @@ Update a cross-cluster API key. Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. +To use this API, you must have at least the `manage_security` cluster privilege. +Users can only update API keys that they created. +To update another user's API key, use the `run_as` feature to submit a request on behalf of another user. + +IMPORTANT: It's not possible to use an API key as the authentication credential for this API. +To update an API key, the owner user's credentials are required. + +It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. + +This API supports updates to an API key's access scope, metadata, and expiration. +The owner user's information, such as the `username` and `realm`, is also updated automatically on every call. + +NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. + {ref}/security-api-update-cross-cluster-api-key.html[Endpoint documentation] [source,ts] ---- @@ -11765,7 +13246,7 @@ client.security.updateCrossClusterApiKey({ id, access }) The access is composed of permissions for cross cluster search and cross cluster replication. At least one of them must be specified. When specified, the new access assignment fully replaces the previously assigned access. -** *`expiration` (Optional, string | -1 | 0)*: Expiration time for the API key. +** *`expiration` (Optional, string | -1 | 0)*: The expiration time for the API key. By default, API keys never expire. This property can be omitted to leave the value unchanged. ** *`metadata` (Optional, Record)*: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. @@ -11775,9 +13256,13 @@ When specified, this information fully replaces metadata previously associated w [discrete] ==== update_settings Update security index settings. -Update the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`. -If a specific index is not in use on the system and settings are provided for it, the request will be rejected. This API does not yet support configuring the settings for indices before they are in use. +Update the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified. This includes `index.auto_expand_replicas` and `index.number_of_replicas`. + +NOTE: If `index.auto_expand_replicas` is set, `index.number_of_replicas` will be ignored during updates. + +If a specific index is not in use on the system and settings are provided for it, the request will be rejected. +This API does not yet support configuring the settings for indices before they are in use. {ref}/security-api-update-settings.html[Endpoint documentation] [source,ts] @@ -11803,6 +13288,21 @@ Update user profile data. Update specific data for the user profile that is associated with a unique ID. +NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. +Individual users and external applications should not call this API directly. +Elastic reserves the right to change or remove this feature in future releases without prior notice. + +To use this API, you must have one of the following privileges: + +* The `manage_user_profile` cluster privilege. +* The `update_profile_data` global privilege for the namespaces that are referenced in the request. + +This API updates the `labels` and `data` fields of an existing user profile document with JSON objects. +New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. + +For both labels and data, content is namespaced by the top-level fields. +The `update_profile_data` global privilege grants privileges for updating only the allowed namespaces. + {ref}/security-api-update-user-profile-data.html[Endpoint documentation] [source,ts] ---- @@ -11814,15 +13314,19 @@ client.security.updateUserProfileData({ uid }) * *Request (object):* ** *`uid` (string)*: A unique identifier for the user profile. -** *`labels` (Optional, Record)*: Searchable data that you want to associate with the user profile. This -field supports a nested data structure. +** *`labels` (Optional, Record)*: Searchable data that you want to associate with the user profile. +This field supports a nested data structure. +Within the labels object, top-level keys cannot begin with an underscore (`_`) or contain a period (`.`). ** *`data` (Optional, Record)*: Non-searchable data that you want to associate with the user profile. This field supports a nested data structure. +Within the `data` object, top-level keys cannot begin with an underscore (`_`) or contain a period (`.`). +The data object is not searchable, but can be retrieved with the get user profile API. ** *`if_seq_no` (Optional, number)*: Only perform the operation if the document has this sequence number. ** *`if_primary_term` (Optional, number)*: Only perform the operation if the document has this primary term. ** *`refresh` (Optional, Enum(true | false | "wait_for"))*: If 'true', Elasticsearch refreshes the affected shards to make this operation -visible to search, if 'wait_for' then wait for a refresh to make this operation -visible to search, if 'false' do nothing with refreshes. +visible to search. +If 'wait_for', it waits for a refresh to make this operation visible to search. +If 'false', nothing is done with refreshes. [discrete] === shutdown @@ -12447,14 +13951,132 @@ To indicate that the request should never timeout, set it to `-1`. [discrete] ==== repository_analyze -Analyzes a repository for correctness and performance +Analyze a snapshot repository. +Analyze the performance characteristics and any incorrect behaviour found in a repository. -{ref}/modules-snapshots.html[Endpoint documentation] +The response exposes implementation details of the analysis which may change from version to version. +The response body format is therefore not considered stable and may be different in newer versions. + +There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. +Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. + +The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. +Run your first analysis with the default parameter values to check for simple problems. +If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a `blob_count` of at least `2000`, a `max_blob_size` of at least `2gb`, a `max_total_data_size` of at least `1tb`, and a `register_operation_count` of at least `100`. +Always specify a generous timeout, possibly `1h` or longer, to allow time for each analysis to run to completion. +Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. + +If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. +This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. +If so, this storage system is not suitable for use as a snapshot repository. +You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. + +If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. +You can use this information to determine the performance of your storage system. +If any operation fails or returns an incorrect result, the API returns an error. +If the API returns an error, it may not have removed all the data it wrote to the repository. +The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. +You should verify that this location has been cleaned up correctly. +If there is still leftover data at the specified location, you should manually remove it. + +If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. +Some clients are configured to close their connection if no response is received within a certain timeout. +An analysis takes a long time to complete so you might need to relax any such client-side timeouts. +On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. +The path to the leftover data is recorded in the Elasticsearch logs. +You should verify that this location has been cleaned up correctly. +If there is still leftover data at the specified location, you should manually remove it. + +If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. +The analysis attempts to detect common bugs but it does not offer 100% coverage. +Additionally, it does not test the following: + +* Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. +* Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. +* Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. + +IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. +This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. +You must ensure this load does not affect other users of these systems. +Analyses respect the repository settings `max_snapshot_bytes_per_sec` and `max_restore_bytes_per_sec` if available and the cluster setting `indices.recovery.max_bytes_per_sec` which you can use to limit the bandwidth they consume. + +NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. + +NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. +A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. +This indicates it behaves incorrectly in ways that the former version did not detect. +You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. + +NOTE: This API may not work correctly in a mixed-version cluster. + +*Implementation details* + +NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. + +The analysis comprises a number of blob-level tasks, as set by the `blob_count` parameter and a number of compare-and-exchange operations on linearizable registers, as set by the `register_operation_count` parameter. +These tasks are distributed over the data and master-eligible nodes in the cluster for execution. + +For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. +The size of the blob is chosen randomly, according to the `max_blob_size` and `max_total_data_size` parameters. +If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. + +For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. +These reads are permitted to fail, but must not return partial data. +If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. + +For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. +In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. +If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. + +The executing node will use a variety of different methods to write the blob. +For instance, where applicable, it will use both single-part and multi-part uploads. +Similarly, the reading nodes will use a variety of different methods to read the data back again. +For instance they may read the entire blob from start to end or may read only a subset of the data. + +For some blob-level tasks, the executing node will cancel the write before it is complete. +In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. + +Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. +This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. +The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. +Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. +Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. +If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. +Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. +Some operations also verify the behavior on small blobs with sizes other than 8 bytes. + +{ref}/repo-analysis-api.html[Endpoint documentation] [source,ts] ---- -client.snapshot.repositoryAnalyze() +client.snapshot.repositoryAnalyze({ repository }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`repository` (string)*: The name of the repository. +** *`blob_count` (Optional, number)*: The total number of blobs to write to the repository during the test. +For realistic experiments, you should set it to at least `2000`. +** *`concurrency` (Optional, number)*: The number of operations to run concurrently during the test. +** *`detailed` (Optional, boolean)*: Indicates whether to return detailed results, including timing information for every operation performed during the analysis. +If false, it returns only a summary of the analysis. +** *`early_read_node_count` (Optional, number)*: The number of nodes on which to perform an early read operation while writing each blob. +Early read operations are only rarely performed. +** *`max_blob_size` (Optional, number | string)*: The maximum size of a blob to be written during the test. +For realistic experiments, you should set it to at least `2gb`. +** *`max_total_data_size` (Optional, number | string)*: An upper limit on the total size of all the blobs written during the test. +For realistic experiments, you should set it to at least `1tb`. +** *`rare_action_probability` (Optional, number)*: The probability of performing a rare action such as an early read, an overwrite, or an aborted write on each blob. +** *`rarely_abort_writes` (Optional, boolean)*: Indicates whether to rarely cancel writes before they complete. +** *`read_node_count` (Optional, number)*: The number of nodes on which to read a blob after writing. +** *`register_operation_count` (Optional, number)*: The minimum number of linearizable register operations to perform in total. +For realistic experiments, you should set it to at least `100`. +** *`seed` (Optional, number)*: The seed for the pseudo-random number generator used to generate the list of operations performed during the test. +To repeat the same set of operations in multiple experiments, use the same seed in each experiment. +Note that the operations are performed concurrently so might not always happen in the same order on each run. +** *`timeout` (Optional, string | -1 | 0)*: The period of time to wait for the test to complete. +If no response is received before the timeout expires, the test is cancelled and returns an error. [discrete] ==== restore @@ -12955,6 +14577,10 @@ client.synonyms.putSynonymRule({ set_id, rule_id, synonyms }) [discrete] ==== cancel Cancel a task. + +WARNING: The task management API is new and should still be considered a beta feature. +The API may change in ways that are not backwards compatible. + A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. The get task information API will continue to list these cancelled tasks until they complete. @@ -12973,17 +14599,22 @@ client.tasks.cancel({ ... }) ==== Arguments * *Request (object):* -** *`task_id` (Optional, string | number)*: ID of the task. -** *`actions` (Optional, string | string[])*: List or wildcard expression of actions used to limit the request. -** *`nodes` (Optional, string[])*: List of node IDs or names used to limit the request. -** *`parent_task_id` (Optional, string)*: Parent task ID used to limit the tasks. -** *`wait_for_completion` (Optional, boolean)*: Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false +** *`task_id` (Optional, string | number)*: The task identifier. +** *`actions` (Optional, string | string[])*: A list or wildcard expression of actions that is used to limit the request. +** *`nodes` (Optional, string[])*: A list of node IDs or names that is used to limit the request. +** *`parent_task_id` (Optional, string)*: A parent task ID that is used to limit the tasks. +** *`wait_for_completion` (Optional, boolean)*: If true, the request blocks until all found tasks are complete. [discrete] ==== get Get task information. Get information about a task currently running in the cluster. +WARNING: The task management API is new and should still be considered a beta feature. +The API may change in ways that are not backwards compatible. + +If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. + {ref}/tasks.html[Endpoint documentation] [source,ts] ---- @@ -12994,8 +14625,8 @@ client.tasks.get({ task_id }) ==== Arguments * *Request (object):* -** *`task_id` (string)*: ID of the task. -** *`timeout` (Optional, string | -1 | 0)*: Period to wait for a response. +** *`task_id` (string)*: The task identifier. +** *`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. ** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the task has completed. @@ -13004,6 +14635,63 @@ If no response is received before the timeout expires, the request fails and ret Get all tasks. Get information about the tasks currently running on one or more nodes in the cluster. +WARNING: The task management API is new and should still be considered a beta feature. +The API may change in ways that are not backwards compatible. + +**Identifying running tasks** + +The `X-Opaque-Id header`, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. +This enables you to track certain calls or associate certain tasks with the client that started them. +For example: + +``` +curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" +``` + +The API returns the following result: + +``` +HTTP/1.1 200 OK +X-Opaque-Id: 123456 +content-type: application/json; charset=UTF-8 +content-length: 831 + +{ + "tasks" : { + "u5lcZHqcQhu-rUoFaqDphA:45" : { + "node" : "u5lcZHqcQhu-rUoFaqDphA", + "id" : 45, + "type" : "transport", + "action" : "cluster:monitor/tasks/lists", + "start_time_in_millis" : 1513823752749, + "running_time_in_nanos" : 293139, + "cancellable" : false, + "headers" : { + "X-Opaque-Id" : "123456" + }, + "children" : [ + { + "node" : "u5lcZHqcQhu-rUoFaqDphA", + "id" : 46, + "type" : "direct", + "action" : "cluster:monitor/tasks/lists[n]", + "start_time_in_millis" : 1513823752750, + "running_time_in_nanos" : 92133, + "cancellable" : false, + "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", + "headers" : { + "X-Opaque-Id" : "123456" + } + } + ] + } + } + } +``` +In this example, `X-Opaque-Id: 123456` is the ID as a part of the response header. +The `X-Opaque-Id` in the task `headers` is the ID for the task that was initiated by the REST request. +The `X-Opaque-Id` in the children `headers` is the child task of the task that was initiated by the REST request. + {ref}/tasks.html[Endpoint documentation] [source,ts] ---- @@ -13014,13 +14702,19 @@ client.tasks.list({ ... }) ==== Arguments * *Request (object):* -** *`actions` (Optional, string | string[])*: List or wildcard expression of actions used to limit the request. -** *`detailed` (Optional, boolean)*: If `true`, the response includes detailed information about shard recoveries. +** *`actions` (Optional, string | string[])*: A list or wildcard expression of actions used to limit the request. +For example, you can use `cluser:*` to retrieve all cluster-related tasks. +** *`detailed` (Optional, boolean)*: If `true`, the response includes detailed information about the running tasks. This information is useful to distinguish tasks from each other but is more costly to run. -** *`group_by` (Optional, Enum("nodes" | "parents" | "none"))*: Key used to group tasks in the response. -** *`nodes` (Optional, string | string[])*: List of node IDs or names used to limit returned information. -** *`parent_task_id` (Optional, string)*: Parent task ID used to limit returned information. To return all tasks, omit this parameter or use a value of `-1`. -** *`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. +** *`group_by` (Optional, Enum("nodes" | "parents" | "none"))*: A key that is used to group tasks in the response. +The task lists can be grouped either by nodes or by parent tasks. +** *`nodes` (Optional, string | string[])*: A list of node IDs or names that is used to limit the returned information. +** *`parent_task_id` (Optional, string)*: A parent task identifier that is used to limit returned information. +To return all tasks, omit this parameter or use a value of `-1`. +If the parent task is not found, the API does not return a 404 response code. +** *`timeout` (Optional, string | -1 | 0)*: The period to wait for each node to respond. +If a node does not respond before its timeout expires, the response does not include its information. +However, timed out nodes are included in the `node_failures` property. ** *`wait_for_completion` (Optional, boolean)*: If `true`, the request blocks until the operation is complete. [discrete] @@ -13445,9 +15139,9 @@ wildcard expression. You can get information for all transforms by using ``. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no transforms that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no transforms that match. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. @@ -13478,9 +15172,9 @@ wildcard expression. You can get information for all transforms by using ``. ** *`allow_no_match` (Optional, boolean)*: Specifies what to do when the request: -1. Contains wildcard expressions and there are no transforms that match. -2. Contains the _all string or no identifiers and there are no matches. -3. Contains wildcard expressions and there are only partial matches. +. Contains wildcard expressions and there are no transforms that match. +. Contains the _all string or no identifiers and there are no matches. +. Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. diff --git a/src/api/api/async_search.ts b/src/api/api/async_search.ts index 88d6104ed..b4d711bc4 100644 --- a/src/api/api/async_search.ts +++ b/src/api/api/async_search.ts @@ -52,13 +52,23 @@ export default class AsyncSearch { async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class AsyncSearch { async get> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise> async get> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,13 +136,23 @@ export default class AsyncSearch { async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -149,12 +179,23 @@ export default class AsyncSearch { async submit> (this: That, params?: T.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedBody.includes(key)) { + body = body ?? {} if (key === 'sort' && typeof params[key] === 'string' && params[key].includes(':')) { // eslint-disable-line querystring[key] = params[key] } else { @@ -163,7 +204,7 @@ export default class AsyncSearch { } } else if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/autoscaling.ts b/src/api/api/autoscaling.ts index aec1226d8..f1e588e08 100644 --- a/src/api/api/autoscaling.ts +++ b/src/api/api/autoscaling.ts @@ -52,13 +52,23 @@ export default class Autoscaling { async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,14 +94,24 @@ export default class Autoscaling { async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -114,13 +134,23 @@ export default class Autoscaling { async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -147,16 +177,17 @@ export default class Autoscaling { async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['policy'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/bulk.ts b/src/api/api/bulk.ts index ebad1b11f..5654ffc1f 100644 --- a/src/api/api/bulk.ts +++ b/src/api/api/bulk.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Bulk index or delete documents. Performs multiple indexing or delete operations in a single API call. This reduces overhead and can greatly increase indexing speed. + * Bulk index or delete documents. Perform multiple `index`, `create`, `delete`, and `update` actions in a single request. This reduces overhead and can greatly increase indexing speed. If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: * To use the `create` action, you must have the `create_doc`, `create`, `index`, or `write` index privilege. Data streams support only the `create` action. * To use the `index` action, you must have the `create`, `index`, or `write` index privilege. * To use the `delete` action, you must have the `delete` or `write` index privilege. * To use the `update` action, you must have the `index` or `write` index privilege. * To automatically create a data stream or index with a bulk API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. * To make the result of a bulk operation visible to search using the `refresh` parameter, you must have the `maintenance` or `manage` index privilege. Automatic data stream creation requires a matching index template with data stream enabled. The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: ``` action_and_meta_data\n optional_source\n action_and_meta_data\n optional_source\n .... action_and_meta_data\n optional_source\n ``` The `index` and `create` actions expect a source on the next line and have the same semantics as the `op_type` parameter in the standard index API. A `create` action fails if a document with the same ID already exists in the target An `index` action adds or replaces a document as necessary. NOTE: Data streams support only the `create` action. To update or delete a document in a data stream, you must target the backing index containing the document. An `update` action expects that the partial doc, upsert, and script and its options are specified on the next line. A `delete` action does not expect a source on the next line and has the same semantics as the standard delete API. NOTE: The final line of data must end with a newline character (`\n`). Each newline character may be preceded by a carriage return (`\r`). When sending NDJSON data to the `_bulk` endpoint, use a `Content-Type` header of `application/json` or `application/x-ndjson`. Because this format uses literal newline characters (`\n`) as delimiters, make sure that the JSON actions and sources are not pretty printed. If you provide a target in the request path, it is used for any actions that don't explicitly specify an `_index` argument. A note on the format: the idea here is to make processing as fast as possible. As some of the actions are redirected to other shards on other nodes, only `action_meta_data` is parsed on the receiving node side. Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. There is no "correct" number of actions to perform in a single bulk request. Experiment with different settings to find the optimal size for your particular workload. Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. **Client suppport for bulk requests** Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: * Go: Check out `esutil.BulkIndexer` * Perl: Check out `Search::Elasticsearch::Client::5_0::Bulk` and `Search::Elasticsearch::Client::5_0::Scroll` * Python: Check out `elasticsearch.helpers.*` * JavaScript: Check out `client.helpers.*` * .NET: Check out `BulkAllObservable` * PHP: Check out bulk indexing. **Submitting bulk requests with cURL** If you're providing text file input to `curl`, you must use the `--data-binary` flag instead of plain `-d`. The latter doesn't preserve newlines. For example: ``` $ cat requests { "index" : { "_index" : "test", "_id" : "1" } } { "field1" : "value1" } $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} ``` **Optimistic concurrency control** Each `index` and `delete` action within a bulk API call may include the `if_seq_no` and `if_primary_term` parameters in their respective action and meta data lines. The `if_seq_no` and `if_primary_term` parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. **Versioning** Each bulk item can include the version value using the `version` field. It automatically follows the behavior of the index or delete operation based on the `_version` mapping. It also support the `version_type`. **Routing** Each bulk item can include the routing value using the `routing` field. It automatically follows the behavior of the index or delete operation based on the `_routing` mapping. NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. **Wait for active shards** When making bulk calls, you can set the `wait_for_active_shards` parameter to require a minimum number of shard copies to be active before starting to process the bulk request. **Refresh** Control when the changes made by this request are visible to search. NOTE: Only the shards that receive the bulk request will be affected by refresh. Imagine a `_bulk?refresh=wait_for` request with three documents in it that happen to be routed to different shards in an index with five shards. The request will only wait for those three shards to refresh. The other two shards that make up the index do not participate in the `_bulk` request at all. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html | Elasticsearch API documentation} */ export default async function BulkApi (this: That, params: T.BulkRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -47,16 +47,17 @@ export default async function BulkApi (this: That, params: T.BulkRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['operations'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/capabilities.ts b/src/api/api/capabilities.ts index facd38421..1d52df861 100644 --- a/src/api/api/capabilities.ts +++ b/src/api/api/capabilities.ts @@ -46,14 +46,24 @@ export default async function CapabilitiesApi (this: That, params?: T.TODO, opti export default async function CapabilitiesApi (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise export default async function CapabilitiesApi (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } diff --git a/src/api/api/cat.ts b/src/api/api/cat.ts index b30c5365c..e4dc21b04 100644 --- a/src/api/api/cat.ts +++ b/src/api/api/cat.ts @@ -44,7 +44,7 @@ export default class Cat { } /** - * Get aliases. Retrieves the cluster’s index aliases, including filter and routing information. The API does not return data stream aliases. CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API. + * Get aliases. Get the cluster's index aliases, including filter and routing information. This API does not return data stream aliases. IMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html | Elasticsearch API documentation} */ async aliases (this: That, params?: T.CatAliasesRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -52,14 +52,24 @@ export default class Cat { async aliases (this: That, params?: T.CatAliasesRequest, options?: TransportRequestOptions): Promise async aliases (this: That, params?: T.CatAliasesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,7 +94,7 @@ export default class Cat { } /** - * Get shard allocation information. Get a snapshot of the number of shards allocated to each data node and their disk space. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. + * Get shard allocation information. Get a snapshot of the number of shards allocated to each data node and their disk space. IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html | Elasticsearch API documentation} */ async allocation (this: That, params?: T.CatAllocationRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -92,14 +102,24 @@ export default class Cat { async allocation (this: That, params?: T.CatAllocationRequest, options?: TransportRequestOptions): Promise async allocation (this: That, params?: T.CatAllocationRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -124,7 +144,7 @@ export default class Cat { } /** - * Get component templates. Returns information about component templates in a cluster. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get component template API. + * Get component templates. Get information about component templates in a cluster. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get component template API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-component-templates.html | Elasticsearch API documentation} */ async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -132,14 +152,24 @@ export default class Cat { async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest, options?: TransportRequestOptions): Promise async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -164,7 +194,7 @@ export default class Cat { } /** - * Get a document count. Provides quick access to a document count for a data stream, an index, or an entire cluster. The document count only includes live documents, not deleted documents which have not yet been removed by the merge process. CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the count API. + * Get a document count. Get quick access to a document count for a data stream, an index, or an entire cluster. The document count only includes live documents, not deleted documents which have not yet been removed by the merge process. IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the count API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html | Elasticsearch API documentation} */ async count (this: That, params?: T.CatCountRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -172,14 +202,24 @@ export default class Cat { async count (this: That, params?: T.CatCountRequest, options?: TransportRequestOptions): Promise async count (this: That, params?: T.CatCountRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -212,14 +252,24 @@ export default class Cat { async fielddata (this: That, params?: T.CatFielddataRequest, options?: TransportRequestOptions): Promise async fielddata (this: That, params?: T.CatFielddataRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['fields'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -244,7 +294,7 @@ export default class Cat { } /** - * Get the cluster health status. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the cluster health API. This API is often used to check malfunctioning clusters. To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: `HH:MM:SS`, which is human-readable but includes no date information; `Unix epoch time`, which is machine-sortable and includes date information. The latter format is useful for cluster recoveries that take multiple days. You can use the cat health API to verify cluster health across multiple nodes. You also can use the API to track the recovery of a large cluster over a longer period of time. + * Get the cluster health status. IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the cluster health API. This API is often used to check malfunctioning clusters. To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: `HH:MM:SS`, which is human-readable but includes no date information; `Unix epoch time`, which is machine-sortable and includes date information. The latter format is useful for cluster recoveries that take multiple days. You can use the cat health API to verify cluster health across multiple nodes. You also can use the API to track the recovery of a large cluster over a longer period of time. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html | Elasticsearch API documentation} */ async health (this: That, params?: T.CatHealthRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -252,14 +302,24 @@ export default class Cat { async health (this: That, params?: T.CatHealthRequest, options?: TransportRequestOptions): Promise async health (this: That, params?: T.CatHealthRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -274,7 +334,7 @@ export default class Cat { } /** - * Get CAT help. Returns help for the CAT APIs. + * Get CAT help. Get help for the CAT APIs. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html | Elasticsearch API documentation} */ async help (this: That, params?: T.CatHelpRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -282,14 +342,24 @@ export default class Cat { async help (this: That, params?: T.CatHelpRequest, options?: TransportRequestOptions): Promise async help (this: That, params?: T.CatHelpRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -304,7 +374,7 @@ export default class Cat { } /** - * Get index information. Returns high-level information about indices in a cluster, including backing indices for data streams. Use this request to get the following information for each index in a cluster: - shard count - document count - deleted document count - primary store size - total store size of all shards, including shard replicas These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents. To get an accurate count of Elasticsearch documents, use the cat count or count APIs. CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use an index endpoint. + * Get index information. Get high-level information about indices in a cluster, including backing indices for data streams. Use this request to get the following information for each index in a cluster: - shard count - document count - deleted document count - primary store size - total store size of all shards, including shard replicas These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents. To get an accurate count of Elasticsearch documents, use the cat count or count APIs. CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use an index endpoint. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html | Elasticsearch API documentation} */ async indices (this: That, params?: T.CatIndicesRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -312,14 +382,24 @@ export default class Cat { async indices (this: That, params?: T.CatIndicesRequest, options?: TransportRequestOptions): Promise async indices (this: That, params?: T.CatIndicesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -352,14 +432,24 @@ export default class Cat { async master (this: That, params?: T.CatMasterRequest, options?: TransportRequestOptions): Promise async master (this: That, params?: T.CatMasterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -374,7 +464,7 @@ export default class Cat { } /** - * Get data frame analytics jobs. Returns configuration and usage information about data frame analytics jobs. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get data frame analytics jobs statistics API. + * Get data frame analytics jobs. Get configuration and usage information about data frame analytics jobs. IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get data frame analytics jobs statistics API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-dfanalytics.html | Elasticsearch API documentation} */ async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -382,14 +472,24 @@ export default class Cat { async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -414,7 +514,7 @@ export default class Cat { } /** - * Get datafeeds. Returns configuration and usage information about datafeeds. This API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get datafeed statistics API. + * Get datafeeds. Get configuration and usage information about datafeeds. This API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get datafeed statistics API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-datafeeds.html | Elasticsearch API documentation} */ async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -422,14 +522,24 @@ export default class Cat { async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest, options?: TransportRequestOptions): Promise async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -454,7 +564,7 @@ export default class Cat { } /** - * Get anomaly detection jobs. Returns configuration and usage information for anomaly detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get anomaly detection job statistics API. + * Get anomaly detection jobs. Get configuration and usage information for anomaly detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get anomaly detection job statistics API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-anomaly-detectors.html | Elasticsearch API documentation} */ async mlJobs (this: That, params?: T.CatMlJobsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -462,14 +572,24 @@ export default class Cat { async mlJobs (this: That, params?: T.CatMlJobsRequest, options?: TransportRequestOptions): Promise async mlJobs (this: That, params?: T.CatMlJobsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -494,7 +614,7 @@ export default class Cat { } /** - * Get trained models. Returns configuration and usage information about inference trained models. CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get trained models statistics API. + * Get trained models. Get configuration and usage information about inference trained models. IMPORTANT: CAT APIs are only intended for human consumption using the Kibana console or command line. They are not intended for use by applications. For application consumption, use the get trained models statistics API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-trained-model.html | Elasticsearch API documentation} */ async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -502,14 +622,24 @@ export default class Cat { async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest, options?: TransportRequestOptions): Promise async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -542,14 +672,24 @@ export default class Cat { async nodeattrs (this: That, params?: T.CatNodeattrsRequest, options?: TransportRequestOptions): Promise async nodeattrs (this: That, params?: T.CatNodeattrsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -572,14 +712,24 @@ export default class Cat { async nodes (this: That, params?: T.CatNodesRequest, options?: TransportRequestOptions): Promise async nodes (this: That, params?: T.CatNodesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -602,14 +752,24 @@ export default class Cat { async pendingTasks (this: That, params?: T.CatPendingTasksRequest, options?: TransportRequestOptions): Promise async pendingTasks (this: That, params?: T.CatPendingTasksRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -632,14 +792,24 @@ export default class Cat { async plugins (this: That, params?: T.CatPluginsRequest, options?: TransportRequestOptions): Promise async plugins (this: That, params?: T.CatPluginsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -662,14 +832,24 @@ export default class Cat { async recovery (this: That, params?: T.CatRecoveryRequest, options?: TransportRequestOptions): Promise async recovery (this: That, params?: T.CatRecoveryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -702,14 +882,24 @@ export default class Cat { async repositories (this: That, params?: T.CatRepositoriesRequest, options?: TransportRequestOptions): Promise async repositories (this: That, params?: T.CatRepositoriesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -732,14 +922,24 @@ export default class Cat { async segments (this: That, params?: T.CatSegmentsRequest, options?: TransportRequestOptions): Promise async segments (this: That, params?: T.CatSegmentsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -772,14 +972,24 @@ export default class Cat { async shards (this: That, params?: T.CatShardsRequest, options?: TransportRequestOptions): Promise async shards (this: That, params?: T.CatShardsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -804,7 +1014,7 @@ export default class Cat { } /** - * Get snapshot information Get information about the snapshots stored in one or more repositories. A snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API. + * Get snapshot information. Get information about the snapshots stored in one or more repositories. A snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html | Elasticsearch API documentation} */ async snapshots (this: That, params?: T.CatSnapshotsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -812,14 +1022,24 @@ export default class Cat { async snapshots (this: That, params?: T.CatSnapshotsRequest, options?: TransportRequestOptions): Promise async snapshots (this: That, params?: T.CatSnapshotsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -852,14 +1072,24 @@ export default class Cat { async tasks (this: That, params?: T.CatTasksRequest, options?: TransportRequestOptions): Promise async tasks (this: That, params?: T.CatTasksRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -882,14 +1112,24 @@ export default class Cat { async templates (this: That, params?: T.CatTemplatesRequest, options?: TransportRequestOptions): Promise async templates (this: That, params?: T.CatTemplatesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -922,14 +1162,24 @@ export default class Cat { async threadPool (this: That, params?: T.CatThreadPoolRequest, options?: TransportRequestOptions): Promise async threadPool (this: That, params?: T.CatThreadPoolRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['thread_pool_patterns'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -962,14 +1212,24 @@ export default class Cat { async transforms (this: That, params?: T.CatTransformsRequest, options?: TransportRequestOptions): Promise async transforms (this: That, params?: T.CatTransformsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/ccr.ts b/src/api/api/ccr.ts index 8fafab146..3631d2dcb 100644 --- a/src/api/api/ccr.ts +++ b/src/api/api/ccr.ts @@ -52,13 +52,23 @@ export default class Ccr { async deleteAutoFollowPattern (this: That, params: T.CcrDeleteAutoFollowPatternRequest, options?: TransportRequestOptions): Promise async deleteAutoFollowPattern (this: That, params: T.CcrDeleteAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -85,16 +95,27 @@ export default class Ccr { async follow (this: That, params: T.CcrFollowRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['data_stream_name', 'leader_index', 'max_outstanding_read_requests', 'max_outstanding_write_requests', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size', 'read_poll_timeout', 'remote_cluster', 'settings'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -120,13 +141,23 @@ export default class Ccr { async followInfo (this: That, params: T.CcrFollowInfoRequest, options?: TransportRequestOptions): Promise async followInfo (this: That, params: T.CcrFollowInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -152,13 +183,23 @@ export default class Ccr { async followStats (this: That, params: T.CcrFollowStatsRequest, options?: TransportRequestOptions): Promise async followStats (this: That, params: T.CcrFollowStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -185,16 +226,27 @@ export default class Ccr { async forgetFollower (this: That, params: T.CcrForgetFollowerRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['follower_cluster', 'follower_index', 'follower_index_uuid', 'leader_remote_cluster'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -220,14 +272,24 @@ export default class Ccr { async getAutoFollowPattern (this: That, params?: T.CcrGetAutoFollowPatternRequest, options?: TransportRequestOptions): Promise async getAutoFollowPattern (this: That, params?: T.CcrGetAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -260,13 +322,23 @@ export default class Ccr { async pauseAutoFollowPattern (this: That, params: T.CcrPauseAutoFollowPatternRequest, options?: TransportRequestOptions): Promise async pauseAutoFollowPattern (this: That, params: T.CcrPauseAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -292,13 +364,23 @@ export default class Ccr { async pauseFollow (this: That, params: T.CcrPauseFollowRequest, options?: TransportRequestOptions): Promise async pauseFollow (this: That, params: T.CcrPauseFollowRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -325,16 +407,27 @@ export default class Ccr { async putAutoFollowPattern (this: That, params: T.CcrPutAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['remote_cluster', 'follow_index_pattern', 'leader_index_patterns', 'leader_index_exclusion_patterns', 'max_outstanding_read_requests', 'settings', 'max_outstanding_write_requests', 'read_poll_timeout', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -360,13 +453,23 @@ export default class Ccr { async resumeAutoFollowPattern (this: That, params: T.CcrResumeAutoFollowPatternRequest, options?: TransportRequestOptions): Promise async resumeAutoFollowPattern (this: That, params: T.CcrResumeAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -393,16 +496,27 @@ export default class Ccr { async resumeFollow (this: That, params: T.CcrResumeFollowRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['max_outstanding_read_requests', 'max_outstanding_write_requests', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size', 'read_poll_timeout'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -428,14 +542,24 @@ export default class Ccr { async stats (this: That, params?: T.CcrStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.CcrStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -458,13 +582,23 @@ export default class Ccr { async unfollow (this: That, params: T.CcrUnfollowRequest, options?: TransportRequestOptions): Promise async unfollow (this: That, params: T.CcrUnfollowRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/clear_scroll.ts b/src/api/api/clear_scroll.ts index 59013642d..5fab83bb9 100644 --- a/src/api/api/clear_scroll.ts +++ b/src/api/api/clear_scroll.ts @@ -47,17 +47,28 @@ export default async function ClearScrollApi (this: That, params?: T.ClearScroll export default async function ClearScrollApi (this: That, params?: T.ClearScrollRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['scroll_id'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/close_point_in_time.ts b/src/api/api/close_point_in_time.ts index 2df8577ec..52334debe 100644 --- a/src/api/api/close_point_in_time.ts +++ b/src/api/api/close_point_in_time.ts @@ -47,16 +47,27 @@ export default async function ClosePointInTimeApi (this: That, params: T.ClosePo export default async function ClosePointInTimeApi (this: That, params: T.ClosePointInTimeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['id'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/cluster.ts b/src/api/api/cluster.ts index 4da8aedfa..9da8711f1 100644 --- a/src/api/api/cluster.ts +++ b/src/api/api/cluster.ts @@ -53,17 +53,28 @@ export default class Cluster { async allocationExplain (this: That, params?: T.ClusterAllocationExplainRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['current_node', 'index', 'primary', 'shard'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -86,13 +97,23 @@ export default class Cluster { async deleteComponentTemplate (this: That, params: T.ClusterDeleteComponentTemplateRequest, options?: TransportRequestOptions): Promise async deleteComponentTemplate (this: That, params: T.ClusterDeleteComponentTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -118,14 +139,24 @@ export default class Cluster { async deleteVotingConfigExclusions (this: That, params?: T.ClusterDeleteVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise async deleteVotingConfigExclusions (this: That, params?: T.ClusterDeleteVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -148,13 +179,23 @@ export default class Cluster { async existsComponentTemplate (this: That, params: T.ClusterExistsComponentTemplateRequest, options?: TransportRequestOptions): Promise async existsComponentTemplate (this: That, params: T.ClusterExistsComponentTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -180,14 +221,24 @@ export default class Cluster { async getComponentTemplate (this: That, params?: T.ClusterGetComponentTemplateRequest, options?: TransportRequestOptions): Promise async getComponentTemplate (this: That, params?: T.ClusterGetComponentTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -220,14 +271,24 @@ export default class Cluster { async getSettings (this: That, params?: T.ClusterGetSettingsRequest, options?: TransportRequestOptions): Promise async getSettings (this: That, params?: T.ClusterGetSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -250,14 +311,24 @@ export default class Cluster { async health (this: That, params?: T.ClusterHealthRequest, options?: TransportRequestOptions): Promise async health (this: That, params?: T.ClusterHealthRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -290,13 +361,23 @@ export default class Cluster { async info (this: That, params: T.ClusterInfoRequest, options?: TransportRequestOptions): Promise async info (this: That, params: T.ClusterInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['target'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -322,14 +403,24 @@ export default class Cluster { async pendingTasks (this: That, params?: T.ClusterPendingTasksRequest, options?: TransportRequestOptions): Promise async pendingTasks (this: That, params?: T.ClusterPendingTasksRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -352,14 +443,24 @@ export default class Cluster { async postVotingConfigExclusions (this: That, params?: T.ClusterPostVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise async postVotingConfigExclusions (this: That, params?: T.ClusterPostVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -383,16 +484,27 @@ export default class Cluster { async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['template', 'version', '_meta', 'deprecated'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -419,17 +531,28 @@ export default class Cluster { async putSettings (this: That, params?: T.ClusterPutSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['persistent', 'transient'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -452,14 +575,24 @@ export default class Cluster { async remoteInfo (this: That, params?: T.ClusterRemoteInfoRequest, options?: TransportRequestOptions): Promise async remoteInfo (this: That, params?: T.ClusterRemoteInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -483,17 +616,28 @@ export default class Cluster { async reroute (this: That, params?: T.ClusterRerouteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['commands'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -516,14 +660,24 @@ export default class Cluster { async state (this: That, params?: T.ClusterStateRequest, options?: TransportRequestOptions): Promise async state (this: That, params?: T.ClusterStateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['metric', 'index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -560,14 +714,24 @@ export default class Cluster { async stats (this: That, params?: T.ClusterStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.ClusterStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/connector.ts b/src/api/api/connector.ts index 399537099..a181384b2 100644 --- a/src/api/api/connector.ts +++ b/src/api/api/connector.ts @@ -52,13 +52,23 @@ export default class Connector { async checkIn (this: That, params: T.ConnectorCheckInRequest, options?: TransportRequestOptions): Promise async checkIn (this: That, params: T.ConnectorCheckInRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class Connector { async delete (this: That, params: T.ConnectorDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.ConnectorDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,13 +136,23 @@ export default class Connector { async get (this: That, params: T.ConnectorGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params: T.ConnectorGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -149,16 +179,27 @@ export default class Connector { async lastSync (this: That, params: T.ConnectorLastSyncRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['last_access_control_sync_error', 'last_access_control_sync_scheduled_at', 'last_access_control_sync_status', 'last_deleted_document_count', 'last_incremental_sync_scheduled_at', 'last_indexed_document_count', 'last_seen', 'last_sync_error', 'last_sync_scheduled_at', 'last_sync_status', 'last_synced', 'sync_cursor'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -184,14 +225,24 @@ export default class Connector { async list (this: That, params?: T.ConnectorListRequest, options?: TransportRequestOptions): Promise async list (this: That, params?: T.ConnectorListRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -215,17 +266,28 @@ export default class Connector { async post (this: That, params?: T.ConnectorPostRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['description', 'index_name', 'is_native', 'language', 'name', 'service_type'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -249,17 +311,28 @@ export default class Connector { async put (this: That, params?: T.ConnectorPutRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['description', 'index_name', 'is_native', 'language', 'name', 'service_type'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -291,14 +364,24 @@ export default class Connector { async secretDelete (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async secretDelete (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -322,14 +405,24 @@ export default class Connector { async secretGet (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async secretGet (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -353,14 +446,24 @@ export default class Connector { async secretPost (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async secretPost (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -381,14 +484,24 @@ export default class Connector { async secretPut (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async secretPut (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -413,13 +526,23 @@ export default class Connector { async syncJobCancel (this: That, params: T.ConnectorSyncJobCancelRequest, options?: TransportRequestOptions): Promise async syncJobCancel (this: That, params: T.ConnectorSyncJobCancelRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -445,13 +568,23 @@ export default class Connector { async syncJobCheckIn (this: That, params: T.ConnectorSyncJobCheckInRequest, options?: TransportRequestOptions): Promise async syncJobCheckIn (this: That, params: T.ConnectorSyncJobCheckInRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -478,16 +611,27 @@ export default class Connector { async syncJobClaim (this: That, params: T.ConnectorSyncJobClaimRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] const acceptedBody: string[] = ['sync_cursor', 'worker_hostname'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -513,13 +657,23 @@ export default class Connector { async syncJobDelete (this: That, params: T.ConnectorSyncJobDeleteRequest, options?: TransportRequestOptions): Promise async syncJobDelete (this: That, params: T.ConnectorSyncJobDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -546,16 +700,27 @@ export default class Connector { async syncJobError (this: That, params: T.ConnectorSyncJobErrorRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] const acceptedBody: string[] = ['error'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -581,13 +746,23 @@ export default class Connector { async syncJobGet (this: That, params: T.ConnectorSyncJobGetRequest, options?: TransportRequestOptions): Promise async syncJobGet (this: That, params: T.ConnectorSyncJobGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -613,14 +788,24 @@ export default class Connector { async syncJobList (this: That, params?: T.ConnectorSyncJobListRequest, options?: TransportRequestOptions): Promise async syncJobList (this: That, params?: T.ConnectorSyncJobListRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -644,16 +829,27 @@ export default class Connector { async syncJobPost (this: That, params: T.ConnectorSyncJobPostRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['id', 'job_type', 'trigger_method'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -677,16 +873,27 @@ export default class Connector { async syncJobUpdateStats (this: That, params: T.ConnectorSyncJobUpdateStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_sync_job_id'] const acceptedBody: string[] = ['deleted_document_count', 'indexed_document_count', 'indexed_document_volume', 'last_seen', 'metadata', 'total_document_count'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -712,13 +919,23 @@ export default class Connector { async updateActiveFiltering (this: That, params: T.ConnectorUpdateActiveFilteringRequest, options?: TransportRequestOptions): Promise async updateActiveFiltering (this: That, params: T.ConnectorUpdateActiveFilteringRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -745,16 +962,27 @@ export default class Connector { async updateApiKeyId (this: That, params: T.ConnectorUpdateApiKeyIdRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['api_key_id', 'api_key_secret_id'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -781,16 +1009,27 @@ export default class Connector { async updateConfiguration (this: That, params: T.ConnectorUpdateConfigurationRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['configuration', 'values'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -817,16 +1056,27 @@ export default class Connector { async updateError (this: That, params: T.ConnectorUpdateErrorRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['error'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -853,16 +1103,27 @@ export default class Connector { async updateFeatures (this: That, params: T.ConnectorUpdateFeaturesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['features'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -889,16 +1150,27 @@ export default class Connector { async updateFiltering (this: That, params: T.ConnectorUpdateFilteringRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['filtering', 'rules', 'advanced_snippet'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -925,16 +1197,27 @@ export default class Connector { async updateFilteringValidation (this: That, params: T.ConnectorUpdateFilteringValidationRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['validation'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -961,16 +1244,27 @@ export default class Connector { async updateIndexName (this: That, params: T.ConnectorUpdateIndexNameRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['index_name'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -997,16 +1291,27 @@ export default class Connector { async updateName (this: That, params: T.ConnectorUpdateNameRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['name', 'description'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1033,16 +1338,27 @@ export default class Connector { async updateNative (this: That, params: T.ConnectorUpdateNativeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['is_native'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1069,16 +1385,27 @@ export default class Connector { async updatePipeline (this: That, params: T.ConnectorUpdatePipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['pipeline'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1105,16 +1432,27 @@ export default class Connector { async updateScheduling (this: That, params: T.ConnectorUpdateSchedulingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['scheduling'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1141,16 +1479,27 @@ export default class Connector { async updateServiceType (this: That, params: T.ConnectorUpdateServiceTypeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['service_type'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1177,16 +1526,27 @@ export default class Connector { async updateStatus (this: That, params: T.ConnectorUpdateStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['connector_id'] const acceptedBody: string[] = ['status'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/count.ts b/src/api/api/count.ts index e8f4561dc..9370a8928 100644 --- a/src/api/api/count.ts +++ b/src/api/api/count.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Count search results. Get the number of documents matching a query. + * Count search results. Get the number of documents matching a query. The query can either be provided using a simple query string as a parameter or using the Query DSL defined within the request body. The latter must be nested in a `query` key, which is the same as the search API. The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. The operation is broadcast across all shards. For each shard ID group, a replica is chosen and the search is run against it. This means that replicas increase the scalability of the count. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html | Elasticsearch API documentation} */ export default async function CountApi (this: That, params?: T.CountRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -47,17 +47,28 @@ export default async function CountApi (this: That, params?: T.CountRequest, opt export default async function CountApi (this: That, params?: T.CountRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['query'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/create.ts b/src/api/api/create.ts index 1ab42f1f3..6d46dec88 100644 --- a/src/api/api/create.ts +++ b/src/api/api/create.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Index a document. Adds a JSON document to the specified data stream or index and makes it searchable. If the target is an index and the document already exists, the request updates the document and increments its version. + * Create a new document in the index. You can index a new JSON document with the `//_doc/` or `//_create/<_id>` APIs Using `_create` guarantees that the document is indexed only if it does not already exist. It returns a 409 response when a document with a same ID already exists in the index. To update an existing document, you must use the `//_doc/` API. If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: * To add a document using the `PUT //_create/<_id>` or `POST //_create/<_id>` request formats, you must have the `create_doc`, `create`, `index`, or `write` index privilege. * To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. Automatic data stream creation requires a matching index template with data stream enabled. **Automatically create data streams and indices** If the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream. If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. If no mapping exists, the index operation creates a dynamic mapping. By default, new fields and objects are automatically added to the mapping if needed. Automatic index creation is controlled by the `action.auto_create_index` setting. If it is `true`, any index can be created automatically. You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely. Specify a comma-separated list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. When a list is specified, the default behaviour is to disallow. NOTE: The `action.auto_create_index` setting affects the automatic creation of indices only. It does not affect the creation of data streams. **Routing** By default, shard placement — or routing — is controlled by using a hash of the document's ID value. For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter. When setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself. This does come at the (very minimal) cost of an additional document parsing pass. If the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. **Distributed** The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. **Active shards** To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. By default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`). This default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`. To alter this behavior per operation, use the `wait_for_active_shards request` parameter. Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1). Specifying a negative value or a number greater than the number of shard copies will throw an error. For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. If `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. However, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. The `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html | Elasticsearch API documentation} */ export default async function CreateApi (this: That, params: T.CreateRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -47,16 +47,17 @@ export default async function CreateApi (this: That, params export default async function CreateApi (this: That, params: T.CreateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] const acceptedBody: string[] = ['document'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/dangling_indices.ts b/src/api/api/dangling_indices.ts index 3cb191687..00a5e88ac 100644 --- a/src/api/api/dangling_indices.ts +++ b/src/api/api/dangling_indices.ts @@ -52,13 +52,23 @@ export default class DanglingIndices { async deleteDanglingIndex (this: That, params: T.DanglingIndicesDeleteDanglingIndexRequest, options?: TransportRequestOptions): Promise async deleteDanglingIndex (this: That, params: T.DanglingIndicesDeleteDanglingIndexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index_uuid'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class DanglingIndices { async importDanglingIndex (this: That, params: T.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptions): Promise async importDanglingIndex (this: That, params: T.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index_uuid'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,14 +136,24 @@ export default class DanglingIndices { async listDanglingIndices (this: That, params?: T.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptions): Promise async listDanglingIndices (this: That, params?: T.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/delete.ts b/src/api/api/delete.ts index 356cf7375..ced9363fb 100644 --- a/src/api/api/delete.ts +++ b/src/api/api/delete.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Delete a document. Removes a JSON document from the specified index. + * Delete a document. Remove a JSON document from the specified index. NOTE: You cannot send deletion requests directly to a data stream. To delete a document in a data stream, you must target the backing index containing the document. **Optimistic concurrency control** Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters. If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`. **Versioning** Each document indexed is versioned. When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. Every write operation run on a document, deletes included, causes its version to be incremented. The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. The length of time for which a deleted document's version remains available is determined by the `index.gc_deletes` index setting. **Routing** If routing is used during indexing, the routing value also needs to be specified to delete a document. If the `_routing` mapping is set to `required` and no routing value is specified, the delete API throws a `RoutingMissingException` and rejects the request. For example: ``` DELETE /my-index-000001/_doc/1?routing=shard-1 ``` This request deletes the document with ID 1, but it is routed based on the user. The document is not deleted if the correct routing is not specified. **Distributed** The delete operation gets hashed into a specific shard ID. It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html | Elasticsearch API documentation} */ export default async function DeleteApi (this: That, params: T.DeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -46,13 +46,23 @@ export default async function DeleteApi (this: That, params: T.DeleteRequest, op export default async function DeleteApi (this: That, params: T.DeleteRequest, options?: TransportRequestOptions): Promise export default async function DeleteApi (this: That, params: T.DeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/delete_by_query.ts b/src/api/api/delete_by_query.ts index f11b3a33c..e2ce7ab74 100644 --- a/src/api/api/delete_by_query.ts +++ b/src/api/api/delete_by_query.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Delete documents. Deletes documents that match the specified query. + * Delete documents. Deletes documents that match the specified query. If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: * `read` * `delete` or `write` You can specify the query criteria in the request URI or the request body using the same syntax as the search API. When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. A bulk delete request is performed for each batch of matching documents. If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. Any delete requests that completed successfully still stick, they are not rolled back. You can opt to count version conflicts instead of halting and returning by setting `conflicts` to `proceed`. Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than `max_docs` until it has successfully deleted `max_docs documents`, or it has gone through every document in the source query. **Throttling delete requests** To control the rate at which delete by query issues batches of delete operations, you can set `requests_per_second` to any positive decimal number. This pads each batch with a wait time to throttle the rate. Set `requests_per_second` to `-1` to disable throttling. Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. By default the batch size is `1000`, so if `requests_per_second` is set to `500`: ``` target_time = 1000 / 500 per second = 2 seconds wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds ``` Since the batch is issued as a single `_bulk` request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. This is "bursty" instead of "smooth". **Slicing** Delete by query supports sliced scroll to parallelize the delete process. This can improve efficiency and provide a convenient way to break the request down into smaller parts. Setting `slices` to `auto` lets Elasticsearch choose the number of slices to use. This setting will use one slice per shard, up to a certain limit. If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. Adding slices to the delete by query operation creates sub-requests which means it has some quirks: * You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. * Fetching the status of the task for the request with slices only contains the status of completed slices. * These sub-requests are individually addressable for things like cancellation and rethrottling. * Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. * Canceling the request with `slices` will cancel each sub-request. * Due to the nature of `slices` each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. * Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being deleted. * Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: * Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many `slices` hurts performance. Setting `slices` higher than the number of shards generally does not improve efficiency and adds overhead. * Delete performance scales linearly across available resources with the number of slices. Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. **Cancel a delete by query operation** Any delete by query can be canceled using the task cancel API. For example: ``` POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel ``` The task ID can be found by using the get tasks API. Cancellation should happen quickly but might take a few seconds. The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html | Elasticsearch API documentation} */ export default async function DeleteByQueryApi (this: That, params: T.DeleteByQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -47,16 +47,27 @@ export default async function DeleteByQueryApi (this: That, params: T.DeleteByQu export default async function DeleteByQueryApi (this: That, params: T.DeleteByQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['max_docs', 'query', 'slice'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/delete_by_query_rethrottle.ts b/src/api/api/delete_by_query_rethrottle.ts index 431e4a7a6..57d9bacda 100644 --- a/src/api/api/delete_by_query_rethrottle.ts +++ b/src/api/api/delete_by_query_rethrottle.ts @@ -39,20 +39,30 @@ interface That { transport: Transport } /** * Throttle a delete by query operation. Change the number of requests per second for a particular delete by query operation. Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html | Elasticsearch API documentation} + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html#docs-delete-by-query-rethrottle | Elasticsearch API documentation} */ export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest, options?: TransportRequestOptionsWithOutMeta): Promise export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest, options?: TransportRequestOptionsWithMeta): Promise> export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest, options?: TransportRequestOptions): Promise export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/delete_script.ts b/src/api/api/delete_script.ts index 5ef36361f..e07b5c09b 100644 --- a/src/api/api/delete_script.ts +++ b/src/api/api/delete_script.ts @@ -46,13 +46,23 @@ export default async function DeleteScriptApi (this: That, params: T.DeleteScrip export default async function DeleteScriptApi (this: That, params: T.DeleteScriptRequest, options?: TransportRequestOptions): Promise export default async function DeleteScriptApi (this: That, params: T.DeleteScriptRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/enrich.ts b/src/api/api/enrich.ts index 023ba410d..2539819a6 100644 --- a/src/api/api/enrich.ts +++ b/src/api/api/enrich.ts @@ -52,13 +52,23 @@ export default class Enrich { async deletePolicy (this: That, params: T.EnrichDeletePolicyRequest, options?: TransportRequestOptions): Promise async deletePolicy (this: That, params: T.EnrichDeletePolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class Enrich { async executePolicy (this: That, params: T.EnrichExecutePolicyRequest, options?: TransportRequestOptions): Promise async executePolicy (this: That, params: T.EnrichExecutePolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,14 +136,24 @@ export default class Enrich { async getPolicy (this: That, params?: T.EnrichGetPolicyRequest, options?: TransportRequestOptions): Promise async getPolicy (this: That, params?: T.EnrichGetPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -157,16 +187,27 @@ export default class Enrich { async putPolicy (this: That, params: T.EnrichPutPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['geo_match', 'match', 'range'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -192,14 +233,24 @@ export default class Enrich { async stats (this: That, params?: T.EnrichStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.EnrichStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/eql.ts b/src/api/api/eql.ts index 258a79a2d..551257c86 100644 --- a/src/api/api/eql.ts +++ b/src/api/api/eql.ts @@ -52,13 +52,23 @@ export default class Eql { async delete (this: That, params: T.EqlDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.EqlDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class Eql { async get (this: That, params: T.EqlGetRequest, options?: TransportRequestOptions): Promise> async get (this: That, params: T.EqlGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,13 +136,23 @@ export default class Eql { async getStatus (this: That, params: T.EqlGetStatusRequest, options?: TransportRequestOptions): Promise async getStatus (this: That, params: T.EqlGetStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -149,16 +179,27 @@ export default class Eql { async search (this: That, params: T.EqlSearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['query', 'case_sensitive', 'event_category_field', 'tiebreaker_field', 'timestamp_field', 'fetch_size', 'filter', 'keep_alive', 'keep_on_completion', 'wait_for_completion_timeout', 'allow_partial_search_results', 'allow_partial_sequence_results', 'size', 'fields', 'result_position', 'runtime_mappings', 'max_samples_per_key'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/esql.ts b/src/api/api/esql.ts index b714d125c..2aede7e26 100644 --- a/src/api/api/esql.ts +++ b/src/api/api/esql.ts @@ -44,22 +44,37 @@ export default class Esql { } /** - * Executes an ESQL request asynchronously + * Run an async ES|QL query. Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-api.html | Elasticsearch API documentation} */ - async asyncQuery (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async asyncQuery (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async asyncQuery (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise - async asyncQuery (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { + async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest, options?: TransportRequestOptionsWithMeta): Promise> + async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest, options?: TransportRequestOptions): Promise + async asyncQuery (this: That, params: T.EsqlAsyncQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'profile', 'query', 'tables'] + 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 } + } + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { + // @ts-expect-error querystring[key] = params[key] } } @@ -73,22 +88,74 @@ export default class Esql { } /** - * Retrieves the results of a previously submitted async query request given its ID. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-get-api.html | Elasticsearch API documentation} + * Delete an async ES|QL query. If the query is still running, it is cancelled. Otherwise, the stored results are deleted. If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: * The authenticated user that submitted the original query request * Users with the `cancel_task` cluster privilege + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-delete-api.html | Elasticsearch API documentation} */ - async asyncQueryGet (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async asyncQueryGet (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async asyncQueryGet (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise - async asyncQueryGet (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { + async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise> + async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptions): Promise + async asyncQueryDelete (this: That, params: T.EsqlAsyncQueryDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } - params = params ?? {} 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 = 'DELETE' + const path = `/_query/async/${encodeURIComponent(params.id.toString())}` + const meta: TransportRequestMetadata = { + name: 'esql.async_query_delete', + pathParts: { + id: params.id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Get async ES|QL query results. Get the current status and available results or stored results for an ES|QL asynchronous query. If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-get-api.html | Elasticsearch API documentation} + */ + async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest, options?: TransportRequestOptionsWithMeta): Promise> + async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest, options?: TransportRequestOptions): Promise + async asyncQueryGet (this: That, params: T.EsqlAsyncQueryGetRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['id'] + 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] } } @@ -114,16 +181,27 @@ export default class Esql { async query (this: That, params: T.EsqlQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'profile', 'query', 'tables'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/exists.ts b/src/api/api/exists.ts index 5d6cf0cfa..e0d66762e 100644 --- a/src/api/api/exists.ts +++ b/src/api/api/exists.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Check a document. Checks if a specified document exists. + * Check a document. Verify that a document exists. For example, check to see if a document with the `_id` 0 exists: ``` HEAD my-index-000001/_doc/0 ``` If the document exists, the API returns a status code of `200 - OK`. If the document doesn’t exist, the API returns `404 - Not Found`. **Versioning support** You can use the `version` parameter to check the document only if its current version is equal to the specified one. Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. The old version of the document doesn't disappear immediately, although you won't be able to access it. Elasticsearch cleans up deleted documents in the background as you continue to index more data. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html | Elasticsearch API documentation} */ export default async function ExistsApi (this: That, params: T.ExistsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -46,13 +46,23 @@ export default async function ExistsApi (this: That, params: T.ExistsRequest, op export default async function ExistsApi (this: That, params: T.ExistsRequest, options?: TransportRequestOptions): Promise export default async function ExistsApi (this: That, params: T.ExistsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/exists_source.ts b/src/api/api/exists_source.ts index d97fa8feb..a57b4b804 100644 --- a/src/api/api/exists_source.ts +++ b/src/api/api/exists_source.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Check for a document source. Checks if a document's `_source` is stored. + * Check for a document source. Check whether a document source exists in an index. For example: ``` HEAD my-index-000001/_source/1 ``` A document's source is not available if it is disabled in the mapping. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html | Elasticsearch API documentation} */ export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -46,13 +46,23 @@ export default async function ExistsSourceApi (this: That, params: T.ExistsSourc export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest, options?: TransportRequestOptions): Promise export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/explain.ts b/src/api/api/explain.ts index 49859bff6..c93ab5275 100644 --- a/src/api/api/explain.ts +++ b/src/api/api/explain.ts @@ -47,16 +47,27 @@ export default async function ExplainApi (this: That, param export default async function ExplainApi (this: That, params: T.ExplainRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] const acceptedBody: string[] = ['query'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/features.ts b/src/api/api/features.ts index 555be12bc..7e90c2808 100644 --- a/src/api/api/features.ts +++ b/src/api/api/features.ts @@ -52,14 +52,24 @@ export default class Features { async getFeatures (this: That, params?: T.FeaturesGetFeaturesRequest, options?: TransportRequestOptions): Promise async getFeatures (this: That, params?: T.FeaturesGetFeaturesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -82,14 +92,24 @@ export default class Features { async resetFeatures (this: That, params?: T.FeaturesResetFeaturesRequest, options?: TransportRequestOptions): Promise async resetFeatures (this: That, params?: T.FeaturesResetFeaturesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/field_caps.ts b/src/api/api/field_caps.ts index 1d907c54c..6f04e7f32 100644 --- a/src/api/api/field_caps.ts +++ b/src/api/api/field_caps.ts @@ -47,17 +47,28 @@ export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequ export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['fields', 'index_filter', 'runtime_mappings'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/fleet.ts b/src/api/api/fleet.ts index 25f83089e..8f4d75d31 100644 --- a/src/api/api/fleet.ts +++ b/src/api/api/fleet.ts @@ -51,14 +51,24 @@ export default class Fleet { async deleteSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async deleteSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -82,14 +92,24 @@ export default class Fleet { async getSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async getSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -114,13 +134,23 @@ export default class Fleet { async globalCheckpoints (this: That, params: T.FleetGlobalCheckpointsRequest, options?: TransportRequestOptions): Promise async globalCheckpoints (this: That, params: T.FleetGlobalCheckpointsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -146,16 +176,17 @@ export default class Fleet { async msearch (this: That, params: T.FleetMsearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['searches'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -187,14 +218,24 @@ export default class Fleet { async postSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async postSecret (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -216,16 +257,27 @@ export default class Fleet { async search (this: That, params: T.FleetSearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/get.ts b/src/api/api/get.ts index a1be83e3c..55d638696 100644 --- a/src/api/api/get.ts +++ b/src/api/api/get.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Get a document by its ID. Retrieves the document with the specified ID from an index. + * Get a document by its ID. Get a document and its source or stored fields from an index. By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). In the case where stored fields are requested with the `stored_fields` parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. To turn off realtime behavior, set the `realtime` parameter to false. **Source filtering** By default, the API returns the contents of the `_source` field unless you have used the `stored_fields` parameter or the `_source` field is turned off. You can turn off `_source` retrieval by using the `_source` parameter: ``` GET my-index-000001/_doc/0?_source=false ``` If you only need one or two fields from the `_source`, use the `_source_includes` or `_source_excludes` parameters to include or filter out particular fields. This can be helpful with large documents where partial retrieval can save on network overhead Both parameters take a comma separated list of fields or wildcard expressions. For example: ``` GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities ``` If you only want to specify includes, you can use a shorter notation: ``` GET my-index-000001/_doc/0?_source=*.id ``` **Routing** If routing is used during indexing, the routing value also needs to be specified to retrieve a document. For example: ``` GET my-index-000001/_doc/2?routing=user1 ``` This request gets the document with ID 2, but it is routed based on the user. The document is not fetched if the correct routing is not specified. **Distributed** The GET operation is hashed into a specific shard ID. It is then redirected to one of the replicas within that shard ID and returns the result. The replicas are the primary shard and its replicas within that shard ID group. This means that the more replicas you have, the better your GET scaling will be. **Versioning support** You can use the `version` parameter to retrieve the document only if its current version is equal to the specified one. Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. The old version of the document doesn't disappear immediately, although you won't be able to access it. Elasticsearch cleans up deleted documents in the background as you continue to index more data. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html | Elasticsearch API documentation} */ export default async function GetApi (this: That, params: T.GetRequest, options?: TransportRequestOptionsWithOutMeta): Promise> @@ -46,13 +46,23 @@ export default async function GetApi (this: That, params: T export default async function GetApi (this: That, params: T.GetRequest, options?: TransportRequestOptions): Promise> export default async function GetApi (this: That, params: T.GetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/get_script.ts b/src/api/api/get_script.ts index c5cae38cb..a3947bdb6 100644 --- a/src/api/api/get_script.ts +++ b/src/api/api/get_script.ts @@ -46,13 +46,23 @@ export default async function GetScriptApi (this: That, params: T.GetScriptReque export default async function GetScriptApi (this: That, params: T.GetScriptRequest, options?: TransportRequestOptions): Promise export default async function GetScriptApi (this: That, params: T.GetScriptRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/get_script_context.ts b/src/api/api/get_script_context.ts index c0a13575c..2f73053f3 100644 --- a/src/api/api/get_script_context.ts +++ b/src/api/api/get_script_context.ts @@ -46,14 +46,24 @@ export default async function GetScriptContextApi (this: That, params?: T.GetScr export default async function GetScriptContextApi (this: That, params?: T.GetScriptContextRequest, options?: TransportRequestOptions): Promise export default async function GetScriptContextApi (this: That, params?: T.GetScriptContextRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/get_script_languages.ts b/src/api/api/get_script_languages.ts index 4a44de5dc..d5b706d9b 100644 --- a/src/api/api/get_script_languages.ts +++ b/src/api/api/get_script_languages.ts @@ -46,14 +46,24 @@ export default async function GetScriptLanguagesApi (this: That, params?: T.GetS export default async function GetScriptLanguagesApi (this: That, params?: T.GetScriptLanguagesRequest, options?: TransportRequestOptions): Promise export default async function GetScriptLanguagesApi (this: That, params?: T.GetScriptLanguagesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/get_source.ts b/src/api/api/get_source.ts index 3ef802718..f72c08cfc 100644 --- a/src/api/api/get_source.ts +++ b/src/api/api/get_source.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Get a document's source. Returns the source of a document. + * Get a document's source. Get the source of a document. For example: ``` GET my-index-000001/_source/1 ``` You can use the source filtering parameters to control which parts of the `_source` are returned: ``` GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities ``` * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html | Elasticsearch API documentation} */ export default async function GetSourceApi (this: That, params: T.GetSourceRequest, options?: TransportRequestOptionsWithOutMeta): Promise> @@ -46,13 +46,23 @@ export default async function GetSourceApi (this: That, par export default async function GetSourceApi (this: That, params: T.GetSourceRequest, options?: TransportRequestOptions): Promise> export default async function GetSourceApi (this: That, params: T.GetSourceRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/graph.ts b/src/api/api/graph.ts index f72fae89a..fc1a19fe6 100644 --- a/src/api/api/graph.ts +++ b/src/api/api/graph.ts @@ -53,16 +53,27 @@ export default class Graph { async explore (this: That, params: T.GraphExploreRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['connections', 'controls', 'query', 'vertices'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/health_report.ts b/src/api/api/health_report.ts index f3b76edd0..1e271ecc0 100644 --- a/src/api/api/health_report.ts +++ b/src/api/api/health_report.ts @@ -46,14 +46,24 @@ export default async function HealthReportApi (this: That, params?: T.HealthRepo export default async function HealthReportApi (this: That, params?: T.HealthReportRequest, options?: TransportRequestOptions): Promise export default async function HealthReportApi (this: That, params?: T.HealthReportRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['feature'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/ilm.ts b/src/api/api/ilm.ts index 86748d989..506120df2 100644 --- a/src/api/api/ilm.ts +++ b/src/api/api/ilm.ts @@ -52,13 +52,23 @@ export default class Ilm { async deleteLifecycle (this: That, params: T.IlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise async deleteLifecycle (this: That, params: T.IlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class Ilm { async explainLifecycle (this: That, params: T.IlmExplainLifecycleRequest, options?: TransportRequestOptions): Promise async explainLifecycle (this: That, params: T.IlmExplainLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,14 +136,24 @@ export default class Ilm { async getLifecycle (this: That, params?: T.IlmGetLifecycleRequest, options?: TransportRequestOptions): Promise async getLifecycle (this: That, params?: T.IlmGetLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -156,14 +186,24 @@ export default class Ilm { async getStatus (this: That, params?: T.IlmGetStatusRequest, options?: TransportRequestOptions): Promise async getStatus (this: That, params?: T.IlmGetStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -187,17 +227,28 @@ export default class Ilm { async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['legacy_template_to_delete', 'node_attribute'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -221,16 +272,27 @@ export default class Ilm { async moveToStep (this: That, params: T.IlmMoveToStepRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['current_step', 'next_step'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -257,16 +319,27 @@ export default class Ilm { async putLifecycle (this: That, params: T.IlmPutLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['policy'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -292,13 +365,23 @@ export default class Ilm { async removePolicy (this: That, params: T.IlmRemovePolicyRequest, options?: TransportRequestOptions): Promise async removePolicy (this: That, params: T.IlmRemovePolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -324,13 +407,23 @@ export default class Ilm { async retry (this: That, params: T.IlmRetryRequest, options?: TransportRequestOptions): Promise async retry (this: That, params: T.IlmRetryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -356,14 +449,24 @@ export default class Ilm { async start (this: That, params?: T.IlmStartRequest, options?: TransportRequestOptions): Promise async start (this: That, params?: T.IlmStartRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -386,14 +489,24 @@ export default class Ilm { async stop (this: That, params?: T.IlmStopRequest, options?: TransportRequestOptions): Promise async stop (this: That, params?: T.IlmStopRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/index.ts b/src/api/api/index.ts index dfdc7c20b..13455eca0 100644 --- a/src/api/api/index.ts +++ b/src/api/api/index.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Index a document. Adds a JSON document to the specified data stream or index and makes it searchable. If the target is an index and the document already exists, the request updates the document and increments its version. + * Create or update a document in an index. Add a JSON document to the specified data stream or index and make it searchable. If the target is an index and the document already exists, the request updates the document and increments its version. NOTE: You cannot use this API to send update requests for existing documents in a data stream. If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: * To add or overwrite a document using the `PUT //_doc/<_id>` request format, you must have the `create`, `index`, or `write` index privilege. * To add a document using the `POST //_doc/` request format, you must have the `create_doc`, `create`, `index`, or `write` index privilege. * To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege. Automatic data stream creation requires a matching index template with data stream enabled. NOTE: Replica shards might not all be started when an indexing operation returns successfully. By default, only the primary is required. Set `wait_for_active_shards` to change this default behavior. **Automatically create data streams and indices** If the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream. If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. If no mapping exists, the index operation creates a dynamic mapping. By default, new fields and objects are automatically added to the mapping if needed. Automatic index creation is controlled by the `action.auto_create_index` setting. If it is `true`, any index can be created automatically. You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely. Specify a comma-separated list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. When a list is specified, the default behaviour is to disallow. NOTE: The `action.auto_create_index` setting affects the automatic creation of indices only. It does not affect the creation of data streams. **Optimistic concurrency control** Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters. If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`. **Routing** By default, shard placement — or routing — is controlled by using a hash of the document's ID value. For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter. When setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself. This does come at the (very minimal) cost of an additional document parsing pass. If the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. NOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template. **Distributed** The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. **Active shards** To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. By default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`). This default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`. To alter this behavior per operation, use the `wait_for_active_shards request` parameter. Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1). Specifying a negative value or a number greater than the number of shard copies will throw an error. For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. If `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. However, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. The `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed. **No operation (noop) updates** When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. If this isn't acceptable use the `_update` API with `detect_noop` set to `true`. The `detect_noop` option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. There isn't a definitive rule for when noop updates aren't acceptable. It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. **Versioning** Each indexed document is given a version number. By default, internal versioning is used that starts at 1 and increments with each update, deletes included. Optionally, the version number can be set to an external value (for example, if maintained in a database). To enable this functionality, `version_type` should be set to `external`. The value provided must be a numeric, long value greater than or equal to 0, and less than around `9.2e+18`. NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. If no version is provided, the operation runs without any version checks. When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. If true, the document will be indexed and the new version number used. If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: ``` PUT my-index-000001/_doc/1?version=2&version_type=external { "user": { "id": "elkbee" } } In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html | Elasticsearch API documentation} */ export default async function IndexApi (this: That, params: T.IndexRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -47,16 +47,17 @@ export default async function IndexApi (this: That, params: export default async function IndexApi (this: That, params: T.IndexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] const acceptedBody: string[] = ['document'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/indices.ts b/src/api/api/indices.ts index 1973b1e76..9fb65257a 100644 --- a/src/api/api/indices.ts +++ b/src/api/api/indices.ts @@ -52,13 +52,23 @@ export default class Indices { async addBlock (this: That, params: T.IndicesAddBlockRequest, options?: TransportRequestOptions): Promise async addBlock (this: That, params: T.IndicesAddBlockRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'block'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -86,17 +96,28 @@ export default class Indices { async analyze (this: That, params?: T.IndicesAnalyzeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['analyzer', 'attributes', 'char_filter', 'explain', 'field', 'filter', 'normalizer', 'text', 'tokenizer'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -120,6 +141,48 @@ export default class Indices { return await this.transport.request({ path, method, querystring, body, meta }, options) } + /** + * Cancel a migration reindex operation. Cancel a migration reindex attempt for a data stream or index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html | Elasticsearch API documentation} + */ + async cancelMigrateReindex (this: That, params: T.IndicesCancelMigrateReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async cancelMigrateReindex (this: That, params: T.IndicesCancelMigrateReindexRequest, options?: TransportRequestOptionsWithMeta): Promise> + async cancelMigrateReindex (this: That, params: T.IndicesCancelMigrateReindexRequest, options?: TransportRequestOptions): Promise + async cancelMigrateReindex (this: That, params: T.IndicesCancelMigrateReindexRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['index'] + 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 = 'POST' + const path = `/_migration/reindex/${encodeURIComponent(params.index.toString())}/_cancel` + const meta: TransportRequestMetadata = { + name: 'indices.cancel_migrate_reindex', + pathParts: { + index: params.index + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + /** * Clear the cache. Clear the cache of one or more indices. For data streams, the API clears the caches of the stream's backing indices. By default, the clear cache API clears all caches. To clear only specific caches, use the `fielddata`, `query`, or `request` parameters. To clear the cache only of specific fields, use the `fields` parameter. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html | Elasticsearch API documentation} @@ -129,14 +192,24 @@ export default class Indices { async clearCache (this: That, params?: T.IndicesClearCacheRequest, options?: TransportRequestOptions): Promise async clearCache (this: That, params?: T.IndicesClearCacheRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -170,16 +243,27 @@ export default class Indices { async clone (this: That, params: T.IndicesCloneRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'target'] const acceptedBody: string[] = ['aliases', 'settings'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -206,13 +290,23 @@ export default class Indices { async close (this: That, params: T.IndicesCloseRequest, options?: TransportRequestOptions): Promise async close (this: That, params: T.IndicesCloseRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -239,16 +333,27 @@ export default class Indices { async create (this: That, params: T.IndicesCreateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['aliases', 'mappings', 'settings'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -274,13 +379,23 @@ export default class Indices { async createDataStream (this: That, params: T.IndicesCreateDataStreamRequest, options?: TransportRequestOptions): Promise async createDataStream (this: That, params: T.IndicesCreateDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -297,6 +412,44 @@ export default class Indices { return await this.transport.request({ path, method, querystring, body, meta }, options) } + /** + * Create an index from a source index. Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html | Elasticsearch API documentation} + */ + async createFrom (this: That, params: T.IndicesCreateFromRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async createFrom (this: That, params: T.IndicesCreateFromRequest, options?: TransportRequestOptionsWithMeta): Promise> + async createFrom (this: That, params: T.IndicesCreateFromRequest, options?: TransportRequestOptions): Promise + async createFrom (this: That, params: T.IndicesCreateFromRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['source', 'dest'] + const acceptedBody: string[] = ['create_from'] + 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') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'PUT' + const path = `/_create_from/${encodeURIComponent(params.source.toString())}/${encodeURIComponent(params.dest.toString())}` + const meta: TransportRequestMetadata = { + name: 'indices.create_from', + pathParts: { + source: params.source, + dest: params.dest + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + /** * Get data stream stats. Retrieves statistics for one or more data streams. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html | Elasticsearch API documentation} @@ -306,14 +459,24 @@ export default class Indices { async dataStreamsStats (this: That, params?: T.IndicesDataStreamsStatsRequest, options?: TransportRequestOptions): Promise async dataStreamsStats (this: That, params?: T.IndicesDataStreamsStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -346,13 +509,23 @@ export default class Indices { async delete (this: That, params: T.IndicesDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.IndicesDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -378,13 +551,23 @@ export default class Indices { async deleteAlias (this: That, params: T.IndicesDeleteAliasRequest, options?: TransportRequestOptions): Promise async deleteAlias (this: That, params: T.IndicesDeleteAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -418,13 +601,23 @@ export default class Indices { async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptions): Promise async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -450,13 +643,23 @@ export default class Indices { async deleteDataStream (this: That, params: T.IndicesDeleteDataStreamRequest, options?: TransportRequestOptions): Promise async deleteDataStream (this: That, params: T.IndicesDeleteDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -482,13 +685,23 @@ export default class Indices { async deleteIndexTemplate (this: That, params: T.IndicesDeleteIndexTemplateRequest, options?: TransportRequestOptions): Promise async deleteIndexTemplate (this: That, params: T.IndicesDeleteIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -514,13 +727,23 @@ export default class Indices { async deleteTemplate (this: That, params: T.IndicesDeleteTemplateRequest, options?: TransportRequestOptions): Promise async deleteTemplate (this: That, params: T.IndicesDeleteTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -546,13 +769,23 @@ export default class Indices { async diskUsage (this: That, params: T.IndicesDiskUsageRequest, options?: TransportRequestOptions): Promise async diskUsage (this: That, params: T.IndicesDiskUsageRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -579,16 +812,17 @@ export default class Indices { async downsample (this: That, params: T.IndicesDownsampleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'target_index'] const acceptedBody: string[] = ['config'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -615,13 +849,23 @@ export default class Indices { async exists (this: That, params: T.IndicesExistsRequest, options?: TransportRequestOptions): Promise async exists (this: That, params: T.IndicesExistsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -647,13 +891,23 @@ export default class Indices { async existsAlias (this: That, params: T.IndicesExistsAliasRequest, options?: TransportRequestOptions): Promise async existsAlias (this: That, params: T.IndicesExistsAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name', 'index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -687,13 +941,23 @@ export default class Indices { async existsIndexTemplate (this: That, params: T.IndicesExistsIndexTemplateRequest, options?: TransportRequestOptions): Promise async existsIndexTemplate (this: That, params: T.IndicesExistsIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -719,13 +983,23 @@ export default class Indices { async existsTemplate (this: That, params: T.IndicesExistsTemplateRequest, options?: TransportRequestOptions): Promise async existsTemplate (this: That, params: T.IndicesExistsTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -751,13 +1025,23 @@ export default class Indices { async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptions): Promise async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -783,13 +1067,23 @@ export default class Indices { async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest, options?: TransportRequestOptions): Promise async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -815,14 +1109,24 @@ export default class Indices { async flush (this: That, params?: T.IndicesFlushRequest, options?: TransportRequestOptions): Promise async flush (this: That, params?: T.IndicesFlushRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -855,14 +1159,24 @@ export default class Indices { async forcemerge (this: That, params?: T.IndicesForcemergeRequest, options?: TransportRequestOptions): Promise async forcemerge (this: That, params?: T.IndicesForcemergeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -895,13 +1209,23 @@ export default class Indices { async get (this: That, params: T.IndicesGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params: T.IndicesGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -920,20 +1244,31 @@ export default class Indices { /** * Get aliases. Retrieves information for one or more data stream or index aliases. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-alias.html | Elasticsearch API documentation} */ async getAlias (this: That, params?: T.IndicesGetAliasRequest, options?: TransportRequestOptionsWithOutMeta): Promise async getAlias (this: That, params?: T.IndicesGetAliasRequest, options?: TransportRequestOptionsWithMeta): Promise> async getAlias (this: That, params?: T.IndicesGetAliasRequest, options?: TransportRequestOptions): Promise async getAlias (this: That, params?: T.IndicesGetAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name', 'index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -973,13 +1308,23 @@ export default class Indices { async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest, options?: TransportRequestOptions): Promise async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1005,14 +1350,24 @@ export default class Indices { async getDataLifecycleStats (this: That, params?: T.IndicesGetDataLifecycleStatsRequest, options?: TransportRequestOptions): Promise async getDataLifecycleStats (this: That, params?: T.IndicesGetDataLifecycleStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1035,14 +1390,24 @@ export default class Indices { async getDataStream (this: That, params?: T.IndicesGetDataStreamRequest, options?: TransportRequestOptions): Promise async getDataStream (this: That, params?: T.IndicesGetDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1075,13 +1440,23 @@ export default class Indices { async getFieldMapping (this: That, params: T.IndicesGetFieldMappingRequest, options?: TransportRequestOptions): Promise async getFieldMapping (this: That, params: T.IndicesGetFieldMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['fields', 'index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1115,14 +1490,24 @@ export default class Indices { async getIndexTemplate (this: That, params?: T.IndicesGetIndexTemplateRequest, options?: TransportRequestOptions): Promise async getIndexTemplate (this: That, params?: T.IndicesGetIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1155,14 +1540,24 @@ export default class Indices { async getMapping (this: That, params?: T.IndicesGetMappingRequest, options?: TransportRequestOptions): Promise async getMapping (this: That, params?: T.IndicesGetMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1186,6 +1581,48 @@ export default class Indices { return await this.transport.request({ path, method, querystring, body, meta }, options) } + /** + * Get the migration reindexing status. Get the status of a migration reindex attempt for a data stream or index. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html | Elasticsearch API documentation} + */ + async getMigrateReindexStatus (this: That, params: T.IndicesGetMigrateReindexStatusRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async getMigrateReindexStatus (this: That, params: T.IndicesGetMigrateReindexStatusRequest, options?: TransportRequestOptionsWithMeta): Promise> + async getMigrateReindexStatus (this: That, params: T.IndicesGetMigrateReindexStatusRequest, options?: TransportRequestOptions): Promise + async getMigrateReindexStatus (this: That, params: T.IndicesGetMigrateReindexStatusRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['index'] + 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 = `/_migration/reindex/${encodeURIComponent(params.index.toString())}/_status` + const meta: TransportRequestMetadata = { + name: 'indices.get_migrate_reindex_status', + pathParts: { + index: params.index + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + /** * Get index settings. Get setting information for one or more indices. For data streams, it returns setting information for the stream's backing indices. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html | Elasticsearch API documentation} @@ -1195,14 +1632,24 @@ export default class Indices { async getSettings (this: That, params?: T.IndicesGetSettingsRequest, options?: TransportRequestOptions): Promise async getSettings (this: That, params?: T.IndicesGetSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1242,14 +1689,24 @@ export default class Indices { async getTemplate (this: That, params?: T.IndicesGetTemplateRequest, options?: TransportRequestOptions): Promise async getTemplate (this: That, params?: T.IndicesGetTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1273,6 +1730,40 @@ export default class Indices { return await this.transport.request({ path, method, querystring, body, meta }, options) } + /** + * Reindex legacy backing indices. Reindex all legacy backing indices for a data stream. This operation occurs in a persistent task. The persistent task ID is returned immediately and the reindexing work is completed in that task. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html | Elasticsearch API documentation} + */ + async migrateReindex (this: That, params: T.IndicesMigrateReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async migrateReindex (this: That, params: T.IndicesMigrateReindexRequest, options?: TransportRequestOptionsWithMeta): Promise> + async migrateReindex (this: That, params: T.IndicesMigrateReindexRequest, options?: TransportRequestOptions): Promise + async migrateReindex (this: That, params: T.IndicesMigrateReindexRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = [] + const acceptedBody: string[] = ['reindex'] + 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') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = '/_migration/reindex' + const meta: TransportRequestMetadata = { + name: 'indices.migrate_reindex' + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + /** * Convert an index alias to a data stream. Converts an index alias to a data stream. You must have a matching index template that is data stream enabled. The alias must meet the following criteria: The alias must have a write index; All indices for the alias must have a `@timestamp` field mapping of a `date` or `date_nanos` field type; The alias must not have any filters; The alias must not use custom routing. If successful, the request removes the alias and creates a data stream with the same name. The indices for the alias become hidden backing indices for the stream. The write index for the alias becomes the write index for the stream. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html | Elasticsearch API documentation} @@ -1282,13 +1773,23 @@ export default class Indices { async migrateToDataStream (this: That, params: T.IndicesMigrateToDataStreamRequest, options?: TransportRequestOptions): Promise async migrateToDataStream (this: That, params: T.IndicesMigrateToDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1315,16 +1816,27 @@ export default class Indices { async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['actions'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1347,13 +1859,23 @@ export default class Indices { async open (this: That, params: T.IndicesOpenRequest, options?: TransportRequestOptions): Promise async open (this: That, params: T.IndicesOpenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1379,13 +1901,23 @@ export default class Indices { async promoteDataStream (this: That, params: T.IndicesPromoteDataStreamRequest, options?: TransportRequestOptions): Promise async promoteDataStream (this: That, params: T.IndicesPromoteDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1412,16 +1944,27 @@ export default class Indices { async putAlias (this: That, params: T.IndicesPutAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'name'] const acceptedBody: string[] = ['filter', 'index_routing', 'is_write_index', 'routing', 'search_routing'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1456,16 +1999,17 @@ export default class Indices { async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['lifecycle'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1492,16 +2036,27 @@ export default class Indices { async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta', 'allow_auto_create', 'ignore_missing_component_templates', 'deprecated'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1528,16 +2083,27 @@ export default class Indices { async putMapping (this: That, params: T.IndicesPutMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['date_detection', 'dynamic', 'dynamic_date_formats', 'dynamic_templates', '_field_names', '_meta', 'numeric_detection', 'properties', '_routing', '_source', 'runtime'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1564,16 +2130,17 @@ export default class Indices { async putSettings (this: That, params: T.IndicesPutSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['settings'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1607,16 +2174,27 @@ export default class Indices { async putTemplate (this: That, params: T.IndicesPutTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['aliases', 'index_patterns', 'mappings', 'order', 'settings', 'version'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1642,14 +2220,24 @@ export default class Indices { async recovery (this: That, params?: T.IndicesRecoveryRequest, options?: TransportRequestOptions): Promise async recovery (this: That, params?: T.IndicesRecoveryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1682,14 +2270,24 @@ export default class Indices { async refresh (this: That, params?: T.IndicesRefreshRequest, options?: TransportRequestOptions): Promise async refresh (this: That, params?: T.IndicesRefreshRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1722,13 +2320,23 @@ export default class Indices { async reloadSearchAnalyzers (this: That, params: T.IndicesReloadSearchAnalyzersRequest, options?: TransportRequestOptions): Promise async reloadSearchAnalyzers (this: That, params: T.IndicesReloadSearchAnalyzersRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1754,13 +2362,23 @@ export default class Indices { async resolveCluster (this: That, params: T.IndicesResolveClusterRequest, options?: TransportRequestOptions): Promise async resolveCluster (this: That, params: T.IndicesResolveClusterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1786,13 +2404,23 @@ export default class Indices { async resolveIndex (this: That, params: T.IndicesResolveIndexRequest, options?: TransportRequestOptions): Promise async resolveIndex (this: That, params: T.IndicesResolveIndexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1819,16 +2447,27 @@ export default class Indices { async rollover (this: That, params: T.IndicesRolloverRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['alias', 'new_index'] const acceptedBody: string[] = ['aliases', 'conditions', 'mappings', 'settings'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1862,14 +2501,24 @@ export default class Indices { async segments (this: That, params?: T.IndicesSegmentsRequest, options?: TransportRequestOptions): Promise async segments (this: That, params?: T.IndicesSegmentsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1902,14 +2551,24 @@ export default class Indices { async shardStores (this: That, params?: T.IndicesShardStoresRequest, options?: TransportRequestOptions): Promise async shardStores (this: That, params?: T.IndicesShardStoresRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1943,16 +2602,27 @@ export default class Indices { async shrink (this: That, params: T.IndicesShrinkRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'target'] const acceptedBody: string[] = ['aliases', 'settings'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1979,13 +2649,23 @@ export default class Indices { async simulateIndexTemplate (this: That, params: T.IndicesSimulateIndexTemplateRequest, options?: TransportRequestOptions): Promise async simulateIndexTemplate (this: That, params: T.IndicesSimulateIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2012,17 +2692,28 @@ export default class Indices { async simulateTemplate (this: That, params?: T.IndicesSimulateTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['allow_auto_create', 'index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta', 'ignore_missing_component_templates', 'deprecated'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2056,16 +2747,27 @@ export default class Indices { async split (this: That, params: T.IndicesSplitRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'target'] const acceptedBody: string[] = ['aliases', 'settings'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2092,14 +2794,24 @@ export default class Indices { async stats (this: That, params?: T.IndicesStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.IndicesStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['metric', 'index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2130,38 +2842,6 @@ export default class Indices { return await this.transport.request({ path, method, querystring, body, meta }, options) } - /** - * Unfreeze an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again. - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/unfreeze-index-api.html | Elasticsearch API documentation} - */ - async unfreeze (this: That, params: T.IndicesUnfreezeRequest, options?: TransportRequestOptionsWithOutMeta): Promise - async unfreeze (this: That, params: T.IndicesUnfreezeRequest, options?: TransportRequestOptionsWithMeta): Promise> - async unfreeze (this: That, params: T.IndicesUnfreezeRequest, options?: TransportRequestOptions): Promise - async unfreeze (this: That, params: T.IndicesUnfreezeRequest, options?: TransportRequestOptions): Promise { - const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined - - for (const key in params) { - if (acceptedPath.includes(key)) { - continue - } else { - // @ts-expect-error - querystring[key] = params[key] - } - } - - const method = 'POST' - const path = `/${encodeURIComponent(params.index.toString())}/_unfreeze` - const meta: TransportRequestMetadata = { - name: 'indices.unfreeze', - pathParts: { - index: params.index - } - } - return await this.transport.request({ path, method, querystring, body, meta }, options) - } - /** * Create or update an alias. Adds a data stream or index to an alias. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html | Elasticsearch API documentation} @@ -2172,17 +2852,28 @@ export default class Indices { async updateAliases (this: That, params?: T.IndicesUpdateAliasesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['actions'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2206,17 +2897,28 @@ export default class Indices { async validateQuery (this: That, params?: T.IndicesValidateQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['query'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/inference.ts b/src/api/api/inference.ts index 195cf46a2..6bdede5f1 100644 --- a/src/api/api/inference.ts +++ b/src/api/api/inference.ts @@ -52,13 +52,23 @@ export default class Inference { async delete (this: That, params: T.InferenceDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.InferenceDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_type', 'inference_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -92,14 +102,24 @@ export default class Inference { async get (this: That, params?: T.InferenceGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params?: T.InferenceGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_type', 'inference_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -137,16 +157,27 @@ export default class Inference { async inference (this: That, params: T.InferenceInferenceRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_type', 'inference_id'] const acceptedBody: string[] = ['query', 'input', 'task_settings'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -181,16 +212,17 @@ export default class Inference { async put (this: That, params: T.InferencePutRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_type', 'inference_id'] const acceptedBody: string[] = ['inference_config'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -216,22 +248,37 @@ export default class Inference { } /** - * Perform streaming inference - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/post-stream-inference-api.html | Elasticsearch API documentation} + * Perform streaming inference. Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. This API works only with the completion task type. 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, Azure, 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. This API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege). You must use a client that supports streaming. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/stream-inference-api.html | Elasticsearch API documentation} */ - async streamInference (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async streamInference (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async streamInference (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise - async streamInference (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { + async streamInference (this: That, params: T.InferenceStreamInferenceRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async streamInference (this: That, params: T.InferenceStreamInferenceRequest, options?: TransportRequestOptionsWithMeta): Promise> + async streamInference (this: That, params: T.InferenceStreamInferenceRequest, options?: TransportRequestOptions): Promise + async streamInference (this: That, params: T.InferenceStreamInferenceRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['inference_id', 'task_type'] - const querystring: Record = {} - const body = undefined + const acceptedBody: string[] = ['input'] + 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 } + } + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { + // @ts-expect-error querystring[key] = params[key] } } @@ -254,4 +301,104 @@ export default class Inference { } return await this.transport.request({ path, method, querystring, body, meta }, options) } + + /** + * Perform inference on the service using the Unified Schema + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/unified-inference-api.html | Elasticsearch API documentation} + */ + async unifiedInference (this: That, params: T.InferenceUnifiedInferenceRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async unifiedInference (this: That, params: T.InferenceUnifiedInferenceRequest, options?: TransportRequestOptionsWithMeta): Promise> + async unifiedInference (this: That, params: T.InferenceUnifiedInferenceRequest, options?: TransportRequestOptions): Promise + async unifiedInference (this: That, params: T.InferenceUnifiedInferenceRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['task_type', 'inference_id'] + const acceptedBody: string[] = ['messages', 'model', 'max_completion_tokens', 'stop', 'temperature', 'tool_choice', 'tools', 'top_p'] + 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') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + let method = '' + let path = '' + if (params.task_type != null && params.inference_id != null) { + method = 'POST' + path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}/_unified` + } else { + method = 'POST' + path = `/_inference/${encodeURIComponent(params.inference_id.toString())}/_unified` + } + const meta: TransportRequestMetadata = { + name: 'inference.unified_inference', + pathParts: { + task_type: params.task_type, + inference_id: params.inference_id + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } + + /** + * Update an inference endpoint. Modify `task_settings`, secrets (within `service_settings`), or `num_allocations` for an inference endpoint, depending on the specific endpoint service and `task_type`. 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, Azure, 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. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/update-inference-api.html | Elasticsearch API documentation} + */ + async update (this: That, params: T.InferenceUpdateRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async update (this: That, params: T.InferenceUpdateRequest, options?: TransportRequestOptionsWithMeta): Promise> + async update (this: That, params: T.InferenceUpdateRequest, options?: TransportRequestOptions): Promise + async update (this: That, params: T.InferenceUpdateRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['inference_id', 'task_type'] + const acceptedBody: string[] = ['inference_config'] + 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') { + // @ts-expect-error + querystring[key] = params[key] + } + } + + let method = '' + let path = '' + if (params.task_type != null && params.inference_id != null) { + method = 'POST' + path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}/_update` + } else { + method = 'POST' + path = `/_inference/${encodeURIComponent(params.inference_id.toString())}/_update` + } + const meta: TransportRequestMetadata = { + name: 'inference.update', + pathParts: { + inference_id: params.inference_id, + task_type: params.task_type + } + } + return await this.transport.request({ path, method, querystring, body, meta }, options) + } } diff --git a/src/api/api/info.ts b/src/api/api/info.ts index 507fc78d9..0c1bf083d 100644 --- a/src/api/api/info.ts +++ b/src/api/api/info.ts @@ -46,14 +46,24 @@ export default async function InfoApi (this: That, params?: T.InfoRequest, optio export default async function InfoApi (this: That, params?: T.InfoRequest, options?: TransportRequestOptions): Promise export default async function InfoApi (this: That, params?: T.InfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/ingest.ts b/src/api/api/ingest.ts index 6999e2064..f691fb5b5 100644 --- a/src/api/api/ingest.ts +++ b/src/api/api/ingest.ts @@ -52,13 +52,23 @@ export default class Ingest { async deleteGeoipDatabase (this: That, params: T.IngestDeleteGeoipDatabaseRequest, options?: TransportRequestOptions): Promise async deleteGeoipDatabase (this: That, params: T.IngestDeleteGeoipDatabaseRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class Ingest { async deleteIpLocationDatabase (this: That, params: T.IngestDeleteIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise async deleteIpLocationDatabase (this: That, params: T.IngestDeleteIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,13 +136,23 @@ export default class Ingest { async deletePipeline (this: That, params: T.IngestDeletePipelineRequest, options?: TransportRequestOptions): Promise async deletePipeline (this: That, params: T.IngestDeletePipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -148,14 +178,24 @@ export default class Ingest { async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest, options?: TransportRequestOptions): Promise async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -178,14 +218,24 @@ export default class Ingest { async getGeoipDatabase (this: That, params?: T.IngestGetGeoipDatabaseRequest, options?: TransportRequestOptions): Promise async getGeoipDatabase (this: That, params?: T.IngestGetGeoipDatabaseRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -218,14 +268,24 @@ export default class Ingest { async getIpLocationDatabase (this: That, params?: T.IngestGetIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise async getIpLocationDatabase (this: That, params?: T.IngestGetIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -258,14 +318,24 @@ export default class Ingest { async getPipeline (this: That, params?: T.IngestGetPipelineRequest, options?: TransportRequestOptions): Promise async getPipeline (this: That, params?: T.IngestGetPipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -298,14 +368,24 @@ export default class Ingest { async processorGrok (this: That, params?: T.IngestProcessorGrokRequest, options?: TransportRequestOptions): Promise async processorGrok (this: That, params?: T.IngestProcessorGrokRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -329,16 +409,27 @@ export default class Ingest { async putGeoipDatabase (this: That, params: T.IngestPutGeoipDatabaseRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['name', 'maxmind'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -365,16 +456,17 @@ export default class Ingest { async putIpLocationDatabase (this: That, params: T.IngestPutIpLocationDatabaseRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['configuration'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -401,16 +493,27 @@ export default class Ingest { async putPipeline (this: That, params: T.IngestPutPipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['_meta', 'description', 'on_failure', 'processors', 'version', 'deprecated'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -437,16 +540,27 @@ export default class Ingest { async simulate (this: That, params: T.IngestSimulateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['docs', 'pipeline'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/knn_search.ts b/src/api/api/knn_search.ts index 6188a31e9..e23a2d87a 100644 --- a/src/api/api/knn_search.ts +++ b/src/api/api/knn_search.ts @@ -47,16 +47,27 @@ export default async function KnnSearchApi (this: That, par export default async function KnnSearchApi (this: That, params: T.KnnSearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['_source', 'docvalue_fields', 'stored_fields', 'fields', 'filter', 'knn'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/license.ts b/src/api/api/license.ts index 9f2e8c627..852661841 100644 --- a/src/api/api/license.ts +++ b/src/api/api/license.ts @@ -52,14 +52,24 @@ export default class License { async delete (this: That, params?: T.LicenseDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params?: T.LicenseDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -82,14 +92,24 @@ export default class License { async get (this: That, params?: T.LicenseGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params?: T.LicenseGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -112,14 +132,24 @@ export default class License { async getBasicStatus (this: That, params?: T.LicenseGetBasicStatusRequest, options?: TransportRequestOptions): Promise async getBasicStatus (this: That, params?: T.LicenseGetBasicStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -142,14 +172,24 @@ export default class License { async getTrialStatus (this: That, params?: T.LicenseGetTrialStatusRequest, options?: TransportRequestOptions): Promise async getTrialStatus (this: That, params?: T.LicenseGetTrialStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -173,17 +213,28 @@ export default class License { async post (this: That, params?: T.LicensePostRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['license', 'licenses'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -206,14 +257,24 @@ export default class License { async postStartBasic (this: That, params?: T.LicensePostStartBasicRequest, options?: TransportRequestOptions): Promise async postStartBasic (this: That, params?: T.LicensePostStartBasicRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -236,14 +297,24 @@ export default class License { async postStartTrial (this: That, params?: T.LicensePostStartTrialRequest, options?: TransportRequestOptions): Promise async postStartTrial (this: That, params?: T.LicensePostStartTrialRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/logstash.ts b/src/api/api/logstash.ts index bee5575b5..559b10011 100644 --- a/src/api/api/logstash.ts +++ b/src/api/api/logstash.ts @@ -52,13 +52,23 @@ export default class Logstash { async deletePipeline (this: That, params: T.LogstashDeletePipelineRequest, options?: TransportRequestOptions): Promise async deletePipeline (this: That, params: T.LogstashDeletePipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,14 +94,24 @@ export default class Logstash { async getPipeline (this: That, params?: T.LogstashGetPipelineRequest, options?: TransportRequestOptions): Promise async getPipeline (this: That, params?: T.LogstashGetPipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -125,16 +145,17 @@ export default class Logstash { async putPipeline (this: That, params: T.LogstashPutPipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['pipeline'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/mget.ts b/src/api/api/mget.ts index 514691961..62f275d77 100644 --- a/src/api/api/mget.ts +++ b/src/api/api/mget.ts @@ -47,17 +47,28 @@ export default async function MgetApi (this: That, params?: export default async function MgetApi (this: That, params?: T.MgetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['docs', 'ids'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/migration.ts b/src/api/api/migration.ts index d07851611..49fed1c3b 100644 --- a/src/api/api/migration.ts +++ b/src/api/api/migration.ts @@ -52,14 +52,24 @@ export default class Migration { async deprecations (this: That, params?: T.MigrationDeprecationsRequest, options?: TransportRequestOptions): Promise async deprecations (this: That, params?: T.MigrationDeprecationsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -92,14 +102,24 @@ export default class Migration { async getFeatureUpgradeStatus (this: That, params?: T.MigrationGetFeatureUpgradeStatusRequest, options?: TransportRequestOptions): Promise async getFeatureUpgradeStatus (this: That, params?: T.MigrationGetFeatureUpgradeStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -122,14 +142,24 @@ export default class Migration { async postFeatureUpgrade (this: That, params?: T.MigrationPostFeatureUpgradeRequest, options?: TransportRequestOptions): Promise async postFeatureUpgrade (this: That, params?: T.MigrationPostFeatureUpgradeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/ml.ts b/src/api/api/ml.ts index e5f997b39..1dbc32a63 100644 --- a/src/api/api/ml.ts +++ b/src/api/api/ml.ts @@ -52,13 +52,23 @@ export default class Ml { async clearTrainedModelDeploymentCache (this: That, params: T.MlClearTrainedModelDeploymentCacheRequest, options?: TransportRequestOptions): Promise async clearTrainedModelDeploymentCache (this: That, params: T.MlClearTrainedModelDeploymentCacheRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -85,16 +95,27 @@ export default class Ml { async closeJob (this: That, params: T.MlCloseJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['allow_no_match', 'force', 'timeout'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -120,13 +141,23 @@ export default class Ml { async deleteCalendar (this: That, params: T.MlDeleteCalendarRequest, options?: TransportRequestOptions): Promise async deleteCalendar (this: That, params: T.MlDeleteCalendarRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -152,13 +183,23 @@ export default class Ml { async deleteCalendarEvent (this: That, params: T.MlDeleteCalendarEventRequest, options?: TransportRequestOptions): Promise async deleteCalendarEvent (this: That, params: T.MlDeleteCalendarEventRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id', 'event_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -185,13 +226,23 @@ export default class Ml { async deleteCalendarJob (this: That, params: T.MlDeleteCalendarJobRequest, options?: TransportRequestOptions): Promise async deleteCalendarJob (this: That, params: T.MlDeleteCalendarJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id', 'job_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -218,13 +269,23 @@ export default class Ml { async deleteDataFrameAnalytics (this: That, params: T.MlDeleteDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async deleteDataFrameAnalytics (this: That, params: T.MlDeleteDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -250,13 +311,23 @@ export default class Ml { async deleteDatafeed (this: That, params: T.MlDeleteDatafeedRequest, options?: TransportRequestOptions): Promise async deleteDatafeed (this: That, params: T.MlDeleteDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -283,17 +354,28 @@ export default class Ml { async deleteExpiredData (this: That, params?: T.MlDeleteExpiredDataRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['requests_per_second', 'timeout'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -326,13 +408,23 @@ export default class Ml { async deleteFilter (this: That, params: T.MlDeleteFilterRequest, options?: TransportRequestOptions): Promise async deleteFilter (this: That, params: T.MlDeleteFilterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['filter_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -358,13 +450,23 @@ export default class Ml { async deleteForecast (this: That, params: T.MlDeleteForecastRequest, options?: TransportRequestOptions): Promise async deleteForecast (this: That, params: T.MlDeleteForecastRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'forecast_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -398,13 +500,23 @@ export default class Ml { async deleteJob (this: That, params: T.MlDeleteJobRequest, options?: TransportRequestOptions): Promise async deleteJob (this: That, params: T.MlDeleteJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -430,13 +542,23 @@ export default class Ml { async deleteModelSnapshot (this: That, params: T.MlDeleteModelSnapshotRequest, options?: TransportRequestOptions): Promise async deleteModelSnapshot (this: That, params: T.MlDeleteModelSnapshotRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -463,13 +585,23 @@ export default class Ml { async deleteTrainedModel (this: That, params: T.MlDeleteTrainedModelRequest, options?: TransportRequestOptions): Promise async deleteTrainedModel (this: That, params: T.MlDeleteTrainedModelRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -495,13 +627,23 @@ export default class Ml { async deleteTrainedModelAlias (this: That, params: T.MlDeleteTrainedModelAliasRequest, options?: TransportRequestOptions): Promise async deleteTrainedModelAlias (this: That, params: T.MlDeleteTrainedModelAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_alias', 'model_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -529,17 +671,28 @@ export default class Ml { async estimateModelMemory (this: That, params?: T.MlEstimateModelMemoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['analysis_config', 'max_bucket_cardinality', 'overall_cardinality'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -563,16 +716,27 @@ export default class Ml { async evaluateDataFrame (this: That, params: T.MlEvaluateDataFrameRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['evaluation', 'index', 'query'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -596,17 +760,28 @@ export default class Ml { async explainDataFrameAnalytics (this: That, params?: T.MlExplainDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['source', 'dest', 'analysis', 'description', 'model_memory_limit', 'max_num_threads', 'analyzed_fields', 'allow_lazy_start'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -640,16 +815,27 @@ export default class Ml { async flushJob (this: That, params: T.MlFlushJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['advance_time', 'calc_interim', 'end', 'skip_time', 'start'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -676,16 +862,27 @@ export default class Ml { async forecast (this: That, params: T.MlForecastRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['duration', 'expires_in', 'max_model_memory'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -712,16 +909,27 @@ export default class Ml { async getBuckets (this: That, params: T.MlGetBucketsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'timestamp'] const acceptedBody: string[] = ['anomaly_score', 'desc', 'end', 'exclude_interim', 'expand', 'page', 'sort', 'start'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -755,13 +963,23 @@ export default class Ml { async getCalendarEvents (this: That, params: T.MlGetCalendarEventsRequest, options?: TransportRequestOptions): Promise async getCalendarEvents (this: That, params: T.MlGetCalendarEventsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -788,17 +1006,28 @@ export default class Ml { async getCalendars (this: That, params?: T.MlGetCalendarsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] const acceptedBody: string[] = ['page'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -832,16 +1061,27 @@ export default class Ml { async getCategories (this: That, params: T.MlGetCategoriesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'category_id'] const acceptedBody: string[] = ['page'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -875,14 +1115,24 @@ export default class Ml { async getDataFrameAnalytics (this: That, params?: T.MlGetDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async getDataFrameAnalytics (this: That, params?: T.MlGetDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -915,14 +1165,24 @@ export default class Ml { async getDataFrameAnalyticsStats (this: That, params?: T.MlGetDataFrameAnalyticsStatsRequest, options?: TransportRequestOptions): Promise async getDataFrameAnalyticsStats (this: That, params?: T.MlGetDataFrameAnalyticsStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -955,14 +1215,24 @@ export default class Ml { async getDatafeedStats (this: That, params?: T.MlGetDatafeedStatsRequest, options?: TransportRequestOptions): Promise async getDatafeedStats (this: That, params?: T.MlGetDatafeedStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -995,14 +1265,24 @@ export default class Ml { async getDatafeeds (this: That, params?: T.MlGetDatafeedsRequest, options?: TransportRequestOptions): Promise async getDatafeeds (this: That, params?: T.MlGetDatafeedsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1035,14 +1315,24 @@ export default class Ml { async getFilters (this: That, params?: T.MlGetFiltersRequest, options?: TransportRequestOptions): Promise async getFilters (this: That, params?: T.MlGetFiltersRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['filter_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1076,16 +1366,27 @@ export default class Ml { async getInfluencers (this: That, params: T.MlGetInfluencersRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['page'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1111,14 +1412,24 @@ export default class Ml { async getJobStats (this: That, params?: T.MlGetJobStatsRequest, options?: TransportRequestOptions): Promise async getJobStats (this: That, params?: T.MlGetJobStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1151,14 +1462,24 @@ export default class Ml { async getJobs (this: That, params?: T.MlGetJobsRequest, options?: TransportRequestOptions): Promise async getJobs (this: That, params?: T.MlGetJobsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1191,14 +1512,24 @@ export default class Ml { async getMemoryStats (this: That, params?: T.MlGetMemoryStatsRequest, options?: TransportRequestOptions): Promise async getMemoryStats (this: That, params?: T.MlGetMemoryStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1231,13 +1562,23 @@ export default class Ml { async getModelSnapshotUpgradeStats (this: That, params: T.MlGetModelSnapshotUpgradeStatsRequest, options?: TransportRequestOptions): Promise async getModelSnapshotUpgradeStats (this: That, params: T.MlGetModelSnapshotUpgradeStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1265,16 +1606,27 @@ export default class Ml { async getModelSnapshots (this: That, params: T.MlGetModelSnapshotsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] const acceptedBody: string[] = ['desc', 'end', 'page', 'sort', 'start'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1309,16 +1661,27 @@ export default class Ml { async getOverallBuckets (this: That, params: T.MlGetOverallBucketsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['allow_no_match', 'bucket_span', 'end', 'exclude_interim', 'overall_score', 'start', 'top_n'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1345,16 +1708,27 @@ export default class Ml { async getRecords (this: That, params: T.MlGetRecordsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['desc', 'end', 'exclude_interim', 'page', 'record_score', 'sort', 'start'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1380,14 +1754,24 @@ export default class Ml { async getTrainedModels (this: That, params?: T.MlGetTrainedModelsRequest, options?: TransportRequestOptions): Promise async getTrainedModels (this: That, params?: T.MlGetTrainedModelsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1420,14 +1804,24 @@ export default class Ml { async getTrainedModelsStats (this: That, params?: T.MlGetTrainedModelsStatsRequest, options?: TransportRequestOptions): Promise async getTrainedModelsStats (this: That, params?: T.MlGetTrainedModelsStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1461,16 +1855,27 @@ export default class Ml { async inferTrainedModel (this: That, params: T.MlInferTrainedModelRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] const acceptedBody: string[] = ['docs', 'inference_config'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1496,14 +1901,24 @@ export default class Ml { async info (this: That, params?: T.MlInfoRequest, options?: TransportRequestOptions): Promise async info (this: That, params?: T.MlInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1527,16 +1942,27 @@ export default class Ml { async openJob (this: That, params: T.MlOpenJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['timeout'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1563,16 +1989,27 @@ export default class Ml { async postCalendarEvents (this: That, params: T.MlPostCalendarEventsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] const acceptedBody: string[] = ['events'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1599,16 +2036,17 @@ export default class Ml { async postData (this: That, params: T.MlPostDataRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['data'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1635,17 +2073,28 @@ export default class Ml { async previewDataFrameAnalytics (this: That, params?: T.MlPreviewDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['config'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1679,17 +2128,28 @@ export default class Ml { async previewDatafeed (this: That, params?: T.MlPreviewDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] const acceptedBody: string[] = ['datafeed_config', 'job_config'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1723,16 +2183,27 @@ export default class Ml { async putCalendar (this: That, params: T.MlPutCalendarRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] const acceptedBody: string[] = ['job_ids', 'description'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1758,13 +2229,23 @@ export default class Ml { async putCalendarJob (this: That, params: T.MlPutCalendarJobRequest, options?: TransportRequestOptions): Promise async putCalendarJob (this: That, params: T.MlPutCalendarJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id', 'job_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1792,16 +2273,27 @@ export default class Ml { async putDataFrameAnalytics (this: That, params: T.MlPutDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['allow_lazy_start', 'analysis', 'analyzed_fields', 'description', 'dest', 'max_num_threads', '_meta', 'model_memory_limit', 'source', 'headers', 'version'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1828,16 +2320,27 @@ export default class Ml { async putDatafeed (this: That, params: T.MlPutDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] const acceptedBody: string[] = ['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', 'headers'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1864,16 +2367,27 @@ export default class Ml { async putFilter (this: That, params: T.MlPutFilterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['filter_id'] const acceptedBody: string[] = ['description', 'items'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1900,16 +2414,27 @@ export default class Ml { async putJob (this: That, params: T.MlPutJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['allow_lazy_open', 'analysis_config', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'daily_model_snapshot_retention_after_days', 'data_description', 'datafeed_config', 'description', 'job_id', 'groups', 'model_plot_config', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_index_name', 'results_retention_days'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1936,16 +2461,27 @@ export default class Ml { async putTrainedModel (this: That, params: T.MlPutTrainedModelRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] const acceptedBody: string[] = ['compressed_definition', 'definition', 'description', 'inference_config', 'input', 'metadata', 'model_type', 'model_size_bytes', 'platform_architecture', 'tags', 'prefix_strings'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1971,13 +2507,23 @@ export default class Ml { async putTrainedModelAlias (this: That, params: T.MlPutTrainedModelAliasRequest, options?: TransportRequestOptions): Promise async putTrainedModelAlias (this: That, params: T.MlPutTrainedModelAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_alias', 'model_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2005,16 +2551,27 @@ export default class Ml { async putTrainedModelDefinitionPart (this: That, params: T.MlPutTrainedModelDefinitionPartRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id', 'part'] const acceptedBody: string[] = ['definition', 'total_definition_length', 'total_parts'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2042,16 +2599,27 @@ export default class Ml { async putTrainedModelVocabulary (this: That, params: T.MlPutTrainedModelVocabularyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] const acceptedBody: string[] = ['vocabulary', 'merges', 'scores'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2077,13 +2645,23 @@ export default class Ml { async resetJob (this: That, params: T.MlResetJobRequest, options?: TransportRequestOptions): Promise async resetJob (this: That, params: T.MlResetJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2110,16 +2688,27 @@ export default class Ml { async revertModelSnapshot (this: That, params: T.MlRevertModelSnapshotRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] const acceptedBody: string[] = ['delete_intervening_results'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2146,14 +2735,24 @@ export default class Ml { async setUpgradeMode (this: That, params?: T.MlSetUpgradeModeRequest, options?: TransportRequestOptions): Promise async setUpgradeMode (this: That, params?: T.MlSetUpgradeModeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2176,13 +2775,23 @@ export default class Ml { async startDataFrameAnalytics (this: That, params: T.MlStartDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async startDataFrameAnalytics (this: That, params: T.MlStartDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2209,16 +2818,27 @@ export default class Ml { async startDatafeed (this: That, params: T.MlStartDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] const acceptedBody: string[] = ['end', 'start', 'timeout'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2244,13 +2864,23 @@ export default class Ml { async startTrainedModelDeployment (this: That, params: T.MlStartTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise async startTrainedModelDeployment (this: That, params: T.MlStartTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2276,13 +2906,23 @@ export default class Ml { async stopDataFrameAnalytics (this: That, params: T.MlStopDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async stopDataFrameAnalytics (this: That, params: T.MlStopDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2309,16 +2949,27 @@ export default class Ml { async stopDatafeed (this: That, params: T.MlStopDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] const acceptedBody: string[] = ['allow_no_match', 'force', 'timeout'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2344,13 +2995,23 @@ export default class Ml { async stopTrainedModelDeployment (this: That, params: T.MlStopTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise async stopTrainedModelDeployment (this: That, params: T.MlStopTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2377,16 +3038,27 @@ export default class Ml { async updateDataFrameAnalytics (this: That, params: T.MlUpdateDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['description', 'model_memory_limit', 'max_num_threads', 'allow_lazy_start'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2413,16 +3085,27 @@ export default class Ml { async updateDatafeed (this: That, params: T.MlUpdateDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] const acceptedBody: string[] = ['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'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2449,16 +3132,27 @@ export default class Ml { async updateFilter (this: That, params: T.MlUpdateFilterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['filter_id'] const acceptedBody: string[] = ['add_items', 'description', 'remove_items'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2485,16 +3179,27 @@ export default class Ml { async updateJob (this: That, params: T.MlUpdateJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] const acceptedBody: string[] = ['allow_lazy_open', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'categorization_filters', 'description', 'model_plot_config', 'model_prune_window', 'daily_model_snapshot_retention_after_days', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_retention_days', 'groups', 'detectors', 'per_partition_categorization'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2521,16 +3226,27 @@ export default class Ml { async updateModelSnapshot (this: That, params: T.MlUpdateModelSnapshotRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] const acceptedBody: string[] = ['description', 'retain'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2558,16 +3274,27 @@ export default class Ml { async updateTrainedModelDeployment (this: That, params: T.MlUpdateTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] const acceptedBody: string[] = ['number_of_allocations'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2593,13 +3320,23 @@ export default class Ml { async upgradeJobSnapshot (this: That, params: T.MlUpgradeJobSnapshotRequest, options?: TransportRequestOptions): Promise async upgradeJobSnapshot (this: That, params: T.MlUpgradeJobSnapshotRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2627,17 +3364,28 @@ export default class Ml { async validate (this: That, params?: T.MlValidateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['job_id', 'analysis_config', 'analysis_limits', 'data_description', 'description', 'model_plot', 'model_snapshot_id', 'model_snapshot_retention_days', 'results_index_name'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2661,16 +3409,17 @@ export default class Ml { async validateDetector (this: That, params: T.MlValidateDetectorRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['detector'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/monitoring.ts b/src/api/api/monitoring.ts index 70360e38e..c4a09fc33 100644 --- a/src/api/api/monitoring.ts +++ b/src/api/api/monitoring.ts @@ -53,16 +53,17 @@ export default class Monitoring { async bulk (this: That, params: T.MonitoringBulkRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['type'] const acceptedBody: string[] = ['operations'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/msearch.ts b/src/api/api/msearch.ts index 7575ba44c..575e95b19 100644 --- a/src/api/api/msearch.ts +++ b/src/api/api/msearch.ts @@ -47,16 +47,17 @@ export default async function MsearchApi> (this: That, params: T.MsearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['searches'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/msearch_template.ts b/src/api/api/msearch_template.ts index 9247cf4b9..54ffc9d32 100644 --- a/src/api/api/msearch_template.ts +++ b/src/api/api/msearch_template.ts @@ -47,16 +47,17 @@ export default async function MsearchTemplateApi> (this: That, params: T.MsearchTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['search_templates'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/mtermvectors.ts b/src/api/api/mtermvectors.ts index 0c2d4880c..fef6e4592 100644 --- a/src/api/api/mtermvectors.ts +++ b/src/api/api/mtermvectors.ts @@ -47,17 +47,28 @@ export default async function MtermvectorsApi (this: That, params?: T.Mtermvecto export default async function MtermvectorsApi (this: That, params?: T.MtermvectorsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['docs', 'ids'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/nodes.ts b/src/api/api/nodes.ts index 3cb956ad5..27ca13040 100644 --- a/src/api/api/nodes.ts +++ b/src/api/api/nodes.ts @@ -52,13 +52,23 @@ export default class Nodes { async clearRepositoriesMeteringArchive (this: That, params: T.NodesClearRepositoriesMeteringArchiveRequest, options?: TransportRequestOptions): Promise async clearRepositoriesMeteringArchive (this: That, params: T.NodesClearRepositoriesMeteringArchiveRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id', 'max_archive_version'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -85,13 +95,23 @@ export default class Nodes { async getRepositoriesMeteringInfo (this: That, params: T.NodesGetRepositoriesMeteringInfoRequest, options?: TransportRequestOptions): Promise async getRepositoriesMeteringInfo (this: That, params: T.NodesGetRepositoriesMeteringInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -117,14 +137,24 @@ export default class Nodes { async hotThreads (this: That, params?: T.NodesHotThreadsRequest, options?: TransportRequestOptions): Promise async hotThreads (this: That, params?: T.NodesHotThreadsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -157,14 +187,24 @@ export default class Nodes { async info (this: That, params?: T.NodesInfoRequest, options?: TransportRequestOptions): Promise async info (this: That, params?: T.NodesInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id', 'metric'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -205,17 +245,28 @@ export default class Nodes { async reloadSecureSettings (this: That, params?: T.NodesReloadSecureSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] const acceptedBody: string[] = ['secure_settings_password'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -248,14 +299,24 @@ export default class Nodes { async stats (this: That, params?: T.NodesStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.NodesStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id', 'metric', 'index_metric'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -302,14 +363,24 @@ export default class Nodes { async usage (this: That, params?: T.NodesUsageRequest, options?: TransportRequestOptions): Promise async usage (this: That, params?: T.NodesUsageRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id', 'metric'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/open_point_in_time.ts b/src/api/api/open_point_in_time.ts index cf566cc3c..685e46870 100644 --- a/src/api/api/open_point_in_time.ts +++ b/src/api/api/open_point_in_time.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Open a point in time. A search request by default runs against the most recent visible data of the target indices, which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple search requests using the same point in time. For example, if refreshes happen between `search_after` requests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time. A point in time must be opened explicitly before being used in search requests. The `keep_alive` parameter tells Elasticsearch how long it should persist. + * Open a point in time. A search request by default runs against the most recent visible data of the target indices, which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple search requests using the same point in time. For example, if refreshes happen between `search_after` requests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time. A point in time must be opened explicitly before being used in search requests. A subsequent search request with the `pit` parameter must not specify `index`, `routing`, or `preference` values as these parameters are copied from the point in time. Just like regular searches, you can use `from` and `size` to page through point in time search results, up to the first 10,000 hits. If you want to retrieve more hits, use PIT with `search_after`. IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a `NoShardAvailableActionException` exception. To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. **Keeping point in time alive** The `keep_alive` parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. The value does not need to be long enough to process all data — it just needs to be long enough for the next request. Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. Once the smaller segments are no longer needed they are deleted. However, open point-in-times prevent the old segments from being deleted since they are still in use. TIP: Keeping older segments alive means that more disk space and file handles are needed. Ensure that you have configured your nodes to have ample free file handles. Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. Note that a point-in-time doesn't prevent its associated indices from being deleted. You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html | Elasticsearch API documentation} */ export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -47,16 +47,27 @@ export default async function OpenPointInTimeApi (this: That, params: T.OpenPoin export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['index_filter'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/ping.ts b/src/api/api/ping.ts index c9a086011..277e3c725 100644 --- a/src/api/api/ping.ts +++ b/src/api/api/ping.ts @@ -46,14 +46,24 @@ export default async function PingApi (this: That, params?: T.PingRequest, optio export default async function PingApi (this: That, params?: T.PingRequest, options?: TransportRequestOptions): Promise export default async function PingApi (this: That, params?: T.PingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/profiling.ts b/src/api/api/profiling.ts index 2abd1c907..75f2d46cc 100644 --- a/src/api/api/profiling.ts +++ b/src/api/api/profiling.ts @@ -52,14 +52,24 @@ export default class Profiling { async flamegraph (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async flamegraph (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -81,14 +91,24 @@ export default class Profiling { async stacktraces (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async stacktraces (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -110,14 +130,24 @@ export default class Profiling { async status (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async status (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -139,14 +169,24 @@ export default class Profiling { async topnFunctions (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async topnFunctions (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } diff --git a/src/api/api/put_script.ts b/src/api/api/put_script.ts index f42e42c3b..a989cf966 100644 --- a/src/api/api/put_script.ts +++ b/src/api/api/put_script.ts @@ -47,16 +47,27 @@ export default async function PutScriptApi (this: That, params: T.PutScriptReque export default async function PutScriptApi (this: That, params: T.PutScriptRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'context'] const acceptedBody: string[] = ['script'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/query_rules.ts b/src/api/api/query_rules.ts index ff826dd38..efddebcc9 100644 --- a/src/api/api/query_rules.ts +++ b/src/api/api/query_rules.ts @@ -52,13 +52,23 @@ export default class QueryRules { async deleteRule (this: That, params: T.QueryRulesDeleteRuleRequest, options?: TransportRequestOptions): Promise async deleteRule (this: That, params: T.QueryRulesDeleteRuleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['ruleset_id', 'rule_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -85,13 +95,23 @@ export default class QueryRules { async deleteRuleset (this: That, params: T.QueryRulesDeleteRulesetRequest, options?: TransportRequestOptions): Promise async deleteRuleset (this: That, params: T.QueryRulesDeleteRulesetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['ruleset_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -117,13 +137,23 @@ export default class QueryRules { async getRule (this: That, params: T.QueryRulesGetRuleRequest, options?: TransportRequestOptions): Promise async getRule (this: That, params: T.QueryRulesGetRuleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['ruleset_id', 'rule_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -150,13 +180,23 @@ export default class QueryRules { async getRuleset (this: That, params: T.QueryRulesGetRulesetRequest, options?: TransportRequestOptions): Promise async getRuleset (this: That, params: T.QueryRulesGetRulesetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['ruleset_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -182,14 +222,24 @@ export default class QueryRules { async listRulesets (this: That, params?: T.QueryRulesListRulesetsRequest, options?: TransportRequestOptions): Promise async listRulesets (this: That, params?: T.QueryRulesListRulesetsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -213,16 +263,27 @@ export default class QueryRules { async putRule (this: That, params: T.QueryRulesPutRuleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['ruleset_id', 'rule_id'] const acceptedBody: string[] = ['type', 'criteria', 'actions', 'priority'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -250,16 +311,27 @@ export default class QueryRules { async putRuleset (this: That, params: T.QueryRulesPutRulesetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['ruleset_id'] const acceptedBody: string[] = ['rules'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -286,16 +358,27 @@ export default class QueryRules { async test (this: That, params: T.QueryRulesTestRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['ruleset_id'] const acceptedBody: string[] = ['match_criteria'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/rank_eval.ts b/src/api/api/rank_eval.ts index bafa83313..890b2eec2 100644 --- a/src/api/api/rank_eval.ts +++ b/src/api/api/rank_eval.ts @@ -47,16 +47,27 @@ export default async function RankEvalApi (this: That, params: T.RankEvalRequest export default async function RankEvalApi (this: That, params: T.RankEvalRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['requests', 'metric'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/reindex.ts b/src/api/api/reindex.ts index 4ef63245c..74f29853c 100644 --- a/src/api/api/reindex.ts +++ b/src/api/api/reindex.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Reindex documents. Copies documents from a source to a destination. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself. + * Reindex documents. Copy documents from a source to a destination. You can copy all documents to the destination index or reindex a subset of the documents. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself. IMPORTANT: Reindex requires `_source` to be enabled for all documents in the source. The destination should be configured as wanted before calling the reindex API. Reindex does not copy the settings from the source or its associated template. Mappings, shard counts, and replicas, for example, must be configured ahead of time. If the Elasticsearch security features are enabled, you must have the following security privileges: * The `read` index privilege for the source data stream, index, or alias. * The `write` index privilege for the destination data stream, index, or index alias. * To automatically create a data stream or index with a reindex API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege for the destination data stream, index, or alias. * If reindexing from a remote cluster, the `source.remote.user` must have the `monitor` cluster privilege and the `read` index privilege for the source data stream, index, or alias. If reindexing from a remote cluster, you must explicitly allow the remote host in the `reindex.remote.whitelist` setting. Automatic data stream creation requires a matching index template with data stream enabled. The `dest` element can be configured like the index API to control optimistic concurrency control. Omitting `version_type` or setting it to `internal` causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. Setting `version_type` to `external` causes Elasticsearch to preserve the `version` from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. Setting `op_type` to `create` causes the reindex API to create only missing documents in the destination. All existing documents will cause a version conflict. IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an `op_type` of `create`. A reindex can only add new documents to a destination data stream. It cannot update existing documents in a destination data stream. By default, version conflicts abort the reindex process. To continue reindexing if there are conflicts, set the `conflicts` request body property to `proceed`. In this case, the response includes a count of the version conflicts that were encountered. Note that the handling of other error types is unaffected by the `conflicts` property. Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query. NOTE: The reindex API makes no effort to handle ID collisions. The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. Instead, make sure that IDs are unique by using a script. **Running reindex asynchronously** If the request contains `wait_for_completion=false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at `_tasks/`. **Reindex from multiple sources** If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. That way you can resume the process if there are any errors by removing the partially completed source and starting over. It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. For example, you can use a bash script like this: ``` for index in i1 i2 i3 i4 i5; do curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ "source": { "index": "'$index'" }, "dest": { "index": "'$index'-reindexed" } }' done ``` **Throttling** Set `requests_per_second` to any positive decimal number (`1.4`, `6`, `1000`, for example) to throttle the rate at which reindex issues batches of index operations. Requests are throttled by padding each batch with a wait time. To turn off throttling, set `requests_per_second` to `-1`. The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. The padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing. By default the batch size is `1000`, so if `requests_per_second` is set to `500`: ``` target_time = 1000 / 500 per second = 2 seconds wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds ``` Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. This is "bursty" instead of "smooth". **Slicing** Reindex supports sliced scroll to parallelize the reindexing process. This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. NOTE: Reindexing from remote clusters does not support manual or automatic slicing. You can slice a reindex request manually by providing a slice ID and total number of slices to each request. You can also let reindex automatically parallelize by using sliced scroll to slice on `_id`. The `slices` parameter specifies the number of slices to use. Adding `slices` to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: * You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. * Fetching the status of the task for the request with `slices` only contains the status of completed slices. * These sub-requests are individually addressable for things like cancellation and rethrottling. * Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally. * Canceling the request with `slices` will cancel each sub-request. * Due to the nature of `slices`, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. * Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being reindexed. * Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. If slicing automatically, setting `slices` to `auto` will choose a reasonable number for most indices. If slicing manually or otherwise tuning automatic slicing, use the following guidelines. Query performance is most efficient when the number of slices is equal to the number of shards in the index. If that number is large (for example, `500`), choose a lower number as too many slices will hurt performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. Indexing performance scales linearly across available resources with the number of slices. Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. **Modify documents during reindexing** Like `_update_by_query`, reindex operations support a script that modifies the document. Unlike `_update_by_query`, the script is allowed to modify the document's metadata. Just as in `_update_by_query`, you can set `ctx.op` to change the operation that is run on the destination. For example, set `ctx.op` to `noop` if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the `noop` counter in the response body. Set `ctx.op` to `delete` if your script decides that the document must be deleted from the destination. The deletion will be reported in the `deleted` counter in the response body. Setting `ctx.op` to anything else will return an error, as will setting any other field in `ctx`. Think of the possibilities! Just be careful; you are able to change: * `_id` * `_index` * `_version` * `_routing` Setting `_version` to `null` or clearing it from the `ctx` map is just like not sending the version in an indexing request. It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. **Reindex from remote** Reindex supports reindexing from a remote Elasticsearch cluster. The `host` parameter must contain a scheme, host, port, and optional path. The `username` and `password` parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. There are a range of settings available to configure the behavior of the HTTPS connection. When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. Remote hosts must be explicitly allowed with the `reindex.remote.whitelist` setting. It can be set to a comma delimited list of allowed remote host and port combinations. Scheme is ignored; only the host and port are used. For example: ``` reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] ``` The list of allowed hosts must be configured on any nodes that will coordinate the reindex. This feature should work with remote clusters of any version of Elasticsearch. This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. WARNING: Elasticsearch does not support forward compatibility across major versions. For example, you cannot reindex from a 7.x cluster into a 6.x cluster. To enable queries sent to older versions of Elasticsearch, the `query` parameter is sent directly to the remote host without validation or modification. NOTE: Reindexing from remote clusters does not support manual or automatic slicing. Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. If the remote index includes very large documents you'll need to use a smaller batch size. It is also possible to set the socket read timeout on the remote connection with the `socket_timeout` field and the connection timeout with the `connect_timeout` field. Both default to 30 seconds. **Configuring SSL parameters** Reindex from remote supports configurable SSL settings. These must be specified in the `elasticsearch.yml` file, with the exception of the secure settings, which you add in the Elasticsearch keystore. It is not possible to configure SSL in the body of the reindex request. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html | Elasticsearch API documentation} */ export default async function ReindexApi (this: That, params: T.ReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -47,16 +47,27 @@ export default async function ReindexApi (this: That, params: T.ReindexRequest, export default async function ReindexApi (this: That, params: T.ReindexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['conflicts', 'dest', 'max_docs', 'script', 'size', 'source'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/reindex_rethrottle.ts b/src/api/api/reindex_rethrottle.ts index 5cd9e6d88..9653803eb 100644 --- a/src/api/api/reindex_rethrottle.ts +++ b/src/api/api/reindex_rethrottle.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Throttle a reindex operation. Change the number of requests per second for a particular reindex operation. + * Throttle a reindex operation. Change the number of requests per second for a particular reindex operation. For example: ``` POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 ``` Rethrottling that speeds up the query takes effect immediately. Rethrottling that slows down the query will take effect after completing the current batch. This behavior prevents scroll timeouts. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html | Elasticsearch API documentation} */ export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -46,13 +46,23 @@ export default async function ReindexRethrottleApi (this: That, params: T.Reinde export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest, options?: TransportRequestOptions): Promise export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/render_search_template.ts b/src/api/api/render_search_template.ts index 3a55809e1..650ba34b1 100644 --- a/src/api/api/render_search_template.ts +++ b/src/api/api/render_search_template.ts @@ -47,17 +47,28 @@ export default async function RenderSearchTemplateApi (this: That, params?: T.Re export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['file', 'params', 'source'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/rollup.ts b/src/api/api/rollup.ts index 36fbbee92..16401f165 100644 --- a/src/api/api/rollup.ts +++ b/src/api/api/rollup.ts @@ -52,13 +52,23 @@ export default class Rollup { async deleteJob (this: That, params: T.RollupDeleteJobRequest, options?: TransportRequestOptions): Promise async deleteJob (this: That, params: T.RollupDeleteJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,14 +94,24 @@ export default class Rollup { async getJobs (this: That, params?: T.RollupGetJobsRequest, options?: TransportRequestOptions): Promise async getJobs (this: That, params?: T.RollupGetJobsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -124,14 +144,24 @@ export default class Rollup { async getRollupCaps (this: That, params?: T.RollupGetRollupCapsRequest, options?: TransportRequestOptions): Promise async getRollupCaps (this: That, params?: T.RollupGetRollupCapsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -164,13 +194,23 @@ export default class Rollup { async getRollupIndexCaps (this: That, params: T.RollupGetRollupIndexCapsRequest, options?: TransportRequestOptions): Promise async getRollupIndexCaps (this: That, params: T.RollupGetRollupIndexCapsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -197,16 +237,27 @@ export default class Rollup { async putJob (this: That, params: T.RollupPutJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['cron', 'groups', 'index_pattern', 'metrics', 'page_size', 'rollup_index', 'timeout', 'headers'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -233,16 +284,27 @@ export default class Rollup { async rollupSearch> (this: That, params: T.RollupRollupSearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['aggregations', 'aggs', 'query', 'size'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -268,13 +330,23 @@ export default class Rollup { async startJob (this: That, params: T.RollupStartJobRequest, options?: TransportRequestOptions): Promise async startJob (this: That, params: T.RollupStartJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -300,13 +372,23 @@ export default class Rollup { async stopJob (this: That, params: T.RollupStopJobRequest, options?: TransportRequestOptions): Promise async stopJob (this: That, params: T.RollupStopJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/scripts_painless_execute.ts b/src/api/api/scripts_painless_execute.ts index 25df53762..bbafbeff1 100644 --- a/src/api/api/scripts_painless_execute.ts +++ b/src/api/api/scripts_painless_execute.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Run a script. Runs a script and returns a result. + * Run a script. Runs a script and returns a result. Use this API to build and test scripts, such as when defining a script for a runtime field. This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster. The API uses several _contexts_, which control how scripts are run, what variables are available at runtime, and what the return type is. Each context requires a script, but additional parameters depend on the context you're using for that script. * @see {@link https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html | Elasticsearch API documentation} */ export default async function ScriptsPainlessExecuteApi (this: That, params?: T.ScriptsPainlessExecuteRequest, options?: TransportRequestOptionsWithOutMeta): Promise> @@ -47,17 +47,28 @@ export default async function ScriptsPainlessExecuteApi (this export default async function ScriptsPainlessExecuteApi (this: That, params?: T.ScriptsPainlessExecuteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['context', 'context_setup', 'script'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/scroll.ts b/src/api/api/scroll.ts index b2ccbb07a..e6b3fb611 100644 --- a/src/api/api/scroll.ts +++ b/src/api/api/scroll.ts @@ -47,16 +47,27 @@ export default async function ScrollApi> (this: That, params: T.ScrollRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['scroll', 'scroll_id'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/search.ts b/src/api/api/search.ts index ec845a47c..11294d979 100644 --- a/src/api/api/search.ts +++ b/src/api/api/search.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Run a search. Get search hits that match the query defined in the request. You can provide search queries using the `q` query string parameter or the request body. If both are specified, only the query parameter is used. + * Run a search. Get search hits that match the query defined in the request. You can provide search queries using the `q` query string parameter or the request body. If both are specified, only the query parameter is used. If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. To search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices. **Search slicing** When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties. By default the splitting is done first on the shards, then locally on each shard. The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. IMPORTANT: The same point-in-time ID should be used for all slices. If different PIT IDs are used, slices can overlap and miss documents. This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html | Elasticsearch API documentation} */ export default async function SearchApi> (this: That, params?: T.SearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise> @@ -47,12 +47,23 @@ export default async function SearchApi> (this: That, params?: T.SearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'rank', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'retriever', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedBody.includes(key)) { + body = body ?? {} if (key === 'sort' && typeof params[key] === 'string' && params[key].includes(':')) { // eslint-disable-line querystring[key] = params[key] } else { @@ -61,7 +72,7 @@ export default async function SearchApi async delete (this: That, params: T.SearchApplicationDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class SearchApplication { async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,13 +136,23 @@ export default class SearchApplication { async get (this: That, params: T.SearchApplicationGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params: T.SearchApplicationGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -148,14 +178,24 @@ export default class SearchApplication { async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -188,14 +228,24 @@ export default class SearchApplication { async list (this: That, params?: T.SearchApplicationListRequest, options?: TransportRequestOptions): Promise async list (this: That, params?: T.SearchApplicationListRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -219,16 +269,17 @@ export default class SearchApplication { async postBehavioralAnalyticsEvent (this: That, params: T.SearchApplicationPostBehavioralAnalyticsEventRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['collection_name', 'event_type'] const acceptedBody: string[] = ['payload'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -256,16 +307,17 @@ export default class SearchApplication { async put (this: That, params: T.SearchApplicationPutRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['search_application'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -291,13 +343,23 @@ export default class SearchApplication { async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -324,16 +386,27 @@ export default class SearchApplication { async renderQuery (this: That, params: T.SearchApplicationRenderQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['params'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -360,16 +433,27 @@ export default class SearchApplication { async search> (this: That, params: T.SearchApplicationSearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['params'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/search_mvt.ts b/src/api/api/search_mvt.ts index c76751fbb..54e002d7a 100644 --- a/src/api/api/search_mvt.ts +++ b/src/api/api/search_mvt.ts @@ -47,16 +47,27 @@ export default async function SearchMvtApi (this: That, params: T.SearchMvtReque export default async function SearchMvtApi (this: That, params: T.SearchMvtRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'field', 'zoom', 'x', 'y'] const acceptedBody: string[] = ['aggs', 'buffer', 'exact_bounds', 'extent', 'fields', 'grid_agg', 'grid_precision', 'grid_type', 'query', 'runtime_mappings', 'size', 'sort', 'track_total_hits', 'with_labels'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/search_shards.ts b/src/api/api/search_shards.ts index e5d724e02..544660325 100644 --- a/src/api/api/search_shards.ts +++ b/src/api/api/search_shards.ts @@ -46,14 +46,24 @@ export default async function SearchShardsApi (this: That, params?: T.SearchShar export default async function SearchShardsApi (this: That, params?: T.SearchShardsRequest, options?: TransportRequestOptions): Promise export default async function SearchShardsApi (this: That, params?: T.SearchShardsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/search_template.ts b/src/api/api/search_template.ts index 30c828f0a..2bcef664e 100644 --- a/src/api/api/search_template.ts +++ b/src/api/api/search_template.ts @@ -47,17 +47,28 @@ export default async function SearchTemplateApi (this: That export default async function SearchTemplateApi (this: That, params?: T.SearchTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['explain', 'id', 'params', 'profile', 'source'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/searchable_snapshots.ts b/src/api/api/searchable_snapshots.ts index 037bcca8c..d26592c27 100644 --- a/src/api/api/searchable_snapshots.ts +++ b/src/api/api/searchable_snapshots.ts @@ -52,14 +52,24 @@ export default class SearchableSnapshots { async cacheStats (this: That, params?: T.SearchableSnapshotsCacheStatsRequest, options?: TransportRequestOptions): Promise async cacheStats (this: That, params?: T.SearchableSnapshotsCacheStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -92,14 +102,24 @@ export default class SearchableSnapshots { async clearCache (this: That, params?: T.SearchableSnapshotsClearCacheRequest, options?: TransportRequestOptions): Promise async clearCache (this: That, params?: T.SearchableSnapshotsClearCacheRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -133,16 +153,27 @@ export default class SearchableSnapshots { async mount (this: That, params: T.SearchableSnapshotsMountRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] const acceptedBody: string[] = ['index', 'renamed_index', 'index_settings', 'ignore_index_settings'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -169,14 +200,24 @@ export default class SearchableSnapshots { async stats (this: That, params?: T.SearchableSnapshotsStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.SearchableSnapshotsStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/security.ts b/src/api/api/security.ts index 8f2309225..201d2c550 100644 --- a/src/api/api/security.ts +++ b/src/api/api/security.ts @@ -44,7 +44,7 @@ export default class Security { } /** - * Activate a user profile. Create or update a user profile on behalf of another user. + * Activate a user profile. Create or update a user profile on behalf of another user. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. The calling application must have either an `access_token` or a combination of `username` and `password` for the user that the profile document is intended for. Elastic reserves the right to change or remove this feature in future releases without prior notice. This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including `username`, `full_name,` `roles`, and the authentication realm. For example, in the JWT `access_token` case, the profile user's `username` is extracted from the JWT token claim pointed to by the `claims.principal` setting of the JWT realm that authenticated the token. When updating a profile document, the API enables the document if it was disabled. Any updates do not change existing content for either the `labels` or `data` fields. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-activate-user-profile.html | Elasticsearch API documentation} */ async activateUserProfile (this: That, params: T.SecurityActivateUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -53,16 +53,27 @@ export default class Security { async activateUserProfile (this: That, params: T.SecurityActivateUserProfileRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['access_token', 'grant_type', 'password', 'username'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -85,14 +96,24 @@ export default class Security { async authenticate (this: That, params?: T.SecurityAuthenticateRequest, options?: TransportRequestOptions): Promise async authenticate (this: That, params?: T.SecurityAuthenticateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,16 +137,27 @@ export default class Security { async bulkDeleteRole (this: That, params: T.SecurityBulkDeleteRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['names'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -149,16 +181,27 @@ export default class Security { async bulkPutRole (this: That, params: T.SecurityBulkPutRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['roles'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -182,16 +225,27 @@ export default class Security { async bulkUpdateApiKeys (this: That, params: T.SecurityBulkUpdateApiKeysRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['expiration', 'ids', 'metadata', 'role_descriptors'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -215,17 +269,28 @@ export default class Security { async changePassword (this: That, params?: T.SecurityChangePasswordRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] const acceptedBody: string[] = ['password', 'password_hash'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -258,13 +323,23 @@ export default class Security { async clearApiKeyCache (this: That, params: T.SecurityClearApiKeyCacheRequest, options?: TransportRequestOptions): Promise async clearApiKeyCache (this: That, params: T.SecurityClearApiKeyCacheRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['ids'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -290,13 +365,23 @@ export default class Security { async clearCachedPrivileges (this: That, params: T.SecurityClearCachedPrivilegesRequest, options?: TransportRequestOptions): Promise async clearCachedPrivileges (this: That, params: T.SecurityClearCachedPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['application'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -314,7 +399,7 @@ export default class Security { } /** - * Clear the user cache. Evict users from the user cache. You can completely clear the cache or evict specific users. + * Clear the user cache. Evict users from the user cache. You can completely clear the cache or evict specific users. User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. There are realm settings that you can use to configure the user cache. For more information, refer to the documentation about controlling the user cache. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-cache.html | Elasticsearch API documentation} */ async clearCachedRealms (this: That, params: T.SecurityClearCachedRealmsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -322,13 +407,23 @@ export default class Security { async clearCachedRealms (this: That, params: T.SecurityClearCachedRealmsRequest, options?: TransportRequestOptions): Promise async clearCachedRealms (this: That, params: T.SecurityClearCachedRealmsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['realms'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -354,13 +449,23 @@ export default class Security { async clearCachedRoles (this: That, params: T.SecurityClearCachedRolesRequest, options?: TransportRequestOptions): Promise async clearCachedRoles (this: That, params: T.SecurityClearCachedRolesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -378,7 +483,7 @@ export default class Security { } /** - * Clear service account token caches. Evict a subset of all entries from the service account token caches. + * Clear service account token caches. Evict a subset of all entries from the service account token caches. Two separate caches exist for service account tokens: one cache for tokens backed by the `service_tokens` file, and another for tokens backed by the `.security` index. This API clears matching entries from both caches. The cache for service account tokens backed by the `.security` index is cleared automatically on state changes of the security index. The cache for tokens backed by the `service_tokens` file is cleared automatically on file changes. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-service-token-caches.html | Elasticsearch API documentation} */ async clearCachedServiceTokens (this: That, params: T.SecurityClearCachedServiceTokensRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -386,13 +491,23 @@ export default class Security { async clearCachedServiceTokens (this: That, params: T.SecurityClearCachedServiceTokensRequest, options?: TransportRequestOptions): Promise async clearCachedServiceTokens (this: That, params: T.SecurityClearCachedServiceTokensRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service', 'name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -412,7 +527,7 @@ export default class Security { } /** - * Create an API key. Create an API key for access without requiring basic authentication. A successful request returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + * Create an API key. Create an API key for access without requiring basic authentication. IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. If you specify privileges, the API returns an error. A successful request returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. The API keys are created by the Elasticsearch API key service, which is automatically enabled. To configure or turn off the API key service, refer to API key service setting documentation. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-create-api-key.html | Elasticsearch API documentation} */ async createApiKey (this: That, params?: T.SecurityCreateApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -421,17 +536,28 @@ export default class Security { async createApiKey (this: That, params?: T.SecurityCreateApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['expiration', 'name', 'role_descriptors', 'metadata'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -455,16 +581,27 @@ export default class Security { async createCrossClusterApiKey (this: That, params: T.SecurityCreateCrossClusterApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['access', 'expiration', 'metadata', 'name'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -479,7 +616,7 @@ export default class Security { } /** - * Create a service account token. Create a service accounts token for access without requiring basic authentication. + * Create a service account token. Create a service accounts token for access without requiring basic authentication. NOTE: Service account tokens never expire. You must actively delete them if they are no longer needed. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-create-service-token.html | Elasticsearch API documentation} */ async createServiceToken (this: That, params: T.SecurityCreateServiceTokenRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -487,13 +624,23 @@ export default class Security { async createServiceToken (this: That, params: T.SecurityCreateServiceTokenRequest, options?: TransportRequestOptions): Promise async createServiceToken (this: That, params: T.SecurityCreateServiceTokenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service', 'name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -529,16 +676,27 @@ export default class Security { async delegatePki (this: That, params: T.SecurityDelegatePkiRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['x509_certificate_chain'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -553,7 +711,7 @@ export default class Security { } /** - * Delete application privileges. + * Delete application privileges. To use this API, you must have one of the following privileges: * The `manage_security` cluster privilege (or a greater privilege such as `all`). * The "Manage Application Privileges" global privilege for the application being referenced in the request. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-privilege.html | Elasticsearch API documentation} */ async deletePrivileges (this: That, params: T.SecurityDeletePrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -561,13 +719,23 @@ export default class Security { async deletePrivileges (this: That, params: T.SecurityDeletePrivilegesRequest, options?: TransportRequestOptions): Promise async deletePrivileges (this: That, params: T.SecurityDeletePrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['application', 'name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -586,7 +754,7 @@ export default class Security { } /** - * Delete roles. Delete roles in the native realm. + * Delete roles. Delete roles in the native realm. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The delete roles API cannot remove roles that are defined in roles files. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-role.html | Elasticsearch API documentation} */ async deleteRole (this: That, params: T.SecurityDeleteRoleRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -594,13 +762,23 @@ export default class Security { async deleteRole (this: That, params: T.SecurityDeleteRoleRequest, options?: TransportRequestOptions): Promise async deleteRole (this: That, params: T.SecurityDeleteRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -618,7 +796,7 @@ export default class Security { } /** - * Delete role mappings. + * Delete role mappings. Role mappings define which roles are assigned to each user. The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The delete role mappings API cannot remove role mappings that are defined in role mapping files. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-role-mapping.html | Elasticsearch API documentation} */ async deleteRoleMapping (this: That, params: T.SecurityDeleteRoleMappingRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -626,13 +804,23 @@ export default class Security { async deleteRoleMapping (this: That, params: T.SecurityDeleteRoleMappingRequest, options?: TransportRequestOptions): Promise async deleteRoleMapping (this: That, params: T.SecurityDeleteRoleMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -658,13 +846,23 @@ export default class Security { async deleteServiceToken (this: That, params: T.SecurityDeleteServiceTokenRequest, options?: TransportRequestOptions): Promise async deleteServiceToken (this: That, params: T.SecurityDeleteServiceTokenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service', 'name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -692,13 +890,23 @@ export default class Security { async deleteUser (this: That, params: T.SecurityDeleteUserRequest, options?: TransportRequestOptions): Promise async deleteUser (this: That, params: T.SecurityDeleteUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -716,7 +924,7 @@ export default class Security { } /** - * Disable users. Disable users in the native realm. + * Disable users. Disable users in the native realm. By default, when you create users, they are enabled. You can use this API to revoke a user's access to Elasticsearch. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-disable-user.html | Elasticsearch API documentation} */ async disableUser (this: That, params: T.SecurityDisableUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -724,13 +932,23 @@ export default class Security { async disableUser (this: That, params: T.SecurityDisableUserRequest, options?: TransportRequestOptions): Promise async disableUser (this: That, params: T.SecurityDisableUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -748,7 +966,7 @@ export default class Security { } /** - * Disable a user profile. Disable user profiles so that they are not visible in user profile searches. + * Disable a user profile. Disable user profiles so that they are not visible in user profile searches. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. To re-enable a disabled user profile, use the enable user profile API . * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-disable-user-profile.html | Elasticsearch API documentation} */ async disableUserProfile (this: That, params: T.SecurityDisableUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -756,13 +974,23 @@ export default class Security { async disableUserProfile (this: That, params: T.SecurityDisableUserProfileRequest, options?: TransportRequestOptions): Promise async disableUserProfile (this: That, params: T.SecurityDisableUserProfileRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['uid'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -780,7 +1008,7 @@ export default class Security { } /** - * Enable users. Enable users in the native realm. + * Enable users. Enable users in the native realm. By default, when you create users, they are enabled. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-enable-user.html | Elasticsearch API documentation} */ async enableUser (this: That, params: T.SecurityEnableUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -788,13 +1016,23 @@ export default class Security { async enableUser (this: That, params: T.SecurityEnableUserRequest, options?: TransportRequestOptions): Promise async enableUser (this: That, params: T.SecurityEnableUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -812,7 +1050,7 @@ export default class Security { } /** - * Enable a user profile. Enable user profiles to make them visible in user profile searches. + * Enable a user profile. Enable user profiles to make them visible in user profile searches. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. When you activate a user profile, it's automatically enabled and visible in user profile searches. If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-enable-user-profile.html | Elasticsearch API documentation} */ async enableUserProfile (this: That, params: T.SecurityEnableUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -820,13 +1058,23 @@ export default class Security { async enableUserProfile (this: That, params: T.SecurityEnableUserProfileRequest, options?: TransportRequestOptions): Promise async enableUserProfile (this: That, params: T.SecurityEnableUserProfileRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['uid'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -844,7 +1092,7 @@ export default class Security { } /** - * Enroll Kibana. Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + * Enroll Kibana. Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. NOTE: This API is currently intended for internal use only by Kibana. Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-kibana-enrollment.html | Elasticsearch API documentation} */ async enrollKibana (this: That, params?: T.SecurityEnrollKibanaRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -852,14 +1100,24 @@ export default class Security { async enrollKibana (this: That, params?: T.SecurityEnrollKibanaRequest, options?: TransportRequestOptions): Promise async enrollKibana (this: That, params?: T.SecurityEnrollKibanaRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -874,7 +1132,7 @@ export default class Security { } /** - * Enroll a node. Enroll a new node to allow it to join an existing cluster with security features enabled. + * Enroll a node. Enroll a new node to allow it to join an existing cluster with security features enabled. The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-node-enrollment.html | Elasticsearch API documentation} */ async enrollNode (this: That, params?: T.SecurityEnrollNodeRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -882,14 +1140,24 @@ export default class Security { async enrollNode (this: That, params?: T.SecurityEnrollNodeRequest, options?: TransportRequestOptions): Promise async enrollNode (this: That, params?: T.SecurityEnrollNodeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -912,14 +1180,24 @@ export default class Security { async getApiKey (this: That, params?: T.SecurityGetApiKeyRequest, options?: TransportRequestOptions): Promise async getApiKey (this: That, params?: T.SecurityGetApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -942,14 +1220,24 @@ export default class Security { async getBuiltinPrivileges (this: That, params?: T.SecurityGetBuiltinPrivilegesRequest, options?: TransportRequestOptions): Promise async getBuiltinPrivileges (this: That, params?: T.SecurityGetBuiltinPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -964,7 +1252,7 @@ export default class Security { } /** - * Get application privileges. + * Get application privileges. To use this API, you must have one of the following privileges: * The `read_security` cluster privilege (or a greater privilege such as `manage_security` or `all`). * The "Manage Application Privileges" global privilege for the application being referenced in the request. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-privileges.html | Elasticsearch API documentation} */ async getPrivileges (this: That, params?: T.SecurityGetPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -972,14 +1260,24 @@ export default class Security { async getPrivileges (this: That, params?: T.SecurityGetPrivilegesRequest, options?: TransportRequestOptions): Promise async getPrivileges (this: That, params?: T.SecurityGetPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['application', 'name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1008,7 +1306,7 @@ export default class Security { } /** - * Get roles. Get roles in the native realm. + * Get roles. Get roles in the native realm. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The get roles API cannot retrieve roles that are defined in roles files. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-role.html | Elasticsearch API documentation} */ async getRole (this: That, params?: T.SecurityGetRoleRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1016,14 +1314,24 @@ export default class Security { async getRole (this: That, params?: T.SecurityGetRoleRequest, options?: TransportRequestOptions): Promise async getRole (this: That, params?: T.SecurityGetRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1056,14 +1364,24 @@ export default class Security { async getRoleMapping (this: That, params?: T.SecurityGetRoleMappingRequest, options?: TransportRequestOptions): Promise async getRoleMapping (this: That, params?: T.SecurityGetRoleMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1088,7 +1406,7 @@ export default class Security { } /** - * Get service accounts. Get a list of service accounts that match the provided path parameters. + * Get service accounts. Get a list of service accounts that match the provided path parameters. NOTE: Currently, only the `elastic/fleet-server` service account is available. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-service-accounts.html | Elasticsearch API documentation} */ async getServiceAccounts (this: That, params?: T.SecurityGetServiceAccountsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1096,14 +1414,24 @@ export default class Security { async getServiceAccounts (this: That, params?: T.SecurityGetServiceAccountsRequest, options?: TransportRequestOptions): Promise async getServiceAccounts (this: That, params?: T.SecurityGetServiceAccountsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1132,7 +1460,7 @@ export default class Security { } /** - * Get service account credentials. + * Get service account credentials. To use this API, you must have at least the `read_security` cluster privilege (or a greater privilege such as `manage_service_account` or `manage_security`). The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. NOTE: For tokens backed by the `service_tokens` file, the API collects them from all nodes of the cluster. Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-service-credentials.html | Elasticsearch API documentation} */ async getServiceCredentials (this: That, params: T.SecurityGetServiceCredentialsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1140,13 +1468,23 @@ export default class Security { async getServiceCredentials (this: That, params: T.SecurityGetServiceCredentialsRequest, options?: TransportRequestOptions): Promise async getServiceCredentials (this: That, params: T.SecurityGetServiceCredentialsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1165,7 +1503,7 @@ export default class Security { } /** - * Get security index settings. Get the user-configurable settings for the security internal index (`.security` and associated indices). + * Get security index settings. Get the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of the index settings — those that are user-configurable—will be shown. This includes: * `index.auto_expand_replicas` * `index.number_of_replicas` * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-settings.html | Elasticsearch API documentation} */ async getSettings (this: That, params?: T.SecurityGetSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1173,14 +1511,24 @@ export default class Security { async getSettings (this: That, params?: T.SecurityGetSettingsRequest, options?: TransportRequestOptions): Promise async getSettings (this: That, params?: T.SecurityGetSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1195,7 +1543,7 @@ export default class Security { } /** - * Get a token. Create a bearer token for access without requiring basic authentication. + * Get a token. Create a bearer token for access without requiring basic authentication. The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. Alternatively, you can explicitly enable the `xpack.security.authc.token.enabled` setting. When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. That time period is defined by the `xpack.security.authc.token.timeout` setting. If you want to invalidate a token immediately, you can do so by using the invalidate token API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-token.html | Elasticsearch API documentation} */ async getToken (this: That, params?: T.SecurityGetTokenRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1204,17 +1552,28 @@ export default class Security { async getToken (this: That, params?: T.SecurityGetTokenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['grant_type', 'scope', 'password', 'kerberos_ticket', 'refresh_token', 'username'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1237,14 +1596,24 @@ export default class Security { async getUser (this: That, params?: T.SecurityGetUserRequest, options?: TransportRequestOptions): Promise async getUser (this: That, params?: T.SecurityGetUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1269,7 +1638,7 @@ export default class Security { } /** - * Get user privileges. + * Get user privileges. Get the security privileges for the logged in user. All users can use this API, but only to determine their own privileges. To check the privileges of other users, you must use the run as feature. To check whether a user has a specific list of privileges, use the has privileges API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-user-privileges.html | Elasticsearch API documentation} */ async getUserPrivileges (this: That, params?: T.SecurityGetUserPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1277,14 +1646,24 @@ export default class Security { async getUserPrivileges (this: That, params?: T.SecurityGetUserPrivilegesRequest, options?: TransportRequestOptions): Promise async getUserPrivileges (this: That, params?: T.SecurityGetUserPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1299,7 +1678,7 @@ export default class Security { } /** - * Get a user profile. Get a user's profile using the unique profile ID. + * Get a user profile. Get a user's profile using the unique profile ID. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-user-profile.html | Elasticsearch API documentation} */ async getUserProfile (this: That, params: T.SecurityGetUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1307,13 +1686,23 @@ export default class Security { async getUserProfile (this: That, params: T.SecurityGetUserProfileRequest, options?: TransportRequestOptions): Promise async getUserProfile (this: That, params: T.SecurityGetUserProfileRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['uid'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1331,7 +1720,7 @@ export default class Security { } /** - * Grant an API key. Create an API key on behalf of another user. This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. It is not possible to use this API to create an API key without that user’s credentials. The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. In this case, the API key will be created on behalf of the impersonated user. This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. By default, API keys never expire. You can specify expiration information when you create the API keys. + * Grant an API key. Create an API key on behalf of another user. This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. The caller must have authentication credentials for the user on whose behalf the API key will be created. It is not possible to use this API to create an API key without that user's credentials. The supported user authentication credential types are: * username and password * Elasticsearch access tokens * JWTs The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. In this case, the API key will be created on behalf of the impersonated user. This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. The API keys are created by the Elasticsearch API key service, which is automatically enabled. A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. By default, API keys never expire. You can specify expiration information when you create the API keys. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-grant-api-key.html | Elasticsearch API documentation} */ async grantApiKey (this: That, params: T.SecurityGrantApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1340,16 +1729,27 @@ export default class Security { async grantApiKey (this: That, params: T.SecurityGrantApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['api_key', 'grant_type', 'access_token', 'username', 'password', 'run_as'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1364,7 +1764,7 @@ export default class Security { } /** - * Check user privileges. Determine whether the specified user has a specified list of privileges. + * Check user privileges. Determine whether the specified user has a specified list of privileges. All users can use this API, but only to determine their own privileges. To check the privileges of other users, you must use the run as feature. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-has-privileges.html | Elasticsearch API documentation} */ async hasPrivileges (this: That, params?: T.SecurityHasPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1373,17 +1773,28 @@ export default class Security { async hasPrivileges (this: That, params?: T.SecurityHasPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['user'] const acceptedBody: string[] = ['application', 'cluster', 'index'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1408,7 +1819,7 @@ export default class Security { } /** - * Check user profile privileges. Determine whether the users associated with the specified user profile IDs have all the requested privileges. + * Check user profile privileges. Determine whether the users associated with the specified user profile IDs have all the requested privileges. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-has-privileges-user-profile.html | Elasticsearch API documentation} */ async hasPrivilegesUserProfile (this: That, params: T.SecurityHasPrivilegesUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1417,16 +1828,27 @@ export default class Security { async hasPrivilegesUserProfile (this: That, params: T.SecurityHasPrivilegesUserProfileRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['uids', 'privileges'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1441,7 +1863,7 @@ export default class Security { } /** - * Invalidate API keys. This API invalidates API keys created by the create API key or grant API key APIs. Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. The `manage_api_key` privilege allows deleting any API keys. The `manage_own_api_key` only allows deleting API keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, an invalidation request must be issued in one of the three formats: - Set the parameter `owner=true`. - Or, set both `username` and `realm_name` to match the user’s identity. - Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the `ids` field. + * Invalidate API keys. This API invalidates API keys created by the create API key or grant API key APIs. Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. To use this API, you must have at least the `manage_security`, `manage_api_key`, or `manage_own_api_key` cluster privileges. The `manage_security` privilege allows deleting any API key, including both REST and cross cluster API keys. The `manage_api_key` privilege allows deleting any REST API key, but not cross cluster API keys. The `manage_own_api_key` only allows deleting REST API keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, an invalidation request must be issued in one of the three formats: - Set the parameter `owner=true`. - Or, set both `username` and `realm_name` to match the user's identity. - Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the `ids` field. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-invalidate-api-key.html | Elasticsearch API documentation} */ async invalidateApiKey (this: That, params?: T.SecurityInvalidateApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1450,17 +1872,28 @@ export default class Security { async invalidateApiKey (this: That, params?: T.SecurityInvalidateApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['id', 'ids', 'name', 'owner', 'realm_name', 'username'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1475,7 +1908,7 @@ export default class Security { } /** - * Invalidate a token. The access tokens returned by the get token API have a finite period of time for which they are valid. After that time period, they can no longer be used. The time period is defined by the `xpack.security.authc.token.timeout` setting. The refresh tokens returned by the get token API are only valid for 24 hours. They can also be used exactly once. If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. + * Invalidate a token. The access tokens returned by the get token API have a finite period of time for which they are valid. After that time period, they can no longer be used. The time period is defined by the `xpack.security.authc.token.timeout` setting. The refresh tokens returned by the get token API are only valid for 24 hours. They can also be used exactly once. If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. NOTE: While all parameters are optional, at least one of them is required. More specifically, either one of `token` or `refresh_token` parameters is required. If none of these two are specified, then `realm_name` and/or `username` need to be specified. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-invalidate-token.html | Elasticsearch API documentation} */ async invalidateToken (this: That, params?: T.SecurityInvalidateTokenRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1484,17 +1917,28 @@ export default class Security { async invalidateToken (this: That, params?: T.SecurityInvalidateTokenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['token', 'refresh_token', 'realm_name', 'username'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1518,16 +1962,27 @@ export default class Security { async oidcAuthenticate (this: That, params: T.SecurityOidcAuthenticateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['nonce', 'realm', 'redirect_uri', 'state'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1551,16 +2006,27 @@ export default class Security { async oidcLogout (this: That, params: T.SecurityOidcLogoutRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['access_token', 'refresh_token'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1584,17 +2050,28 @@ export default class Security { async oidcPrepareAuthentication (this: That, params?: T.SecurityOidcPrepareAuthenticationRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['iss', 'login_hint', 'nonce', 'realm', 'state'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1609,7 +2086,7 @@ export default class Security { } /** - * Create or update application privileges. + * Create or update application privileges. To use this API, you must have one of the following privileges: * The `manage_security` cluster privilege (or a greater privilege such as `all`). * The "Manage Application Privileges" global privilege for the application being referenced in the request. Application names are formed from a prefix, with an optional suffix that conform to the following rules: * The prefix must begin with a lowercase ASCII letter. * The prefix must contain only ASCII letters or digits. * The prefix must be at least 3 characters long. * If the suffix exists, it must begin with either a dash `-` or `_`. * The suffix cannot contain any of the following characters: `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, `*`. * No part of the name can contain whitespace. Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters `_`, `-`, and `.`. Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: `/`, `*`, `:`. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-privileges.html | Elasticsearch API documentation} */ async putPrivileges (this: That, params: T.SecurityPutPrivilegesRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1618,16 +2095,17 @@ export default class Security { async putPrivileges (this: That, params: T.SecurityPutPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['privileges'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1651,16 +2129,27 @@ export default class Security { async putRole (this: That, params: T.SecurityPutRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['applications', 'cluster', 'global', 'indices', 'remote_indices', 'remote_cluster', 'metadata', 'run_as', 'description', 'transient_metadata'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1678,7 +2167,7 @@ export default class Security { } /** - * Create or update role mappings. Role mappings define which roles are assigned to each user. Each mapping has rules that identify users and a list of roles that are granted to those users. The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. This API does not create roles. Rather, it maps users to existing roles. Roles can be created by using the create or update roles API or roles files. + * Create or update role mappings. Role mappings define which roles are assigned to each user. Each mapping has rules that identify users and a list of roles that are granted to those users. The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. NOTE: This API does not create roles. Rather, it maps users to existing roles. Roles can be created by using the create or update roles API or roles files. **Role templates** The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. For example, all users in the `cn=admin,dc=example,dc=com` LDAP group should be given the superuser role in Elasticsearch. The `roles` field is used for this purpose. For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. The `role_templates` field is used for this purpose. NOTE: To use role templates successfully, the relevant scripting feature must be enabled. Otherwise, all attempts to create a role mapping with role templates fail. All of the user fields that are available in the role mapping rules are also available in the role templates. Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-role-mapping.html | Elasticsearch API documentation} */ async putRoleMapping (this: That, params: T.SecurityPutRoleMappingRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1687,16 +2176,27 @@ export default class Security { async putRoleMapping (this: That, params: T.SecurityPutRoleMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['enabled', 'metadata', 'roles', 'role_templates', 'rules', 'run_as'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1714,7 +2214,7 @@ export default class Security { } /** - * Create or update users. A password is required for adding a new user but is optional when updating an existing user. To change a user’s password without updating any other fields, use the change password API. + * Create or update users. Add and update users in the native realm. A password is required for adding a new user but is optional when updating an existing user. To change a user's password without updating any other fields, use the change password API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-user.html | Elasticsearch API documentation} */ async putUser (this: That, params: T.SecurityPutUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1723,16 +2223,27 @@ export default class Security { async putUser (this: That, params: T.SecurityPutUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['username', 'email', 'full_name', 'metadata', 'password', 'password_hash', 'roles', 'enabled'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1750,7 +2261,7 @@ export default class Security { } /** - * Find API keys with a query. Get a paginated list of API keys and their information. You can optionally filter the results with a query. + * Find API keys with a query. Get a paginated list of API keys and their information. You can optionally filter the results with a query. To use this API, you must have at least the `manage_own_api_key` or the `read_security` cluster privileges. If you have only the `manage_own_api_key` privilege, this API returns only the API keys that you own. If you have the `read_security`, `manage_api_key`, or greater privileges (including `manage_security`), this API returns all API keys regardless of ownership. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-query-api-key.html | Elasticsearch API documentation} */ async queryApiKeys (this: That, params?: T.SecurityQueryApiKeysRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1759,17 +2270,28 @@ export default class Security { async queryApiKeys (this: That, params?: T.SecurityQueryApiKeysRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['aggregations', 'aggs', 'query', 'from', 'sort', 'size', 'search_after'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1784,7 +2306,7 @@ export default class Security { } /** - * Find roles with a query. Get roles in a paginated manner. You can optionally filter the results with a query. + * Find roles with a query. Get roles in a paginated manner. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. You can optionally filter the results with a query. Also, the results can be paginated and sorted. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-query-role.html | Elasticsearch API documentation} */ async queryRole (this: That, params?: T.SecurityQueryRoleRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1793,17 +2315,28 @@ export default class Security { async queryRole (this: That, params?: T.SecurityQueryRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['query', 'from', 'sort', 'size', 'search_after'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1818,7 +2351,7 @@ export default class Security { } /** - * Find users with a query. Get information for users in a paginated manner. You can optionally filter the results with a query. + * Find users with a query. Get information for users in a paginated manner. You can optionally filter the results with a query. NOTE: As opposed to the get user API, built-in users are excluded from the result. This API is only for native users. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-query-user.html | Elasticsearch API documentation} */ async queryUser (this: That, params?: T.SecurityQueryUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1827,17 +2360,28 @@ export default class Security { async queryUser (this: That, params?: T.SecurityQueryUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['query', 'from', 'sort', 'size', 'search_after'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1852,7 +2396,7 @@ export default class Security { } /** - * Authenticate SAML. Submits a SAML response message to Elasticsearch for consumption. + * Authenticate SAML. Submit a SAML response message to Elasticsearch for consumption. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. The SAML message that is submitted can be: * A response to a SAML authentication request that was previously created using the SAML prepare authentication API. * An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. In either case, the SAML message needs to be a base64 encoded XML document with a root element of ``. After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-authenticate.html | Elasticsearch API documentation} */ async samlAuthenticate (this: That, params: T.SecuritySamlAuthenticateRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1861,16 +2405,27 @@ export default class Security { async samlAuthenticate (this: That, params: T.SecuritySamlAuthenticateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['content', 'ids', 'realm'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1885,7 +2440,7 @@ export default class Security { } /** - * Logout of SAML completely. Verifies the logout response sent from the SAML IdP. + * Logout of SAML completely. Verifies the logout response sent from the SAML IdP. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. This API verifies the response by ensuring the content is relevant and validating its signature. An empty response is returned if the verification process is successful. The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. The caller of this API must prepare the request accordingly so that this API can handle either of them. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-complete-logout.html | Elasticsearch API documentation} */ async samlCompleteLogout (this: That, params: T.SecuritySamlCompleteLogoutRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1894,16 +2449,27 @@ export default class Security { async samlCompleteLogout (this: That, params: T.SecuritySamlCompleteLogoutRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['realm', 'ids', 'query_string', 'content'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1918,7 +2484,7 @@ export default class Security { } /** - * Invalidate SAML. Submits a SAML LogoutRequest message to Elasticsearch for consumption. + * Invalidate SAML. Submit a SAML LogoutRequest message to Elasticsearch for consumption. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. The logout request comes from the SAML IdP during an IdP initiated Single Logout. The custom web application can use this API to have Elasticsearch process the `LogoutRequest`. After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. Thus the user can be redirected back to their IdP. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-invalidate.html | Elasticsearch API documentation} */ async samlInvalidate (this: That, params: T.SecuritySamlInvalidateRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1927,16 +2493,27 @@ export default class Security { async samlInvalidate (this: That, params: T.SecuritySamlInvalidateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['acs', 'query_string', 'realm'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1951,7 +2528,7 @@ export default class Security { } /** - * Logout of SAML. Submits a request to invalidate an access token and refresh token. + * Logout of SAML. Submits a request to invalidate an access token and refresh token. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. This API invalidates the tokens that were generated for a user by the SAML authenticate API. If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-logout.html | Elasticsearch API documentation} */ async samlLogout (this: That, params: T.SecuritySamlLogoutRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1960,16 +2537,27 @@ export default class Security { async samlLogout (this: That, params: T.SecuritySamlLogoutRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['token', 'refresh_token'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -1984,7 +2572,7 @@ export default class Security { } /** - * Prepare SAML authentication. Creates a SAML authentication request (``) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + * Prepare SAML authentication. Create a SAML authentication request (``) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. NOTE: This API is intended for use by custom web applications other than Kibana. If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. This API returns a URL pointing to the SAML Identity Provider. You can use the URL to redirect the browser of the user in order to continue the authentication process. The URL includes a single parameter named `SAMLRequest`, which contains a SAML Authentication request that is deflated and Base64 encoded. If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named `SigAlg` and `Signature`. These parameters contain the algorithm used for the signature and the signature value itself. It also returns a random string that uniquely identifies this SAML Authentication request. The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-prepare-authentication.html | Elasticsearch API documentation} */ async samlPrepareAuthentication (this: That, params?: T.SecuritySamlPrepareAuthenticationRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -1993,17 +2581,28 @@ export default class Security { async samlPrepareAuthentication (this: That, params?: T.SecuritySamlPrepareAuthenticationRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['acs', 'realm', 'relay_state'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2018,7 +2617,7 @@ export default class Security { } /** - * Create SAML service provider metadata. Generate SAML metadata for a SAML 2.0 Service Provider. + * Create SAML service provider metadata. Generate SAML metadata for a SAML 2.0 Service Provider. The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-saml-sp-metadata.html | Elasticsearch API documentation} */ async samlServiceProviderMetadata (this: That, params: T.SecuritySamlServiceProviderMetadataRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -2026,13 +2625,23 @@ export default class Security { async samlServiceProviderMetadata (this: That, params: T.SecuritySamlServiceProviderMetadataRequest, options?: TransportRequestOptions): Promise async samlServiceProviderMetadata (this: That, params: T.SecuritySamlServiceProviderMetadataRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['realm_name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2050,7 +2659,7 @@ export default class Security { } /** - * Suggest a user profile. Get suggestions for user profiles that match specified search criteria. + * Suggest a user profile. Get suggestions for user profiles that match specified search criteria. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-suggest-user-profile.html | Elasticsearch API documentation} */ async suggestUserProfiles (this: That, params?: T.SecuritySuggestUserProfilesRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -2059,17 +2668,28 @@ export default class Security { async suggestUserProfiles (this: That, params?: T.SecuritySuggestUserProfilesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['name', 'size', 'data', 'hint'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2084,7 +2704,7 @@ export default class Security { } /** - * Update an API key. Updates attributes of an existing API key. Users can only update API keys that they created or that were granted to them. Use this API to update API keys created by the create API Key or grant API Key APIs. If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. This API supports updates to an API key’s access scope and metadata. The access scope of an API key is derived from the `role_descriptors` you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. The snapshot of the owner’s permissions is updated automatically on every call. If you don’t specify `role_descriptors` in the request, a call to this API might still change the API key’s access scope. This change can occur if the owner user’s permissions have changed since the API key was created or last modified. To update another user’s API key, use the `run_as` feature to submit a request on behalf of another user. IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. To update an API key, the owner user’s credentials are required. + * Update an API key. Update attributes of an existing API key. This API supports updates to an API key's access scope, expiration, and metadata. To use this API, you must have at least the `manage_own_api_key` cluster privilege. Users can only update API keys that they created or that were granted to them. To update another user’s API key, use the `run_as` feature to submit a request on behalf of another user. IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. Use this API to update API keys created by the create API key or grant API Key APIs. If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. The access scope of an API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request. The snapshot of the owner's permissions is updated automatically on every call. IMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change the API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-update-api-key.html | Elasticsearch API documentation} */ async updateApiKey (this: That, params: T.SecurityUpdateApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -2093,16 +2713,27 @@ export default class Security { async updateApiKey (this: That, params: T.SecurityUpdateApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['role_descriptors', 'metadata', 'expiration'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2120,7 +2751,7 @@ export default class Security { } /** - * Update a cross-cluster API key. Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. + * Update a cross-cluster API key. Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. To use this API, you must have at least the `manage_security` cluster privilege. Users can only update API keys that they created. To update another user's API key, use the `run_as` feature to submit a request on behalf of another user. IMPORTANT: It's not possible to use an API key as the authentication credential for this API. To update an API key, the owner user's credentials are required. It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. This API supports updates to an API key's access scope, metadata, and expiration. The owner user's information, such as the `username` and `realm`, is also updated automatically on every call. NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-update-cross-cluster-api-key.html | Elasticsearch API documentation} */ async updateCrossClusterApiKey (this: That, params: T.SecurityUpdateCrossClusterApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -2129,16 +2760,27 @@ export default class Security { async updateCrossClusterApiKey (this: That, params: T.SecurityUpdateCrossClusterApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['access', 'expiration', 'metadata'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2156,7 +2798,7 @@ export default class Security { } /** - * Update security index settings. Update the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`. If a specific index is not in use on the system and settings are provided for it, the request will be rejected. This API does not yet support configuring the settings for indices before they are in use. + * Update security index settings. Update the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified. This includes `index.auto_expand_replicas` and `index.number_of_replicas`. NOTE: If `index.auto_expand_replicas` is set, `index.number_of_replicas` will be ignored during updates. If a specific index is not in use on the system and settings are provided for it, the request will be rejected. This API does not yet support configuring the settings for indices before they are in use. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-update-settings.html | Elasticsearch API documentation} */ async updateSettings (this: That, params?: T.SecurityUpdateSettingsRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -2165,17 +2807,28 @@ export default class Security { async updateSettings (this: That, params?: T.SecurityUpdateSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['security', 'security-profile', 'security-tokens'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -2190,7 +2843,7 @@ export default class Security { } /** - * Update user profile data. Update specific data for the user profile that is associated with a unique ID. + * Update user profile data. Update specific data for the user profile that is associated with a unique ID. NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice. To use this API, you must have one of the following privileges: * The `manage_user_profile` cluster privilege. * The `update_profile_data` global privilege for the namespaces that are referenced in the request. This API updates the `labels` and `data` fields of an existing user profile document with JSON objects. New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. For both labels and data, content is namespaced by the top-level fields. The `update_profile_data` global privilege grants privileges for updating only the allowed namespaces. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-update-user-profile-data.html | Elasticsearch API documentation} */ async updateUserProfileData (this: That, params: T.SecurityUpdateUserProfileDataRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -2199,16 +2852,27 @@ export default class Security { async updateUserProfileData (this: That, params: T.SecurityUpdateUserProfileDataRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['uid'] const acceptedBody: string[] = ['labels', 'data'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/shutdown.ts b/src/api/api/shutdown.ts index 873402d5d..61a4ce6cb 100644 --- a/src/api/api/shutdown.ts +++ b/src/api/api/shutdown.ts @@ -52,13 +52,23 @@ export default class Shutdown { async deleteNode (this: That, params: T.ShutdownDeleteNodeRequest, options?: TransportRequestOptions): Promise async deleteNode (this: That, params: T.ShutdownDeleteNodeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,14 +94,24 @@ export default class Shutdown { async getNode (this: That, params?: T.ShutdownGetNodeRequest, options?: TransportRequestOptions): Promise async getNode (this: That, params?: T.ShutdownGetNodeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -125,16 +145,27 @@ export default class Shutdown { async putNode (this: That, params: T.ShutdownPutNodeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] const acceptedBody: string[] = ['type', 'reason', 'allocation_delay', 'target_node_name'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/simulate.ts b/src/api/api/simulate.ts index f1ced5c0a..ee6e13de6 100644 --- a/src/api/api/simulate.ts +++ b/src/api/api/simulate.ts @@ -53,16 +53,27 @@ export default class Simulate { async ingest (this: That, params: T.SimulateIngestRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['docs', 'component_template_substitutions', 'index_template_subtitutions', 'mapping_addition', 'pipeline_substitutions'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/slm.ts b/src/api/api/slm.ts index 7dd058206..9cb2542aa 100644 --- a/src/api/api/slm.ts +++ b/src/api/api/slm.ts @@ -52,13 +52,23 @@ export default class Slm { async deleteLifecycle (this: That, params: T.SlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise async deleteLifecycle (this: That, params: T.SlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class Slm { async executeLifecycle (this: That, params: T.SlmExecuteLifecycleRequest, options?: TransportRequestOptions): Promise async executeLifecycle (this: That, params: T.SlmExecuteLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,14 +136,24 @@ export default class Slm { async executeRetention (this: That, params?: T.SlmExecuteRetentionRequest, options?: TransportRequestOptions): Promise async executeRetention (this: That, params?: T.SlmExecuteRetentionRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -146,14 +176,24 @@ export default class Slm { async getLifecycle (this: That, params?: T.SlmGetLifecycleRequest, options?: TransportRequestOptions): Promise async getLifecycle (this: That, params?: T.SlmGetLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -186,14 +226,24 @@ export default class Slm { async getStats (this: That, params?: T.SlmGetStatsRequest, options?: TransportRequestOptions): Promise async getStats (this: That, params?: T.SlmGetStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -216,14 +266,24 @@ export default class Slm { async getStatus (this: That, params?: T.SlmGetStatusRequest, options?: TransportRequestOptions): Promise async getStatus (this: That, params?: T.SlmGetStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -247,16 +307,27 @@ export default class Slm { async putLifecycle (this: That, params: T.SlmPutLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy_id'] const acceptedBody: string[] = ['config', 'name', 'repository', 'retention', 'schedule'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -282,14 +353,24 @@ export default class Slm { async start (this: That, params?: T.SlmStartRequest, options?: TransportRequestOptions): Promise async start (this: That, params?: T.SlmStartRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -312,14 +393,24 @@ export default class Slm { async stop (this: That, params?: T.SlmStopRequest, options?: TransportRequestOptions): Promise async stop (this: That, params?: T.SlmStopRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/snapshot.ts b/src/api/api/snapshot.ts index a6b98caaa..762afb7fb 100644 --- a/src/api/api/snapshot.ts +++ b/src/api/api/snapshot.ts @@ -52,13 +52,23 @@ export default class Snapshot { async cleanupRepository (this: That, params: T.SnapshotCleanupRepositoryRequest, options?: TransportRequestOptions): Promise async cleanupRepository (this: That, params: T.SnapshotCleanupRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -85,16 +95,27 @@ export default class Snapshot { async clone (this: That, params: T.SnapshotCloneRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot', 'target_snapshot'] const acceptedBody: string[] = ['indices'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -123,16 +144,27 @@ export default class Snapshot { async create (this: That, params: T.SnapshotCreateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] const acceptedBody: string[] = ['expand_wildcards', 'feature_states', 'ignore_unavailable', 'include_global_state', 'indices', 'metadata', 'partial'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -160,16 +192,17 @@ export default class Snapshot { async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] const acceptedBody: string[] = ['repository'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -195,13 +228,23 @@ export default class Snapshot { async delete (this: That, params: T.SnapshotDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.SnapshotDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -228,13 +271,23 @@ export default class Snapshot { async deleteRepository (this: That, params: T.SnapshotDeleteRepositoryRequest, options?: TransportRequestOptions): Promise async deleteRepository (this: That, params: T.SnapshotDeleteRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -260,13 +313,23 @@ export default class Snapshot { async get (this: That, params: T.SnapshotGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params: T.SnapshotGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -293,14 +356,24 @@ export default class Snapshot { async getRepository (this: That, params?: T.SnapshotGetRepositoryRequest, options?: TransportRequestOptions): Promise async getRepository (this: That, params?: T.SnapshotGetRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -325,32 +398,42 @@ export default class Snapshot { } /** - * Analyzes a repository for correctness and performance - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html | Elasticsearch API documentation} + * Analyze a snapshot repository. Analyze the performance characteristics and any incorrect behaviour found in a repository. The response exposes implementation details of the analysis which may change from version to version. The response body format is therefore not considered stable and may be different in newer versions. There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. Run your first analysis with the default parameter values to check for simple problems. If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a `blob_count` of at least `2000`, a `max_blob_size` of at least `2gb`, a `max_total_data_size` of at least `1tb`, and a `register_operation_count` of at least `100`. Always specify a generous timeout, possibly `1h` or longer, to allow time for each analysis to run to completion. Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. If so, this storage system is not suitable for use as a snapshot repository. You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. You can use this information to determine the performance of your storage system. If any operation fails or returns an incorrect result, the API returns an error. If the API returns an error, it may not have removed all the data it wrote to the repository. The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. You should verify that this location has been cleaned up correctly. If there is still leftover data at the specified location, you should manually remove it. If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. Some clients are configured to close their connection if no response is received within a certain timeout. An analysis takes a long time to complete so you might need to relax any such client-side timeouts. On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. The path to the leftover data is recorded in the Elasticsearch logs. You should verify that this location has been cleaned up correctly. If there is still leftover data at the specified location, you should manually remove it. If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. The analysis attempts to detect common bugs but it does not offer 100% coverage. Additionally, it does not test the following: * Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. * Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. * Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. You must ensure this load does not affect other users of these systems. Analyses respect the repository settings `max_snapshot_bytes_per_sec` and `max_restore_bytes_per_sec` if available and the cluster setting `indices.recovery.max_bytes_per_sec` which you can use to limit the bandwidth they consume. NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. This indicates it behaves incorrectly in ways that the former version did not detect. You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. NOTE: This API may not work correctly in a mixed-version cluster. *Implementation details* NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. The analysis comprises a number of blob-level tasks, as set by the `blob_count` parameter and a number of compare-and-exchange operations on linearizable registers, as set by the `register_operation_count` parameter. These tasks are distributed over the data and master-eligible nodes in the cluster for execution. For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. The size of the blob is chosen randomly, according to the `max_blob_size` and `max_total_data_size` parameters. If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. These reads are permitted to fail, but must not return partial data. If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. The executing node will use a variety of different methods to write the blob. For instance, where applicable, it will use both single-part and multi-part uploads. Similarly, the reading nodes will use a variety of different methods to read the data back again. For instance they may read the entire blob from start to end or may read only a subset of the data. For some blob-level tasks, the executing node will cancel the write before it is complete. In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. Some operations also verify the behavior on small blobs with sizes other than 8 bytes. + * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/repo-analysis-api.html | Elasticsearch API documentation} */ - async repositoryAnalyze (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async repositoryAnalyze (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async repositoryAnalyze (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise - async repositoryAnalyze (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { - const acceptedPath: string[] = ['repository'] - const querystring: Record = {} - const body = undefined + async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptionsWithMeta): Promise> + async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptions): Promise + async repositoryAnalyze (this: That, params: T.SnapshotRepositoryAnalyzeRequest, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = ['name'] + 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 } + } + } - params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { + // @ts-expect-error querystring[key] = params[key] } } const method = 'POST' - const path = `/_snapshot/${encodeURIComponent(params.repository.toString())}/_analyze` + const path = `/_snapshot/${encodeURIComponent(params.name.toString())}/_analyze` const meta: TransportRequestMetadata = { name: 'snapshot.repository_analyze', pathParts: { - repository: params.repository + name: params.name } } return await this.transport.request({ path, method, querystring, body, meta }, options) @@ -365,13 +448,23 @@ export default class Snapshot { async repositoryVerifyIntegrity (this: That, params: T.SnapshotRepositoryVerifyIntegrityRequest, options?: TransportRequestOptions): Promise async repositoryVerifyIntegrity (this: That, params: T.SnapshotRepositoryVerifyIntegrityRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -398,16 +491,27 @@ export default class Snapshot { async restore (this: That, params: T.SnapshotRestoreRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] const acceptedBody: string[] = ['feature_states', 'ignore_index_settings', 'ignore_unavailable', 'include_aliases', 'include_global_state', 'index_settings', 'indices', 'partial', 'rename_pattern', 'rename_replacement'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -434,14 +538,24 @@ export default class Snapshot { async status (this: That, params?: T.SnapshotStatusRequest, options?: TransportRequestOptions): Promise async status (this: That, params?: T.SnapshotStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -478,13 +592,23 @@ export default class Snapshot { async verifyRepository (this: That, params: T.SnapshotVerifyRepositoryRequest, options?: TransportRequestOptions): Promise async verifyRepository (this: That, params: T.SnapshotVerifyRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/sql.ts b/src/api/api/sql.ts index 286316bcb..df4bac5d9 100644 --- a/src/api/api/sql.ts +++ b/src/api/api/sql.ts @@ -53,16 +53,27 @@ export default class Sql { async clearCursor (this: That, params: T.SqlClearCursorRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['cursor'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -85,13 +96,23 @@ export default class Sql { async deleteAsync (this: That, params: T.SqlDeleteAsyncRequest, options?: TransportRequestOptions): Promise async deleteAsync (this: That, params: T.SqlDeleteAsyncRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -117,13 +138,23 @@ export default class Sql { async getAsync (this: That, params: T.SqlGetAsyncRequest, options?: TransportRequestOptions): Promise async getAsync (this: That, params: T.SqlGetAsyncRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -149,13 +180,23 @@ export default class Sql { async getAsyncStatus (this: That, params: T.SqlGetAsyncStatusRequest, options?: TransportRequestOptions): Promise async getAsyncStatus (this: That, params: T.SqlGetAsyncStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -182,17 +223,28 @@ export default class Sql { async query (this: That, params?: T.SqlQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['allow_partial_search_results', 'catalog', 'columnar', 'cursor', 'fetch_size', 'field_multi_value_leniency', 'filter', 'index_using_frozen', 'keep_alive', 'keep_on_completion', 'page_timeout', 'params', 'query', 'request_timeout', 'runtime_mappings', 'time_zone', 'wait_for_completion_timeout'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -216,16 +268,27 @@ export default class Sql { async translate (this: That, params: T.SqlTranslateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['fetch_size', 'filter', 'query', 'time_zone'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/ssl.ts b/src/api/api/ssl.ts index 8ebb1a7ac..9f4b81c50 100644 --- a/src/api/api/ssl.ts +++ b/src/api/api/ssl.ts @@ -52,14 +52,24 @@ export default class Ssl { async certificates (this: That, params?: T.SslCertificatesRequest, options?: TransportRequestOptions): Promise async certificates (this: That, params?: T.SslCertificatesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/synonyms.ts b/src/api/api/synonyms.ts index 107dae465..9f52fcff5 100644 --- a/src/api/api/synonyms.ts +++ b/src/api/api/synonyms.ts @@ -52,13 +52,23 @@ export default class Synonyms { async deleteSynonym (this: That, params: T.SynonymsDeleteSynonymRequest, options?: TransportRequestOptions): Promise async deleteSynonym (this: That, params: T.SynonymsDeleteSynonymRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,13 +94,23 @@ export default class Synonyms { async deleteSynonymRule (this: That, params: T.SynonymsDeleteSynonymRuleRequest, options?: TransportRequestOptions): Promise async deleteSynonymRule (this: That, params: T.SynonymsDeleteSynonymRuleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['set_id', 'rule_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -117,13 +137,23 @@ export default class Synonyms { async getSynonym (this: That, params: T.SynonymsGetSynonymRequest, options?: TransportRequestOptions): Promise async getSynonym (this: That, params: T.SynonymsGetSynonymRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -149,13 +179,23 @@ export default class Synonyms { async getSynonymRule (this: That, params: T.SynonymsGetSynonymRuleRequest, options?: TransportRequestOptions): Promise async getSynonymRule (this: That, params: T.SynonymsGetSynonymRuleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['set_id', 'rule_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -182,14 +222,24 @@ export default class Synonyms { async getSynonymsSets (this: That, params?: T.SynonymsGetSynonymsSetsRequest, options?: TransportRequestOptions): Promise async getSynonymsSets (this: That, params?: T.SynonymsGetSynonymsSetsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -213,16 +263,27 @@ export default class Synonyms { async putSynonym (this: That, params: T.SynonymsPutSynonymRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['synonyms_set'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -249,16 +310,27 @@ export default class Synonyms { async putSynonymRule (this: That, params: T.SynonymsPutSynonymRuleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['set_id', 'rule_id'] const acceptedBody: string[] = ['synonyms'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/tasks.ts b/src/api/api/tasks.ts index 51ec2731d..a906a58fd 100644 --- a/src/api/api/tasks.ts +++ b/src/api/api/tasks.ts @@ -44,7 +44,7 @@ export default class Tasks { } /** - * Cancel a task. A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. The get task information API will continue to list these cancelled tasks until they complete. The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the `?detailed` parameter to identify the other tasks the system is running. You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. + * Cancel a task. WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible. A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. The get task information API will continue to list these cancelled tasks until they complete. The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the `?detailed` parameter to identify the other tasks the system is running. You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html | Elasticsearch API documentation} */ async cancel (this: That, params?: T.TasksCancelRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -52,14 +52,24 @@ export default class Tasks { async cancel (this: That, params?: T.TasksCancelRequest, options?: TransportRequestOptions): Promise async cancel (this: That, params?: T.TasksCancelRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,7 +94,7 @@ export default class Tasks { } /** - * Get task information. Get information about a task currently running in the cluster. + * Get task information. Get information about a task currently running in the cluster. WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible. If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html | Elasticsearch API documentation} */ async get (this: That, params: T.TasksGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -92,13 +102,23 @@ export default class Tasks { async get (this: That, params: T.TasksGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params: T.TasksGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -116,7 +136,7 @@ export default class Tasks { } /** - * Get all tasks. Get information about the tasks currently running on one or more nodes in the cluster. + * Get all tasks. Get information about the tasks currently running on one or more nodes in the cluster. WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible. **Identifying running tasks** The `X-Opaque-Id header`, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. This enables you to track certain calls or associate certain tasks with the client that started them. For example: ``` curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" ``` The API returns the following result: ``` HTTP/1.1 200 OK X-Opaque-Id: 123456 content-type: application/json; charset=UTF-8 content-length: 831 { "tasks" : { "u5lcZHqcQhu-rUoFaqDphA:45" : { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 45, "type" : "transport", "action" : "cluster:monitor/tasks/lists", "start_time_in_millis" : 1513823752749, "running_time_in_nanos" : 293139, "cancellable" : false, "headers" : { "X-Opaque-Id" : "123456" }, "children" : [ { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 46, "type" : "direct", "action" : "cluster:monitor/tasks/lists[n]", "start_time_in_millis" : 1513823752750, "running_time_in_nanos" : 92133, "cancellable" : false, "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", "headers" : { "X-Opaque-Id" : "123456" } } ] } } } ``` In this example, `X-Opaque-Id: 123456` is the ID as a part of the response header. The `X-Opaque-Id` in the task `headers` is the ID for the task that was initiated by the REST request. The `X-Opaque-Id` in the children `headers` is the child task of the task that was initiated by the REST request. * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html | Elasticsearch API documentation} */ async list (this: That, params?: T.TasksListRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -124,14 +144,24 @@ export default class Tasks { async list (this: That, params?: T.TasksListRequest, options?: TransportRequestOptions): Promise async list (this: That, params?: T.TasksListRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/terms_enum.ts b/src/api/api/terms_enum.ts index 1176ced32..af8c1d1e4 100644 --- a/src/api/api/terms_enum.ts +++ b/src/api/api/terms_enum.ts @@ -47,16 +47,27 @@ export default async function TermsEnumApi (this: That, params: T.TermsEnumReque export default async function TermsEnumApi (this: That, params: T.TermsEnumRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['field', 'size', 'timeout', 'case_insensitive', 'index_filter', 'string', 'search_after'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/termvectors.ts b/src/api/api/termvectors.ts index f113c2c15..a4333ccc0 100644 --- a/src/api/api/termvectors.ts +++ b/src/api/api/termvectors.ts @@ -47,16 +47,27 @@ export default async function TermvectorsApi (this: That, p export default async function TermvectorsApi (this: That, params: T.TermvectorsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'id'] const acceptedBody: string[] = ['doc', 'filter', 'per_field_analyzer'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/text_structure.ts b/src/api/api/text_structure.ts index 35de18ecf..86efca83c 100644 --- a/src/api/api/text_structure.ts +++ b/src/api/api/text_structure.ts @@ -52,13 +52,23 @@ export default class TextStructure { async findFieldStructure (this: That, params: T.TextStructureFindFieldStructureRequest, options?: TransportRequestOptions): Promise async findFieldStructure (this: That, params: T.TextStructureFindFieldStructureRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -82,16 +92,27 @@ export default class TextStructure { async findMessageStructure (this: That, params: T.TextStructureFindMessageStructureRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['messages'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -115,16 +136,17 @@ export default class TextStructure { async findStructure (this: That, params: T.TextStructureFindStructureRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['text_files'] - const querystring: Record = {} - let body: any + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -148,16 +170,27 @@ export default class TextStructure { async testGrokPattern (this: That, params: T.TextStructureTestGrokPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['grok_pattern', 'text'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/transform.ts b/src/api/api/transform.ts index ffbaec1f5..b826dfffd 100644 --- a/src/api/api/transform.ts +++ b/src/api/api/transform.ts @@ -52,13 +52,23 @@ export default class Transform { async deleteTransform (this: That, params: T.TransformDeleteTransformRequest, options?: TransportRequestOptions): Promise async deleteTransform (this: That, params: T.TransformDeleteTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -84,14 +94,24 @@ export default class Transform { async getNodeStats (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise async getNodeStats (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { querystring[key] = params[key] } } @@ -113,14 +133,24 @@ export default class Transform { async getTransform (this: That, params?: T.TransformGetTransformRequest, options?: TransportRequestOptions): Promise async getTransform (this: That, params?: T.TransformGetTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -153,13 +183,23 @@ export default class Transform { async getTransformStats (this: That, params: T.TransformGetTransformStatsRequest, options?: TransportRequestOptions): Promise async getTransformStats (this: That, params: T.TransformGetTransformStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -186,17 +226,28 @@ export default class Transform { async previewTransform (this: That, params?: T.TransformPreviewTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] const acceptedBody: string[] = ['dest', 'description', 'frequency', 'pivot', 'source', 'settings', 'sync', 'retention_policy', 'latest'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -230,16 +281,27 @@ export default class Transform { async putTransform (this: That, params: T.TransformPutTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] const acceptedBody: string[] = ['dest', 'description', 'frequency', 'latest', '_meta', 'pivot', 'retention_policy', 'settings', 'source', 'sync'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -265,13 +327,23 @@ export default class Transform { async resetTransform (this: That, params: T.TransformResetTransformRequest, options?: TransportRequestOptions): Promise async resetTransform (this: That, params: T.TransformResetTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -297,13 +369,23 @@ export default class Transform { async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest, options?: TransportRequestOptions): Promise async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -329,13 +411,23 @@ export default class Transform { async startTransform (this: That, params: T.TransformStartTransformRequest, options?: TransportRequestOptions): Promise async startTransform (this: That, params: T.TransformStartTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -361,13 +453,23 @@ export default class Transform { async stopTransform (this: That, params: T.TransformStopTransformRequest, options?: TransportRequestOptions): Promise async stopTransform (this: That, params: T.TransformStopTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -394,16 +496,27 @@ export default class Transform { async updateTransform (this: That, params: T.TransformUpdateTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] const acceptedBody: string[] = ['dest', 'description', 'frequency', '_meta', 'source', 'settings', 'sync', 'retention_policy'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -429,14 +542,24 @@ export default class Transform { async upgradeTransforms (this: That, params?: T.TransformUpgradeTransformsRequest, options?: TransportRequestOptions): Promise async upgradeTransforms (this: That, params?: T.TransformUpgradeTransformsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/update.ts b/src/api/api/update.ts index 400f8dae0..d4dc6f183 100644 --- a/src/api/api/update.ts +++ b/src/api/api/update.ts @@ -38,7 +38,7 @@ import * as T from '../types' interface That { transport: Transport } /** - * Update a document. Updates a document by running a script or passing a partial document. + * Update a document. Update a document by running a script or passing a partial document. If the Elasticsearch security features are enabled, you must have the `index` or `write` index privilege for the target index or index alias. The script can update, delete, or skip modifying the document. The API also supports passing a partial document, which is merged into the existing document. To fully replace an existing document, use the index API. This operation: * Gets the document (collocated with the shard) from the index. * Runs the specified script. * Indexes the result. The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. The `_source` field must be enabled to use this API. In addition to `_source`, you can access the following variables through the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing`, and `_now` (the current timestamp). * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html | Elasticsearch API documentation} */ export default async function UpdateApi (this: That, params: T.UpdateRequest, options?: TransportRequestOptionsWithOutMeta): Promise> @@ -47,16 +47,27 @@ export default async function UpdateApi (this: That, params: T.UpdateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] const acceptedBody: string[] = ['detect_noop', 'doc', 'doc_as_upsert', 'script', 'scripted_upsert', '_source', 'upsert'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/update_by_query.ts b/src/api/api/update_by_query.ts index 83ea42500..503b5f9bb 100644 --- a/src/api/api/update_by_query.ts +++ b/src/api/api/update_by_query.ts @@ -47,16 +47,27 @@ export default async function UpdateByQueryApi (this: That, params: T.UpdateByQu export default async function UpdateByQueryApi (this: That, params: T.UpdateByQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] const acceptedBody: string[] = ['max_docs', 'query', 'script', 'slice', 'conflicts'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/update_by_query_rethrottle.ts b/src/api/api/update_by_query_rethrottle.ts index bd5fa29d7..e2f7aa6fa 100644 --- a/src/api/api/update_by_query_rethrottle.ts +++ b/src/api/api/update_by_query_rethrottle.ts @@ -46,13 +46,23 @@ export default async function UpdateByQueryRethrottleApi (this: That, params: T. export default async function UpdateByQueryRethrottleApi (this: That, params: T.UpdateByQueryRethrottleRequest, options?: TransportRequestOptions): Promise export default async function UpdateByQueryRethrottleApi (this: That, params: T.UpdateByQueryRethrottleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/watcher.ts b/src/api/api/watcher.ts index de32a06e7..df5201232 100644 --- a/src/api/api/watcher.ts +++ b/src/api/api/watcher.ts @@ -52,13 +52,23 @@ export default class Watcher { async ackWatch (this: That, params: T.WatcherAckWatchRequest, options?: TransportRequestOptions): Promise async ackWatch (this: That, params: T.WatcherAckWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['watch_id', 'action_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -92,13 +102,23 @@ export default class Watcher { async activateWatch (this: That, params: T.WatcherActivateWatchRequest, options?: TransportRequestOptions): Promise async activateWatch (this: That, params: T.WatcherActivateWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['watch_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -124,13 +144,23 @@ export default class Watcher { async deactivateWatch (this: That, params: T.WatcherDeactivateWatchRequest, options?: TransportRequestOptions): Promise async deactivateWatch (this: That, params: T.WatcherDeactivateWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['watch_id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -156,13 +186,23 @@ export default class Watcher { async deleteWatch (this: That, params: T.WatcherDeleteWatchRequest, options?: TransportRequestOptions): Promise async deleteWatch (this: That, params: T.WatcherDeleteWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -189,17 +229,28 @@ export default class Watcher { async executeWatch (this: That, params?: T.WatcherExecuteWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['action_modes', 'alternative_input', 'ignore_condition', 'record_execution', 'simulated_actions', 'trigger_data', 'watch'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -232,14 +283,24 @@ export default class Watcher { async getSettings (this: That, params?: T.WatcherGetSettingsRequest, options?: TransportRequestOptions): Promise async getSettings (this: That, params?: T.WatcherGetSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -262,13 +323,23 @@ export default class Watcher { async getWatch (this: That, params: T.WatcherGetWatchRequest, options?: TransportRequestOptions): Promise async getWatch (this: That, params: T.WatcherGetWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const querystring: Record = {} - const body = undefined + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -295,16 +366,27 @@ export default class Watcher { async putWatch (this: That, params: T.WatcherPutWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] const acceptedBody: string[] = ['actions', 'condition', 'input', 'metadata', 'throttle_period', 'throttle_period_in_millis', 'transform', 'trigger'] - const querystring: Record = {} - const body: Record = {} + 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -331,17 +413,28 @@ export default class Watcher { async queryWatches (this: That, params?: T.WatcherQueryWatchesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['from', 'size', 'query', 'sort', 'search_after'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -364,14 +457,24 @@ export default class Watcher { async start (this: That, params?: T.WatcherStartRequest, options?: TransportRequestOptions): Promise async start (this: That, params?: T.WatcherStartRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -394,14 +497,24 @@ export default class Watcher { async stats (this: That, params?: T.WatcherStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.WatcherStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['metric'] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -434,14 +547,24 @@ export default class Watcher { async stop (this: That, params?: T.WatcherStopRequest, options?: TransportRequestOptions): Promise async stop (this: That, params?: T.WatcherStopRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -465,17 +588,28 @@ export default class Watcher { async updateSettings (this: That, params?: T.WatcherUpdateSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] const acceptedBody: string[] = ['index.auto_expand_replicas', 'index.number_of_replicas'] - const querystring: Record = {} - const body: Record = {} + 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 } + } + } params = params ?? {} 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 { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/api/xpack.ts b/src/api/api/xpack.ts index b57d2d754..0082b65e2 100644 --- a/src/api/api/xpack.ts +++ b/src/api/api/xpack.ts @@ -52,14 +52,24 @@ export default class Xpack { async info (this: That, params?: T.XpackInfoRequest, options?: TransportRequestOptions): Promise async info (this: That, params?: T.XpackInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } @@ -82,14 +92,24 @@ export default class Xpack { async usage (this: That, params?: T.XpackUsageRequest, options?: TransportRequestOptions): Promise async usage (this: That, params?: T.XpackUsageRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const querystring: Record = {} - const body = undefined + 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 } + } + } params = params ?? {} for (const key in params) { if (acceptedPath.includes(key)) { continue - } else { + } else if (key !== 'body' && key !== 'querystring') { // @ts-expect-error querystring[key] = params[key] } diff --git a/src/api/types.ts b/src/api/types.ts index 33075707b..f55ad9226 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -57,19 +57,35 @@ export interface BulkOperationContainer { export type BulkOperationType = 'index' | 'create' | 'update' | 'delete' export interface BulkRequest extends RequestBase { +/** The name of the data stream, index, or index alias to perform bulk actions on. */ index?: IndexName + /** If `true`, the response will include the ingest pipelines that were run for each index or create. */ list_executed_pipelines?: boolean + /** The pipeline identifier to use to preprocess incoming documents. If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. If a final pipeline is configured, it will always run regardless of the value of this parameter. */ pipeline?: string + /** If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. If `wait_for`, wait for a refresh to make this operation visible to search. If `false`, do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. */ refresh?: Refresh + /** A custom value that is used to route operations to a specific shard. */ routing?: Routing + /** Indicates whether to return the `_source` field (`true` or `false`) or contains a list of fields to return. */ _source?: SearchSourceConfigParam + /** A comma-separated 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_excludes?: Fields + /** 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. If the `_source` parameter is `false`, this parameter is ignored. */ _source_includes?: Fields + /** The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards. The default is `1m` (one minute), which guarantees Elasticsearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur. */ timeout?: Duration + /** The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default is `1`, which waits for each primary shard to be active. */ wait_for_active_shards?: WaitForActiveShards + /** If `true`, the request's actions must target an index alias. */ require_alias?: boolean + /** If `true`, the request's actions must target a data stream (existing or to be created). */ require_data_stream?: boolean operations?: (BulkOperationContainer | BulkUpdateAction | TDocument)[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, list_executed_pipelines?: never, pipeline?: never, refresh?: never, routing?: never, _source?: never, _source_excludes?: never, _source_includes?: never, timeout?: never, wait_for_active_shards?: never, require_alias?: never, require_data_stream?: never, operations?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, list_executed_pipelines?: never, pipeline?: never, refresh?: never, routing?: never, _source?: never, _source_excludes?: never, _source_includes?: never, timeout?: never, wait_for_active_shards?: never, require_alias?: never, require_data_stream?: never, operations?: never } } export interface BulkResponse { @@ -115,7 +131,12 @@ export interface BulkWriteOperation extends BulkOperationBase { } export interface ClearScrollRequest extends RequestBase { +/** A comma-separated list of scroll IDs to clear. To clear all scroll IDs, use `_all`. IMPORTANT: Scroll IDs can be long. It is recommended to specify scroll IDs in the request body parameter. */ scroll_id?: ScrollIds + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { scroll_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { scroll_id?: never } } export interface ClearScrollResponse { @@ -124,7 +145,12 @@ export interface ClearScrollResponse { } export interface ClosePointInTimeRequest extends RequestBase { +/** The ID of the point-in-time. */ id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export interface ClosePointInTimeResponse { @@ -133,22 +159,42 @@ export interface ClosePointInTimeResponse { } export interface CountRequest extends RequestBase { +/** A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. */ analyzer?: string + /** If `true`, wildcard and prefix queries are analyzed. This parameter can be used only when the `q` query string parameter is specified. */ analyze_wildcard?: boolean + /** The default operator for query string query: `AND` or `OR`. This parameter can be used only when the `q` query string parameter is specified. */ default_operator?: QueryDslOperator + /** The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter is specified. */ df?: string + /** The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** If `true`, concrete, expanded, or aliased indices are ignored when frozen. */ ignore_throttled?: boolean + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the `q` query string parameter is specified. */ lenient?: boolean + /** The minimum `_score` value that documents must have to be included in the result. */ min_score?: double + /** The node or shard the operation should be performed on. By default, it is random. */ preference?: string + /** A custom value used to route operations to a specific shard. */ routing?: Routing + /** The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. */ terminate_after?: long + /** The query in Lucene query string syntax. */ q?: string + /** Defines the search definition using the Query DSL. The query is optional, and when not provided, it will use `match_all` to count all the docs. */ query?: QueryDslQueryContainer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, analyzer?: never, analyze_wildcard?: never, default_operator?: never, df?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, lenient?: never, min_score?: never, preference?: never, routing?: never, terminate_after?: never, q?: never, query?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, analyzer?: never, analyze_wildcard?: never, default_operator?: never, df?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, lenient?: never, min_score?: never, preference?: never, routing?: never, terminate_after?: never, q?: never, query?: never } } export interface CountResponse { @@ -157,68 +203,131 @@ export interface CountResponse { } export interface CreateRequest extends RequestBase { +/** A unique identifier for the document. To automatically generate a document ID, use the `POST //_doc/` request format. */ id: Id + /** The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If the target doesn't exist and doesn’t match a data stream template, this request creates the index. */ index: IndexName + /** The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. If a final pipeline is configured, it will always run regardless of the value of this parameter. */ pipeline?: string + /** If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. If `wait_for`, it waits for a refresh to make this operation visible to search. If `false`, it does nothing with refreshes. */ refresh?: Refresh + /** A custom value that is used to route operations to a specific shard. */ routing?: Routing + /** The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. Elasticsearch waits for at least the specified timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur. This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. The actual wait time could be longer, particularly when multiple waits occur. */ timeout?: Duration + /** The explicit version number for concurrency control. It must be a non-negative long number. */ version?: VersionNumber + /** The version type. */ version_type?: VersionType + /** The number of shard copies that must be active before proceeding with the operation. You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default value of `1` means it waits for each primary shard to be active. */ wait_for_active_shards?: WaitForActiveShards document?: TDocument + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, index?: never, pipeline?: never, refresh?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, document?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, index?: never, pipeline?: never, refresh?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, document?: never } } export type CreateResponse = WriteResponseBase export interface DeleteRequest extends RequestBase { +/** A unique identifier for the document. */ id: Id + /** The name of the target index. */ index: IndexName + /** Only perform the operation if the document has this primary term. */ if_primary_term?: long + /** Only perform the operation if the document has this sequence number. */ if_seq_no?: SequenceNumber + /** If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. If `wait_for`, it waits for a refresh to make this operation visible to search. If `false`, it does nothing with refreshes. */ refresh?: Refresh + /** A custom value used to route operations to a specific shard. */ routing?: Routing + /** The period to wait for active shards. This parameter is useful for situations where the primary shard assigned to perform the delete operation might not be available when the delete operation runs. Some reasons for this might be that the primary shard is currently recovering from a store or undergoing relocation. By default, the delete operation will wait on the primary shard to become available for up to 1 minute before failing and responding with an error. */ timeout?: Duration + /** An explicit version number for concurrency control. It must match the current version of the document for the request to succeed. */ version?: VersionNumber + /** The version type. */ version_type?: VersionType + /** The minimum number of shard copies that must be active before proceeding with the operation. You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default value of `1` means it waits for each primary shard to be active. */ wait_for_active_shards?: WaitForActiveShards + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, index?: never, if_primary_term?: never, if_seq_no?: never, refresh?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, index?: never, if_primary_term?: never, if_seq_no?: never, refresh?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never } } export type DeleteResponse = WriteResponseBase export interface DeleteByQueryRequest extends RequestBase { +/** A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams or indices, omit this parameter or use `*` or `_all`. */ index: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** Analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. */ analyzer?: string + /** If `true`, wildcard and prefix queries are analyzed. This parameter can be used only when the `q` query string parameter is specified. */ analyze_wildcard?: boolean + /** What to do if delete by query hits version conflicts: `abort` or `proceed`. */ conflicts?: Conflicts + /** The default operator for query string query: `AND` or `OR`. This parameter can be used only when the `q` query string parameter is specified. */ default_operator?: QueryDslOperator + /** The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter is specified. */ df?: string + /** The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** Starting offset (default: 0) */ from?: long + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the `q` query string parameter is specified. */ lenient?: boolean + /** The node or shard the operation should be performed on. It is random by default. */ preference?: string + /** If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. This is different than the delete API's `refresh` parameter, which causes just the shard that received the delete request to be refreshed. Unlike the delete API, it does not support `wait_for`. */ refresh?: boolean + /** If `true`, the request cache is used for this request. Defaults to the index-level setting. */ request_cache?: boolean + /** The throttle for this request in sub-requests per second. */ requests_per_second?: float + /** A custom value used to route operations to a specific shard. */ routing?: Routing + /** A query in the Lucene query string syntax. */ q?: string + /** The period to retain the search context for scrolling. */ scroll?: Duration + /** The size of the scroll request that powers the operation. */ scroll_size?: long + /** The explicit timeout for each search request. It defaults to no timeout. */ search_timeout?: Duration + /** The type of the search operation. Available options include `query_then_fetch` and `dfs_query_then_fetch`. */ search_type?: SearchType + /** The number of slices this task should be divided into. */ slices?: Slices + /** A comma-separated list of `:` pairs. */ sort?: string[] + /** The specific `tag` of the request for logging and statistical purposes. */ stats?: string[] + /** The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. */ terminate_after?: long + /** The period each deletion request waits for active shards. */ timeout?: Duration + /** If `true`, returns the document version as part of a hit. */ version?: boolean + /** The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The `timeout` value controls how long each write request waits for unavailable shards to become available. */ wait_for_active_shards?: WaitForActiveShards + /** If `true`, the request blocks until the operation is complete. If `false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. */ wait_for_completion?: boolean + /** The maximum number of documents to delete. */ max_docs?: long + /** The documents to delete specified with Query DSL. */ query?: QueryDslQueryContainer + /** Slice the request manually using the provided slice ID and total number of slices. */ slice?: SlicedScroll + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, analyzer?: never, analyze_wildcard?: never, conflicts?: never, default_operator?: never, df?: never, expand_wildcards?: never, from?: never, ignore_unavailable?: never, lenient?: never, preference?: never, refresh?: never, request_cache?: never, requests_per_second?: never, routing?: never, q?: never, scroll?: never, scroll_size?: never, search_timeout?: never, search_type?: never, slices?: never, sort?: never, stats?: never, terminate_after?: never, timeout?: never, version?: never, wait_for_active_shards?: never, wait_for_completion?: never, max_docs?: never, query?: never, slice?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, analyzer?: never, analyze_wildcard?: never, conflicts?: never, default_operator?: never, df?: never, expand_wildcards?: never, from?: never, ignore_unavailable?: never, lenient?: never, preference?: never, refresh?: never, request_cache?: never, requests_per_second?: never, routing?: never, q?: never, scroll?: never, scroll_size?: never, search_timeout?: never, search_type?: never, slices?: never, sort?: never, stats?: never, terminate_after?: never, timeout?: never, version?: never, wait_for_active_shards?: never, wait_for_completion?: never, max_docs?: never, query?: never, slice?: never } } export interface DeleteByQueryResponse { @@ -241,49 +350,93 @@ export interface DeleteByQueryResponse { } export interface DeleteByQueryRethrottleRequest extends RequestBase { +/** The ID for the task. */ task_id: TaskId + /** The throttle for this request in sub-requests per second. To disable throttling, set it to `-1`. */ requests_per_second?: float + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_id?: never, requests_per_second?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_id?: never, requests_per_second?: never } } export type DeleteByQueryRethrottleResponse = TasksTaskListResponseBase export interface DeleteScriptRequest extends RequestBase { +/** Identifier for the stored script or search template. */ id: Id + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never } } export type DeleteScriptResponse = AcknowledgedResponseBase export interface ExistsRequest extends RequestBase { +/** A unique document identifier. */ id: Id + /** A comma-separated list of data streams, indices, and aliases. It supports wildcards (`*`). */ index: IndexName + /** The node or shard the operation should be performed on. By default, the operation is randomized between the shard replicas. If it is set to `_local`, the operation will prefer to be run on a local allocated shard when possible. If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. This can help with "jumping values" when hitting different shards in different refresh states. A sample value can be something like the web session ID or the user name. */ preference?: string + /** If `true`, the request is real-time as opposed to near-real-time. */ realtime?: boolean + /** If `true`, the request refreshes the relevant shards before retrieving the document. Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). */ refresh?: boolean + /** A custom value used to route operations to a specific shard. */ routing?: Routing + /** Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. */ _source?: SearchSourceConfigParam + /** A comma-separated 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_excludes?: Fields + /** 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. If the `_source` parameter is `false`, this parameter is ignored. */ _source_includes?: Fields + /** A comma-separated 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`. */ stored_fields?: Fields + /** Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. */ version?: VersionNumber + /** 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, 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, 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 ExistsResponse = boolean export interface ExistsSourceRequest extends RequestBase { +/** A unique identifier for the document. */ id: Id + /** A comma-separated list of data streams, indices, and aliases. It supports wildcards (`*`). */ index: IndexName + /** The node or shard the operation should be performed on. By default, the operation is randomized between the shard replicas. */ preference?: string + /** If `true`, the request is real-time as opposed to near-real-time. */ realtime?: boolean + /** If `true`, the request refreshes the relevant shards before retrieving the document. Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). */ refresh?: boolean + /** A custom value used to route operations to a specific shard. */ routing?: Routing + /** Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. */ _source?: SearchSourceConfigParam + /** A comma-separated list of source fields to exclude in the response. */ _source_excludes?: Fields + /** A comma-separated list of source fields to include in the response. */ _source_includes?: Fields + /** The version number for concurrency control. It must match the current version of the document for the request to succeed. */ version?: VersionNumber + /** 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, preference?: never, realtime?: never, refresh?: never, routing?: never, _source?: never, _source_excludes?: never, _source_includes?: 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, preference?: never, realtime?: never, refresh?: never, routing?: never, _source?: never, _source_excludes?: never, _source_includes?: never, version?: never, version_type?: never } } export type ExistsSourceResponse = boolean @@ -301,21 +454,40 @@ export interface ExplainExplanationDetail { } export interface ExplainRequest extends RequestBase { +/** Defines the document ID. */ id: Id + /** Index names used to limit the request. Only a single index name can be provided to this parameter. */ index: IndexName + /** Analyzer to use for the query string. This parameter can only be used when the `q` query string parameter is specified. */ analyzer?: string + /** If `true`, wildcard and prefix queries are analyzed. */ analyze_wildcard?: boolean + /** The default operator for query string query: `AND` or `OR`. */ default_operator?: QueryDslOperator + /** Field to use as default where no field prefix is given in the query string. */ df?: string + /** If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. */ lenient?: boolean + /** Specifies the node or shard the operation should be performed on. Random by default. */ preference?: string + /** Custom value used to route operations to a specific shard. */ routing?: Routing + /** True or false to return the `_source` field or not, or a list of fields to return. */ _source?: SearchSourceConfigParam + /** A comma-separated list of source fields to exclude from the response. */ _source_excludes?: Fields + /** A comma-separated list of source fields to include in the response. */ _source_includes?: Fields + /** A comma-separated list of stored fields to return in the response. */ stored_fields?: Fields + /** Query in the Lucene query string syntax. */ q?: string + /** Defines the search definition using the Query DSL. */ query?: QueryDslQueryContainer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, index?: never, analyzer?: never, analyze_wildcard?: never, default_operator?: never, df?: never, lenient?: never, preference?: never, routing?: never, _source?: never, _source_excludes?: never, _source_includes?: never, stored_fields?: never, q?: never, query?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, index?: never, analyzer?: never, analyze_wildcard?: never, default_operator?: never, df?: never, lenient?: never, preference?: never, routing?: never, _source?: never, _source_excludes?: never, _source_includes?: never, stored_fields?: never, q?: never, query?: never } } export interface ExplainResponse { @@ -342,17 +514,32 @@ export interface FieldCapsFieldCapability { } export interface FieldCapsRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. */ index?: Indices + /** If false, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** If `true`, missing or closed indices are not included in the response. */ ignore_unavailable?: boolean + /** If true, unmapped fields are included in the response. */ include_unmapped?: boolean + /** An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent */ filters?: string + /** Only return results for fields that have one of the types in the list */ types?: string[] + /** If false, empty fields are not included in the response. */ include_empty_fields?: boolean + /** List of fields to retrieve capabilities for. Wildcard (`*`) expressions are supported. */ fields?: Fields + /** Allows to filter indices if the provided query rewrites to match_none on every shard. */ index_filter?: QueryDslQueryContainer + /** Defines ad-hoc runtime fields in the request similar to the way it is done in search requests. These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. */ runtime_mappings?: MappingRuntimeFields + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, include_unmapped?: never, filters?: never, types?: never, include_empty_fields?: never, fields?: never, index_filter?: never, runtime_mappings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, include_unmapped?: never, filters?: never, types?: never, include_empty_fields?: never, fields?: never, index_filter?: never, runtime_mappings?: never } } export interface FieldCapsResponse { @@ -374,26 +561,49 @@ export interface GetGetResult { } export interface GetRequest extends RequestBase { +/** A unique document identifier. */ id: Id + /** The name of the index that contains the document. */ index: IndexName + /** Indicates whether the request forces synthetic `_source`. Use this paramater to test if the mapping supports synthetic `_source` and to get a sense of the worst case performance. Fetches with this parameter enabled will be slower than enabling synthetic source natively in the index. */ force_synthetic_source?: boolean + /** The node or shard the operation should be performed on. By default, the operation is randomized between the shard replicas. If it is set to `_local`, the operation will prefer to be run on a local allocated shard when possible. If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. This can help with "jumping values" when hitting different shards in different refresh states. A sample value can be something like the web session ID or the user name. */ preference?: string + /** If `true`, the request is real-time as opposed to near-real-time. */ realtime?: boolean + /** If `true`, the request refreshes the relevant shards before retrieving the document. Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). */ refresh?: boolean + /** A custom value used to route operations to a specific shard. */ routing?: Routing + /** Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. */ _source?: SearchSourceConfigParam + /** A comma-separated 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_excludes?: Fields + /** 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. If the `_source` parameter is `false`, this parameter is ignored. */ _source_includes?: Fields + /** A comma-separated 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_field` option. Object fields can't be returned;if specified, the request fails. */ stored_fields?: Fields + /** The version number for concurrency control. It must match the current version of the document for the request to succeed. */ version?: VersionNumber + /** 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_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_includes?: never, stored_fields?: never, version?: never, version_type?: never } } export type GetResponse = GetGetResult export interface GetScriptRequest extends RequestBase { +/** Identifier for the stored script or search template. */ id: Id + /** Specify timeout for connection to master */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never } } export interface GetScriptResponse { @@ -419,6 +629,10 @@ export interface GetScriptContextContextMethodParam { } export interface GetScriptContextRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface GetScriptContextResponse { @@ -431,6 +645,10 @@ export interface GetScriptLanguagesLanguageContext { } export interface GetScriptLanguagesRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface GetScriptLanguagesResponse { @@ -439,18 +657,34 @@ export interface GetScriptLanguagesResponse { } export interface GetSourceRequest extends RequestBase { +/** A unique document identifier. */ id: Id + /** The name of the index that contains the document. */ index: IndexName + /** The node or shard the operation should be performed on. By default, the operation is randomized between the shard replicas. */ preference?: string + /** If `true`, the request is real-time as opposed to near-real-time. */ realtime?: boolean + /** If `true`, the request refreshes the relevant shards before retrieving the document. Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). */ refresh?: boolean + /** A custom value used to route operations to a specific shard. */ routing?: Routing + /** Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. */ _source?: SearchSourceConfigParam + /** A comma-separated list of source fields to exclude in the response. */ _source_excludes?: Fields + /** A comma-separated list of source fields to include in the response. */ _source_includes?: Fields + /** A comma-separated list of stored fields to return as part of a hit. */ stored_fields?: Fields + /** The version number for concurrency control. It must match the current version of the document for the request to succeed. */ version?: VersionNumber + /** 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, 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, 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 GetSourceResponse = TDocument @@ -580,10 +814,18 @@ export interface HealthReportRepositoryIntegrityIndicatorDetails { } export interface HealthReportRequest extends RequestBase { +/** A feature of the cluster, as returned by the top-level health report API. */ feature?: string | string[] + /** Explicit operation timeout. */ timeout?: Duration + /** Opt-in for more information about the health of the system. */ verbose?: boolean + /** Limit the number of affected resources the health report API returns. */ size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { feature?: never, timeout?: never, verbose?: never, size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { feature?: never, timeout?: never, verbose?: never, size?: never } } export interface HealthReportResponse { @@ -645,25 +887,46 @@ export interface HealthReportStagnatingBackingIndices { } export interface IndexRequest extends RequestBase { +/** A unique identifier for the document. To automatically generate a document ID, use the `POST //_doc/` request format and omit this parameter. */ id?: Id + /** The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If the target doesn't exist and doesn't match a data stream template, this request creates the index. You can check for existing targets with the resolve index API. */ index: IndexName + /** Only perform the operation if the document has this primary term. */ if_primary_term?: long + /** Only perform the operation if the document has this sequence number. */ if_seq_no?: SequenceNumber + /** Set to `create` to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. The behavior is the same as using the `/_create` endpoint. If a document ID is specified, this paramater defaults to `index`. Otherwise, it defaults to `create`. If the request targets a data stream, an `op_type` of `create` is required. */ op_type?: OpType + /** The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. */ pipeline?: string + /** If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. If `wait_for`, it waits for a refresh to make this operation visible to search. If `false`, it does nothing with refreshes. */ refresh?: Refresh + /** A custom value that is used to route operations to a specific shard. */ routing?: Routing + /** The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. The actual wait time could be longer, particularly when multiple waits occur. */ timeout?: Duration + /** An explicit version number for concurrency control. It must be a non-negative long number. */ version?: VersionNumber + /** The version type. */ version_type?: VersionType + /** The number of shard copies that must be active before proceeding with the operation. You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default value of `1` means it waits for each primary shard to be active. */ wait_for_active_shards?: WaitForActiveShards + /** If `true`, the destination must be an index alias. */ require_alias?: boolean document?: TDocument + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, index?: never, if_primary_term?: never, if_seq_no?: never, op_type?: never, pipeline?: never, refresh?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, require_alias?: never, document?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, index?: never, if_primary_term?: never, if_seq_no?: never, op_type?: never, pipeline?: never, refresh?: never, routing?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, require_alias?: never, document?: never } } export type IndexResponse = WriteResponseBase export interface InfoRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface InfoResponse { @@ -675,14 +938,26 @@ export interface InfoResponse { } export interface KnnSearchRequest extends RequestBase { +/** A comma-separated list of index names to search; use `_all` or to perform the operation on all indices */ index: Indices + /** A comma-separated list of specific routing values */ routing?: Routing + /** Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response. */ _source?: SearchSourceConfig + /** The request returns doc values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns. */ docvalue_fields?: (QueryDslFieldAndFormat | Field)[] + /** 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. You can pass _source: true to return both source fields and stored fields in the search response. */ stored_fields?: Fields + /** The request returns values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns. */ fields?: Fields + /** Query to filter the documents that can match. The kNN search will return the top `k` documents that also match this filter. The value can be a single query or a list of queries. If `filter` isn't provided, all documents are allowed to match. */ filter?: QueryDslQueryContainer | QueryDslQueryContainer[] + /** kNN query to execute */ knn: KnnSearchQuery + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, routing?: never, _source?: never, docvalue_fields?: never, stored_fields?: never, fields?: never, filter?: never, knn?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, routing?: never, _source?: never, docvalue_fields?: never, stored_fields?: never, fields?: never, filter?: never, knn?: never } } export interface KnnSearchResponse { @@ -718,18 +993,34 @@ export interface MgetOperation { } export interface MgetRequest extends RequestBase { +/** Name of the index to retrieve documents from when `ids` are specified, or when a document in the `docs` array does not specify an index. */ index?: IndexName + /** 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. */ force_synthetic_source?: boolean + /** Specifies the node or shard the operation should be performed on. Random by default. */ preference?: string + /** If `true`, the request is real-time as opposed to near-real-time. */ realtime?: boolean + /** If `true`, the request refreshes relevant shards before retrieving documents. */ refresh?: boolean + /** Custom value used to route operations to a specific shard. */ routing?: Routing + /** True or false to return the `_source` field or not, or a list of fields to return. */ _source?: SearchSourceConfigParam + /** A comma-separated 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. */ _source_excludes?: Fields + /** 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. If the `_source` parameter is `false`, this parameter is ignored. */ _source_includes?: Fields + /** If `true`, retrieves the document fields stored in the index rather than the document `_source`. */ stored_fields?: Fields + /** The documents you want to retrieve. Required if no index is specified in the request URI. */ docs?: MgetOperation[] + /** The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI. */ ids?: Ids + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { 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, docs?: never, ids?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { 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, docs?: never, ids?: never } } export interface MgetResponse { @@ -797,21 +1088,39 @@ export interface MsearchMultisearchHeader { } export interface MsearchRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and index aliases to search. */ index?: Indices + /** If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. */ allow_no_indices?: boolean + /** If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests. */ ccs_minimize_roundtrips?: boolean + /** Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. */ expand_wildcards?: ExpandWildcards + /** If true, concrete, expanded or aliased indices are ignored when frozen. */ ignore_throttled?: boolean + /** If true, missing or closed indices are not included in the response. */ ignore_unavailable?: boolean + /** Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) This functionality reruns each named query on every hit in a search response. Typically, this adds a small overhead to a request. However, using computationally expensive named queries on a large number of hits may add significant overhead. */ include_named_queries_score?: boolean + /** Maximum number of concurrent searches the multi search API can execute. */ max_concurrent_searches?: long + /** Maximum number of concurrent shard requests that each sub-search request executes per node. */ max_concurrent_shard_requests?: long + /** Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. */ pre_filter_shard_size?: long + /** If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. */ rest_total_hits_as_int?: boolean + /** Custom routing value used to route search operations to a specific shard. */ routing?: Routing + /** Indicates whether global term and document frequencies should be used when scoring returned documents. */ search_type?: SearchType + /** Specifies whether aggregation and suggester names should be prefixed by their respective types in the response. */ typed_keys?: boolean searches?: MsearchRequestItem[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, ccs_minimize_roundtrips?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, include_named_queries_score?: never, max_concurrent_searches?: never, max_concurrent_shard_requests?: never, pre_filter_shard_size?: never, rest_total_hits_as_int?: never, routing?: never, search_type?: never, typed_keys?: never, searches?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, ccs_minimize_roundtrips?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, include_named_queries_score?: never, max_concurrent_searches?: never, max_concurrent_shard_requests?: never, pre_filter_shard_size?: never, rest_total_hits_as_int?: never, routing?: never, search_type?: never, typed_keys?: never, searches?: never } } export type MsearchRequestItem = MsearchMultisearchHeader | MsearchMultisearchBody @@ -821,13 +1130,23 @@ export type MsearchResponse = MsearchMultiSearchItem | ErrorResponseBase export interface MsearchTemplateRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*`. */ index?: Indices + /** If `true`, network round-trips are minimized for cross-cluster search requests. */ ccs_minimize_roundtrips?: boolean + /** Maximum number of concurrent searches the API can run. */ max_concurrent_searches?: long + /** The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`. */ search_type?: SearchType + /** If `true`, the response returns `hits.total` as an integer. If `false`, it returns `hits.total` as an object. */ rest_total_hits_as_int?: boolean + /** If `true`, the response prefixes aggregation and suggester names with their respective types. */ typed_keys?: boolean search_templates?: MsearchTemplateRequestItem[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, ccs_minimize_roundtrips?: never, max_concurrent_searches?: never, search_type?: never, rest_total_hits_as_int?: never, typed_keys?: never, search_templates?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, ccs_minimize_roundtrips?: never, max_concurrent_searches?: never, search_type?: never, rest_total_hits_as_int?: never, typed_keys?: never, search_templates?: never } } export type MsearchTemplateRequestItem = MsearchMultisearchHeader | MsearchTemplateTemplateConfig @@ -859,20 +1178,38 @@ export interface MtermvectorsOperation { } export interface MtermvectorsRequest extends RequestBase { +/** Name of the index that contains the documents. */ index?: IndexName + /** Comma-separated list or wildcard expressions of fields to include in the statistics. Used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. */ fields?: Fields + /** If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. */ field_statistics?: boolean + /** If `true`, the response includes term offsets. */ offsets?: boolean + /** If `true`, the response includes term payloads. */ payloads?: boolean + /** If `true`, the response includes term positions. */ positions?: boolean + /** Specifies the node or shard the operation should be performed on. Random by default. */ preference?: string + /** If true, the request is real-time as opposed to near-real-time. */ realtime?: boolean + /** Custom value used to route operations to a specific shard. */ routing?: Routing + /** If true, the response includes term frequency and document frequency. */ term_statistics?: boolean + /** If `true`, returns the document version as part of a hit. */ version?: VersionNumber + /** Specific version type. */ version_type?: VersionType + /** Array of existing or artificial documents. */ docs?: MtermvectorsOperation[] + /** Simplified syntax to specify documents by their ID if they're in the same index. */ ids?: Id[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, fields?: never, field_statistics?: never, offsets?: never, payloads?: never, positions?: never, preference?: never, realtime?: never, routing?: never, term_statistics?: never, version?: never, version_type?: never, docs?: never, ids?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, fields?: never, field_statistics?: never, offsets?: never, payloads?: never, positions?: never, preference?: never, realtime?: never, routing?: never, term_statistics?: never, version?: never, version_type?: never, docs?: never, ids?: never } } export interface MtermvectorsResponse { @@ -890,14 +1227,26 @@ export interface MtermvectorsTermVectorsResult { } export interface OpenPointInTimeRequest extends RequestBase { +/** A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices */ index: Indices + /** Extend the length of time that the point in time persists. */ keep_alive: Duration + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** The node or shard the operation should be performed on. By default, it is random. */ preference?: string + /** A custom value that is used to route operations to a specific shard. */ routing?: Routing + /** The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** Indicates whether the point in time tolerates unavailable shards or shard failures when initially creating the PIT. If `false`, creating a point in time request when a shard is missing or unavailable will throw an exception. If `true`, the point in time will contain all the shards that are available at the time of the request. */ allow_partial_search_results?: boolean + /** Filter indices if the provided query rewrites to `match_none` on every shard. */ index_filter?: QueryDslQueryContainer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, keep_alive?: never, ignore_unavailable?: never, preference?: never, routing?: never, expand_wildcards?: never, allow_partial_search_results?: never, index_filter?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, keep_alive?: never, ignore_unavailable?: never, preference?: never, routing?: never, expand_wildcards?: never, allow_partial_search_results?: never, index_filter?: never } } export interface OpenPointInTimeResponse { @@ -906,16 +1255,29 @@ export interface OpenPointInTimeResponse { } export interface PingRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export type PingResponse = boolean export interface PutScriptRequest extends RequestBase { +/** Identifier for the stored script or search template. Must be unique within the cluster. */ id: Id + /** Context in which the script or search template should run. To prevent errors, the API immediately compiles the script or template in this context. */ context?: Name + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** Contains the script or search template, its parameters, and its language. */ script: StoredScript + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, context?: never, master_timeout?: never, timeout?: never, script?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, context?: never, master_timeout?: never, timeout?: never, script?: never } } export type PutScriptResponse = AcknowledgedResponseBase @@ -992,13 +1354,24 @@ export interface RankEvalRankEvalRequestItem { } export interface RankEvalRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. To target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** Whether to expand wildcard expression to concrete indices that are open, closed or both. */ expand_wildcards?: ExpandWildcards + /** If `true`, missing or closed indices are not included in the response. */ ignore_unavailable?: boolean + /** Search operation type */ search_type?: string + /** A set of typical search requests, together with their provided ratings. */ requests: RankEvalRankEvalRequestItem[] + /** Definition of the evaluation metric to calculate. */ metric?: RankEvalRankEvalMetric + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, search_type?: never, requests?: never, metric?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, search_type?: never, requests?: never, metric?: never } } export interface RankEvalResponse { @@ -1030,20 +1403,37 @@ export interface ReindexRemoteSource { } export interface ReindexRequest extends RequestBase { +/** If `true`, the request refreshes affected shards to make this operation visible to search. */ refresh?: boolean + /** The throttle for this request in sub-requests per second. By default, there is no throttle. */ requests_per_second?: float + /** The period of time that a consistent view of the index should be maintained for scrolled search. */ scroll?: Duration + /** The number of slices this task should be divided into. It defaults to one slice, which means the task isn't sliced into subtasks. Reindex supports sliced scroll to parallelize the reindexing process. This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. NOTE: Reindexing from remote clusters does not support manual or automatic slicing. If set to `auto`, Elasticsearch chooses the number of slices to use. This setting will use one slice per shard, up to a certain limit. If there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards. */ slices?: Slices + /** The period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. By default, Elasticsearch waits for at least one minute before failing. The actual wait time could be longer, particularly when multiple waits occur. */ timeout?: Duration + /** The number of shard copies that must be active before proceeding with the operation. Set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). The default value is one, which means it waits for each primary shard to be active. */ wait_for_active_shards?: WaitForActiveShards + /** If `true`, the request blocks until the operation is complete. */ wait_for_completion?: boolean + /** If `true`, the destination must be an index alias. */ require_alias?: boolean + /** Indicates whether to continue reindexing even when there are conflicts. */ conflicts?: Conflicts + /** The destination you are copying to. */ dest: ReindexDestination + /** The maximum number of documents to reindex. By default, all documents are reindexed. If it is a value less then or equal to `scroll_size`, a scroll will not be used to retrieve the results for the operation. If `conflicts` is set to `proceed`, the reindex operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query. */ max_docs?: long + /** The script to run to update the document source or metadata when reindexing. */ script?: Script | string size?: long + /** The source you are copying from. */ source: ReindexSource + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { refresh?: never, requests_per_second?: never, scroll?: never, slices?: never, timeout?: never, wait_for_active_shards?: never, wait_for_completion?: never, require_alias?: never, conflicts?: never, dest?: never, max_docs?: never, script?: never, size?: never, source?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { refresh?: never, requests_per_second?: never, scroll?: never, slices?: never, timeout?: never, wait_for_active_shards?: never, wait_for_completion?: never, require_alias?: never, conflicts?: never, dest?: never, max_docs?: never, script?: never, size?: never, source?: never } } export interface ReindexResponse { @@ -1110,8 +1500,14 @@ export interface ReindexRethrottleReindexTask { } export interface ReindexRethrottleRequest extends RequestBase { +/** The task identifier, which can be found by using the tasks API. */ task_id: Id + /** The throttle for this request in sub-requests per second. It can be either `-1` to turn off throttling or any decimal number like `1.7` or `12` to throttle to that level. */ requests_per_second?: float + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_id?: never, requests_per_second?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_id?: never, requests_per_second?: never } } export interface ReindexRethrottleResponse { @@ -1119,16 +1515,25 @@ export interface ReindexRethrottleResponse { } export interface RenderSearchTemplateRequest extends RequestBase { +/** ID of the search template to render. If no `source` is specified, this or the `id` request body parameter is required. */ id?: Id file?: string + /** Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. */ params?: Record + /** An inline search template. Supports the same parameters as the search API's request body. These parameters also support Mustache variables. If no `id` or `` is specified, this parameter is required. */ source?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, file?: never, params?: never, source?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, file?: never, params?: never, source?: never } } export interface RenderSearchTemplateResponse { template_output: Record } +export type ScriptsPainlessExecutePainlessContext = 'painless_test' | 'filter' | 'score' | 'boolean_field' | 'date_field' | 'double_field' | 'geo_point_field' | 'ip_field' | 'keyword_field' | 'long_field' | 'composite_field' + export interface ScriptsPainlessExecutePainlessContextSetup { document: any index: IndexName @@ -1136,9 +1541,16 @@ export interface ScriptsPainlessExecutePainlessContextSetup { } export interface ScriptsPainlessExecuteRequest extends RequestBase { - context?: string +/** The context that the script should run in. NOTE: Result ordering in the field contexts is not guaranteed. */ + context?: ScriptsPainlessExecutePainlessContext + /** Additional parameters for the `context`. NOTE: This parameter is required for all contexts except `painless_test`, which is the default if no value is provided for `context`. */ context_setup?: ScriptsPainlessExecutePainlessContextSetup + /** The Painless script to run. */ script?: Script | string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { context?: never, context_setup?: never, script?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { context?: never, context_setup?: never, script?: never } } export interface ScriptsPainlessExecuteResponse { @@ -1146,81 +1558,158 @@ export interface ScriptsPainlessExecuteResponse { } export interface ScrollRequest extends RequestBase { +/** The scroll ID */ scroll_id?: ScrollId + /** If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. */ rest_total_hits_as_int?: boolean + /** Period to retain the search context for scrolling. */ scroll?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { scroll_id?: never, rest_total_hits_as_int?: never, scroll?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { scroll_id?: never, rest_total_hits_as_int?: never, scroll?: never } } export type ScrollResponse> = SearchResponseBody export interface SearchRequest extends RequestBase { +/** A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** If `true` and there are shard request timeouts or shard failures, the request returns partial results. If `false`, it returns an error with no partial results. To override the default behavior, you can set the `search.default_allow_partial_results` cluster setting to `false`. */ allow_partial_search_results?: boolean + /** The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. */ analyzer?: string + /** If `true`, wildcard and prefix queries are analyzed. This parameter can be used only when the `q` query string parameter is specified. */ analyze_wildcard?: boolean + /** The number of shard results that should be reduced at once on the coordinating node. If the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request. */ batched_reduce_size?: long + /** If `true`, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests. */ ccs_minimize_roundtrips?: boolean + /** The default operator for the query string query: `AND` or `OR`. This parameter can be used only when the `q` query string parameter is specified. */ default_operator?: QueryDslOperator + /** The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter is specified. */ df?: string + /** The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** If `true`, concrete, expanded or aliased indices will be ignored when frozen. */ ignore_throttled?: boolean + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, the response includes the score contribution from any named queries. This functionality reruns each named query on every hit in a search response. Typically, this adds a small overhead to a request. However, using computationally expensive named queries on a large number of hits may add significant overhead. */ include_named_queries_score?: boolean + /** If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the `q` query string parameter is specified. */ lenient?: boolean + /** The number of concurrent shard requests per node that the search runs concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. */ max_concurrent_shard_requests?: long + /** The nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are: * `_only_local` to run the search only on shards on the local node. * `_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method. * `_only_nodes:,` to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method. * `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs. If not, select shards using the default method. `_shards:,` to run the search only on the specified shards. You can combine this value with other `preference` values. However, the `_shards` value must come first. For example: `_shards:2,3|_local`. `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order. */ preference?: string + /** A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint). When unspecified, the pre-filter phase is executed if any of these conditions is met: * The request targets more than 128 shards. * The request targets one or more read-only index. * The primary sort of the query targets an indexed field. */ pre_filter_shard_size?: long + /** If `true`, the caching of search results is enabled for requests where `size` is `0`. It defaults to index level settings. */ request_cache?: boolean + /** A custom value that is used to route operations to a specific shard. */ routing?: Routing + /** The period to retain the search context for scrolling. By default, this value cannot exceed `1d` (24 hours). You can change this limit by using the `search.max_keep_alive` cluster-level setting. */ scroll?: Duration + /** Indicates how distributed term frequencies are calculated for relevance scoring. */ search_type?: SearchType + /** The field to use for suggestions. */ suggest_field?: Field + /** The suggest mode. This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. */ suggest_mode?: SuggestMode + /** The number of suggestions to return. This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. */ suggest_size?: long + /** The source text for which the suggestions should be returned. This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. */ suggest_text?: string + /** If `true`, aggregation and suggester names are be prefixed by their respective types in the response. */ typed_keys?: boolean + /** Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response. */ rest_total_hits_as_int?: boolean + /** A comma-separated 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_excludes?: Fields + /** 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. If the `_source` parameter is `false`, this parameter is ignored. */ _source_includes?: Fields + /** 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. */ q?: string + /** 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. */ force_synthetic_source?: boolean + /** Defines the aggregations that are run as part of the search request. */ aggregations?: Record /** @alias aggregations */ + /** Defines the aggregations that are run as part of the search request. */ aggs?: Record + /** Collapses search results the values of the specified field. */ collapse?: SearchFieldCollapse + /** If `true`, the request returns detailed information about score computation as part of a hit. */ explain?: boolean + /** Configuration of search extensions defined by Elasticsearch plugins. */ ext?: Record + /** The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. */ from?: integer + /** Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. */ highlight?: SearchHighlight + /** Number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. */ track_total_hits?: SearchTrackHits + /** Boost the `_score` of documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than `1.0` increases the score. A boost value between `0` and `1.0` decreases the score. */ indices_boost?: Record[] + /** An array of wildcard (`*`) field patterns. The request returns doc values for field names matching these patterns in the `hits.fields` property of the response. */ docvalue_fields?: (QueryDslFieldAndFormat | Field)[] + /** The approximate kNN search to run. */ knn?: KnnSearch | KnnSearch[] + /** The Reciprocal Rank Fusion (RRF) to use. */ rank?: RankContainer + /** The minimum `_score` for matching documents. Documents with a lower `_score` are not included in the search results. */ min_score?: double + /** Use the `post_filter` parameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results. */ post_filter?: QueryDslQueryContainer + /** Set to `true` to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. */ profile?: boolean + /** The search definition using the Query DSL. */ query?: QueryDslQueryContainer + /** Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases. */ rescore?: SearchRescore | SearchRescore[] + /** A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such as `query` and `knn`. */ retriever?: RetrieverContainer + /** Retrieve a script evaluation (based on different fields) for each hit. */ script_fields?: Record + /** Used to retrieve the next page of hits using a set of sort values from the previous page. */ search_after?: SortResults + /** The number of hits to return, which must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` property. */ size?: integer + /** Split a scrolled search into multiple slices that can be consumed independently. */ slice?: SlicedScroll + /** A comma-separated list of : pairs. */ sort?: Sort + /** The source fields that are returned for matching documents. These fields are returned in the `hits._source` property of the search response. If the `stored_fields` property is specified, the `_source` property defaults to `false`. Otherwise, it defaults to `true`. */ _source?: SearchSourceConfig + /** An array of wildcard (`*`) field patterns. The request returns values for field names matching these patterns in the `hits.fields` property of the response. */ fields?: (QueryDslFieldAndFormat | Field)[] + /** Defines a suggester that provides similar looking terms based on a provided text. */ suggest?: SearchSuggester + /** The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. Elasticsearch applies this property to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers. If set to `0` (default), the query does not terminate early. */ terminate_after?: long + /** The period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout. */ timeout?: string + /** If `true`, calculate and return document scores, even if the scores are not used for sorting. */ track_scores?: boolean + /** If `true`, the request returns the document version as part of a hit. */ version?: boolean + /** If `true`, the request returns sequence number and primary term of the last modification of each hit. */ seq_no_primary_term?: boolean + /** A comma-separated 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` property defaults to `false`. You can pass `_source: true` to return both source fields and stored fields in the search response. */ stored_fields?: Fields + /** Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an `` in the request path. */ pit?: SearchPointInTimeReference + /** One or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. */ runtime_mappings?: MappingRuntimeFields + /** The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. 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_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_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 @@ -1808,25 +2297,48 @@ export type SearchTotalHitsRelation = 'eq' | 'gte' export type SearchTrackHits = boolean | integer export interface SearchMvtRequest extends RequestBase { +/** Comma-separated list of data streams, indices, or aliases to search */ index: Indices + /** Field containing geospatial data to return */ field: Field + /** Zoom level for the vector tile to search */ zoom: SearchMvtZoomLevel + /** X coordinate for the vector tile to search */ x: SearchMvtCoordinate + /** Y coordinate for the vector tile to search */ y: SearchMvtCoordinate + /** Sub-aggregations for the geotile_grid. Supports the following aggregation types: - avg - cardinality - max - min - sum */ aggs?: Record + /** Size, in pixels, of a clipping buffer outside the tile. This allows renderers to avoid outline artifacts from geometries that extend past the extent of the tile. */ buffer?: integer + /** If false, the meta layer’s feature is the bounding box of the tile. If true, the meta layer’s feature is a bounding box resulting from a geo_bounds aggregation. The aggregation runs on values that intersect the // tile with wrap_longitude set to false. The resulting bounding box may be larger than the vector tile. */ exact_bounds?: boolean + /** Size, in pixels, of a side of the tile. Vector tiles are square with equal sides. */ extent?: integer + /** Fields to return in the `hits` layer. Supports wildcards (`*`). This parameter does not support fields with array values. Fields with array values may return inconsistent results. */ fields?: Fields + /** Aggregation used to create a grid for the `field`. */ grid_agg?: SearchMvtGridAggregationType + /** Additional zoom levels available through the aggs layer. For example, if is 7 and grid_precision is 8, you can zoom in up to level 15. Accepts 0-8. If 0, results don’t include the aggs layer. */ grid_precision?: integer + /** Determines the geometry type for features in the aggs layer. In the aggs layer, each feature represents a geotile_grid cell. If 'grid' each feature is a Polygon of the cells bounding box. If 'point' each feature is a Point that is the centroid of the cell. */ grid_type?: SearchMvtGridType + /** Query DSL used to filter documents for the search. */ query?: QueryDslQueryContainer + /** Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. */ runtime_mappings?: MappingRuntimeFields + /** Maximum number of features to return in the hits layer. Accepts 0-10000. If 0, results don’t include the hits layer. */ size?: integer + /** Sorts features in the hits layer. By default, the API calculates a bounding box for each feature. It sorts features based on this box’s diagonal length, from longest to shortest. */ sort?: Sort + /** Number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. */ track_total_hits?: SearchTrackHits + /** If `true`, the hits and aggs layers will contain additional point features representing suggested label positions for the original features. */ with_labels?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, field?: never, zoom?: never, x?: never, y?: never, aggs?: never, buffer?: never, exact_bounds?: never, extent?: never, fields?: never, grid_agg?: never, grid_precision?: never, grid_type?: never, query?: never, runtime_mappings?: never, size?: never, sort?: never, track_total_hits?: never, with_labels?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, field?: never, zoom?: never, x?: never, y?: never, aggs?: never, buffer?: never, exact_bounds?: never, extent?: never, fields?: never, grid_agg?: never, grid_precision?: never, grid_type?: never, query?: never, runtime_mappings?: never, size?: never, sort?: never, track_total_hits?: never, with_labels?: never } } export type SearchMvtResponse = MapboxVectorTiles @@ -1840,14 +2352,26 @@ export type SearchMvtGridType = 'grid' | 'point' | 'centroid' export type SearchMvtZoomLevel = integer export interface SearchShardsRequest extends RequestBase { +/** Returns the indices and shards that a search request would be executed against. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, the request retrieves information from the local node only. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Specifies the node or shard the operation should be performed on. Random by default. */ preference?: string + /** Custom value used to route operations to a specific shard. */ routing?: Routing + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, local?: never, master_timeout?: never, preference?: never, routing?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, local?: never, master_timeout?: never, preference?: never, routing?: never } } export interface SearchShardsResponse { @@ -1874,23 +2398,44 @@ export interface SearchShardsShardStoreIndex { } export interface SearchTemplateRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*). */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** If `true`, network round-trips are minimized for cross-cluster search requests. */ ccs_minimize_roundtrips?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `true`, specified concrete, expanded, or aliased indices are not included in the response when throttled. */ ignore_throttled?: boolean + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** Specifies the node or shard the operation should be performed on. Random by default. */ preference?: string + /** Custom value used to route operations to a specific shard. */ routing?: Routing + /** Specifies how long a consistent view of the index should be maintained for scrolled search. */ scroll?: Duration + /** The type of the search operation. */ search_type?: SearchType + /** If true, hits.total are rendered as an integer in the response. */ rest_total_hits_as_int?: boolean + /** If `true`, the response prefixes aggregation and suggester names with their respective types. */ typed_keys?: boolean + /** If `true`, returns detailed information about score calculation as part of each hit. */ explain?: boolean + /** ID of the search template to use. If no source is specified, this parameter is required. */ id?: Id + /** Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. */ params?: Record + /** If `true`, the query execution is profiled. */ profile?: boolean + /** An inline search template. Supports the same parameters as the search API's request body. Also supports Mustache variables. If no id is specified, this parameter is required. */ source?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, ccs_minimize_roundtrips?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, preference?: never, routing?: never, scroll?: never, search_type?: never, rest_total_hits_as_int?: never, typed_keys?: never, explain?: never, id?: never, params?: never, profile?: never, source?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, ccs_minimize_roundtrips?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, preference?: never, routing?: never, scroll?: never, search_type?: never, rest_total_hits_as_int?: never, typed_keys?: never, explain?: never, id?: never, params?: never, profile?: never, source?: never } } export interface SearchTemplateResponse { @@ -1911,14 +2456,25 @@ export interface SearchTemplateResponse { } export interface TermsEnumRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and index aliases to search. Wildcard (*) expressions are supported. */ index: IndexName + /** The string to match at the start of indexed terms. If not provided, all terms in the field are considered. */ field: Field + /** How many matching terms to return. */ size?: integer + /** The maximum length of time to spend collecting results. Defaults to "1s" (one second). If the timeout is exceeded the complete flag set to false in the response and the results may be partial or empty. */ timeout?: Duration + /** When true the provided search string is matched against index terms without case sensitivity. */ case_insensitive?: boolean + /** Allows to filter an index shard if the provided query rewrites to match_none. */ index_filter?: QueryDslQueryContainer + /** The string after which terms in the index should be returned. Allows for a form of pagination if the last result from one request is passed as the search_after parameter for a subsequent request. */ string?: string search_after?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, field?: never, size?: never, timeout?: never, case_insensitive?: never, index_filter?: never, string?: never, search_after?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, field?: never, size?: never, timeout?: never, case_insensitive?: never, index_filter?: never, string?: never, search_after?: never } } export interface TermsEnumResponse { @@ -1944,22 +2500,42 @@ export interface TermvectorsFilter { } export interface TermvectorsRequest extends RequestBase { +/** Name of the index that contains the document. */ index: IndexName + /** Unique identifier of the document. */ id?: Id + /** Comma-separated list or wildcard expressions of fields to include in the statistics. Used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. */ fields?: Fields + /** If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. */ field_statistics?: boolean + /** If `true`, the response includes term offsets. */ offsets?: boolean + /** If `true`, the response includes term payloads. */ payloads?: boolean + /** If `true`, the response includes term positions. */ positions?: boolean + /** Specifies the node or shard the operation should be performed on. Random by default. */ preference?: string + /** If true, the request is real-time as opposed to near-real-time. */ realtime?: boolean + /** Custom value used to route operations to a specific shard. */ routing?: Routing + /** If `true`, the response includes term frequency and document frequency. */ term_statistics?: boolean + /** If `true`, returns the document version as part of a hit. */ version?: VersionNumber + /** Specific version type. */ version_type?: VersionType + /** An artificial document (a document not present in the index) for which you want to retrieve term vectors. */ doc?: TDocument + /** Filter terms based on their tf-idf scores. */ filter?: TermvectorsFilter + /** Overrides the default per-field analyzer. */ per_field_analyzer?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, id?: never, fields?: never, field_statistics?: never, offsets?: never, payloads?: never, positions?: never, preference?: never, realtime?: never, routing?: never, term_statistics?: never, version?: never, version_type?: never, doc?: never, filter?: never, per_field_analyzer?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, id?: never, fields?: never, field_statistics?: never, offsets?: never, payloads?: never, positions?: never, preference?: never, realtime?: never, routing?: never, term_statistics?: never, version?: never, version_type?: never, doc?: never, filter?: never, per_field_analyzer?: never } } export interface TermvectorsResponse { @@ -1992,26 +2568,50 @@ export interface TermvectorsToken { } export interface UpdateRequest extends RequestBase { +/** A unique identifier for the document to be updated. */ id: Id + /** The name of the target index. By default, the index is created automatically if it doesn't exist. */ index: IndexName + /** Only perform the operation if the document has this primary term. */ if_primary_term?: long + /** Only perform the operation if the document has this sequence number. */ if_seq_no?: SequenceNumber + /** The script language. */ lang?: string + /** If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to make this operation visible to search. If 'false', it does nothing with refreshes. */ refresh?: Refresh + /** If `true`, the destination must be an index alias. */ require_alias?: boolean + /** The number of times the operation should be retried when a conflict occurs. */ retry_on_conflict?: integer + /** A custom value used to route operations to a specific shard. */ routing?: Routing + /** The period to wait for the following operations: dynamic mapping updates and waiting for active shards. Elasticsearch waits for at least the timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur. */ timeout?: Duration + /** The number of copies of each shard that must be active before proceeding with the operation. Set to 'all' or any positive integer up to the total number of shards in the index (`number_of_replicas`+1). The default value of `1` means it waits for each primary shard to be active. */ wait_for_active_shards?: WaitForActiveShards + /** The source fields you want to exclude. */ _source_excludes?: Fields + /** The source fields you want to retrieve. */ _source_includes?: Fields + /** If `true`, the `result` in the response is set to `noop` (no operation) when there are no changes to the document. */ detect_noop?: boolean + /** A partial update to an existing document. If both `doc` and `script` are specified, `doc` is ignored. */ doc?: TPartialDocument + /** If `true`, use the contents of 'doc' as the value of 'upsert'. NOTE: Using ingest pipelines with `doc_as_upsert` is not supported. */ doc_as_upsert?: boolean + /** The script to run to update the document. */ script?: Script | string + /** If `true`, run the script whether or not the document exists. */ scripted_upsert?: boolean + /** If `false`, turn off source retrieval. You can also specify a comma-separated list of the fields you want to retrieve. */ _source?: SearchSourceConfig + /** If the document does not already exist, the contents of 'upsert' are inserted as a new document. If the document exists, the 'script' is run. */ upsert?: TDocument + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, index?: never, if_primary_term?: never, if_seq_no?: never, lang?: never, refresh?: never, require_alias?: never, retry_on_conflict?: never, routing?: never, timeout?: never, wait_for_active_shards?: never, _source_excludes?: never, _source_includes?: never, detect_noop?: never, doc?: never, doc_as_upsert?: never, script?: never, scripted_upsert?: never, _source?: never, upsert?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, index?: never, if_primary_term?: never, if_seq_no?: never, lang?: never, refresh?: never, require_alias?: never, retry_on_conflict?: never, routing?: never, timeout?: never, wait_for_active_shards?: never, _source_excludes?: never, _source_includes?: never, detect_noop?: never, doc?: never, doc_as_upsert?: never, script?: never, scripted_upsert?: never, _source?: never, upsert?: never } } export type UpdateResponse = UpdateUpdateWriteResponseBase @@ -2021,41 +2621,80 @@ export interface UpdateUpdateWriteResponseBase extends Writ } export interface UpdateByQueryRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (`*`). To search all data streams or indices, omit this parameter or use `*` or `_all`. */ index: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** Analyzer to use for the query string. */ analyzer?: string + /** If `true`, wildcard and prefix queries are analyzed. */ analyze_wildcard?: boolean + /** The default operator for query string query: `AND` or `OR`. */ default_operator?: QueryDslOperator + /** Field to use as default where no field prefix is given in the query string. */ df?: string + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** Starting offset (default: 0) */ from?: long + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. */ lenient?: boolean + /** ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. */ pipeline?: string + /** Specifies the node or shard the operation should be performed on. Random by default. */ preference?: string + /** Query in the Lucene query string syntax. */ q?: string + /** If `true`, Elasticsearch refreshes affected shards to make the operation visible to search. */ refresh?: boolean + /** If `true`, the request cache is used for this request. */ request_cache?: boolean + /** The throttle for this request in sub-requests per second. */ requests_per_second?: float + /** Custom value used to route operations to a specific shard. */ routing?: Routing + /** Period to retain the search context for scrolling. */ scroll?: Duration + /** Size of the scroll request that powers the operation. */ scroll_size?: long + /** Explicit timeout for each search request. */ search_timeout?: Duration + /** The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`. */ search_type?: SearchType + /** The number of slices this task should be divided into. */ slices?: Slices + /** A comma-separated list of : pairs. */ sort?: string[] + /** Specific `tag` of the request for logging and statistical purposes. */ stats?: string[] + /** Maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. */ terminate_after?: long + /** Period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. */ timeout?: Duration + /** If `true`, returns the document version as part of a hit. */ version?: boolean + /** Should the document increment the version number (internal) on hit or not (reindex) */ version_type?: boolean + /** The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */ wait_for_active_shards?: WaitForActiveShards + /** If `true`, the request blocks until the operation is complete. */ wait_for_completion?: boolean + /** The maximum number of documents to update. */ max_docs?: long + /** Specifies the documents to update using the Query DSL. */ query?: QueryDslQueryContainer + /** The script to run to update the document source or metadata when updating. */ script?: Script | string + /** Slice the request manually using the provided slice ID and total number of slices. */ slice?: SlicedScroll + /** What to do if update by query hits version conflicts: `abort` or `proceed`. */ conflicts?: Conflicts + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, analyzer?: never, analyze_wildcard?: never, default_operator?: never, df?: never, expand_wildcards?: never, from?: never, ignore_unavailable?: never, lenient?: never, pipeline?: never, preference?: never, q?: never, refresh?: never, request_cache?: never, requests_per_second?: never, routing?: never, scroll?: never, scroll_size?: never, search_timeout?: never, search_type?: never, slices?: never, sort?: never, stats?: never, terminate_after?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, wait_for_completion?: never, max_docs?: never, query?: never, script?: never, slice?: never, conflicts?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, analyzer?: never, analyze_wildcard?: never, default_operator?: never, df?: never, expand_wildcards?: never, from?: never, ignore_unavailable?: never, lenient?: never, pipeline?: never, preference?: never, q?: never, refresh?: never, request_cache?: never, requests_per_second?: never, routing?: never, scroll?: never, scroll_size?: never, search_timeout?: never, search_type?: never, slices?: never, sort?: never, stats?: never, terminate_after?: never, timeout?: never, version?: never, version_type?: never, wait_for_active_shards?: never, wait_for_completion?: never, max_docs?: never, query?: never, script?: never, slice?: never, conflicts?: never } } export interface UpdateByQueryResponse { @@ -2078,8 +2717,14 @@ export interface UpdateByQueryResponse { } export interface UpdateByQueryRethrottleRequest extends RequestBase { +/** The ID for the task. */ task_id: Id + /** The throttle for this request in sub-requests per second. */ requests_per_second?: float + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_id?: never, requests_per_second?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_id?: never, requests_per_second?: never } } export interface UpdateByQueryRethrottleResponse { @@ -2431,6 +3076,7 @@ export interface KnnQuery extends QueryDslQueryBase { k?: integer filter?: QueryDslQueryContainer | QueryDslQueryContainer[] similarity?: float + rescore_vector?: RescoreVector } export interface KnnRetriever extends RetrieverBase { @@ -2440,6 +3086,7 @@ export interface KnnRetriever extends RetrieverBase { k: integer num_candidates: integer similarity?: float + rescore_vector?: RescoreVector } export interface KnnSearch { @@ -2452,6 +3099,7 @@ export interface KnnSearch { filter?: QueryDslQueryContainer | QueryDslQueryContainer[] similarity?: float inner_hits?: SearchInnerHits + rescore_vector?: RescoreVector } export interface LatLonGeoLocation { @@ -2632,6 +3280,10 @@ export interface RequestCacheStats { miss_count: long } +export interface RescoreVector { + oversample: float +} + export type Result = 'created' | 'updated' | 'deleted' | 'not_found' | 'noop' export interface Retries { @@ -2839,6 +3491,8 @@ export interface StoredScript { source: string } +export type StreamResult = ArrayBuffer + export type SuggestMode = 'missing' | 'popular' | 'always' export type SuggestionName = string @@ -5335,6 +5989,11 @@ export interface MappingCorePropertyBase extends MappingPropertyBase { store?: boolean } +export interface MappingCountedKeywordProperty extends MappingPropertyBase { + type: 'counted_keyword' + index?: boolean +} + export interface MappingDataStreamTimestamp { enabled: boolean } @@ -5455,7 +6114,7 @@ export interface MappingFieldNamesField { enabled: boolean } -export type MappingFieldType = 'none' | 'geo_point' | 'geo_shape' | 'ip' | 'binary' | 'keyword' | 'text' | 'search_as_you_type' | 'date' | 'date_nanos' | 'boolean' | 'completion' | 'nested' | 'object' | 'passthrough' | 'version' | 'murmur3' | 'token_count' | 'percolator' | 'integer' | 'long' | 'short' | 'byte' | 'float' | 'half_float' | 'scaled_float' | 'double' | 'integer_range' | 'float_range' | 'long_range' | 'double_range' | 'date_range' | 'ip_range' | 'alias' | 'join' | 'rank_feature' | 'rank_features' | 'flattened' | 'shape' | 'histogram' | 'constant_keyword' | 'aggregate_metric_double' | 'dense_vector' | 'semantic_text' | 'sparse_vector' | 'match_only_text' | 'icu_collation_keyword' +export type MappingFieldType = 'none' | 'geo_point' | 'geo_shape' | 'ip' | 'binary' | 'keyword' | 'text' | 'search_as_you_type' | 'date' | 'date_nanos' | 'boolean' | 'completion' | 'nested' | 'object' | 'passthrough' | 'version' | 'murmur3' | 'token_count' | 'percolator' | 'integer' | 'long' | 'short' | 'byte' | 'float' | 'half_float' | 'scaled_float' | 'double' | 'integer_range' | 'float_range' | 'long_range' | 'double_range' | 'date_range' | 'ip_range' | 'alias' | 'join' | 'rank_feature' | 'rank_features' | 'flattened' | 'shape' | 'histogram' | 'constant_keyword' | 'counted_keyword' | 'aggregate_metric_double' | 'dense_vector' | 'semantic_text' | 'sparse_vector' | 'match_only_text' | 'icu_collation_keyword' export interface MappingFlattenedProperty extends MappingPropertyBase { boost?: double @@ -5650,7 +6309,7 @@ export interface MappingPointProperty extends MappingDocValuesPropertyBase { type: 'point' } -export type MappingProperty = MappingBinaryProperty | MappingBooleanProperty | MappingDynamicProperty | MappingJoinProperty | MappingKeywordProperty | MappingMatchOnlyTextProperty | MappingPercolatorProperty | MappingRankFeatureProperty | MappingRankFeaturesProperty | MappingSearchAsYouTypeProperty | MappingTextProperty | MappingVersionProperty | MappingWildcardProperty | MappingDateNanosProperty | MappingDateProperty | MappingAggregateMetricDoubleProperty | MappingDenseVectorProperty | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingPassthroughObjectProperty | MappingSemanticTextProperty | MappingSparseVectorProperty | MappingCompletionProperty | MappingConstantKeywordProperty | MappingFieldAliasProperty | MappingHistogramProperty | MappingIpProperty | MappingMurmur3HashProperty | MappingTokenCountProperty | MappingGeoPointProperty | MappingGeoShapeProperty | MappingPointProperty | MappingShapeProperty | MappingByteNumberProperty | MappingDoubleNumberProperty | MappingFloatNumberProperty | MappingHalfFloatNumberProperty | MappingIntegerNumberProperty | MappingLongNumberProperty | MappingScaledFloatNumberProperty | MappingShortNumberProperty | MappingUnsignedLongNumberProperty | MappingDateRangeProperty | MappingDoubleRangeProperty | MappingFloatRangeProperty | MappingIntegerRangeProperty | MappingIpRangeProperty | MappingLongRangeProperty | MappingIcuCollationProperty +export type MappingProperty = MappingBinaryProperty | MappingBooleanProperty | MappingDynamicProperty | MappingJoinProperty | MappingKeywordProperty | MappingMatchOnlyTextProperty | MappingPercolatorProperty | MappingRankFeatureProperty | MappingRankFeaturesProperty | MappingSearchAsYouTypeProperty | MappingTextProperty | MappingVersionProperty | MappingWildcardProperty | MappingDateNanosProperty | MappingDateProperty | MappingAggregateMetricDoubleProperty | MappingDenseVectorProperty | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingPassthroughObjectProperty | MappingSemanticTextProperty | MappingSparseVectorProperty | MappingCompletionProperty | MappingConstantKeywordProperty | MappingCountedKeywordProperty | MappingFieldAliasProperty | MappingHistogramProperty | MappingIpProperty | MappingMurmur3HashProperty | MappingTokenCountProperty | MappingGeoPointProperty | MappingGeoShapeProperty | MappingPointProperty | MappingShapeProperty | MappingByteNumberProperty | MappingDoubleNumberProperty | MappingFloatNumberProperty | MappingHalfFloatNumberProperty | MappingIntegerNumberProperty | MappingLongNumberProperty | MappingScaledFloatNumberProperty | MappingShortNumberProperty | MappingUnsignedLongNumberProperty | MappingDateRangeProperty | MappingDoubleRangeProperty | MappingFloatRangeProperty | MappingIntegerRangeProperty | MappingIpRangeProperty | MappingLongRangeProperty | MappingIcuCollationProperty export interface MappingPropertyBase { meta?: Record @@ -5658,6 +6317,7 @@ export interface MappingPropertyBase { ignore_above?: integer dynamic?: MappingDynamicMapping fields?: Record + synthetic_source_keep?: MappingSyntheticSourceKeepEnum } export interface MappingRangePropertyBase extends MappingDocValuesPropertyBase { @@ -5764,6 +6424,8 @@ export interface MappingSuggestContext { precision?: integer | string } +export type MappingSyntheticSourceKeepEnum = 'none' | 'arrays' | 'all' + export type MappingTermVectorOption = 'no' | 'yes' | 'with_offsets' | 'with_positions' | 'with_positions_offsets' | 'with_positions_offsets_payloads' | 'with_positions_payloads' export interface MappingTextIndexPrefixes { @@ -6668,23 +7330,42 @@ export interface AsyncSearchAsyncSearchResponseBase { } export interface AsyncSearchDeleteRequest extends RequestBase { +/** A unique identifier for the async search. */ id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export type AsyncSearchDeleteResponse = AcknowledgedResponseBase export interface AsyncSearchGetRequest extends RequestBase { +/** A unique identifier for the async search. */ id: Id + /** Specifies how long the async search should be available in the cluster. When not specified, the `keep_alive` set with the corresponding submit async request will be used. Otherwise, it is possible to override the value and extend the validity of the request. When this period expires, the search, if still running, is cancelled. If the search is completed, its saved results are deleted. */ keep_alive?: Duration + /** Specify whether aggregation and suggester names should be prefixed by their respective types in the response */ typed_keys?: boolean + /** Specifies to wait for the search to be completed up until the provided timeout. Final results will be returned if available before the timeout expires, otherwise the currently available results will be returned once the timeout expires. By default no timeout is set meaning that the currently available results will be returned without any additional wait. */ wait_for_completion_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, keep_alive?: never, typed_keys?: never, wait_for_completion_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, keep_alive?: never, typed_keys?: never, wait_for_completion_timeout?: never } } export type AsyncSearchGetResponse> = AsyncSearchAsyncSearchDocumentResponseBase export interface AsyncSearchStatusRequest extends RequestBase { +/** A unique identifier for the async search. */ id: Id + /** Specifies how long the async search needs to be available. Ongoing async searches and any saved search results are deleted after this period. */ keep_alive?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, keep_alive?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, keep_alive?: never } } export type AsyncSearchStatusResponse = AsyncSearchStatusStatusResponseBase @@ -6696,69 +7377,126 @@ export interface AsyncSearchStatusStatusResponseBase extends AsyncSearchAsyncSea } export interface AsyncSearchSubmitRequest extends RequestBase { +/** A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices */ index?: Indices + /** Blocks and waits until the search is completed up to a certain timeout. When the async search completes within the timeout, the response won’t include the ID as the results are not stored in the cluster. */ wait_for_completion_timeout?: Duration + /** Specifies how long the async search needs to be available. Ongoing async searches and any saved search results are deleted after this period. */ + keep_alive?: Duration + /** If `true`, results are stored for later retrieval when the search completes within the `wait_for_completion_timeout`. */ keep_on_completion?: boolean + /** Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) */ allow_no_indices?: boolean + /** Indicate if an error should be returned if there is a partial search failure or timeout */ allow_partial_search_results?: boolean + /** The analyzer to use for the query string */ analyzer?: string + /** Specify whether wildcard and prefix queries should be analyzed (default: false) */ analyze_wildcard?: boolean + /** Affects how often partial results become available, which happens whenever shard results are reduced. A partial reduction is performed every time the coordinating node has received a certain number of new shard responses (5 by default). */ batched_reduce_size?: long + /** The default value is the only supported value. */ ccs_minimize_roundtrips?: boolean + /** The default operator for query string query (AND or OR) */ default_operator?: QueryDslOperator + /** The field to use as default where no field prefix is given in the query string */ df?: string + /** Whether to expand wildcard expression to concrete indices that are open, closed or both. */ expand_wildcards?: ExpandWildcards + /** Whether specified concrete, expanded or aliased indices should be ignored when throttled */ ignore_throttled?: boolean + /** Whether specified concrete indices should be ignored when unavailable (missing or closed) */ ignore_unavailable?: boolean + /** Specify whether format-based query failures (such as providing text to a numeric field) should be ignored */ lenient?: boolean + /** The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests */ max_concurrent_shard_requests?: long + /** Specify the node or shard the operation should be performed on (default: random) */ preference?: string + /** Specify if request cache should be used for this request or not, defaults to true */ request_cache?: boolean + /** A comma-separated list of specific routing values */ routing?: Routing + /** Search operation type */ search_type?: SearchType + /** Specifies which field to use for suggestions. */ suggest_field?: Field + /** Specify suggest mode */ suggest_mode?: SuggestMode + /** How many suggestions to return in response */ suggest_size?: long + /** The source text for which the suggestions should be returned. */ suggest_text?: string + /** Specify whether aggregation and suggester names should be prefixed by their respective types in the response */ typed_keys?: boolean + /** Indicates whether hits.total should be rendered as an integer or an object in the rest search response */ rest_total_hits_as_int?: boolean + /** A list of fields to exclude from the returned _source field */ _source_excludes?: Fields + /** A list of fields to extract and return from the _source field */ _source_includes?: Fields + /** Query in the Lucene query string syntax */ q?: string aggregations?: Record /** @alias aggregations */ aggs?: Record collapse?: SearchFieldCollapse + /** If true, returns detailed information about score computation as part of a hit. */ explain?: boolean + /** Configuration of search extensions defined by Elasticsearch plugins. */ ext?: Record + /** Starting document offset. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter. */ from?: integer highlight?: SearchHighlight + /** Number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query. Defaults to 10,000 hits. */ track_total_hits?: SearchTrackHits + /** Boosts the _score of documents from specified indices. */ indices_boost?: Record[] + /** Array of wildcard (*) patterns. The request returns doc values for field names matching these patterns in the hits.fields property of the response. */ docvalue_fields?: (QueryDslFieldAndFormat | Field)[] + /** Defines the approximate kNN search to run. */ knn?: KnnSearch | KnnSearch[] + /** Minimum _score for matching documents. Documents with a lower _score are not included in the search results. */ min_score?: double post_filter?: QueryDslQueryContainer profile?: boolean + /** Defines the search definition using the Query DSL. */ query?: QueryDslQueryContainer rescore?: SearchRescore | SearchRescore[] + /** Retrieve a script evaluation (based on different fields) for each hit. */ script_fields?: Record search_after?: SortResults + /** The number of hits to return. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter. */ size?: integer slice?: SlicedScroll sort?: Sort + /** Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response. */ _source?: SearchSourceConfig + /** Array of wildcard (*) patterns. The request returns values for field names matching these patterns in the hits.fields property of the response. */ fields?: (QueryDslFieldAndFormat | Field)[] suggest?: SearchSuggester + /** Maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. Defaults to 0, which does not terminate query execution early. */ terminate_after?: long + /** Specifies the period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout. */ timeout?: string + /** If true, calculate and return document scores, even if the scores are not used for sorting. */ track_scores?: boolean + /** If true, returns document version as part of a hit. */ version?: boolean + /** If true, returns sequence number and primary term of the last modification of each hit. See Optimistic concurrency control. */ seq_no_primary_term?: boolean + /** 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. You can pass _source: true to return both source fields and stored fields in the search response. */ stored_fields?: Fields + /** Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. */ pit?: SearchPointInTimeReference + /** Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. */ runtime_mappings?: MappingRuntimeFields + /** Stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. 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, wait_for_completion_timeout?: never, keep_alive?: never, keep_on_completion?: 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, lenient?: never, max_concurrent_shard_requests?: never, preference?: never, request_cache?: never, routing?: 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, 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, min_score?: never, post_filter?: never, profile?: never, query?: never, rescore?: 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, wait_for_completion_timeout?: never, keep_alive?: never, keep_on_completion?: 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, lenient?: never, max_concurrent_shard_requests?: never, preference?: never, request_cache?: never, routing?: 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, 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, min_score?: never, post_filter?: never, profile?: never, query?: never, rescore?: 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 AsyncSearchSubmitResponse> = AsyncSearchAsyncSearchDocumentResponseBase @@ -6769,9 +7507,16 @@ export interface AutoscalingAutoscalingPolicy { } export interface AutoscalingDeleteAutoscalingPolicyRequest extends RequestBase { +/** the name of the autoscaling policy */ name: Name + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export type AutoscalingDeleteAutoscalingPolicyResponse = AcknowledgedResponseBase @@ -6804,7 +7549,12 @@ export interface AutoscalingGetAutoscalingCapacityAutoscalingResources { } export interface AutoscalingGetAutoscalingCapacityRequest extends RequestBase { +/** 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 } & { master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never } } export interface AutoscalingGetAutoscalingCapacityResponse { @@ -6812,17 +7562,30 @@ export interface AutoscalingGetAutoscalingCapacityResponse { } export interface AutoscalingGetAutoscalingPolicyRequest extends RequestBase { +/** the name of the autoscaling policy */ name: Name + /** 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 type AutoscalingGetAutoscalingPolicyResponse = AutoscalingAutoscalingPolicy export interface AutoscalingPutAutoscalingPolicyRequest extends RequestBase { +/** the name of the autoscaling policy */ name: Name + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration policy?: AutoscalingAutoscalingPolicy + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never, policy?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never, policy?: never } } export type AutoscalingPutAutoscalingPolicyResponse = AcknowledgedResponseBase @@ -6871,9 +7634,16 @@ export interface CatAliasesAliasesRecord { } export interface CatAliasesRequest extends CatCatRequestBase { +/** A comma-separated list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. */ name?: Names + /** The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** The period to wait for a connection to the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicated that the request should never timeout, you can set it to `-1`. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, expand_wildcards?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, expand_wildcards?: never, master_timeout?: never } } export type CatAliasesResponse = CatAliasesAliasesRecord[] @@ -6915,17 +7685,25 @@ export interface CatAllocationAllocationRecord { } export interface CatAllocationRequest extends CatCatRequestBase { +/** A comma-separated list of node identifiers or names used to limit the returned information. */ node_id?: NodeIds + /** The unit used to display byte values. */ bytes?: Bytes + /** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, bytes?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, bytes?: never, local?: never, master_timeout?: never } } export type CatAllocationResponse = CatAllocationAllocationRecord[] export interface CatComponentTemplatesComponentTemplate { name: string - version: string + version: string | null alias_count: string mapping_count: string settings_count: string @@ -6934,9 +7712,16 @@ export interface CatComponentTemplatesComponentTemplate { } export interface CatComponentTemplatesRequest extends CatCatRequestBase { +/** The name of the component template. It accepts wildcard expressions. If it is omitted, all component templates are returned. */ name?: string + /** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** The period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, local?: never, master_timeout?: never } } export type CatComponentTemplatesResponse = CatComponentTemplatesComponentTemplate[] @@ -6956,7 +7741,12 @@ export interface CatCountCountRecord { } export interface CatCountRequest extends CatCatRequestBase { +/** A comma-separated list of data streams, indices, and aliases used to limit the request. It supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never } } export type CatCountResponse = CatCountCountRecord[] @@ -6974,8 +7764,14 @@ export interface CatFielddataFielddataRecord { } export interface CatFielddataRequest extends CatCatRequestBase { +/** Comma-separated list of fields used to limit returned information. To retrieve all fields, omit this parameter. */ fields?: Fields + /** The unit used to display byte values. */ bytes?: Bytes + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { fields?: never, bytes?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { fields?: never, bytes?: never } } export type CatFielddataResponse = CatFielddataFielddataRecord[] @@ -7034,13 +7830,23 @@ export interface CatHealthHealthRecord { } export interface CatHealthRequest extends CatCatRequestBase { +/** The unit used to display time values. */ time?: TimeUnit + /** If true, returns `HH:MM:SS` and Unix epoch timestamps. */ ts?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { time?: never, ts?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { time?: never, ts?: never } } export type CatHealthResponse = CatHealthHealthRecord[] export interface CatHelpRequest { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface CatHelpResponse { @@ -7338,14 +8144,26 @@ export interface CatIndicesIndicesRecord { } export interface CatIndicesRequest extends CatCatRequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** The unit used to display byte values. */ bytes?: Bytes + /** The type of index that wildcard patterns can match. */ expand_wildcards?: ExpandWildcards + /** The health status used to limit returned indices. By default, the response includes indices of any health status. */ health?: HealthStatus + /** If true, the response includes information from segments that are not loaded into memory. */ include_unloaded_segments?: boolean + /** If true, the response only includes information from primary shards. */ pri?: boolean + /** The unit used to display time values. */ time?: TimeUnit + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, bytes?: never, expand_wildcards?: never, health?: never, include_unloaded_segments?: never, pri?: never, time?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, bytes?: never, expand_wildcards?: never, health?: never, include_unloaded_segments?: never, pri?: never, time?: never, master_timeout?: never } } export type CatIndicesResponse = CatIndicesIndicesRecord[] @@ -7360,8 +8178,14 @@ export interface CatMasterMasterRecord { } export interface CatMasterRequest extends CatCatRequestBase { +/** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { local?: never, master_timeout?: never } } export type CatMasterResponse = CatMasterMasterRecord[] @@ -7411,12 +8235,22 @@ export interface CatMlDataFrameAnalyticsDataFrameAnalyticsRecord { } export interface CatMlDataFrameAnalyticsRequest extends CatCatRequestBase { +/** The ID of the data frame analytics to fetch */ id?: Id + /** Whether to ignore if a wildcard expression matches no configs. (This includes `_all` string or when no configs have been specified) */ allow_no_match?: boolean + /** The unit in which to display byte values */ bytes?: Bytes + /** Comma-separated list of column names to display. */ h?: CatCatDfaColumns + /** Comma-separated list of column names or column aliases used to sort the response. */ s?: CatCatDfaColumns + /** Unit used to display time values. */ time?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, allow_no_match?: never, bytes?: never, h?: never, s?: never, time?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, allow_no_match?: never, bytes?: never, h?: never, s?: never, time?: never } } export type CatMlDataFrameAnalyticsResponse = CatMlDataFrameAnalyticsDataFrameAnalyticsRecord[] @@ -7457,11 +8291,20 @@ export interface CatMlDatafeedsDatafeedsRecord { } export interface CatMlDatafeedsRequest extends CatCatRequestBase { +/** A numerical character string that uniquely identifies the datafeed. */ datafeed_id?: Id + /** Specifies what to do when the request: * Contains wildcard expressions and there are no datafeeds that match. * Contains the `_all` string or no identifiers and there are no matches. * Contains wildcard expressions and there are only partial matches. If `true`, the API returns an empty datafeeds array when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** Comma-separated list of column names to display. */ h?: CatCatDatafeedColumns + /** Comma-separated list of column names or column aliases used to sort the response. */ s?: CatCatDatafeedColumns + /** The unit used to display time values. */ time?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { datafeed_id?: never, allow_no_match?: never, h?: never, s?: never, time?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { datafeed_id?: never, allow_no_match?: never, h?: never, s?: never, time?: never } } export type CatMlDatafeedsResponse = CatMlDatafeedsDatafeedsRecord[] @@ -7644,25 +8487,47 @@ export interface CatMlJobsJobsRecord { } export interface CatMlJobsRequest extends CatCatRequestBase { +/** Identifier for the anomaly detection job. */ job_id?: Id + /** Specifies what to do when the request: * Contains wildcard expressions and there are no jobs that match. * Contains the `_all` string or no identifiers and there are no matches. * Contains wildcard expressions and there are only partial matches. If `true`, the API returns an empty jobs array when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** The unit used to display byte values. */ bytes?: Bytes + /** Comma-separated list of column names to display. */ h?: CatCatAnonalyDetectorColumns + /** Comma-separated list of column names or column aliases used to sort the response. */ s?: CatCatAnonalyDetectorColumns + /** The unit used to display time values. */ time?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, allow_no_match?: never, bytes?: never, h?: never, s?: never, time?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, allow_no_match?: never, bytes?: never, h?: never, s?: never, time?: never } } export type CatMlJobsResponse = CatMlJobsJobsRecord[] export interface CatMlTrainedModelsRequest extends CatCatRequestBase { +/** A unique identifier for the trained model. */ model_id?: Id + /** Specifies what to do when the request: contains wildcard expressions and there are no models that match; contains the `_all` string or no identifiers and there are no matches; contains wildcard expressions and there are only partial matches. If `true`, the API returns an empty array when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** The unit used to display byte values. */ bytes?: Bytes + /** A comma-separated list of column names to display. */ h?: CatCatTrainedModelsColumns + /** A comma-separated list of column names or aliases used to sort the response. */ s?: CatCatTrainedModelsColumns + /** Skips the specified number of transforms. */ from?: integer + /** The maximum number of transforms to display. */ size?: integer + /** Unit used to display time values. */ time?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, allow_no_match?: never, bytes?: never, h?: never, s?: never, from?: never, size?: never, time?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, allow_no_match?: never, bytes?: never, h?: never, s?: never, from?: never, size?: never, time?: never } } export type CatMlTrainedModelsResponse = CatMlTrainedModelsTrainedModelsRecord[] @@ -7730,8 +8595,14 @@ export interface CatNodeattrsNodeAttributesRecord { } export interface CatNodeattrsRequest extends CatCatRequestBase { +/** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { local?: never, master_timeout?: never } } export type CatNodeattrsResponse = CatNodeattrsNodeAttributesRecord[] @@ -8007,11 +8878,20 @@ export interface CatNodesNodesRecord { } export interface CatNodesRequest extends CatCatRequestBase { +/** The unit used to display byte values. */ bytes?: Bytes + /** If `true`, return the full node ID. If `false`, return the shortened node ID. */ full_id?: boolean | string + /** If true, the response includes information from segments that are not loaded into memory. */ include_unloaded_segments?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Unit used to display time values. */ time?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { bytes?: never, full_id?: never, include_unloaded_segments?: never, master_timeout?: never, time?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { bytes?: never, full_id?: never, include_unloaded_segments?: never, master_timeout?: never, time?: never } } export type CatNodesResponse = CatNodesNodesRecord[] @@ -8028,9 +8908,16 @@ export interface CatPendingTasksPendingTasksRecord { } export interface CatPendingTasksRequest extends CatCatRequestBase { +/** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Unit used to display time values. */ time?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { local?: never, master_timeout?: never, time?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { local?: never, master_timeout?: never, time?: never } } export type CatPendingTasksResponse = CatPendingTasksPendingTasksRecord[] @@ -8050,9 +8937,16 @@ export interface CatPluginsPluginsRecord { } export interface CatPluginsRequest extends CatCatRequestBase { +/** Include bootstrap plugins in the response */ include_bootstrap?: boolean + /** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { include_bootstrap?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { include_bootstrap?: never, local?: never, master_timeout?: never } } export type CatPluginsResponse = CatPluginsPluginsRecord[] @@ -8116,11 +9010,20 @@ export interface CatRecoveryRecoveryRecord { } export interface CatRecoveryRequest extends CatCatRequestBase { +/** A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `true`, the response only includes ongoing shard recoveries. */ active_only?: boolean + /** The unit used to display byte values. */ bytes?: Bytes + /** If `true`, the response includes detailed information about shard recoveries. */ detailed?: boolean + /** Unit used to display time values. */ time?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, active_only?: never, bytes?: never, detailed?: never, time?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, active_only?: never, bytes?: never, detailed?: never, time?: never } } export type CatRecoveryResponse = CatRecoveryRecoveryRecord[] @@ -8133,17 +9036,31 @@ export interface CatRepositoriesRepositoriesRecord { } export interface CatRepositoriesRequest extends CatCatRequestBase { +/** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { local?: never, master_timeout?: never } } export type CatRepositoriesResponse = CatRepositoriesRepositoriesRecord[] export interface CatSegmentsRequest extends CatCatRequestBase { +/** A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** The unit used to display byte values. */ bytes?: Bytes + /** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, bytes?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, bytes?: never, local?: never, master_timeout?: never } } export type CatSegmentsResponse = CatSegmentsSegmentsRecord[] @@ -8191,10 +9108,18 @@ export interface CatSegmentsSegmentsRecord { } export interface CatShardsRequest extends CatCatRequestBase { +/** A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** The unit used to display byte values. */ bytes?: Bytes + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Unit used to display time values. */ time?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, bytes?: never, master_timeout?: never, time?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, bytes?: never, master_timeout?: never, time?: never } } export type CatShardsResponse = CatShardsShardsRecord[] @@ -8415,10 +9340,18 @@ export interface CatShardsShardsRecord { } export interface CatSnapshotsRequest extends CatCatRequestBase { +/** A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. If any repository fails during the request, Elasticsearch returns an error. */ repository?: Names + /** If `true`, the response does not include information from unavailable snapshots. */ ignore_unavailable?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Unit used to display time values. */ time?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { repository?: never, ignore_unavailable?: never, master_timeout?: never, time?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { repository?: never, ignore_unavailable?: never, master_timeout?: never, time?: never } } export type CatSnapshotsResponse = CatSnapshotsSnapshotsRecord[] @@ -8458,13 +9391,24 @@ export interface CatSnapshotsSnapshotsRecord { } export interface CatTasksRequest extends CatCatRequestBase { +/** The task action names, which are used to limit the response. */ actions?: string[] + /** If `true`, the response includes detailed information about shard recoveries. */ detailed?: boolean + /** Unique node identifiers, which are used to limit the response. */ nodes?: string[] + /** The parent task identifier, which is used to limit the response. */ parent_task_id?: string + /** Unit used to display time values. */ time?: TimeUnit + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** If `true`, the request blocks until the task has completed. */ wait_for_completion?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { actions?: never, detailed?: never, nodes?: never, parent_task_id?: never, time?: never, timeout?: never, wait_for_completion?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { actions?: never, detailed?: never, nodes?: never, parent_task_id?: never, time?: never, timeout?: never, wait_for_completion?: never } } export type CatTasksResponse = CatTasksTasksRecord[] @@ -8505,9 +9449,16 @@ export interface CatTasksTasksRecord { } export interface CatTemplatesRequest extends CatCatRequestBase { +/** The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned. */ name?: Name + /** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, local?: never, master_timeout?: never } } export type CatTemplatesResponse = CatTemplatesTemplatesRecord[] @@ -8527,10 +9478,18 @@ export interface CatTemplatesTemplatesRecord { } export interface CatThreadPoolRequest extends CatCatRequestBase { +/** A comma-separated list of thread pool names used to limit the request. Accepts wildcard expressions. */ thread_pool_patterns?: Names + /** The unit used to display time values. */ time?: TimeUnit + /** If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. */ local?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { thread_pool_patterns?: never, time?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { thread_pool_patterns?: never, time?: never, local?: never, master_timeout?: never } } export type CatThreadPoolResponse = CatThreadPoolThreadPoolRecord[] @@ -8579,13 +9538,24 @@ export interface CatThreadPoolThreadPoolRecord { } export interface CatTransformsRequest extends CatCatRequestBase { +/** A transform identifier or a wildcard expression. If you do not specify one of these options, the API returns information for all transforms. */ transform_id?: Id + /** Specifies what to do when the request: contains wildcard expressions and there are no transforms that match; contains the `_all` string or no identifiers and there are no matches; contains wildcard expressions and there are only partial matches. If `true`, it returns an empty transforms array when there are no matches and the subset of results when there are partial matches. If `false`, the request returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** Skips the specified number of transforms. */ from?: integer + /** Comma-separated list of column names to display. */ h?: CatCatTransformColumns + /** Comma-separated list of column names or column aliases used to sort the response. */ s?: CatCatTransformColumns + /** The unit used to display time values. */ time?: TimeUnit + /** The maximum number of transforms to obtain. */ size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, allow_no_match?: never, from?: never, h?: never, s?: never, time?: never, size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, allow_no_match?: never, from?: never, h?: never, s?: never, time?: never, size?: never } } export type CatTransformsResponse = CatTransformsTransformsRecord[] @@ -8713,30 +9683,57 @@ export interface CcrShardStats { } export interface CcrDeleteAutoFollowPatternRequest extends RequestBase { +/** The name of the auto follow pattern. */ name: Name + /** Period to wait for a connection to the master node. */ 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 type CcrDeleteAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrFollowRequest extends RequestBase { +/** The name of the follower index. */ index: IndexName + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Specifies the number of shards to wait on being active before responding. This defaults to waiting on none of the shards to be active. A shard must be restored from the leader index before being active. Restoring a follower shard requires transferring all the remote Lucene segment files to the follower index. */ wait_for_active_shards?: WaitForActiveShards + /** If the leader index is part of a data stream, the name to which the local data stream for the followed index should be renamed. */ data_stream_name?: string + /** The name of the index in the leader cluster to follow. */ leader_index: IndexName + /** The maximum number of outstanding reads requests from the remote cluster. */ max_outstanding_read_requests?: long + /** The maximum number of outstanding write requests on the follower. */ max_outstanding_write_requests?: integer + /** The maximum number of operations to pull per read from the remote cluster. */ max_read_request_operation_count?: integer + /** The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. */ max_read_request_size?: ByteSize + /** The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when retrying. */ max_retry_delay?: Duration + /** The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the number of queued operations goes below the limit. */ max_write_buffer_count?: integer + /** The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the total bytes of queued operations goes below the limit. */ max_write_buffer_size?: ByteSize + /** The maximum number of operations per bulk write request executed on the follower. */ max_write_request_operation_count?: integer + /** The maximum total bytes of operations per bulk write request executed on the follower. */ max_write_request_size?: ByteSize + /** The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. Then the follower will immediately attempt to read from the leader again. */ read_poll_timeout?: Duration + /** The remote cluster containing the leader index. */ remote_cluster: string + /** Settings to override from the leader index. */ settings?: IndicesIndexSettings + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, master_timeout?: never, wait_for_active_shards?: never, data_stream_name?: never, leader_index?: never, max_outstanding_read_requests?: never, max_outstanding_write_requests?: never, max_read_request_operation_count?: never, max_read_request_size?: never, max_retry_delay?: never, max_write_buffer_count?: never, max_write_buffer_size?: never, max_write_request_operation_count?: never, max_write_request_size?: never, read_poll_timeout?: never, remote_cluster?: never, settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, master_timeout?: never, wait_for_active_shards?: never, data_stream_name?: never, leader_index?: never, max_outstanding_read_requests?: never, max_outstanding_write_requests?: never, max_read_request_operation_count?: never, max_read_request_size?: never, max_retry_delay?: never, max_write_buffer_count?: never, max_write_buffer_size?: never, max_write_request_operation_count?: never, max_write_request_size?: never, read_poll_timeout?: never, remote_cluster?: never, settings?: never } } export interface CcrFollowResponse { @@ -8769,8 +9766,14 @@ export interface CcrFollowInfoFollowerIndexParameters { export type CcrFollowInfoFollowerIndexStatus = 'active' | 'paused' export interface CcrFollowInfoRequest extends RequestBase { +/** A comma-separated list of index patterns; use `_all` to perform the operation on all indices */ index: Indices + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, master_timeout?: never } } export interface CcrFollowInfoResponse { @@ -8778,8 +9781,14 @@ export interface CcrFollowInfoResponse { } export interface CcrFollowStatsRequest extends RequestBase { +/** A comma-separated list of index patterns; use `_all` to perform the operation on all indices */ index: Indices + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, timeout?: never } } export interface CcrFollowStatsResponse { @@ -8787,12 +9796,18 @@ export interface CcrFollowStatsResponse { } export interface CcrForgetFollowerRequest extends RequestBase { +/** the name of the leader index for which specified follower retention leases should be removed */ index: IndexName + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration follower_cluster?: string follower_index?: IndexName follower_index_uuid?: Uuid leader_remote_cluster?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, timeout?: never, follower_cluster?: never, follower_index?: never, follower_index_uuid?: never, leader_remote_cluster?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, timeout?: never, follower_cluster?: never, follower_index?: never, follower_index_uuid?: never, leader_remote_cluster?: never } } export interface CcrForgetFollowerResponse { @@ -8814,8 +9829,14 @@ export interface CcrGetAutoFollowPatternAutoFollowPatternSummary { } export interface CcrGetAutoFollowPatternRequest extends RequestBase { +/** Specifies the auto-follow pattern collection that you want to retrieve. If you do not specify a name, the API returns information for all collections. */ name?: Name + /** Period to wait for a connection to the master node. */ 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 CcrGetAutoFollowPatternResponse { @@ -8823,50 +9844,91 @@ export interface CcrGetAutoFollowPatternResponse { } export interface CcrPauseAutoFollowPatternRequest extends RequestBase { +/** The name of the auto follow pattern that should pause discovering new indices to follow. */ name: Name + /** Period to wait for a connection to the master node. */ 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 type CcrPauseAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrPauseFollowRequest extends RequestBase { +/** The name of the follower index that should pause following its leader index. */ index: IndexName + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, master_timeout?: never } } export type CcrPauseFollowResponse = AcknowledgedResponseBase export interface CcrPutAutoFollowPatternRequest extends RequestBase { +/** The name of the collection of auto-follow patterns. */ name: Name + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** The remote cluster containing the leader indices to match against. */ remote_cluster: string + /** The name of follower index. The template {{leader_index}} can be used to derive the name of the follower index from the name of the leader index. When following a data stream, use {{leader_index}}; CCR does not support changes to the names of a follower data stream’s backing indices. */ follow_index_pattern?: IndexPattern + /** An array of simple index patterns to match against indices in the remote cluster specified by the remote_cluster field. */ leader_index_patterns?: IndexPatterns + /** An array of simple index patterns that can be used to exclude indices from being auto-followed. Indices in the remote cluster whose names are matching one or more leader_index_patterns and one or more leader_index_exclusion_patterns won’t be followed. */ leader_index_exclusion_patterns?: IndexPatterns + /** The maximum number of outstanding reads requests from the remote cluster. */ max_outstanding_read_requests?: integer + /** Settings to override from the leader index. Note that certain settings can not be overrode (e.g., index.number_of_shards). */ settings?: Record + /** The maximum number of outstanding reads requests from the remote cluster. */ max_outstanding_write_requests?: integer + /** The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. Then the follower will immediately attempt to read from the leader again. */ read_poll_timeout?: Duration + /** The maximum number of operations to pull per read from the remote cluster. */ max_read_request_operation_count?: integer + /** The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. */ max_read_request_size?: ByteSize + /** The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when retrying. */ max_retry_delay?: Duration + /** The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the number of queued operations goes below the limit. */ max_write_buffer_count?: integer + /** The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the total bytes of queued operations goes below the limit. */ max_write_buffer_size?: ByteSize + /** The maximum number of operations per bulk write request executed on the follower. */ max_write_request_operation_count?: integer + /** The maximum total bytes of operations per bulk write request executed on the follower. */ max_write_request_size?: ByteSize + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, remote_cluster?: never, follow_index_pattern?: never, leader_index_patterns?: never, leader_index_exclusion_patterns?: never, max_outstanding_read_requests?: never, settings?: never, max_outstanding_write_requests?: never, read_poll_timeout?: never, max_read_request_operation_count?: never, max_read_request_size?: never, max_retry_delay?: never, max_write_buffer_count?: never, max_write_buffer_size?: never, max_write_request_operation_count?: never, max_write_request_size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, remote_cluster?: never, follow_index_pattern?: never, leader_index_patterns?: never, leader_index_exclusion_patterns?: never, max_outstanding_read_requests?: never, settings?: never, max_outstanding_write_requests?: never, read_poll_timeout?: never, max_read_request_operation_count?: never, max_read_request_size?: never, max_retry_delay?: never, max_write_buffer_count?: never, max_write_buffer_size?: never, max_write_request_operation_count?: never, max_write_request_size?: never } } export type CcrPutAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrResumeAutoFollowPatternRequest extends RequestBase { +/** The name of the auto follow pattern to resume discovering new indices to follow. */ name: Name + /** Period to wait for a connection to the master node. */ 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 type CcrResumeAutoFollowPatternResponse = AcknowledgedResponseBase export interface CcrResumeFollowRequest extends RequestBase { +/** The name of the follow index to resume following. */ index: IndexName + /** Period to wait for a connection to the master node. */ master_timeout?: Duration max_outstanding_read_requests?: long max_outstanding_write_requests?: long @@ -8878,6 +9940,10 @@ export interface CcrResumeFollowRequest extends RequestBase { max_write_request_operation_count?: long max_write_request_size?: string read_poll_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, master_timeout?: never, max_outstanding_read_requests?: never, max_outstanding_write_requests?: never, max_read_request_operation_count?: never, max_read_request_size?: never, max_retry_delay?: never, max_write_buffer_count?: never, max_write_buffer_size?: never, max_write_request_operation_count?: never, max_write_request_size?: never, read_poll_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, master_timeout?: never, max_outstanding_read_requests?: never, max_outstanding_write_requests?: never, max_read_request_operation_count?: never, max_read_request_size?: never, max_retry_delay?: never, max_write_buffer_count?: never, max_write_buffer_size?: never, max_write_request_operation_count?: never, max_write_request_size?: never, read_poll_timeout?: never } } export type CcrResumeFollowResponse = AcknowledgedResponseBase @@ -8901,8 +9967,14 @@ export interface CcrStatsFollowStats { } export interface CcrStatsRequest extends RequestBase { +/** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never } } export interface CcrStatsResponse { @@ -8911,8 +9983,14 @@ export interface CcrStatsResponse { } export interface CcrUnfollowRequest extends RequestBase { +/** The name of the follower index that should be turned into a regular index. */ index: IndexName + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, master_timeout?: never } } export type CcrUnfollowResponse = AcknowledgedResponseBase @@ -9001,13 +10079,24 @@ export interface ClusterAllocationExplainNodeDiskUsage { } export interface ClusterAllocationExplainRequest extends RequestBase { +/** If true, returns information about disk usage and shard sizes. */ include_disk_info?: boolean + /** If true, returns YES decisions in explanation. */ include_yes_decisions?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** 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 + /** If true, returns explanation for the primary shard for the given shard ID. */ primary?: boolean + /** 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, 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, current_node?: never, index?: never, primary?: never, shard?: never } } export interface ClusterAllocationExplainReservedSize { @@ -9058,34 +10147,63 @@ export interface ClusterAllocationExplainUnassignedInformation { export type ClusterAllocationExplainUnassignedInformationReason = 'INDEX_CREATED' | 'CLUSTER_RECOVERED' | 'INDEX_REOPENED' | 'DANGLING_INDEX_IMPORTED' | 'NEW_INDEX_RESTORED' | 'EXISTING_INDEX_RESTORED' | 'REPLICA_ADDED' | 'ALLOCATION_FAILED' | 'NODE_LEFT' | 'REROUTE_CANCELLED' | 'REINITIALIZED' | 'REALLOCATED_REPLICA' | 'PRIMARY_FAILED' | 'FORCED_EMPTY_PRIMARY' | 'MANUAL_ALLOCATION' export interface ClusterDeleteComponentTemplateRequest extends RequestBase { +/** Comma-separated list or wildcard expression of component template names used to limit the request. */ name: Names + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export type ClusterDeleteComponentTemplateResponse = AcknowledgedResponseBase export interface ClusterDeleteVotingConfigExclusionsRequest extends RequestBase { +/** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. Defaults to true, meaning that all excluded nodes must be removed from the cluster before this API takes any action. If set to false then the voting configuration exclusions list is cleared even if some excluded nodes are still in the cluster. */ wait_for_removal?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, wait_for_removal?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, wait_for_removal?: never } } export type ClusterDeleteVotingConfigExclusionsResponse = boolean export interface ClusterExistsComponentTemplateRequest extends RequestBase { +/** Comma-separated list of component template names used to limit the request. Wildcard (*) expressions are supported. */ name: Names + /** 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 + /** If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. */ local?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, local?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, local?: never } } export type ClusterExistsComponentTemplateResponse = boolean export interface ClusterGetComponentTemplateRequest extends RequestBase { +/** Comma-separated list of component template names used to limit the request. Wildcard (`*`) expressions are supported. */ name?: Name + /** If `true`, returns settings in flat format. */ flat_settings?: boolean + /** Return all default configurations for the component template (default: false) */ include_defaults?: boolean + /** If `true`, the request retrieves information from the local node only. If `false`, information is retrieved from the master node. */ local?: boolean + /** 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, flat_settings?: never, include_defaults?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, flat_settings?: never, include_defaults?: never, local?: never, master_timeout?: never } } export interface ClusterGetComponentTemplateResponse { @@ -9093,10 +10211,18 @@ export interface ClusterGetComponentTemplateResponse { } export interface ClusterGetSettingsRequest extends RequestBase { +/** If `true`, returns settings in flat format. */ flat_settings?: boolean + /** If `true`, returns default cluster settings from the local node. */ include_defaults?: boolean + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { flat_settings?: never, include_defaults?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { flat_settings?: never, include_defaults?: never, master_timeout?: never, timeout?: never } } export interface ClusterGetSettingsResponse { @@ -9140,18 +10266,34 @@ export interface ClusterHealthIndexHealthStats { } export interface ClusterHealthRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (`*`) are supported. To target all data streams and indices in a cluster, omit this parameter or use _all or `*`. */ index?: Indices + /** Whether to expand wildcard expression to concrete indices that are open, closed or both. */ expand_wildcards?: ExpandWildcards + /** Can be one of cluster, indices or shards. Controls the details level of the health information returned. */ level?: Level + /** If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. */ local?: boolean + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** A number controlling to how many active shards to wait for, all to wait for all shards in the cluster to be active, or 0 to not wait. */ wait_for_active_shards?: WaitForActiveShards + /** Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are processed. */ wait_for_events?: WaitForEvents + /** The request waits until the specified number N of nodes is available. It also accepts >=N, <=N, >N and yellow > red. By default, will not wait for any status. */ wait_for_status?: HealthStatus + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, expand_wildcards?: never, level?: never, local?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, wait_for_events?: never, wait_for_nodes?: never, wait_for_no_initializing_shards?: never, wait_for_no_relocating_shards?: never, wait_for_status?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, expand_wildcards?: never, level?: never, local?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, wait_for_events?: never, wait_for_nodes?: never, wait_for_no_initializing_shards?: never, wait_for_no_relocating_shards?: never, wait_for_status?: never } } export type ClusterHealthResponse = ClusterHealthHealthResponseBody @@ -9167,7 +10309,12 @@ export interface ClusterHealthShardHealthStats { } export interface ClusterInfoRequest extends RequestBase { +/** Limits the information returned to the specific target. Supports a comma-separated list, such as http,ingest. */ target: ClusterInfoTargets + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { target?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { target?: never } } export interface ClusterInfoResponse { @@ -9188,8 +10335,14 @@ export interface ClusterPendingTasksPendingTask { } export interface ClusterPendingTasksRequest extends RequestBase { +/** If `true`, the request retrieves information from the local node only. If `false`, information is retrieved from the master node. */ local?: boolean + /** 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 } & { local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { local?: never, master_timeout?: never } } export interface ClusterPendingTasksResponse { @@ -9197,32 +10350,58 @@ export interface ClusterPendingTasksResponse { } export interface ClusterPostVotingConfigExclusionsRequest extends RequestBase { +/** A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify node_ids. */ node_names?: Names + /** A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify node_names. */ node_ids?: Ids + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** When adding a voting configuration exclusion, the API waits for the specified nodes to be excluded from the voting configuration before returning. If the timeout expires before the appropriate condition is satisfied, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_names?: never, node_ids?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_names?: never, node_ids?: never, master_timeout?: never, timeout?: never } } export type ClusterPostVotingConfigExclusionsResponse = boolean export interface ClusterPutComponentTemplateRequest extends RequestBase { +/** Name of the component template to create. Elasticsearch includes the following built-in component templates: `logs-mappings`; `logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. Elastic Agent uses these templates to configure backing indices for its data streams. If you use Elastic Agent and want to overwrite one of these templates, set the `version` for your replacement template higher than the current version. If you don’t use Elastic Agent and want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the cluster update settings API. */ name: Name + /** If `true`, this request cannot replace or update existing component templates. */ create?: boolean + /** 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 template to be applied which includes mappings, settings, or aliases configuration. */ template: IndicesIndexState + /** Version number used to manage component templates externally. This number isn't automatically generated or incremented by Elasticsearch. To unset a version, replace the template without specifying a version. */ version?: VersionNumber + /** Optional user metadata about the component template. It may have any contents. This map is not automatically generated by Elasticsearch. This information is stored in the cluster state, so keeping it short is preferable. To unset `_meta`, replace the template without specifying this information. */ _meta?: Metadata + /** Marks this index template as deprecated. When creating or updating a non-deprecated index template that uses deprecated components, Elasticsearch will emit a deprecation warning. */ deprecated?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, template?: never, version?: never, _meta?: never, deprecated?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, template?: never, version?: never, _meta?: never, deprecated?: never } } export type ClusterPutComponentTemplateResponse = AcknowledgedResponseBase export interface ClusterPutSettingsRequest extends RequestBase { +/** Return settings in flat format (default: false) */ flat_settings?: boolean + /** Explicit operation timeout for connection to master node */ master_timeout?: Duration + /** Explicit operation timeout */ timeout?: Duration persistent?: Record transient?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { flat_settings?: never, master_timeout?: never, timeout?: never, persistent?: never, transient?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { flat_settings?: never, master_timeout?: never, timeout?: never, persistent?: never, transient?: never } } export interface ClusterPutSettingsResponse { @@ -9255,6 +10434,10 @@ export interface ClusterRemoteInfoClusterRemoteSniffInfo { } export interface ClusterRemoteInfoRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export type ClusterRemoteInfoResponse = Record @@ -9295,13 +10478,24 @@ export interface ClusterRerouteCommandMoveAction { } export interface ClusterRerouteRequest extends RequestBase { +/** If true, then the request simulates the operation. It will calculate the result of applying the commands to the current cluster state and return the resulting cluster state after the commands (and rebalancing) have been applied; it will not actually perform the requested changes. */ dry_run?: boolean + /** If true, then the response contains an explanation of why the commands can or cannot run. */ explain?: boolean + /** Limits the information returned to the specified metrics. */ metric?: Metrics + /** If true, then retries allocation of shards that are blocked due to too many subsequent allocation failures. */ retry_failed?: boolean + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** Defines the commands to perform. */ commands?: ClusterRerouteCommand[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { dry_run?: never, explain?: never, metric?: never, retry_failed?: never, master_timeout?: never, timeout?: never, commands?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { dry_run?: never, explain?: never, metric?: never, retry_failed?: never, master_timeout?: never, timeout?: never, commands?: never } } export interface ClusterRerouteRerouteDecision { @@ -9332,16 +10526,30 @@ export interface ClusterRerouteResponse { } export interface ClusterStateRequest extends RequestBase { +/** Limit the information returned to the specified metrics */ metric?: Metrics + /** A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices */ index?: Indices + /** Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) */ allow_no_indices?: boolean + /** Whether to expand wildcard expression to concrete indices that are open, closed or both. */ expand_wildcards?: ExpandWildcards + /** Return settings in flat format (default: false) */ flat_settings?: boolean + /** Whether specified concrete indices should be ignored when unavailable (missing or closed) */ ignore_unavailable?: boolean + /** Return local information, do not retrieve the state from master node (default: false) */ local?: boolean + /** 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 + /** The maximum time to wait for wait_for_metadata_version before timing out */ wait_for_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { metric?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, local?: never, master_timeout?: never, wait_for_metadata_version?: never, wait_for_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { metric?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, local?: never, master_timeout?: never, wait_for_metadata_version?: never, wait_for_timeout?: never } } export type ClusterStateResponse = any @@ -9570,9 +10778,16 @@ export interface ClusterStatsOperatingSystemMemoryInfo { } export interface ClusterStatsRequest extends RequestBase { +/** Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. */ node_id?: NodeIds + /** Include remote cluster data into the response */ include_remotes?: boolean + /** Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, timed out nodes are included in the response’s `_nodes.failed` property. Defaults to no timeout. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, include_remotes?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, include_remotes?: never, timeout?: never } } export type ClusterStatsResponse = ClusterStatsStatsResponseBase @@ -9608,6 +10823,7 @@ export interface ConnectorConnector { api_key_secret_id?: string configuration: ConnectorConnectorConfiguration custom_scheduling: ConnectorConnectorCustomScheduling + deleted: boolean description?: string error?: string | null features?: ConnectorConnectorFeatures @@ -9835,7 +11051,12 @@ export type ConnectorSyncStatus = 'canceling' | 'canceled' | 'completed' | 'erro export type ConnectorValidation = ConnectorLessThanValidation | ConnectorGreaterThanValidation | ConnectorListTypeValidation | ConnectorIncludedInValidation | ConnectorRegexValidation export interface ConnectorCheckInRequest extends RequestBase { +/** The unique identifier of the connector to be checked in */ connector_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never } } export interface ConnectorCheckInResponse { @@ -9843,19 +11064,35 @@ export interface ConnectorCheckInResponse { } export interface ConnectorDeleteRequest extends RequestBase { +/** The unique identifier of the connector to be deleted */ connector_id: Id + /** A flag indicating if associated sync jobs should be also removed. Defaults to false. */ delete_sync_jobs?: boolean + /** A flag indicating if the connector should be hard deleted. */ + hard?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, delete_sync_jobs?: never, hard?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, delete_sync_jobs?: never, hard?: never } } export type ConnectorDeleteResponse = AcknowledgedResponseBase export interface ConnectorGetRequest extends RequestBase { +/** The unique identifier of the connector */ connector_id: Id + /** A flag to indicate if the desired connector should be fetched, even if it was soft-deleted. */ + include_deleted?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, include_deleted?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, include_deleted?: never } } export type ConnectorGetResponse = ConnectorConnector export interface ConnectorLastSyncRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id last_access_control_sync_error?: string last_access_control_sync_scheduled_at?: DateTime @@ -9869,6 +11106,10 @@ export interface ConnectorLastSyncRequest extends RequestBase { last_sync_status?: ConnectorSyncStatus last_synced?: DateTime sync_cursor?: any + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, last_access_control_sync_error?: never, last_access_control_sync_scheduled_at?: never, last_access_control_sync_status?: never, last_deleted_document_count?: never, last_incremental_sync_scheduled_at?: never, last_indexed_document_count?: never, last_seen?: never, last_sync_error?: never, last_sync_scheduled_at?: never, last_sync_status?: never, last_synced?: never, sync_cursor?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, last_access_control_sync_error?: never, last_access_control_sync_scheduled_at?: never, last_access_control_sync_status?: never, last_deleted_document_count?: never, last_incremental_sync_scheduled_at?: never, last_indexed_document_count?: never, last_seen?: never, last_sync_error?: never, last_sync_scheduled_at?: never, last_sync_status?: never, last_synced?: never, sync_cursor?: never } } export interface ConnectorLastSyncResponse { @@ -9876,12 +11117,24 @@ export interface ConnectorLastSyncResponse { } export interface ConnectorListRequest extends RequestBase { +/** Starting offset (default: 0) */ from?: integer + /** Specifies a max number of results to get */ size?: integer + /** A comma-separated list of connector index names to fetch connector documents for */ index_name?: Indices + /** A comma-separated list of connector names to fetch connector documents for */ connector_name?: Names + /** A comma-separated list of connector service types to fetch connector documents for */ service_type?: Names + /** A flag to indicate if the desired connector should be fetched, even if it was soft-deleted. */ + include_deleted?: boolean + /** A wildcard query string that filters connectors with matching name, description or index name */ query?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { from?: never, size?: never, index_name?: never, connector_name?: never, service_type?: never, include_deleted?: never, query?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { from?: never, size?: never, index_name?: never, connector_name?: never, service_type?: never, include_deleted?: never, query?: never } } export interface ConnectorListResponse { @@ -9896,6 +11149,10 @@ export interface ConnectorPostRequest extends RequestBase { language?: string name?: string service_type?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { description?: never, index_name?: never, is_native?: never, language?: never, name?: never, service_type?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { description?: never, index_name?: never, is_native?: never, language?: never, name?: never, service_type?: never } } export interface ConnectorPostResponse { @@ -9904,6 +11161,7 @@ export interface ConnectorPostResponse { } export interface ConnectorPutRequest extends RequestBase { +/** The unique identifier of the connector to be created or updated. ID is auto-generated if not provided. */ connector_id?: Id description?: string index_name?: IndexName @@ -9911,6 +11169,10 @@ export interface ConnectorPutRequest extends RequestBase { language?: string name?: string service_type?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, description?: never, index_name?: never, is_native?: never, language?: never, name?: never, service_type?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, description?: never, index_name?: never, is_native?: never, language?: never, name?: never, service_type?: never } } export interface ConnectorPutResponse { @@ -9919,7 +11181,12 @@ export interface ConnectorPutResponse { } export interface ConnectorSyncJobCancelRequest extends RequestBase { +/** The unique identifier of the connector sync job */ connector_sync_job_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_sync_job_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_sync_job_id?: never } } export interface ConnectorSyncJobCancelResponse { @@ -9927,47 +11194,84 @@ export interface ConnectorSyncJobCancelResponse { } export interface ConnectorSyncJobCheckInRequest extends RequestBase { +/** The unique identifier of the connector sync job to be checked in. */ connector_sync_job_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_sync_job_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_sync_job_id?: never } } export interface ConnectorSyncJobCheckInResponse { } export interface ConnectorSyncJobClaimRequest extends RequestBase { +/** The unique identifier of the connector sync job. */ connector_sync_job_id: Id + /** The cursor object from the last incremental sync job. This should reference the `sync_cursor` field in the connector state for which the job runs. */ sync_cursor?: any + /** The host name of the current system that will run the job. */ worker_hostname: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_sync_job_id?: never, sync_cursor?: never, worker_hostname?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_sync_job_id?: never, sync_cursor?: never, worker_hostname?: never } } export interface ConnectorSyncJobClaimResponse { } export interface ConnectorSyncJobDeleteRequest extends RequestBase { +/** The unique identifier of the connector sync job to be deleted */ connector_sync_job_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_sync_job_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_sync_job_id?: never } } export type ConnectorSyncJobDeleteResponse = AcknowledgedResponseBase export interface ConnectorSyncJobErrorRequest extends RequestBase { +/** The unique identifier for the connector sync job. */ connector_sync_job_id: Id + /** The error for the connector sync job error field. */ error: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_sync_job_id?: never, error?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_sync_job_id?: never, error?: never } } export interface ConnectorSyncJobErrorResponse { } export interface ConnectorSyncJobGetRequest extends RequestBase { +/** The unique identifier of the connector sync job */ connector_sync_job_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_sync_job_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_sync_job_id?: never } } export type ConnectorSyncJobGetResponse = ConnectorConnectorSyncJob export interface ConnectorSyncJobListRequest extends RequestBase { +/** Starting offset (default: 0) */ from?: integer + /** Specifies a max number of results to get */ size?: integer + /** A sync job status to fetch connector sync jobs for */ status?: ConnectorSyncStatus + /** A connector id to fetch connector sync jobs for */ connector_id?: Id + /** A comma-separated list of job types to fetch the sync jobs for */ job_type?: ConnectorSyncJobType | ConnectorSyncJobType[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { from?: never, size?: never, status?: never, connector_id?: never, job_type?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { from?: never, size?: never, status?: never, connector_id?: never, job_type?: never } } export interface ConnectorSyncJobListResponse { @@ -9976,9 +11280,14 @@ export interface ConnectorSyncJobListResponse { } export interface ConnectorSyncJobPostRequest extends RequestBase { +/** The id of the associated connector */ id: Id job_type?: ConnectorSyncJobType trigger_method?: ConnectorSyncJobTriggerMethod + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, job_type?: never, trigger_method?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, job_type?: never, trigger_method?: never } } export interface ConnectorSyncJobPostResponse { @@ -9986,20 +11295,36 @@ export interface ConnectorSyncJobPostResponse { } export interface ConnectorSyncJobUpdateStatsRequest extends RequestBase { +/** The unique identifier of the connector sync job. */ connector_sync_job_id: Id + /** The number of documents the sync job deleted. */ deleted_document_count: long + /** The number of documents the sync job indexed. */ indexed_document_count: long + /** The total size of the data (in MiB) the sync job indexed. */ indexed_document_volume: long + /** The timestamp to use in the `last_seen` property for the connector sync job. */ last_seen?: Duration + /** The connector-specific metadata. */ metadata?: Metadata + /** The total number of documents in the target index after the sync job finished. */ total_document_count?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_sync_job_id?: never, deleted_document_count?: never, indexed_document_count?: never, indexed_document_volume?: never, last_seen?: never, metadata?: never, total_document_count?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_sync_job_id?: never, deleted_document_count?: never, indexed_document_count?: never, indexed_document_volume?: never, last_seen?: never, metadata?: never, total_document_count?: never } } export interface ConnectorSyncJobUpdateStatsResponse { } export interface ConnectorUpdateActiveFilteringRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never } } export interface ConnectorUpdateActiveFilteringResponse { @@ -10007,9 +11332,14 @@ export interface ConnectorUpdateActiveFilteringResponse { } export interface ConnectorUpdateApiKeyIdRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id api_key_id?: string api_key_secret_id?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, api_key_id?: never, api_key_secret_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, api_key_id?: never, api_key_secret_id?: never } } export interface ConnectorUpdateApiKeyIdResponse { @@ -10017,9 +11347,14 @@ export interface ConnectorUpdateApiKeyIdResponse { } export interface ConnectorUpdateConfigurationRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id configuration?: ConnectorConnectorConfiguration values?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, configuration?: never, values?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, configuration?: never, values?: never } } export interface ConnectorUpdateConfigurationResponse { @@ -10027,8 +11362,13 @@ export interface ConnectorUpdateConfigurationResponse { } export interface ConnectorUpdateErrorRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id error: SpecUtilsWithNullValue + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, error?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, error?: never } } export interface ConnectorUpdateErrorResponse { @@ -10036,8 +11376,13 @@ export interface ConnectorUpdateErrorResponse { } export interface ConnectorUpdateFeaturesRequest extends RequestBase { +/** The unique identifier of the connector to be updated. */ connector_id: Id features: ConnectorConnectorFeatures + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, features?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, features?: never } } export interface ConnectorUpdateFeaturesResponse { @@ -10045,10 +11390,15 @@ export interface ConnectorUpdateFeaturesResponse { } export interface ConnectorUpdateFilteringRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id filtering?: ConnectorFilteringConfig[] rules?: ConnectorFilteringRule[] advanced_snippet?: ConnectorFilteringAdvancedSnippet + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, filtering?: never, rules?: never, advanced_snippet?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, filtering?: never, rules?: never, advanced_snippet?: never } } export interface ConnectorUpdateFilteringResponse { @@ -10056,8 +11406,13 @@ export interface ConnectorUpdateFilteringResponse { } export interface ConnectorUpdateFilteringValidationRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id validation: ConnectorFilteringRulesValidation + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, validation?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, validation?: never } } export interface ConnectorUpdateFilteringValidationResponse { @@ -10065,8 +11420,13 @@ export interface ConnectorUpdateFilteringValidationResponse { } export interface ConnectorUpdateIndexNameRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id index_name: SpecUtilsWithNullValue + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, index_name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, index_name?: never } } export interface ConnectorUpdateIndexNameResponse { @@ -10074,9 +11434,14 @@ export interface ConnectorUpdateIndexNameResponse { } export interface ConnectorUpdateNameRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id name?: string description?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, name?: never, description?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, name?: never, description?: never } } export interface ConnectorUpdateNameResponse { @@ -10084,8 +11449,13 @@ export interface ConnectorUpdateNameResponse { } export interface ConnectorUpdateNativeRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id is_native: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, is_native?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, is_native?: never } } export interface ConnectorUpdateNativeResponse { @@ -10093,8 +11463,13 @@ export interface ConnectorUpdateNativeResponse { } export interface ConnectorUpdatePipelineRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id pipeline: ConnectorIngestPipelineParams + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, pipeline?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, pipeline?: never } } export interface ConnectorUpdatePipelineResponse { @@ -10102,8 +11477,13 @@ export interface ConnectorUpdatePipelineResponse { } export interface ConnectorUpdateSchedulingRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id scheduling: ConnectorSchedulingConfiguration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, scheduling?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, scheduling?: never } } export interface ConnectorUpdateSchedulingResponse { @@ -10111,8 +11491,13 @@ export interface ConnectorUpdateSchedulingResponse { } export interface ConnectorUpdateServiceTypeRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id service_type: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, service_type?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, service_type?: never } } export interface ConnectorUpdateServiceTypeResponse { @@ -10120,8 +11505,13 @@ export interface ConnectorUpdateServiceTypeResponse { } export interface ConnectorUpdateStatusRequest extends RequestBase { +/** The unique identifier of the connector to be updated */ connector_id: Id status: ConnectorConnectorStatus + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { connector_id?: never, status?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { connector_id?: never, status?: never } } export interface ConnectorUpdateStatusResponse { @@ -10129,19 +11519,35 @@ export interface ConnectorUpdateStatusResponse { } export interface DanglingIndicesDeleteDanglingIndexRequest extends RequestBase { +/** The UUID of the index to delete. Use the get dangling indices API to find the UUID. */ index_uuid: Uuid + /** This parameter must be set to true to acknowledge that it will no longer be possible to recove data from the dangling index. */ accept_data_loss: boolean + /** Specify timeout for connection to master */ master_timeout?: Duration + /** Explicit operation timeout */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index_uuid?: never, accept_data_loss?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index_uuid?: never, accept_data_loss?: never, master_timeout?: never, timeout?: never } } export type DanglingIndicesDeleteDanglingIndexResponse = AcknowledgedResponseBase export interface DanglingIndicesImportDanglingIndexRequest extends RequestBase { +/** The UUID of the index to import. Use the get dangling indices API to locate the UUID. */ index_uuid: Uuid + /** This parameter must be set to true to import a dangling index. Because Elasticsearch cannot know where the dangling index data came from or determine which shard copies are fresh and which are stale, it cannot guarantee that the imported data represents the latest state of the index when it was last in the cluster. */ accept_data_loss: boolean + /** Specify timeout for connection to master */ master_timeout?: Duration + /** Explicit operation timeout */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index_uuid?: never, accept_data_loss?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index_uuid?: never, accept_data_loss?: never, master_timeout?: never, timeout?: never } } export type DanglingIndicesImportDanglingIndexResponse = AcknowledgedResponseBase @@ -10154,6 +11560,10 @@ export interface DanglingIndicesListDanglingIndicesDanglingIndex { } export interface DanglingIndicesListDanglingIndicesRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface DanglingIndicesListDanglingIndicesResponse { @@ -10176,8 +11586,14 @@ export interface EnrichSummary { } export interface EnrichDeletePolicyRequest extends RequestBase { +/** Enrich policy to delete. */ name: Name + /** Period to wait for a connection to the master node. */ 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 type EnrichDeletePolicyResponse = AcknowledgedResponseBase @@ -10189,9 +11605,16 @@ export interface EnrichExecutePolicyExecuteEnrichPolicyStatus { } export interface EnrichExecutePolicyRequest extends RequestBase { +/** Enrich policy to execute. */ name: Name + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** If `true`, the request blocks other enrich policy execution requests until complete. */ wait_for_completion?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, wait_for_completion?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, wait_for_completion?: never } } export interface EnrichExecutePolicyResponse { @@ -10200,8 +11623,14 @@ export interface EnrichExecutePolicyResponse { } export interface EnrichGetPolicyRequest extends RequestBase { +/** Comma-separated list of enrich policy names used to limit the request. To return information for all enrich policies, omit this parameter. */ name?: Names + /** Period to wait for a connection to the master node. */ 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 EnrichGetPolicyResponse { @@ -10209,11 +11638,20 @@ export interface EnrichGetPolicyResponse { } export interface EnrichPutPolicyRequest extends RequestBase { +/** Name of the enrich policy to create or update. */ name: Name + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Matches enrich data to incoming documents based on a `geo_shape` query. */ geo_match?: EnrichPolicy + /** Matches enrich data to incoming documents based on a `term` query. */ match?: EnrichPolicy + /** Matches a number, date, or IP address in incoming documents to a range in the enrich index based on a `term` query. */ range?: EnrichPolicy + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, geo_match?: never, match?: never, range?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, geo_match?: never, match?: never, range?: never } } export type EnrichPutPolicyResponse = AcknowledgedResponseBase @@ -10243,7 +11681,12 @@ export interface EnrichStatsExecutingPolicy { } export interface EnrichStatsRequest extends RequestBase { +/** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never } } export interface EnrichStatsResponse { @@ -10282,21 +11725,38 @@ export interface EqlHitsSequence { } export interface EqlDeleteRequest extends RequestBase { +/** Identifier for the search to delete. A search ID is provided in the EQL search API's response for an async search. A search ID is also provided if the request’s `keep_on_completion` parameter is `true`. */ id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export type EqlDeleteResponse = AcknowledgedResponseBase export interface EqlGetRequest extends RequestBase { +/** Identifier for the search. */ id: Id + /** Period for which the search and its results are stored on the cluster. Defaults to the keep_alive value set by the search’s EQL search API request. */ keep_alive?: Duration + /** Timeout duration to wait for the request to finish. Defaults to no timeout, meaning the request waits for complete search results. */ wait_for_completion_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, keep_alive?: never, wait_for_completion_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, keep_alive?: never, wait_for_completion_timeout?: never } } export type EqlGetResponse = EqlEqlSearchResponseBase export interface EqlGetStatusRequest extends RequestBase { +/** Identifier for the search. */ id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export interface EqlGetStatusResponse { @@ -10309,33 +11769,50 @@ export interface EqlGetStatusResponse { } export interface EqlSearchRequest extends RequestBase { +/** The name of the index to scope the operation */ index: Indices allow_no_indices?: boolean expand_wildcards?: ExpandWildcards + /** If true, missing or closed indices are not included in the response. */ ignore_unavailable?: boolean + /** EQL query you wish to run. */ query: string case_sensitive?: boolean + /** Field containing the event classification, such as process, file, or network. */ event_category_field?: Field + /** Field used to sort hits with the same timestamp in ascending order */ tiebreaker_field?: Field + /** Field containing event timestamp. Default "@timestamp" */ timestamp_field?: Field + /** Maximum number of events to search at a time for sequence queries. */ fetch_size?: uint + /** Query, written in Query DSL, used to filter the events on which the EQL query runs. */ filter?: QueryDslQueryContainer | QueryDslQueryContainer[] keep_alive?: Duration keep_on_completion?: boolean wait_for_completion_timeout?: Duration allow_partial_search_results?: boolean allow_partial_sequence_results?: boolean + /** For basic queries, the maximum number of matching events to return. Defaults to 10 */ size?: uint + /** Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. */ fields?: QueryDslFieldAndFormat | Field | (QueryDslFieldAndFormat | Field)[] result_position?: EqlSearchResultPosition runtime_mappings?: MappingRuntimeFields + /** By default, the response of a sample query contains up to `10` samples, with one sample per unique set of join keys. Use the `size` parameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the `max_samples_per_key` parameter. Pipes are not supported for sample queries. */ max_samples_per_key?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, query?: never, case_sensitive?: never, event_category_field?: never, tiebreaker_field?: never, timestamp_field?: never, fetch_size?: never, filter?: never, keep_alive?: never, keep_on_completion?: never, wait_for_completion_timeout?: never, allow_partial_search_results?: never, allow_partial_sequence_results?: never, size?: never, fields?: never, result_position?: never, runtime_mappings?: never, max_samples_per_key?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, query?: never, case_sensitive?: never, event_category_field?: never, tiebreaker_field?: never, timestamp_field?: never, fetch_size?: never, filter?: never, keep_alive?: never, keep_on_completion?: never, wait_for_completion_timeout?: never, allow_partial_search_results?: never, allow_partial_sequence_results?: never, size?: never, fields?: never, result_position?: never, runtime_mappings?: never, max_samples_per_key?: never } } export type EqlSearchResponse = EqlEqlSearchResponseBase export type EqlSearchResultPosition = 'tail' | 'head' +export type EsqlEsqlFormat = 'csv' | 'json' | 'tsv' | 'txt' | 'yaml' | 'cbor' | 'smile' | 'arrow' + export interface EsqlTableValuesContainer { integer?: EsqlTableValuesIntegerValue[] keyword?: EsqlTableValuesKeywordValue[] @@ -10351,19 +11828,99 @@ export type EsqlTableValuesLongDouble = double | double[] export type EsqlTableValuesLongValue = long | long[] -export type EsqlQueryEsqlFormat = 'csv' | 'json' | 'tsv' | 'txt' | 'yaml' | 'cbor' | 'smile' | 'arrow' +export interface EsqlAsyncQueryRequest extends RequestBase { +/** The character to use between values within a CSV row. It is valid only for the CSV format. */ + delimiter?: string + /** Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results. If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns. */ + drop_null_columns?: boolean + /** A short version of the Accept header, for example `json` or `yaml`. */ + format?: EsqlEsqlFormat + /** The period for which the query and its results are stored in the cluster. The default period is five days. When this period expires, the query and its results are deleted, even if the query is still ongoing. If the `keep_on_completion` parameter is false, Elasticsearch only stores async queries that do not complete within the period set by the `wait_for_completion_timeout` parameter, regardless of this value. */ + keep_alive?: Duration + /** Indicates whether the query and its results are stored in the cluster. If false, the query and its results are stored in the cluster only if the request does not complete during the period set by the `wait_for_completion_timeout` parameter. */ + keep_on_completion?: boolean + /** The period to wait for the request to finish. By default, the request waits for 1 second for the query results. If the query completes during this period, results are returned Otherwise, a query ID is returned that can later be used to retrieve the results. */ + wait_for_completion_timeout?: Duration + /** By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. */ + columnar?: boolean + /** Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. */ + filter?: QueryDslQueryContainer + locale?: string + /** To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. */ + params?: FieldValue[] + /** If provided and `true` the response will include an extra `profile` object with information on how the query was executed. This information is for human debugging and its format can change at any time but it can give some insight into the performance of each part of the query. */ + profile?: boolean + /** The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. */ + query: string + /** Tables to use with the LOOKUP operation. The top level key is the table name and the next level key is the column name. */ + tables?: Record> + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { delimiter?: never, drop_null_columns?: never, format?: never, keep_alive?: never, keep_on_completion?: never, wait_for_completion_timeout?: never, columnar?: never, filter?: never, locale?: never, params?: never, profile?: never, query?: never, tables?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { delimiter?: never, drop_null_columns?: never, format?: never, keep_alive?: never, keep_on_completion?: never, wait_for_completion_timeout?: never, columnar?: never, filter?: never, locale?: never, params?: never, profile?: never, query?: never, tables?: never } +} + +export interface EsqlAsyncQueryResponse { + columns?: EsqlColumns + id?: string + is_running: boolean +} + +export interface EsqlAsyncQueryDeleteRequest extends RequestBase { +/** The unique identifier of the query. A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. A query ID is also provided when the request was submitted with the `keep_on_completion` parameter set to `true`. */ + id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } +} + +export type EsqlAsyncQueryDeleteResponse = AcknowledgedResponseBase + +export interface EsqlAsyncQueryGetRequest extends RequestBase { +/** The unique identifier of the query. A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. A query ID is also provided when the request was submitted with the `keep_on_completion` parameter set to `true`. */ + id: Id + /** Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results. If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns. */ + drop_null_columns?: boolean + /** The period for which the query and its results are stored in the cluster. When this period expires, the query and its results are deleted, even if the query is still ongoing. */ + keep_alive?: Duration + /** The period to wait for the request to finish. By default, the request waits for complete query results. If the request completes during the period specified in this parameter, complete query results are returned. Otherwise, the response returns an `is_running` value of `true` and no results. */ + wait_for_completion_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, drop_null_columns?: never, keep_alive?: never, wait_for_completion_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, drop_null_columns?: never, keep_alive?: never, wait_for_completion_timeout?: never } +} + +export interface EsqlAsyncQueryGetResponse { + columns?: EsqlColumns + is_running: boolean +} export interface EsqlQueryRequest extends RequestBase { - format?: EsqlQueryEsqlFormat +/** A short version of the Accept header, e.g. json, yaml. */ + format?: EsqlEsqlFormat + /** The character to use between values within a CSV row. Only valid for the CSV format. */ delimiter?: string + /** Should columns that are entirely `null` be removed from the `columns` and `values` portion of the results? Defaults to `false`. If `true` then the response will include an extra section under the name `all_columns` which has the name of all columns. */ drop_null_columns?: boolean + /** By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. */ columnar?: boolean + /** Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. */ filter?: QueryDslQueryContainer locale?: string + /** To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. */ params?: FieldValue[] + /** If provided and `true` the response will include an extra `profile` object with information on how the query was executed. This information is for human debugging and its format can change at any time but it can give some insight into the performance of each part of the query. */ profile?: boolean + /** The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. */ query: string + /** Tables to use with the LOOKUP operation. The top level key is the table name and the next level key is the column name. */ tables?: Record> + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { format?: never, delimiter?: never, drop_null_columns?: never, columnar?: never, filter?: never, locale?: never, params?: never, profile?: never, query?: never, tables?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { format?: never, delimiter?: never, drop_null_columns?: never, columnar?: never, filter?: never, locale?: never, params?: never, profile?: never, query?: never, tables?: never } } export type EsqlQueryResponse = EsqlColumns @@ -10374,7 +11931,12 @@ export interface FeaturesFeature { } export interface FeaturesGetFeaturesRequest extends RequestBase { +/** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never } } export interface FeaturesGetFeaturesResponse { @@ -10382,7 +11944,12 @@ export interface FeaturesGetFeaturesResponse { } export interface FeaturesResetFeaturesRequest extends RequestBase { +/** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never } } export interface FeaturesResetFeaturesResponse { @@ -10392,11 +11959,20 @@ export interface FeaturesResetFeaturesResponse { export type FleetCheckpoint = long export interface FleetGlobalCheckpointsRequest extends RequestBase { +/** A single index or index alias that resolves to a single index. */ index: IndexName | IndexAlias + /** A boolean value which controls whether to wait (until the timeout) for the global checkpoints to advance past the provided `checkpoints`. */ wait_for_advance?: boolean + /** A boolean value which controls whether to wait (until the timeout) for the target index to exist and all primary shards be active. Can only be true when `wait_for_advance` is true. */ wait_for_index?: boolean + /** A comma separated list of previous global checkpoints. When used in combination with `wait_for_advance`, the API will only return once the global checkpoints advances past the checkpoints. Providing an empty list will cause Elasticsearch to immediately return the current global checkpoints. */ checkpoints?: FleetCheckpoint[] + /** Period to wait for a global checkpoints to advance past `checkpoints`. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, wait_for_advance?: never, wait_for_index?: never, checkpoints?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, wait_for_advance?: never, wait_for_index?: never, checkpoints?: never, timeout?: never } } export interface FleetGlobalCheckpointsResponse { @@ -10405,21 +11981,39 @@ export interface FleetGlobalCheckpointsResponse { } export interface FleetMsearchRequest extends RequestBase { +/** A single target to search. If the target is an index alias, it must resolve to a single index. */ index?: IndexName | IndexAlias + /** If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. */ allow_no_indices?: boolean + /** If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests. */ ccs_minimize_roundtrips?: boolean + /** Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. */ expand_wildcards?: ExpandWildcards + /** If true, concrete, expanded or aliased indices are ignored when frozen. */ ignore_throttled?: boolean + /** If true, missing or closed indices are not included in the response. */ ignore_unavailable?: boolean + /** Maximum number of concurrent searches the multi search API can execute. */ max_concurrent_searches?: long + /** Maximum number of concurrent shard requests that each sub-search request executes per node. */ max_concurrent_shard_requests?: long + /** Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. */ pre_filter_shard_size?: long + /** Indicates whether global term and document frequencies should be used when scoring returned documents. */ search_type?: SearchType + /** If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. */ rest_total_hits_as_int?: boolean + /** Specifies whether aggregation and suggester names should be prefixed by their respective types in the response. */ typed_keys?: boolean + /** A comma separated list of checkpoints. When configured, the search API will only be executed on a shard after the relevant checkpoint has become visible for search. Defaults to an empty list which will cause Elasticsearch to immediately execute the search. */ wait_for_checkpoints?: FleetCheckpoint[] + /** If true, returns partial results if there are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures). If false, returns an error with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results` which is true by default. */ allow_partial_search_results?: boolean searches?: MsearchRequestItem[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, ccs_minimize_roundtrips?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, max_concurrent_searches?: never, max_concurrent_shard_requests?: never, pre_filter_shard_size?: never, search_type?: never, rest_total_hits_as_int?: never, typed_keys?: never, wait_for_checkpoints?: never, allow_partial_search_results?: never, searches?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, ccs_minimize_roundtrips?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, max_concurrent_searches?: never, max_concurrent_shard_requests?: never, pre_filter_shard_size?: never, search_type?: never, rest_total_hits_as_int?: never, typed_keys?: never, wait_for_checkpoints?: never, allow_partial_search_results?: never, searches?: never } } export interface FleetMsearchResponse { @@ -10427,6 +12021,7 @@ export interface FleetMsearchResponse { } export interface FleetSearchRequest extends RequestBase { +/** A single target to search. If the target is an index alias, it must resolve to a single index. */ index: IndexName | IndexAlias allow_no_indices?: boolean analyzer?: string @@ -10446,50 +12041,79 @@ export interface FleetSearchRequest extends RequestBase { routing?: Routing scroll?: Duration search_type?: SearchType + /** Specifies which field to use for suggestions. */ suggest_field?: Field suggest_mode?: SuggestMode suggest_size?: long + /** The source text for which the suggestions should be returned. */ suggest_text?: string typed_keys?: boolean rest_total_hits_as_int?: boolean _source_excludes?: Fields _source_includes?: Fields q?: string + /** A comma separated list of checkpoints. When configured, the search API will only be executed on a shard after the relevant checkpoint has become visible for search. Defaults to an empty list which will cause Elasticsearch to immediately execute the search. */ wait_for_checkpoints?: FleetCheckpoint[] + /** If true, returns partial results if there are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures). If false, returns an error with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results` which is true by default. */ allow_partial_search_results?: boolean aggregations?: Record /** @alias aggregations */ aggs?: Record collapse?: SearchFieldCollapse + /** If true, returns detailed information about score computation as part of a hit. */ explain?: boolean + /** Configuration of search extensions defined by Elasticsearch plugins. */ ext?: Record + /** Starting document offset. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter. */ from?: integer highlight?: SearchHighlight + /** Number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query. Defaults to 10,000 hits. */ track_total_hits?: SearchTrackHits + /** Boosts the _score of documents from specified indices. */ indices_boost?: Record[] + /** Array of wildcard (*) patterns. The request returns doc values for field names matching these patterns in the hits.fields property of the response. */ docvalue_fields?: (QueryDslFieldAndFormat | Field)[] + /** Minimum _score for matching documents. Documents with a lower _score are not included in the search results. */ min_score?: double post_filter?: QueryDslQueryContainer profile?: boolean + /** Defines the search definition using the Query DSL. */ query?: QueryDslQueryContainer rescore?: SearchRescore | SearchRescore[] + /** Retrieve a script evaluation (based on different fields) for each hit. */ script_fields?: Record search_after?: SortResults + /** The number of hits to return. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter. */ size?: integer slice?: SlicedScroll sort?: Sort + /** Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response. */ _source?: SearchSourceConfig + /** Array of wildcard (*) patterns. The request returns values for field names matching these patterns in the hits.fields property of the response. */ fields?: (QueryDslFieldAndFormat | Field)[] suggest?: SearchSuggester + /** Maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. Defaults to 0, which does not terminate query execution early. */ terminate_after?: long + /** Specifies the period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout. */ timeout?: string + /** If true, calculate and return document scores, even if the scores are not used for sorting. */ track_scores?: boolean + /** If true, returns document version as part of a hit. */ version?: boolean + /** If true, returns sequence number and primary term of the last modification of each hit. See Optimistic concurrency control. */ seq_no_primary_term?: boolean + /** 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. You can pass _source: true to return both source fields and stored fields in the search response. */ stored_fields?: Fields + /** Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. */ pit?: SearchPointInTimeReference + /** Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. */ runtime_mappings?: MappingRuntimeFields + /** Stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. 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, 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, 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, wait_for_checkpoints?: never, allow_partial_search_results?: 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, min_score?: never, post_filter?: never, profile?: never, query?: never, rescore?: 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, 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, 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, wait_for_checkpoints?: never, allow_partial_search_results?: 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, min_score?: never, post_filter?: never, profile?: never, query?: never, rescore?: 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 interface FleetSearchResponse { @@ -10556,13 +12180,24 @@ export interface GraphVertexInclude { } export interface GraphExploreRequest extends RequestBase { +/** Name of the index. */ index: Indices + /** Custom value used to route operations to a specific shard. */ routing?: Routing + /** Specifies the period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout. */ timeout?: Duration + /** Specifies or more fields from which you want to extract terms that are associated with the specified vertices. */ connections?: GraphHop + /** Direct the Graph API how to build the graph. */ controls?: GraphExploreControls + /** A seed query that identifies the documents of interest. Can be any valid Elasticsearch query. */ query?: QueryDslQueryContainer + /** Specifies one or more fields that contain the terms you want to include in the graph as vertices. */ vertices?: GraphVertexDefinition[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, routing?: never, timeout?: never, connections?: never, controls?: never, query?: never, vertices?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, routing?: never, timeout?: never, connections?: never, controls?: never, query?: never, vertices?: never } } export interface GraphExploreResponse { @@ -10617,7 +12252,7 @@ export interface IlmMigrateAction { export interface IlmPhase { actions?: IlmActions - min_age?: Duration | long + min_age?: Duration } export interface IlmPhases { @@ -10666,9 +12301,16 @@ export interface IlmWaitForSnapshotAction { } export interface IlmDeleteLifecycleRequest extends RequestBase { +/** Identifier for the policy. */ name: Name + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export type IlmDeleteLifecycleResponse = AcknowledgedResponseBase @@ -10713,10 +12355,18 @@ export interface IlmExplainLifecycleLifecycleExplainUnmanaged { } export interface IlmExplainLifecycleRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases to target. Supports wildcards (`*`). To target all data streams and indices, use `*` or `_all`. */ index: IndexName + /** Filters the returned indices to only indices that are managed by ILM and are in an error state, either due to an encountering an error while executing the policy, or attempting to use a policy that does not exist. */ only_errors?: boolean + /** Filters the returned indices to only indices that are managed by ILM. */ only_managed?: boolean + /** 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 } & { index?: never, only_errors?: never, only_managed?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, only_errors?: never, only_managed?: never, master_timeout?: never } } export interface IlmExplainLifecycleResponse { @@ -10730,14 +12380,25 @@ export interface IlmGetLifecycleLifecycle { } export interface IlmGetLifecycleRequest extends RequestBase { +/** Identifier for the policy. */ name?: Name + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export type IlmGetLifecycleResponse = Record export interface IlmGetStatusRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface IlmGetStatusResponse { @@ -10745,9 +12406,14 @@ export interface IlmGetStatusResponse { } export interface IlmMigrateToDataTiersRequest extends RequestBase { +/** If true, simulates the migration from node attributes based allocation filters to data tiers, but does not perform the migration. This provides a way to retrieve the indices and ILM policies that need to be migrated. */ dry_run?: boolean legacy_template_to_delete?: string node_attribute?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { dry_run?: never, legacy_template_to_delete?: never, node_attribute?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { dry_run?: never, legacy_template_to_delete?: never, node_attribute?: never } } export interface IlmMigrateToDataTiersResponse { @@ -10761,9 +12427,16 @@ export interface IlmMigrateToDataTiersResponse { } export interface IlmMoveToStepRequest extends RequestBase { +/** The name of the index whose lifecycle step is to change */ index: IndexName + /** The step that the index is expected to be in. */ current_step: IlmMoveToStepStepKey + /** The step that you want to run. */ next_step: IlmMoveToStepStepKey + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, current_step?: never, next_step?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, current_step?: never, next_step?: never } } export type IlmMoveToStepResponse = AcknowledgedResponseBase @@ -10775,16 +12448,28 @@ export interface IlmMoveToStepStepKey { } export interface IlmPutLifecycleRequest extends RequestBase { +/** Identifier for the policy. */ name: Name + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration policy?: IlmPolicy + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never, policy?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never, policy?: never } } export type IlmPutLifecycleResponse = AcknowledgedResponseBase export interface IlmRemovePolicyRequest extends RequestBase { +/** The name of the index to remove policy on */ index: IndexName + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never } } export interface IlmRemovePolicyResponse { @@ -10793,21 +12478,38 @@ export interface IlmRemovePolicyResponse { } export interface IlmRetryRequest extends RequestBase { +/** The name of the indices (comma-separated) whose failed lifecycle step is to be retry */ index: IndexName + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never } } export type IlmRetryResponse = AcknowledgedResponseBase export interface IlmStartRequest extends RequestBase { +/** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never } } export type IlmStartResponse = AcknowledgedResponseBase export interface IlmStopRequest extends RequestBase { +/** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never } } export type IlmStopResponse = AcknowledgedResponseBase @@ -11045,6 +12747,7 @@ export interface IndicesIndexSettingsLifecycle { parse_origination_date?: boolean step?: IndicesIndexSettingsLifecycleStep rollover_alias?: string + prefer_ilm?: boolean | string } export interface IndicesIndexSettingsLifecycleStep { @@ -11124,7 +12827,8 @@ export interface IndicesMappingLimitSettings { nested_objects?: IndicesMappingLimitSettingsNestedObjects field_name_length?: IndicesMappingLimitSettingsFieldNameLength dimension_fields?: IndicesMappingLimitSettingsDimensionFields - ignore_malformed?: boolean + source?: IndicesMappingLimitSettingsSourceFields + ignore_malformed?: boolean | string } export interface IndicesMappingLimitSettingsDepth { @@ -11147,6 +12851,10 @@ export interface IndicesMappingLimitSettingsNestedObjects { limit?: long } +export interface IndicesMappingLimitSettingsSourceFields { + mode: IndicesSourceMode +} + export interface IndicesMappingLimitSettingsTotalFields { limit?: long | string ignore_dynamic_beyond_limit?: boolean | string @@ -11274,6 +12982,8 @@ export interface IndicesSoftDeletes { retention_lease?: IndicesRetentionLease } +export type IndicesSourceMode = 'disabled' | 'stored' | 'synthetic' + export interface IndicesStorage { type: IndicesStorageType allow_mmap?: boolean @@ -11312,13 +13022,24 @@ export interface IndicesAddBlockIndicesBlockStatus { } export interface IndicesAddBlockRequest extends RequestBase { +/** A comma separated list of indices to add a block to */ index: IndexName + /** The block to add (one of read, write, read_only or metadata) */ block: IndicesAddBlockIndicesBlockOptions + /** Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) */ allow_no_indices?: boolean + /** Whether to expand wildcard expression to concrete indices that are open, closed or both. */ expand_wildcards?: ExpandWildcards + /** Whether specified concrete indices should be ignored when unavailable (missing or closed) */ ignore_unavailable?: boolean + /** Specify timeout for connection to master */ master_timeout?: Duration + /** Explicit operation timeout */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, block?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, block?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never } } export interface IndicesAddBlockResponse { @@ -11369,16 +13090,30 @@ export type IndicesAnalyzeExplainAnalyzeToken = IndicesAnalyzeExplainAnalyzeToke & { [property: string]: any } export interface IndicesAnalyzeRequest extends RequestBase { +/** Index used to derive the analyzer. If specified, the `analyzer` or field parameter overrides this value. If no index is specified or the index does not have a default analyzer, the analyze API uses the standard analyzer. */ index?: IndexName + /** The name of the analyzer that should be applied to the provided `text`. This could be a built-in analyzer, or an analyzer that’s been configured in the index. */ analyzer?: string + /** Array of token attributes used to filter the output of the `explain` parameter. */ attributes?: string[] + /** Array of character filters used to preprocess characters before the tokenizer. */ char_filter?: AnalysisCharFilter[] + /** If `true`, the response includes token attributes and additional details. */ explain?: boolean + /** Field used to derive the analyzer. To use this parameter, you must specify an index. If specified, the `analyzer` parameter overrides this value. */ field?: Field + /** Array of token filters used to apply after the tokenizer. */ filter?: AnalysisTokenFilter[] + /** Normalizer to use to convert text into a single token. */ normalizer?: string + /** Text to analyze. If an array of strings is provided, it is analyzed as a multi-value field. */ text?: IndicesAnalyzeTextToAnalyze + /** Tokenizer to use to convert text into tokens. */ tokenizer?: AnalysisTokenizer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, analyzer?: never, attributes?: never, char_filter?: never, explain?: never, field?: never, filter?: never, normalizer?: never, text?: never, tokenizer?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, analyzer?: never, attributes?: never, char_filter?: never, explain?: never, field?: never, filter?: never, normalizer?: never, text?: never, tokenizer?: never } } export interface IndicesAnalyzeResponse { @@ -11393,27 +13128,61 @@ export interface IndicesAnalyzeTokenDetail { tokens: IndicesAnalyzeExplainAnalyzeToken[] } +export interface IndicesCancelMigrateReindexRequest extends RequestBase { +/** The index or data stream name */ + index: Indices + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never } +} + +export type IndicesCancelMigrateReindexResponse = AcknowledgedResponseBase + export interface IndicesClearCacheRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `true`, clears the fields cache. Use the `fields` parameter to clear the cache of specific fields only. */ fielddata?: boolean + /** Comma-separated list of field names used to limit the `fielddata` parameter. */ fields?: Fields + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, clears the query cache. */ query?: boolean + /** If `true`, clears the request cache. */ request?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, fielddata?: never, fields?: never, ignore_unavailable?: never, query?: never, request?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, fielddata?: never, fields?: never, ignore_unavailable?: never, query?: never, request?: never } } export type IndicesClearCacheResponse = ShardsOperationResponseBase export interface IndicesCloneRequest extends RequestBase { +/** Name of the source index to clone. */ index: IndexName + /** Name of the target index to create. */ target: Name + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */ wait_for_active_shards?: WaitForActiveShards + /** Aliases for the resulting index. */ aliases?: Record + /** Configuration options for the target index. */ settings?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, target?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, target?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, settings?: never } } export interface IndicesCloneResponse { @@ -11432,13 +13201,24 @@ export interface IndicesCloseCloseShardResult { } export interface IndicesCloseRequest extends RequestBase { +/** Comma-separated list or wildcard expression of index names used to limit the request. */ index: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */ wait_for_active_shards?: WaitForActiveShards + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never } } export interface IndicesCloseResponse { @@ -11448,13 +13228,24 @@ export interface IndicesCloseResponse { } export interface IndicesCreateRequest extends RequestBase { +/** Name of the index you wish to create. */ index: IndexName + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */ wait_for_active_shards?: WaitForActiveShards + /** Aliases for the index. */ aliases?: Record + /** Mapping for fields in the index. If specified, this mapping can include: - Field names - Field data types - Mapping parameters */ mappings?: MappingTypeMapping + /** Configuration options for the index. */ settings?: IndicesIndexSettings + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, mappings?: never, settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, mappings?: never, settings?: never } } export interface IndicesCreateResponse { @@ -11464,13 +13255,44 @@ export interface IndicesCreateResponse { } export interface IndicesCreateDataStreamRequest extends RequestBase { +/** Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, `#`, `:`, or a space character; Cannot start with `-`, `_`, `+`, or `.ds-`; Cannot be `.` or `..`; Cannot be longer than 255 bytes. Multi-byte characters count towards this limit faster. */ name: DataStreamName + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export type IndicesCreateDataStreamResponse = AcknowledgedResponseBase +export interface IndicesCreateFromCreateFrom { + mappings_override?: MappingTypeMapping + settings_override?: IndicesIndexSettings + remove_index_blocks?: boolean +} + +export interface IndicesCreateFromRequest extends RequestBase { +/** The source index or data stream name */ + source: IndexName + /** The destination index or data stream name */ + dest: IndexName + create_from?: IndicesCreateFromCreateFrom + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { source?: never, dest?: never, create_from?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { source?: never, dest?: never, create_from?: never } +} + +export interface IndicesCreateFromResponse { + acknowledged: boolean + index: IndexName + shards_acknowledged: boolean +} + export interface IndicesDataStreamsStatsDataStreamsStatsItem { backing_indices: integer data_stream: Name @@ -11480,8 +13302,14 @@ export interface IndicesDataStreamsStatsDataStreamsStatsItem { } export interface IndicesDataStreamsStatsRequest extends RequestBase { +/** Comma-separated list of data streams used to limit the request. Wildcard expressions (`*`) are supported. To target all data streams in a cluster, omit this parameter or use `*`. */ name?: IndexName + /** Type of data stream that wildcard patterns can match. Supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, expand_wildcards?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, expand_wildcards?: never } } export interface IndicesDataStreamsStatsResponse { @@ -11494,112 +13322,210 @@ export interface IndicesDataStreamsStatsResponse { } export interface IndicesDeleteRequest extends RequestBase { +/** Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not support wildcards (`*`) or `_all`. To use wildcards or `_all`, set the `action.destructive_requires_name` cluster setting to `false`. */ index: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never } } export type IndicesDeleteResponse = IndicesResponseBase export interface IndicesDeleteAliasRequest extends RequestBase { +/** Comma-separated list of data streams or indices used to limit the request. Supports wildcards (`*`). */ index: Indices + /** Comma-separated list of aliases to remove. Supports wildcards (`*`). To remove all aliases, use `*` or `_all`. */ name: Names + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, name?: never, master_timeout?: never, timeout?: never } } export type IndicesDeleteAliasResponse = AcknowledgedResponseBase export interface IndicesDeleteDataLifecycleRequest extends RequestBase { +/** A comma-separated list of data streams of which the data stream lifecycle will be deleted; use `*` to get all data streams */ name: DataStreamNames + /** Whether wildcard expressions should get expanded to open or closed indices (default: open) */ expand_wildcards?: ExpandWildcards + /** Specify timeout for connection to master */ master_timeout?: Duration + /** Explicit timestamp for the document */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, expand_wildcards?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, expand_wildcards?: never, master_timeout?: never, timeout?: never } } export type IndicesDeleteDataLifecycleResponse = AcknowledgedResponseBase export interface IndicesDeleteDataStreamRequest extends RequestBase { +/** Comma-separated list of data streams to delete. Wildcard (`*`) expressions are supported. */ name: DataStreamNames + /** 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 + /** Type of data stream that wildcard patterns can match. Supports comma-separated values,such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, expand_wildcards?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, expand_wildcards?: never } } export type IndicesDeleteDataStreamResponse = AcknowledgedResponseBase export interface IndicesDeleteIndexTemplateRequest extends RequestBase { +/** Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. */ name: Names + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export type IndicesDeleteIndexTemplateResponse = AcknowledgedResponseBase export interface IndicesDeleteTemplateRequest extends RequestBase { +/** The name of the legacy index template to delete. Wildcard (`*`) expressions are supported. */ name: Name + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export type IndicesDeleteTemplateResponse = AcknowledgedResponseBase export interface IndicesDiskUsageRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. It’s recommended to execute this API with a single index (or the latest backing index of a data stream) as the API consumes resources significantly. */ index: Indices + /** If false, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** If `true`, the API performs a flush before analysis. If `false`, the response may not include uncommitted data. */ flush?: boolean + /** If `true`, missing or closed indices are not included in the response. */ ignore_unavailable?: boolean + /** Analyzing field disk usage is resource-intensive. To use the API, this parameter must be set to `true`. */ run_expensive_tasks?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flush?: never, ignore_unavailable?: never, run_expensive_tasks?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flush?: never, ignore_unavailable?: never, run_expensive_tasks?: never } } export type IndicesDiskUsageResponse = any export interface IndicesDownsampleRequest extends RequestBase { +/** Name of the time series index to downsample. */ index: IndexName + /** Name of the index to create. */ target_index: IndexName config?: IndicesDownsampleConfig + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, target_index?: never, config?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, target_index?: never, config?: never } } export type IndicesDownsampleResponse = any export interface IndicesExistsRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases. Supports wildcards (`*`). */ index: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `true`, returns settings in flat format. */ flat_settings?: boolean + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, return all default settings in the response. */ include_defaults?: boolean + /** If `true`, the request retrieves information from the local node only. */ local?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, include_defaults?: never, local?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, include_defaults?: never, local?: never } } export type IndicesExistsResponse = boolean export interface IndicesExistsAliasRequest extends RequestBase { +/** Comma-separated list of aliases to check. Supports wildcards (`*`). */ name: Names + /** Comma-separated list of data streams or indices used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, requests that include a missing data stream or index in the target indices or data streams return an error. */ ignore_unavailable?: boolean + /** 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, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never } } export type IndicesExistsAliasResponse = boolean export interface IndicesExistsIndexTemplateRequest extends RequestBase { +/** Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. */ name: Name + /** 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 type IndicesExistsIndexTemplateResponse = boolean export interface IndicesExistsTemplateRequest extends RequestBase { +/** A comma-separated list of index template names used to limit the request. Wildcard (`*`) expressions are supported. */ name: Names + /** Indicates whether to use a flat format for the response. */ flat_settings?: boolean + /** Indicates whether to get information from the local node only. */ local?: boolean + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, flat_settings?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, flat_settings?: never, local?: never, master_timeout?: never } } export type IndicesExistsTemplateResponse = boolean @@ -11617,9 +13543,16 @@ export interface IndicesExplainDataLifecycleDataStreamLifecycleExplain { } export interface IndicesExplainDataLifecycleRequest extends RequestBase { +/** The name of the index to explain */ index: Indices + /** indicates if the API should return the default values the system uses for the index's lifecycle */ include_defaults?: boolean + /** Specify timeout for connection to master */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, include_defaults?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, include_defaults?: never, master_timeout?: never } } export interface IndicesExplainDataLifecycleResponse { @@ -11654,12 +13587,22 @@ export interface IndicesFieldUsageStatsInvertedIndex { } export interface IndicesFieldUsageStatsRequest extends RequestBase { +/** Comma-separated list or wildcard expression of index names used to limit the request. */ index: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** If `true`, missing or closed indices are not included in the response. */ ignore_unavailable?: boolean + /** Comma-separated list or wildcard expressions of fields to include in the statistics. */ fields?: Fields + /** The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */ wait_for_active_shards?: WaitForActiveShards + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, fields?: never, wait_for_active_shards?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, fields?: never, wait_for_active_shards?: never } } export type IndicesFieldUsageStatsResponse = IndicesFieldUsageStatsFieldsUsageBody @@ -11681,25 +13624,47 @@ export interface IndicesFieldUsageStatsUsageStatsShards { } export interface IndicesFlushRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases to flush. Supports wildcards (`*`). To flush all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `true`, the request forces a flush even if there are no changes to commit to the index. */ force?: boolean + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, the flush operation blocks until execution when another flush operation is running. If `false`, Elasticsearch returns an error if you request a flush when another flush operation is running. */ wait_if_ongoing?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, force?: never, ignore_unavailable?: never, wait_if_ongoing?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, force?: never, ignore_unavailable?: never, wait_if_ongoing?: never } } export type IndicesFlushResponse = ShardsOperationResponseBase export interface IndicesForcemergeRequest extends RequestBase { +/** A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices */ index?: Indices + /** Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) */ allow_no_indices?: boolean + /** Whether to expand wildcard expression to concrete indices that are open, closed or both. */ expand_wildcards?: ExpandWildcards + /** Specify whether the index should be flushed after performing the operation (default: true) */ flush?: boolean + /** Whether specified concrete indices should be ignored when unavailable (missing or closed) */ ignore_unavailable?: boolean + /** The number of segments the index should be merged into (default: dynamic) */ max_num_segments?: long + /** Specify whether the operation should only expunge deleted documents */ only_expunge_deletes?: boolean + /** Should the request wait until the force merge is completed. */ wait_for_completion?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flush?: never, ignore_unavailable?: never, max_num_segments?: never, only_expunge_deletes?: never, wait_for_completion?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flush?: never, ignore_unavailable?: never, max_num_segments?: never, only_expunge_deletes?: never, wait_for_completion?: never } } export type IndicesForcemergeResponse = IndicesForcemergeForceMergeResponseBody @@ -11713,15 +13678,28 @@ export type IndicesGetFeature = 'aliases' | 'mappings' | 'settings' export type IndicesGetFeatures = IndicesGetFeature | IndicesGetFeature[] export interface IndicesGetRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported. */ index: Indices + /** If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. */ allow_no_indices?: boolean + /** Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. */ expand_wildcards?: ExpandWildcards + /** If true, returns settings in flat format. */ flat_settings?: boolean + /** If false, requests that target a missing index return an error. */ ignore_unavailable?: boolean + /** If true, return all default settings in the response. */ include_defaults?: boolean + /** If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. */ local?: boolean + /** 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 + /** Return only information on specified index features */ features?: IndicesGetFeatures + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, include_defaults?: never, local?: never, master_timeout?: never, features?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, include_defaults?: never, local?: never, master_timeout?: never, features?: never } } export type IndicesGetResponse = Record @@ -11731,12 +13709,22 @@ export interface IndicesGetAliasIndexAliases { } export interface IndicesGetAliasRequest extends RequestBase { +/** Comma-separated list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. */ name?: Names + /** Comma-separated list of data streams or indices used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** 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, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never } } export type IndicesGetAliasResponse = Record @@ -11747,10 +13735,18 @@ export interface IndicesGetDataLifecycleDataStreamWithLifecycle { } export interface IndicesGetDataLifecycleRequest extends RequestBase { +/** Comma-separated list of data streams to limit the request. Supports wildcards (`*`). To target all data streams, omit this parameter or use `*` or `_all`. */ name: DataStreamNames + /** Type of data stream that wildcard patterns can match. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `true`, return all default settings in the response. */ include_defaults?: boolean + /** 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, expand_wildcards?: never, include_defaults?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, expand_wildcards?: never, include_defaults?: never, master_timeout?: never } } export interface IndicesGetDataLifecycleResponse { @@ -11764,6 +13760,10 @@ export interface IndicesGetDataLifecycleStatsDataStreamStats { } export interface IndicesGetDataLifecycleStatsRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface IndicesGetDataLifecycleStatsResponse { @@ -11774,11 +13774,20 @@ export interface IndicesGetDataLifecycleStatsResponse { } export interface IndicesGetDataStreamRequest extends RequestBase { +/** Comma-separated list of data stream names used to limit the request. Wildcard (`*`) expressions are supported. If omitted, all data streams are returned. */ name?: DataStreamNames + /** Type of data stream that wildcard patterns can match. Supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** If true, returns all relevant default configurations for the index template. */ include_defaults?: boolean + /** 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 + /** Whether the maximum timestamp for each data stream should be calculated and returned. */ verbose?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, expand_wildcards?: never, include_defaults?: never, master_timeout?: never, verbose?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, expand_wildcards?: never, include_defaults?: never, master_timeout?: never, verbose?: never } } export interface IndicesGetDataStreamResponse { @@ -11786,13 +13795,24 @@ export interface IndicesGetDataStreamResponse { } export interface IndicesGetFieldMappingRequest extends RequestBase { +/** Comma-separated list or wildcard expression of fields used to limit returned information. Supports wildcards (`*`). */ fields: Fields + /** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, return all default settings in the response. */ include_defaults?: boolean + /** If `true`, the request retrieves information from the local node only. */ local?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { fields?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, include_defaults?: never, local?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { fields?: never, index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, include_defaults?: never, local?: never } } export type IndicesGetFieldMappingResponse = Record @@ -11807,11 +13827,20 @@ export interface IndicesGetIndexTemplateIndexTemplateItem { } export interface IndicesGetIndexTemplateRequest extends RequestBase { +/** Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. */ name?: Name + /** If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. */ local?: boolean + /** If true, returns settings in flat format. */ flat_settings?: boolean + /** 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 + /** If true, returns all relevant default configurations for the index template. */ include_defaults?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, local?: never, flat_settings?: never, master_timeout?: never, include_defaults?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, local?: never, flat_settings?: never, master_timeout?: never, include_defaults?: never } } export interface IndicesGetIndexTemplateResponse { @@ -11824,43 +13853,135 @@ export interface IndicesGetMappingIndexMappingRecord { } export interface IndicesGetMappingRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, the request retrieves information from the local node only. */ local?: boolean + /** 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 } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, local?: never, master_timeout?: never } } export type IndicesGetMappingResponse = Record +export interface IndicesGetMigrateReindexStatusRequest extends RequestBase { +/** The index or data stream name. */ + index: Indices + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never } +} + +export interface IndicesGetMigrateReindexStatusResponse { + start_time?: DateTime + start_time_millis: EpochTime + complete: boolean + total_indices_in_data_stream: integer + total_indices_requiring_upgrade: integer + successes: integer + in_progress: IndicesGetMigrateReindexStatusStatusInProgress[] + pending: integer + errors: IndicesGetMigrateReindexStatusStatusError[] + exception?: string +} + +export interface IndicesGetMigrateReindexStatusStatusError { + index: string + message: string +} + +export interface IndicesGetMigrateReindexStatusStatusInProgress { + index: string + total_doc_count: long + reindexed_doc_count: long +} + export interface IndicesGetSettingsRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** Comma-separated list or wildcard expression of settings to retrieve. */ name?: Names + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with `bar`. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** If `true`, returns settings in flat format. */ flat_settings?: boolean + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, return all default settings in the response. */ include_defaults?: boolean + /** If `true`, the request retrieves information from the local node only. If `false`, information is retrieved from the master node. */ local?: boolean + /** 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 } & { index?: never, name?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, include_defaults?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, name?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, include_defaults?: never, local?: never, master_timeout?: never } } export type IndicesGetSettingsResponse = Record export interface IndicesGetTemplateRequest extends RequestBase { +/** Comma-separated list of index template names used to limit the request. Wildcard (`*`) expressions are supported. To return all index templates, omit this parameter or use a value of `_all` or `*`. */ name?: Names + /** If `true`, returns settings in flat format. */ flat_settings?: boolean + /** If `true`, the request retrieves information from the local node only. */ local?: boolean + /** 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, flat_settings?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, flat_settings?: never, local?: never, master_timeout?: never } } export type IndicesGetTemplateResponse = Record +export interface IndicesMigrateReindexMigrateReindex { + mode: IndicesMigrateReindexModeEnum + source: IndicesMigrateReindexSourceIndex +} + +export type IndicesMigrateReindexModeEnum = 'upgrade' + +export interface IndicesMigrateReindexRequest extends RequestBase { + reindex?: IndicesMigrateReindexMigrateReindex + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { reindex?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { reindex?: never } +} + +export type IndicesMigrateReindexResponse = AcknowledgedResponseBase + +export interface IndicesMigrateReindexSourceIndex { + index: IndexName +} + export interface IndicesMigrateToDataStreamRequest extends RequestBase { +/** Name of the index alias to convert to a data stream. */ name: IndexName + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export type IndicesMigrateToDataStreamResponse = AcknowledgedResponseBase @@ -11876,19 +13997,35 @@ export interface IndicesModifyDataStreamIndexAndDataStreamAction { } export interface IndicesModifyDataStreamRequest extends RequestBase { +/** Actions to perform. */ actions: IndicesModifyDataStreamAction[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { actions?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { actions?: never } } export type IndicesModifyDataStreamResponse = AcknowledgedResponseBase export interface IndicesOpenRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). By default, you must explicitly name the indices you using to limit the request. To limit a request using `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to false. You can update this setting in the `elasticsearch.yml` file or using the cluster update settings API. */ index: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */ wait_for_active_shards?: WaitForActiveShards + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never } } export interface IndicesOpenResponse { @@ -11897,32 +14034,59 @@ export interface IndicesOpenResponse { } export interface IndicesPromoteDataStreamRequest extends RequestBase { +/** The name of the data stream */ name: IndexName + /** 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 type IndicesPromoteDataStreamResponse = any export interface IndicesPutAliasRequest extends RequestBase { +/** Comma-separated list of data streams or indices to add. Supports wildcards (`*`). Wildcard patterns that match both data streams and indices return an error. */ index: Indices + /** Alias to update. If the alias doesn’t exist, the request creates it. Index alias names support date math. */ name: Name + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** Query used to limit documents the alias can access. */ filter?: QueryDslQueryContainer + /** Value used to route indexing operations to a specific shard. If specified, this overwrites the `routing` value for indexing operations. Data stream aliases don’t support this parameter. */ index_routing?: Routing + /** If `true`, sets the write index or data stream for the alias. If an alias points to multiple indices or data streams and `is_write_index` isn’t set, the alias rejects write requests. If an index alias points to one index and `is_write_index` isn’t set, the index automatically acts as the write index. Data stream aliases don’t automatically set a write data stream, even if the alias points to one data stream. */ is_write_index?: boolean + /** Value used to route indexing and search operations to a specific shard. Data stream aliases don’t support this parameter. */ routing?: Routing + /** Value used to route search operations to a specific shard. If specified, this overwrites the `routing` value for search operations. Data stream aliases don’t support this parameter. */ search_routing?: Routing + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, name?: never, master_timeout?: never, timeout?: never, filter?: never, index_routing?: never, is_write_index?: never, routing?: never, search_routing?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, name?: never, master_timeout?: never, timeout?: never, filter?: never, index_routing?: never, is_write_index?: never, routing?: never, search_routing?: never } } export type IndicesPutAliasResponse = AcknowledgedResponseBase export interface IndicesPutDataLifecycleRequest extends RequestBase { +/** Comma-separated list of data streams used to limit the request. Supports wildcards (`*`). To target all data streams use `*` or `_all`. */ name: DataStreamNames + /** Type of data stream that wildcard patterns can match. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `hidden`, `open`, `closed`, `none`. */ expand_wildcards?: ExpandWildcards + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration lifecycle?: IndicesDataStreamLifecycle + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, expand_wildcards?: never, master_timeout?: never, timeout?: never, lifecycle?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, expand_wildcards?: never, master_timeout?: never, timeout?: never, lifecycle?: never } } export type IndicesPutDataLifecycleResponse = AcknowledgedResponseBase @@ -11935,72 +14099,137 @@ export interface IndicesPutIndexTemplateIndexTemplateMapping { } export interface IndicesPutIndexTemplateRequest extends RequestBase { +/** Index or template name */ name: Name + /** If `true`, this request cannot replace or update existing index templates. */ create?: boolean + /** 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 + /** User defined reason for creating/updating the index template */ cause?: string + /** Name of the index template to create. */ index_patterns?: Indices + /** An ordered list of component template names. Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. */ composed_of?: Name[] + /** Template to be applied. It may optionally include an `aliases`, `mappings`, or `settings` configuration. */ template?: IndicesPutIndexTemplateIndexTemplateMapping + /** If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. Data streams require a matching index template with a `data_stream` object. */ data_stream?: IndicesDataStreamVisibility + /** Priority to determine index template precedence when a new data stream or index is created. The index template with the highest priority is chosen. If no priority is specified the template is treated as though it is of priority 0 (lowest priority). This number is not automatically generated by Elasticsearch. */ priority?: long + /** Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. External systems can use these version numbers to simplify template management. To unset a version, replace the template without specifying one. */ version?: VersionNumber + /** Optional user metadata about the index template. It may have any contents. It is not automatically generated or used by Elasticsearch. This user-defined object is stored in the cluster state, so keeping it short is preferable To unset the metadata, replace the template without specifying it. */ _meta?: Metadata + /** This setting overrides the value of the `action.auto_create_index` cluster setting. If set to `true` in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled via `actions.auto_create_index`. If set to `false`, then indices or data streams matching the template must always be explicitly created, and may never be automatically created. */ allow_auto_create?: boolean + /** The configuration option ignore_missing_component_templates can be used when an index template references a component template that might not exist */ ignore_missing_component_templates?: string[] + /** Marks this index template as deprecated. When creating or updating a non-deprecated index template that uses deprecated components, Elasticsearch will emit a deprecation warning. */ deprecated?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, cause?: never, index_patterns?: never, composed_of?: never, template?: never, data_stream?: never, priority?: never, version?: never, _meta?: never, allow_auto_create?: never, ignore_missing_component_templates?: never, deprecated?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, cause?: never, index_patterns?: never, composed_of?: never, template?: never, data_stream?: never, priority?: never, version?: never, _meta?: never, allow_auto_create?: never, ignore_missing_component_templates?: never, deprecated?: never } } export type IndicesPutIndexTemplateResponse = AcknowledgedResponseBase export interface IndicesPutMappingRequest extends RequestBase { +/** A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. */ index: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** If `true`, the mappings are applied only to the current write index for the target. */ write_index_only?: boolean + /** Controls whether dynamic date detection is enabled. */ date_detection?: boolean + /** Controls whether new fields are added dynamically. */ dynamic?: MappingDynamicMapping + /** If date detection is enabled then new string fields are checked against 'dynamic_date_formats' and if the value matches then a new date field is added instead of string. */ dynamic_date_formats?: string[] + /** Specify dynamic templates for the mapping. */ dynamic_templates?: Record | Record[] + /** Control whether field names are enabled for the index. */ _field_names?: MappingFieldNamesField + /** A mapping type can have custom meta data associated with it. These are not used at all by Elasticsearch, but can be used to store application-specific metadata. */ _meta?: Metadata + /** Automatically map strings into numeric data types for all fields. */ numeric_detection?: boolean + /** Mapping for a field. For new fields, this mapping can include: - Field name - Field data type - Mapping parameters */ properties?: Record + /** Enable making a routing value required on indexed documents. */ _routing?: MappingRoutingField + /** Control whether the _source field is enabled on the index. */ _source?: MappingSourceField + /** Mapping of runtime fields for the index. */ runtime?: MappingRuntimeFields + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never, write_index_only?: never, date_detection?: never, dynamic?: never, dynamic_date_formats?: never, dynamic_templates?: never, _field_names?: never, _meta?: never, numeric_detection?: never, properties?: never, _routing?: never, _source?: never, runtime?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, master_timeout?: never, timeout?: never, write_index_only?: never, date_detection?: never, dynamic?: never, dynamic_date_formats?: never, dynamic_templates?: never, _field_names?: never, _meta?: never, numeric_detection?: never, properties?: never, _routing?: never, _source?: never, runtime?: never } } export type IndicesPutMappingResponse = IndicesResponseBase export interface IndicesPutSettingsRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** If `true`, returns settings in flat format. */ flat_settings?: boolean + /** If `true`, returns settings in flat format. */ ignore_unavailable?: boolean + /** 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 + /** If `true`, existing index settings remain unchanged. */ preserve_existing?: boolean + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration settings?: IndicesIndexSettings + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, master_timeout?: never, preserve_existing?: never, timeout?: never, settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, flat_settings?: never, ignore_unavailable?: never, master_timeout?: never, preserve_existing?: never, timeout?: never, settings?: never } } export type IndicesPutSettingsResponse = AcknowledgedResponseBase export interface IndicesPutTemplateRequest extends RequestBase { +/** The name of the template */ name: Name + /** If true, this request cannot replace or update existing index templates. */ create?: boolean + /** 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 cause?: string + /** Aliases for the index. */ aliases?: Record + /** Array of wildcard expressions used to match the names of indices during creation. */ index_patterns?: string | string[] + /** Mapping for fields in the index. */ mappings?: MappingTypeMapping + /** Order in which Elasticsearch applies this template if index matches multiple templates. Templates with lower 'order' values are merged first. Templates with higher 'order' values are merged later, overriding templates with lower values. */ order?: integer + /** Configuration options for the index. */ settings?: IndicesIndexSettings + /** Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. To unset a version, replace the template without specifying one. */ version?: VersionNumber + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, cause?: never, aliases?: never, index_patterns?: never, mappings?: never, order?: never, settings?: never, version?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, cause?: never, aliases?: never, index_patterns?: never, mappings?: never, order?: never, settings?: never, version?: never } } export type IndicesPutTemplateResponse = AcknowledgedResponseBase @@ -12070,9 +14299,16 @@ export interface IndicesRecoveryRecoveryStatus { } export interface IndicesRecoveryRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `true`, the response only includes ongoing shard recoveries. */ active_only?: boolean + /** If `true`, the response includes detailed information about shard recoveries. */ detailed?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, active_only?: never, detailed?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, active_only?: never, detailed?: never } } export type IndicesRecoveryResponse = Record @@ -12113,10 +14349,18 @@ export interface IndicesRecoveryVerifyIndex { } export interface IndicesRefreshRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never } } export type IndicesRefreshResponse = ShardsOperationResponseBase @@ -12133,20 +14377,37 @@ export interface IndicesReloadSearchAnalyzersReloadResult { } export interface IndicesReloadSearchAnalyzersRequest extends RequestBase { +/** A comma-separated list of index names to reload analyzers for */ index: Indices + /** Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) */ allow_no_indices?: boolean + /** Whether to expand wildcard expression to concrete indices that are open, closed or both. */ expand_wildcards?: ExpandWildcards + /** Whether specified concrete indices should be ignored when unavailable (missing or closed) */ ignore_unavailable?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never } } export type IndicesReloadSearchAnalyzersResponse = IndicesReloadSearchAnalyzersReloadResult export interface IndicesResolveClusterRequest extends RequestBase { +/** Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified using the ``:`` syntax. */ name: Names + /** If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If true, concrete, expanded or aliased indices are ignored when frozen. Defaults to false. */ ignore_throttled?: boolean + /** If false, the request returns an error if it targets a missing or closed index. Defaults to false. */ ignore_unavailable?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never } } export interface IndicesResolveClusterResolveClusterInfo { @@ -12160,10 +14421,18 @@ export interface IndicesResolveClusterResolveClusterInfo { export type IndicesResolveClusterResponse = Record export interface IndicesResolveIndexRequest extends RequestBase { +/** Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified using the ``:`` syntax. */ name: Names + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, expand_wildcards?: never, ignore_unavailable?: never, allow_no_indices?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, expand_wildcards?: never, ignore_unavailable?: never, allow_no_indices?: never } } export interface IndicesResolveIndexResolveIndexAliasItem { @@ -12191,16 +14460,30 @@ export interface IndicesResolveIndexResponse { } export interface IndicesRolloverRequest extends RequestBase { +/** Name of the data stream or index alias to roll over. */ alias: IndexAlias + /** Name of the index to create. Supports date math. Data streams do not support this parameter. */ new_index?: IndexName + /** If `true`, checks whether the current index satisfies the specified conditions but does not perform a rollover. */ dry_run?: boolean + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */ wait_for_active_shards?: WaitForActiveShards + /** Aliases for the target index. Data streams do not support this parameter. */ aliases?: Record + /** Conditions for the rollover. If specified, Elasticsearch only performs the rollover if the current index satisfies these conditions. If this parameter is not specified, Elasticsearch performs the rollover unconditionally. If conditions are specified, at least one of them must be a `max_*` condition. The index will rollover if any `max_*` condition is satisfied and all `min_*` conditions are satisfied. */ conditions?: IndicesRolloverRolloverConditions + /** Mapping for fields in the index. If specified, this mapping can include field names, field data types, and mapping paramaters. */ mappings?: MappingTypeMapping + /** Configuration options for the index. Data streams do not support this parameter. */ settings?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { alias?: never, new_index?: never, dry_run?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, conditions?: never, mappings?: never, settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { alias?: never, new_index?: never, dry_run?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, conditions?: never, mappings?: never, settings?: never } } export interface IndicesRolloverResponse { @@ -12236,10 +14519,18 @@ export interface IndicesSegmentsIndexSegment { } export interface IndicesSegmentsRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never } } export interface IndicesSegmentsResponse { @@ -12277,11 +14568,20 @@ export interface IndicesShardStoresIndicesShardStores { } export interface IndicesShardStoresRequest extends RequestBase { +/** List of data streams, indices, and aliases used to limit the request. */ index?: Indices + /** If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. */ expand_wildcards?: ExpandWildcards + /** If true, missing or closed indices are not included in the response. */ ignore_unavailable?: boolean + /** List of shard health statuses used to limit the request. */ status?: IndicesShardStoresShardStoreStatus | IndicesShardStoresShardStoreStatus[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, status?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_unavailable?: never, status?: never } } export interface IndicesShardStoresResponse { @@ -12319,13 +14619,24 @@ export interface IndicesShardStoresShardStoreWrapper { } export interface IndicesShrinkRequest extends RequestBase { +/** Name of the source index to shrink. */ index: IndexName + /** Name of the target index to create. */ target: IndexName + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */ wait_for_active_shards?: WaitForActiveShards + /** The key is the alias name. Index alias names support date math. */ aliases?: Record + /** Configuration options for the target index. */ settings?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, target?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, target?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, settings?: never } } export interface IndicesShrinkResponse { @@ -12335,9 +14646,16 @@ export interface IndicesShrinkResponse { } export interface IndicesSimulateIndexTemplateRequest extends RequestBase { +/** Name of the index to simulate */ name: Name + /** 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 + /** If true, returns all relevant default configurations for the index template. */ include_defaults?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, include_defaults?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, include_defaults?: never } } export interface IndicesSimulateIndexTemplateResponse { @@ -12351,20 +14669,38 @@ export interface IndicesSimulateTemplateOverlapping { } export interface IndicesSimulateTemplateRequest extends RequestBase { +/** Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit this parameter and specify the template configuration in the request body. */ name?: Name + /** If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. */ create?: boolean + /** 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 + /** If true, returns all relevant default configurations for the index template. */ include_defaults?: boolean + /** This setting overrides the value of the `action.auto_create_index` cluster setting. If set to `true` in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled via `actions.auto_create_index`. If set to `false`, then indices or data streams matching the template must always be explicitly created, and may never be automatically created. */ allow_auto_create?: boolean + /** Array of wildcard (`*`) expressions used to match the names of data streams and indices during creation. */ index_patterns?: Indices + /** An ordered list of component template names. Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. */ composed_of?: Name[] + /** Template to be applied. It may optionally include an `aliases`, `mappings`, or `settings` configuration. */ template?: IndicesPutIndexTemplateIndexTemplateMapping + /** If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. Data streams require a matching index template with a `data_stream` object. */ data_stream?: IndicesDataStreamVisibility + /** Priority to determine index template precedence when a new data stream or index is created. The index template with the highest priority is chosen. If no priority is specified the template is treated as though it is of priority 0 (lowest priority). This number is not automatically generated by Elasticsearch. */ priority?: long + /** Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. */ version?: VersionNumber + /** Optional user metadata about the index template. May have any contents. This map is not automatically generated by Elasticsearch. */ _meta?: Metadata + /** The configuration option ignore_missing_component_templates can be used when an index template references a component template that might not exist */ ignore_missing_component_templates?: string[] + /** Marks this index template as deprecated. When creating or updating a non-deprecated index template that uses deprecated components, Elasticsearch will emit a deprecation warning. */ deprecated?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, include_defaults?: never, allow_auto_create?: never, index_patterns?: never, composed_of?: never, template?: never, data_stream?: never, priority?: never, version?: never, _meta?: never, ignore_missing_component_templates?: never, deprecated?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, create?: never, master_timeout?: never, include_defaults?: never, allow_auto_create?: never, index_patterns?: never, composed_of?: never, template?: never, data_stream?: never, priority?: never, version?: never, _meta?: never, ignore_missing_component_templates?: never, deprecated?: never } } export interface IndicesSimulateTemplateResponse { @@ -12379,13 +14715,24 @@ export interface IndicesSimulateTemplateTemplate { } export interface IndicesSplitRequest extends RequestBase { +/** Name of the source index to split. */ index: IndexName + /** Name of the target index to create. */ target: IndexName + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). */ wait_for_active_shards?: WaitForActiveShards + /** Aliases for the resulting index. */ aliases?: Record + /** Configuration options for the target index. */ settings?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, target?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, target?: never, master_timeout?: never, timeout?: never, wait_for_active_shards?: never, aliases?: never, settings?: never } } export interface IndicesSplitResponse { @@ -12434,17 +14781,32 @@ export interface IndicesStatsMappingStats { } export interface IndicesStatsRequest extends RequestBase { +/** Limit the information returned the specific metrics. */ metric?: Metrics + /** A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices */ index?: Indices + /** Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. */ completion_fields?: Fields + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** Comma-separated list or wildcard expressions of fields to include in fielddata statistics. */ fielddata_fields?: Fields + /** Comma-separated list or wildcard expressions of fields to include in the statistics. */ fields?: Fields + /** If true, statistics are not collected from closed indices. */ forbid_closed_indices?: boolean + /** Comma-separated list of search groups to include in the search statistics. */ groups?: string | string[] + /** If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). */ include_segment_file_sizes?: boolean + /** If true, the response includes information from segments that are not loaded into memory. */ include_unloaded_segments?: boolean + /** Indicates whether statistics are aggregated at the cluster, index, or shard level. */ level?: Level + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { metric?: never, index?: never, completion_fields?: never, expand_wildcards?: never, fielddata_fields?: never, fields?: never, forbid_closed_indices?: never, groups?: never, include_segment_file_sizes?: never, include_unloaded_segments?: never, level?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { metric?: never, index?: never, completion_fields?: never, expand_wildcards?: never, fielddata_fields?: never, fields?: never, forbid_closed_indices?: never, groups?: never, include_segment_file_sizes?: never, include_unloaded_segments?: never, level?: never } } export interface IndicesStatsResponse { @@ -12546,21 +14908,6 @@ export interface IndicesStatsShardsTotalStats { total_count: long } -export interface IndicesUnfreezeRequest extends RequestBase { - index: IndexName - allow_no_indices?: boolean - expand_wildcards?: ExpandWildcards - ignore_unavailable?: boolean - master_timeout?: Duration - timeout?: Duration - wait_for_active_shards?: string -} - -export interface IndicesUnfreezeResponse { - acknowledged: boolean - shards_acknowledged: boolean -} - export interface IndicesUpdateAliasesAction { add?: IndicesUpdateAliasesAddAction remove?: IndicesUpdateAliasesRemoveAction @@ -12596,9 +14943,16 @@ export interface IndicesUpdateAliasesRemoveIndexAction { } export interface IndicesUpdateAliasesRequest extends RequestBase { +/** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** Actions to perform. */ actions?: IndicesUpdateAliasesAction[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never, actions?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never, actions?: never } } export type IndicesUpdateAliasesResponse = AcknowledgedResponseBase @@ -12611,20 +14965,38 @@ export interface IndicesValidateQueryIndicesValidationExplanation { } export interface IndicesValidateQueryRequest extends RequestBase { +/** Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (`*`). To search all data streams or indices, omit this parameter or use `*` or `_all`. */ index?: Indices + /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. */ allow_no_indices?: boolean + /** If `true`, the validation is executed on all shards instead of one random shard per index. */ all_shards?: boolean + /** Analyzer to use for the query string. This parameter can only be used when the `q` query string parameter is specified. */ analyzer?: string + /** If `true`, wildcard and prefix queries are analyzed. */ analyze_wildcard?: boolean + /** The default operator for query string query: `AND` or `OR`. */ default_operator?: QueryDslOperator + /** Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. */ df?: string + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. */ expand_wildcards?: ExpandWildcards + /** If `true`, the response returns detailed information if an error has occurred. */ explain?: boolean + /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean + /** If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. */ lenient?: boolean + /** If `true`, returns a more detailed explanation showing the actual Lucene query that will be executed. */ rewrite?: boolean + /** Query in the Lucene query string syntax. */ q?: string + /** Query in the Lucene query string syntax. */ query?: QueryDslQueryContainer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, allow_no_indices?: never, all_shards?: never, analyzer?: never, analyze_wildcard?: never, default_operator?: never, df?: never, expand_wildcards?: never, explain?: never, ignore_unavailable?: never, lenient?: never, rewrite?: never, q?: never, query?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, allow_no_indices?: never, all_shards?: never, analyzer?: never, analyze_wildcard?: never, default_operator?: never, df?: never, expand_wildcards?: never, explain?: never, ignore_unavailable?: never, lenient?: never, rewrite?: never, q?: never, query?: never } } export interface IndicesValidateQueryResponse { @@ -12692,17 +15064,31 @@ export interface InferenceTextEmbeddingResult { } export interface InferenceDeleteRequest extends RequestBase { +/** The task type */ task_type?: InferenceTaskType + /** The inference Id */ inference_id: Id + /** When true, the endpoint is not deleted, and a list of ingest processors which reference this endpoint is returned */ dry_run?: boolean + /** When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields */ force?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_type?: never, inference_id?: never, dry_run?: never, force?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_type?: never, inference_id?: never, dry_run?: never, force?: never } } export type InferenceDeleteResponse = InferenceDeleteInferenceEndpointResult export interface InferenceGetRequest extends RequestBase { +/** The task type */ task_type?: InferenceTaskType + /** The inference Id */ inference_id?: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_type?: never, inference_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_type?: never, inference_id?: never } } export interface InferenceGetResponse { @@ -12710,24 +15096,148 @@ export interface InferenceGetResponse { } export interface InferenceInferenceRequest extends RequestBase { +/** The task type */ task_type?: InferenceTaskType + /** The inference Id */ inference_id: Id + /** Specifies the amount of time to wait for the inference request to complete. */ timeout?: Duration + /** Query input, required for rerank task. Not required for other tasks. */ query?: string + /** Inference input. Either a string or an array of strings. */ input: string | string[] + /** Optional task settings */ task_settings?: InferenceTaskSettings + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_type?: never, inference_id?: never, timeout?: never, query?: never, input?: never, task_settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_type?: never, inference_id?: never, timeout?: never, query?: never, input?: never, task_settings?: never } } export type InferenceInferenceResponse = InferenceInferenceResult export interface InferencePutRequest extends RequestBase { +/** The task type */ task_type?: InferenceTaskType + /** The inference Id */ inference_id: Id inference_config?: InferenceInferenceEndpoint + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_type?: never, inference_id?: never, inference_config?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_type?: never, inference_id?: never, inference_config?: never } } export type InferencePutResponse = InferenceInferenceEndpointInfo +export interface InferenceStreamInferenceRequest extends RequestBase { +/** The unique identifier for the inference endpoint. */ + inference_id: Id + /** The type of task that the model performs. */ + task_type?: InferenceTaskType + /** The text on which you want to perform the inference task. It can be a single string or an array. NOTE: Inference endpoints for the completion task type currently only support a single string as input. */ + input: string | string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { inference_id?: never, task_type?: never, input?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { inference_id?: never, task_type?: never, input?: never } +} + +export type InferenceStreamInferenceResponse = StreamResult + +export interface InferenceUnifiedInferenceCompletionTool { + type: string + function: InferenceUnifiedInferenceCompletionToolFunction +} + +export interface InferenceUnifiedInferenceCompletionToolChoice { + type: string + function: InferenceUnifiedInferenceCompletionToolChoiceFunction +} + +export interface InferenceUnifiedInferenceCompletionToolChoiceFunction { + name: string +} + +export interface InferenceUnifiedInferenceCompletionToolFunction { + description?: string + name: string + parameters?: any + strict?: boolean +} + +export type InferenceUnifiedInferenceCompletionToolType = string | InferenceUnifiedInferenceCompletionToolChoice + +export interface InferenceUnifiedInferenceContentObject { + text: string + type: string +} + +export interface InferenceUnifiedInferenceMessage { + content?: InferenceUnifiedInferenceMessageContent + role: string + tool_call_id?: Id + tool_calls?: InferenceUnifiedInferenceToolCall[] +} + +export type InferenceUnifiedInferenceMessageContent = string | InferenceUnifiedInferenceContentObject[] + +export interface InferenceUnifiedInferenceRequest extends RequestBase { +/** The task type */ + task_type?: InferenceTaskType + /** The inference Id */ + inference_id: Id + /** Specifies the amount of time to wait for the inference request to complete. */ + timeout?: Duration + /** A list of objects representing the conversation. */ + messages: InferenceUnifiedInferenceMessage[] + /** The ID of the model to use. */ + model?: string + /** The upper bound limit for the number of tokens that can be generated for a completion request. */ + max_completion_tokens?: long + /** A sequence of strings to control when the model should stop generating additional tokens. */ + stop?: string[] + /** The sampling temperature to use. */ + temperature?: float + /** Controls which tool is called by the model. */ + tool_choice?: InferenceUnifiedInferenceCompletionToolType + /** A list of tools that the model can call. */ + tools?: InferenceUnifiedInferenceCompletionTool[] + /** Nucleus sampling, an alternative to sampling with temperature. */ + top_p?: float + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_type?: never, inference_id?: never, timeout?: never, messages?: never, model?: never, max_completion_tokens?: never, stop?: never, temperature?: never, tool_choice?: never, tools?: never, top_p?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_type?: never, inference_id?: never, timeout?: never, messages?: never, model?: never, max_completion_tokens?: never, stop?: never, temperature?: never, tool_choice?: never, tools?: never, top_p?: never } +} + +export type InferenceUnifiedInferenceResponse = StreamResult + +export interface InferenceUnifiedInferenceToolCall { + id: Id + function: InferenceUnifiedInferenceToolCallFunction + type: string +} + +export interface InferenceUnifiedInferenceToolCallFunction { + arguments: string + name: string +} + +export interface InferenceUpdateRequest extends RequestBase { +/** The unique identifier of the inference endpoint. */ + inference_id: Id + /** The type of inference task that the model performs. */ + task_type?: InferenceTaskType + inference_config?: InferenceInferenceEndpoint + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { inference_id?: never, task_type?: never, inference_config?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { inference_id?: never, task_type?: never, inference_config?: never } +} + +export type InferenceUpdateResponse = InferenceInferenceEndpointInfo + export interface IngestAppendProcessor extends IngestProcessorBase { field: Field value: any | any[] @@ -13247,25 +15757,46 @@ export interface IngestWeb { } export interface IngestDeleteGeoipDatabaseRequest extends RequestBase { +/** A comma-separated list of geoip database configurations to delete */ id: Ids + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never } } export type IngestDeleteGeoipDatabaseResponse = AcknowledgedResponseBase export interface IngestDeleteIpLocationDatabaseRequest extends RequestBase { +/** A comma-separated list of IP location database configurations. */ id: Ids + /** 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. A value of `-1` indicates that the request should never time out. */ 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. A value of `-1` indicates that the request should never time out. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never } } export type IngestDeleteIpLocationDatabaseResponse = AcknowledgedResponseBase export interface IngestDeletePipelineRequest extends RequestBase { +/** Pipeline ID or wildcard expression of pipeline IDs used to limit the request. To delete all ingest pipelines in a cluster, use a value of `*`. */ id: Id + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never } } export type IngestDeletePipelineResponse = AcknowledgedResponseBase @@ -13289,6 +15820,10 @@ export interface IngestGeoIpStatsGeoIpNodeDatabases { } export interface IngestGeoIpStatsRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface IngestGeoIpStatsResponse { @@ -13304,7 +15839,12 @@ export interface IngestGetGeoipDatabaseDatabaseConfigurationMetadata { } export interface IngestGetGeoipDatabaseRequest extends RequestBase { +/** Comma-separated list of database configuration IDs to retrieve. Wildcard (`*`) expressions are supported. To get all database configurations, omit this parameter or use `*`. */ id?: Ids + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export interface IngestGetGeoipDatabaseResponse { @@ -13320,8 +15860,14 @@ export interface IngestGetIpLocationDatabaseDatabaseConfigurationMetadata { } export interface IngestGetIpLocationDatabaseRequest extends RequestBase { +/** Comma-separated list of database configuration IDs to retrieve. Wildcard (`*`) expressions are supported. To get all database configurations, omit this parameter or use `*`. */ id?: Ids + /** 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. A value of `-1` indicates that the request should never time out. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never } } export interface IngestGetIpLocationDatabaseResponse { @@ -13329,14 +15875,25 @@ export interface IngestGetIpLocationDatabaseResponse { } export interface IngestGetPipelineRequest extends RequestBase { +/** Comma-separated list of pipeline IDs to retrieve. Wildcard (`*`) expressions are supported. To get all ingest pipelines, omit this parameter or use `*`. */ id?: Id + /** 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 + /** Return pipelines without their definitions (default: false) */ summary?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never, summary?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never, summary?: never } } export type IngestGetPipelineResponse = Record export interface IngestProcessorGrokRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface IngestProcessorGrokResponse { @@ -13344,44 +15901,82 @@ export interface IngestProcessorGrokResponse { } export interface IngestPutGeoipDatabaseRequest extends RequestBase { +/** ID of the database configuration to create or update. */ id: Id + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The provider-assigned name of the IP geolocation database to download. */ name: Name + /** The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured. */ maxmind: IngestMaxmind + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never, name?: never, maxmind?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never, name?: never, maxmind?: never } } export type IngestPutGeoipDatabaseResponse = AcknowledgedResponseBase export interface IngestPutIpLocationDatabaseRequest extends RequestBase { +/** The database configuration identifier. */ id: Id + /** 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. A value of `-1` indicates that the request should never time out. */ master_timeout?: Duration + /** The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. If no response is received before the timeout expires, the cluster metadata update still applies but the response indicates that it was not completely acknowledged. A value of `-1` indicates that the request should never time out. */ timeout?: Duration configuration?: IngestDatabaseConfiguration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never, configuration?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never, configuration?: never } } export type IngestPutIpLocationDatabaseResponse = AcknowledgedResponseBase export interface IngestPutPipelineRequest extends RequestBase { +/** ID of the ingest pipeline to create or update. */ id: Id + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** Required version for optimistic concurrency control for pipeline updates */ if_version?: VersionNumber + /** Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch. */ _meta?: Metadata + /** Description of the ingest pipeline. */ description?: string + /** Processors to run immediately after a processor failure. Each processor supports a processor-level `on_failure` value. If a processor without an `on_failure` value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. */ on_failure?: IngestProcessorContainer[] + /** Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. */ processors?: IngestProcessorContainer[] + /** Version number used by external systems to track ingest pipelines. This parameter is intended for external systems only. Elasticsearch does not use or validate pipeline version numbers. */ version?: VersionNumber + /** Marks this ingest pipeline as deprecated. When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. */ deprecated?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never, if_version?: never, _meta?: never, description?: never, on_failure?: never, processors?: never, version?: never, deprecated?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, master_timeout?: never, timeout?: never, if_version?: never, _meta?: never, description?: never, on_failure?: never, processors?: never, version?: never, deprecated?: never } } export type IngestPutPipelineResponse = AcknowledgedResponseBase export interface IngestSimulateRequest extends RequestBase { +/** Pipeline to test. If you don’t specify a `pipeline` in the request body, this parameter is required. */ id?: Id + /** If `true`, the response includes output data for each processor in the executed pipeline. */ verbose?: boolean + /** Sample documents to test in the pipeline. */ docs: IngestDocument[] + /** Pipeline to test. If you don’t specify the `pipeline` request path parameter, this parameter is required. If you specify both this and the request path parameter, the API only uses the request path parameter. */ pipeline?: IngestPipeline + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, verbose?: never, docs?: never, pipeline?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, verbose?: never, docs?: never, pipeline?: never } } export interface IngestSimulateResponse { @@ -13406,8 +16001,14 @@ export type LicenseLicenseStatus = 'active' | 'valid' | 'invalid' | 'expired' export type LicenseLicenseType = 'missing' | 'trial' | 'basic' | 'standard' | 'dev' | 'silver' | 'gold' | 'platinum' | 'enterprise' export interface LicenseDeleteRequest extends RequestBase { +/** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never } } export type LicenseDeleteResponse = AcknowledgedResponseBase @@ -13428,8 +16029,14 @@ export interface LicenseGetLicenseInformation { } export interface LicenseGetRequest extends RequestBase { +/** If `true`, this parameter returns enterprise for Enterprise license types. If `false`, this parameter returns platinum for both platinum and enterprise license types. This behavior is maintained for backwards compatibility. This parameter is deprecated and will always be set to true in 8.x. */ accept_enterprise?: boolean + /** Specifies whether to retrieve local information. The default value is `false`, which means the information is retrieved from the master node. */ local?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { accept_enterprise?: never, local?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { accept_enterprise?: never, local?: never } } export interface LicenseGetResponse { @@ -13437,6 +16044,10 @@ export interface LicenseGetResponse { } export interface LicenseGetBasicStatusRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface LicenseGetBasicStatusResponse { @@ -13444,6 +16055,10 @@ export interface LicenseGetBasicStatusResponse { } export interface LicenseGetTrialStatusRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface LicenseGetTrialStatusResponse { @@ -13456,11 +16071,19 @@ export interface LicensePostAcknowledgement { } export interface LicensePostRequest extends RequestBase { +/** Specifies whether you acknowledge the license changes. */ acknowledge?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration license?: LicenseLicense + /** A sequence of one or more JSON documents containing the license information. */ licenses?: LicenseLicense[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { acknowledge?: never, master_timeout?: never, timeout?: never, license?: never, licenses?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { acknowledge?: never, master_timeout?: never, timeout?: never, license?: never, licenses?: never } } export interface LicensePostResponse { @@ -13470,9 +16093,16 @@ export interface LicensePostResponse { } export interface LicensePostStartBasicRequest extends RequestBase { +/** whether the user has acknowledged acknowledge messages (default: false) */ acknowledge?: boolean + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { acknowledge?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { acknowledge?: never, master_timeout?: never, timeout?: never } } export interface LicensePostStartBasicResponse { @@ -13484,9 +16114,15 @@ export interface LicensePostStartBasicResponse { } export interface LicensePostStartTrialRequest extends RequestBase { +/** whether the user has acknowledged acknowledge messages (default: false) */ acknowledge?: boolean type_query_string?: string + /** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { acknowledge?: never, type_query_string?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { acknowledge?: never, type_query_string?: never, master_timeout?: never } } export interface LicensePostStartTrialResponse { @@ -13521,20 +16157,35 @@ export interface LogstashPipelineSettings { } export interface LogstashDeletePipelineRequest extends RequestBase { +/** An identifier for the pipeline. */ id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export type LogstashDeletePipelineResponse = boolean export interface LogstashGetPipelineRequest extends RequestBase { +/** A comma-separated list of pipeline identifiers. */ id?: Ids + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export type LogstashGetPipelineResponse = Record export interface LogstashPutPipelineRequest extends RequestBase { +/** An identifier for the pipeline. */ id: Id pipeline?: LogstashPipeline + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, pipeline?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, pipeline?: never } } export type LogstashPutPipelineResponse = boolean @@ -13551,7 +16202,12 @@ export interface MigrationDeprecationsDeprecation { export type MigrationDeprecationsDeprecationLevel = 'none' | 'info' | 'warning' | 'critical' export interface MigrationDeprecationsRequest extends RequestBase { +/** Comma-separate list of data streams or indices to check. Wildcard (*) expressions are supported. */ index?: IndexName + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never } } export interface MigrationDeprecationsResponse { @@ -13578,6 +16234,10 @@ export interface MigrationGetFeatureUpgradeStatusMigrationFeatureIndexInfo { export type MigrationGetFeatureUpgradeStatusMigrationStatus = 'NO_MIGRATION_NEEDED' | 'MIGRATION_NEEDED' | 'IN_PROGRESS' | 'ERROR' export interface MigrationGetFeatureUpgradeStatusRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface MigrationGetFeatureUpgradeStatusResponse { @@ -13590,6 +16250,10 @@ export interface MigrationPostFeatureUpgradeMigrationFeature { } export interface MigrationPostFeatureUpgradeRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface MigrationPostFeatureUpgradeResponse { @@ -14893,7 +17557,12 @@ export interface MlZeroShotClassificationInferenceUpdateOptions { } export interface MlClearTrainedModelDeploymentCacheRequest extends RequestBase { +/** The unique identifier of the trained model. */ model_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never } } export interface MlClearTrainedModelDeploymentCacheResponse { @@ -14901,10 +17570,18 @@ export interface MlClearTrainedModelDeploymentCacheResponse { } export interface MlCloseJobRequest extends RequestBase { +/** Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. You can close multiple anomaly detection jobs in a single API request by using a group name, a comma-separated list of jobs, or a wildcard expression. You can close all jobs by using `_all` or by specifying `*` as the job identifier. */ job_id: Id + /** Refer to the description for the `allow_no_match` query parameter. */ allow_no_match?: boolean + /** Refer to the descriptiion for the `force` query parameter. */ force?: boolean + /** Refer to the description for the `timeout` query parameter. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, allow_no_match?: never, force?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, allow_no_match?: never, force?: never, timeout?: never } } export interface MlCloseJobResponse { @@ -14912,21 +17589,38 @@ export interface MlCloseJobResponse { } export interface MlDeleteCalendarRequest extends RequestBase { +/** A string that uniquely identifies a calendar. */ calendar_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { calendar_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { calendar_id?: never } } export type MlDeleteCalendarResponse = AcknowledgedResponseBase export interface MlDeleteCalendarEventRequest extends RequestBase { +/** A string that uniquely identifies a calendar. */ calendar_id: Id + /** Identifier for the scheduled event. You can obtain this identifier by using the get calendar events API. */ event_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { calendar_id?: never, event_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { calendar_id?: never, event_id?: never } } export type MlDeleteCalendarEventResponse = AcknowledgedResponseBase export interface MlDeleteCalendarJobRequest extends RequestBase { +/** A string that uniquely identifies a calendar. */ calendar_id: Id + /** An identifier for the anomaly detection jobs. It can be a job identifier, a group name, or a comma-separated list of jobs or groups. */ job_id: Ids + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { calendar_id?: never, job_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { calendar_id?: never, job_id?: never } } export interface MlDeleteCalendarJobResponse { @@ -14936,24 +17630,44 @@ export interface MlDeleteCalendarJobResponse { } export interface MlDeleteDataFrameAnalyticsRequest extends RequestBase { +/** Identifier for the data frame analytics job. */ id: Id + /** If `true`, it deletes a job that is not stopped; this method is quicker than stopping and deleting the job. */ force?: boolean + /** The time to wait for the job to be deleted. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, force?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, force?: never, timeout?: never } } export type MlDeleteDataFrameAnalyticsResponse = AcknowledgedResponseBase export interface MlDeleteDatafeedRequest extends RequestBase { +/** A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ datafeed_id: Id + /** Use to forcefully delete a started datafeed; this method is quicker than stopping and deleting the datafeed. */ force?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { datafeed_id?: never, force?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { datafeed_id?: never, force?: never } } export type MlDeleteDatafeedResponse = AcknowledgedResponseBase export interface MlDeleteExpiredDataRequest extends RequestBase { +/** Identifier for an anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. */ job_id?: Id + /** The desired requests per second for the deletion processes. The default behavior is no throttling. */ requests_per_second?: float + /** How long can the underlying delete processes run until they are canceled. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, requests_per_second?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, requests_per_second?: never, timeout?: never } } export interface MlDeleteExpiredDataResponse { @@ -14961,55 +17675,102 @@ export interface MlDeleteExpiredDataResponse { } export interface MlDeleteFilterRequest extends RequestBase { +/** A string that uniquely identifies a filter. */ filter_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { filter_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { filter_id?: never } } export type MlDeleteFilterResponse = AcknowledgedResponseBase export interface MlDeleteForecastRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** A comma-separated list of forecast identifiers. If you do not specify this optional parameter or if you specify `_all` or `*` the API deletes all forecasts from the job. */ forecast_id?: Id + /** Specifies whether an error occurs when there are no forecasts. In particular, if this parameter is set to `false` and there are no forecasts associated with the job, attempts to delete all forecasts return an error. */ allow_no_forecasts?: boolean + /** Specifies the period of time to wait for the completion of the delete operation. When this period of time elapses, the API fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, forecast_id?: never, allow_no_forecasts?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, forecast_id?: never, allow_no_forecasts?: never, timeout?: never } } export type MlDeleteForecastResponse = AcknowledgedResponseBase export interface MlDeleteJobRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** Use to forcefully delete an opened job; this method is quicker than closing and deleting the job. */ force?: boolean + /** Specifies whether annotations that have been added by the user should be deleted along with any auto-generated annotations when the job is reset. */ delete_user_annotations?: boolean + /** Specifies whether the request should return immediately or wait until the job deletion completes. */ wait_for_completion?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, force?: never, delete_user_annotations?: never, wait_for_completion?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, force?: never, delete_user_annotations?: never, wait_for_completion?: never } } export type MlDeleteJobResponse = AcknowledgedResponseBase export interface MlDeleteModelSnapshotRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** Identifier for the model snapshot. */ snapshot_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, snapshot_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, snapshot_id?: never } } export type MlDeleteModelSnapshotResponse = AcknowledgedResponseBase export interface MlDeleteTrainedModelRequest extends RequestBase { +/** The unique identifier of the trained model. */ model_id: Id + /** Forcefully deletes a trained model that is referenced by ingest pipelines or has a started deployment. */ force?: boolean + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, force?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, force?: never, timeout?: never } } export type MlDeleteTrainedModelResponse = AcknowledgedResponseBase export interface MlDeleteTrainedModelAliasRequest extends RequestBase { +/** The model alias to delete. */ model_alias: Name + /** The trained model ID to which the model alias refers. */ model_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_alias?: never, model_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_alias?: never, model_id?: never } } export type MlDeleteTrainedModelAliasResponse = AcknowledgedResponseBase export interface MlEstimateModelMemoryRequest extends RequestBase { +/** For a list of the properties that you can specify in the `analysis_config` component of the body of this API. */ analysis_config?: MlAnalysisConfig + /** Estimates of the highest cardinality in a single bucket that is observed for influencer fields over the time period that the job analyzes data. To produce a good answer, values must be provided for all influencer fields. Providing values for fields that are not listed as `influencers` has no effect on the estimation. */ max_bucket_cardinality?: Record + /** Estimates of the cardinality that is observed for fields over the whole time period that the job analyzes data. To produce a good answer, values must be provided for fields referenced in the `by_field_name`, `over_field_name` and `partition_field_name` of any detectors. Providing values for other fields has no effect on the estimation. It can be omitted from the request if no detectors have a `by_field_name`, `over_field_name` or `partition_field_name`. */ overall_cardinality?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { analysis_config?: never, max_bucket_cardinality?: never, overall_cardinality?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { analysis_config?: never, max_bucket_cardinality?: never, overall_cardinality?: never } } export interface MlEstimateModelMemoryResponse { @@ -15096,9 +17857,16 @@ export interface MlEvaluateDataFrameDataframeRegressionSummary { } export interface MlEvaluateDataFrameRequest extends RequestBase { +/** Defines the type of evaluation you want to perform. */ evaluation: MlDataframeEvaluationContainer + /** Defines the `index` in which the evaluation will be performed. */ index: IndexName + /** A query clause that retrieves a subset of data from the source index. */ query?: QueryDslQueryContainer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { evaluation?: never, index?: never, query?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { evaluation?: never, index?: never, query?: never } } export interface MlEvaluateDataFrameResponse { @@ -15108,15 +17876,28 @@ export interface MlEvaluateDataFrameResponse { } export interface MlExplainDataFrameAnalyticsRequest extends RequestBase { +/** Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ id?: Id + /** The configuration of how to source the analysis data. It requires an index. Optionally, query and _source may be specified. */ source?: MlDataframeAnalyticsSource + /** The destination configuration, consisting of index and optionally results_field (ml by default). */ dest?: MlDataframeAnalyticsDestination + /** The analysis configuration, which contains the information necessary to perform one of the following types of analysis: classification, outlier detection, or regression. */ analysis?: MlDataframeAnalysisContainer + /** A description of the job. */ description?: string + /** The approximate maximum amount of memory resources that are permitted for analytical processing. If your `elasticsearch.yml` file contains an `xpack.ml.max_model_memory_limit` setting, an error occurs when you try to create data frame analytics jobs that have `model_memory_limit` values greater than that setting. */ model_memory_limit?: string + /** The maximum number of threads to be used by the analysis. Using more threads may decrease the time necessary to complete the analysis at the cost of using more CPU. Note that the process may use additional threads for operational functionality other than the analysis itself. */ max_num_threads?: integer + /** Specify includes and/or excludes patterns to select which fields will be included in the analysis. The patterns specified in excludes are applied last, therefore excludes takes precedence. In other words, if the same field is specified in both includes and excludes, then the field will not be included in the analysis. */ analyzed_fields?: MlDataframeAnalysisAnalyzedFields | string[] + /** Specifies whether this job can start when there is insufficient machine learning node capacity for it to be immediately assigned to a node. */ allow_lazy_start?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, source?: never, dest?: never, analysis?: never, description?: never, model_memory_limit?: never, max_num_threads?: never, analyzed_fields?: never, allow_lazy_start?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, source?: never, dest?: never, analysis?: never, description?: never, model_memory_limit?: never, max_num_threads?: never, analyzed_fields?: never, allow_lazy_start?: never } } export interface MlExplainDataFrameAnalyticsResponse { @@ -15125,12 +17906,22 @@ export interface MlExplainDataFrameAnalyticsResponse { } export interface MlFlushJobRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** Refer to the description for the `advance_time` query parameter. */ advance_time?: DateTime + /** Refer to the description for the `calc_interim` query parameter. */ calc_interim?: boolean + /** Refer to the description for the `end` query parameter. */ end?: DateTime + /** Refer to the description for the `skip_time` query parameter. */ skip_time?: DateTime + /** Refer to the description for the `start` query parameter. */ start?: DateTime + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, advance_time?: never, calc_interim?: never, end?: never, skip_time?: never, start?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, advance_time?: never, calc_interim?: never, end?: never, skip_time?: never, start?: never } } export interface MlFlushJobResponse { @@ -15139,10 +17930,18 @@ export interface MlFlushJobResponse { } export interface MlForecastRequest extends RequestBase { +/** Identifier for the anomaly detection job. The job must be open when you create a forecast; otherwise, an error occurs. */ job_id: Id + /** Refer to the description for the `duration` query parameter. */ duration?: Duration + /** Refer to the description for the `expires_in` query parameter. */ expires_in?: Duration + /** Refer to the description for the `max_model_memory` query parameter. */ max_model_memory?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, duration?: never, expires_in?: never, max_model_memory?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, duration?: never, expires_in?: never, max_model_memory?: never } } export interface MlForecastResponse { @@ -15151,18 +17950,33 @@ export interface MlForecastResponse { } export interface MlGetBucketsRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** The timestamp of a single bucket result. If you do not specify this parameter, the API returns information about all buckets. */ timestamp?: DateTime + /** Skips the specified number of buckets. */ from?: integer + /** Specifies the maximum number of buckets to obtain. */ size?: integer + /** Refer to the description for the `anomaly_score` query parameter. */ anomaly_score?: double + /** Refer to the description for the `desc` query parameter. */ desc?: boolean + /** Refer to the description for the `end` query parameter. */ end?: DateTime + /** Refer to the description for the `exclude_interim` query parameter. */ exclude_interim?: boolean + /** Refer to the description for the `expand` query parameter. */ expand?: boolean page?: MlPage + /** Refer to the desription for the `sort` query parameter. */ sort?: Field + /** Refer to the description for the `start` query parameter. */ start?: DateTime + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, timestamp?: never, from?: never, size?: never, anomaly_score?: never, desc?: never, end?: never, exclude_interim?: never, expand?: never, page?: never, sort?: never, start?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, timestamp?: never, from?: never, size?: never, anomaly_score?: never, desc?: never, end?: never, exclude_interim?: never, expand?: never, page?: never, sort?: never, start?: never } } export interface MlGetBucketsResponse { @@ -15171,12 +17985,22 @@ export interface MlGetBucketsResponse { } export interface MlGetCalendarEventsRequest extends RequestBase { +/** A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids or a wildcard expression. You can get information for all calendars by using `_all` or `*` or by omitting the calendar identifier. */ calendar_id: Id + /** Specifies to get events with timestamps earlier than this time. */ end?: DateTime + /** Skips the specified number of events. */ from?: integer + /** Specifies to get events for a specific anomaly detection job identifier or job group. It must be used with a calendar identifier of `_all` or `*`. */ job_id?: Id + /** Specifies the maximum number of events to obtain. */ size?: integer + /** Specifies to get events with timestamps after this time. */ start?: DateTime + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { calendar_id?: never, end?: never, from?: never, job_id?: never, size?: never, start?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { calendar_id?: never, end?: never, from?: never, job_id?: never, size?: never, start?: never } } export interface MlGetCalendarEventsResponse { @@ -15191,10 +18015,18 @@ export interface MlGetCalendarsCalendar { } export interface MlGetCalendarsRequest extends RequestBase { +/** A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids or a wildcard expression. You can get information for all calendars by using `_all` or `*` or by omitting the calendar identifier. */ calendar_id?: Id + /** Skips the specified number of calendars. This parameter is supported only when you omit the calendar identifier. */ from?: integer + /** Specifies the maximum number of calendars to obtain. This parameter is supported only when you omit the calendar identifier. */ size?: integer + /** This object is supported only when you omit the calendar identifier. */ page?: MlPage + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { calendar_id?: never, from?: never, size?: never, page?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { calendar_id?: never, from?: never, size?: never, page?: never } } export interface MlGetCalendarsResponse { @@ -15203,12 +18035,22 @@ export interface MlGetCalendarsResponse { } export interface MlGetCategoriesRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** Identifier for the category, which is unique in the job. If you specify neither the category ID nor the partition_field_value, the API returns information about all categories. If you specify only the partition_field_value, it returns information about all categories for the specified partition. */ category_id?: CategoryId + /** Skips the specified number of categories. */ from?: integer + /** Only return categories for the specified partition. */ partition_field_value?: string + /** Specifies the maximum number of categories to obtain. */ size?: integer + /** Configures pagination. This parameter has the `from` and `size` properties. */ page?: MlPage + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, category_id?: never, from?: never, partition_field_value?: never, size?: never, page?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, category_id?: never, from?: never, partition_field_value?: never, size?: never, page?: never } } export interface MlGetCategoriesResponse { @@ -15217,11 +18059,20 @@ export interface MlGetCategoriesResponse { } export interface MlGetDataFrameAnalyticsRequest extends RequestBase { +/** Identifier for the data frame analytics job. If you do not specify this option, the API returns information for the first hundred data frame analytics jobs. */ id?: Id + /** Specifies what to do when the request: 1. Contains wildcard expressions and there are no data frame analytics jobs that match. 2. Contains the `_all` string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. If this parameter is `false`, the request returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** Skips the specified number of data frame analytics jobs. */ from?: integer + /** Specifies the maximum number of data frame analytics jobs to obtain. */ size?: integer + /** Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster. */ exclude_generated?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, allow_no_match?: never, from?: never, size?: never, exclude_generated?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, allow_no_match?: never, from?: never, size?: never, exclude_generated?: never } } export interface MlGetDataFrameAnalyticsResponse { @@ -15230,11 +18081,20 @@ export interface MlGetDataFrameAnalyticsResponse { } export interface MlGetDataFrameAnalyticsStatsRequest extends RequestBase { +/** Identifier for the data frame analytics job. If you do not specify this option, the API returns information for the first hundred data frame analytics jobs. */ id?: Id + /** Specifies what to do when the request: 1. Contains wildcard expressions and there are no data frame analytics jobs that match. 2. Contains the `_all` string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. If this parameter is `false`, the request returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** Skips the specified number of data frame analytics jobs. */ from?: integer + /** Specifies the maximum number of data frame analytics jobs to obtain. */ size?: integer + /** Defines whether the stats response should be verbose. */ verbose?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, allow_no_match?: never, from?: never, size?: never, verbose?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, allow_no_match?: never, from?: never, size?: never, verbose?: never } } export interface MlGetDataFrameAnalyticsStatsResponse { @@ -15243,8 +18103,14 @@ export interface MlGetDataFrameAnalyticsStatsResponse { } export interface MlGetDatafeedStatsRequest extends RequestBase { +/** Identifier for the datafeed. It can be a datafeed identifier or a wildcard expression. If you do not specify one of these options, the API returns information about all datafeeds. */ datafeed_id?: Ids + /** Specifies what to do when the request: 1. Contains wildcard expressions and there are no datafeeds that match. 2. Contains the `_all` string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value is `true`, which returns an empty `datafeeds` array when there are no matches and the subset of results when there are partial matches. If this parameter is `false`, the request returns a `404` status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { datafeed_id?: never, allow_no_match?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { datafeed_id?: never, allow_no_match?: never } } export interface MlGetDatafeedStatsResponse { @@ -15253,9 +18119,16 @@ export interface MlGetDatafeedStatsResponse { } export interface MlGetDatafeedsRequest extends RequestBase { +/** Identifier for the datafeed. It can be a datafeed identifier or a wildcard expression. If you do not specify one of these options, the API returns information about all datafeeds. */ datafeed_id?: Ids + /** Specifies what to do when the request: 1. Contains wildcard expressions and there are no datafeeds that match. 2. Contains the `_all` string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value is `true`, which returns an empty `datafeeds` array when there are no matches and the subset of results when there are partial matches. If this parameter is `false`, the request returns a `404` status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster. */ exclude_generated?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { datafeed_id?: never, allow_no_match?: never, exclude_generated?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { datafeed_id?: never, allow_no_match?: never, exclude_generated?: never } } export interface MlGetDatafeedsResponse { @@ -15264,9 +18137,16 @@ export interface MlGetDatafeedsResponse { } export interface MlGetFiltersRequest extends RequestBase { +/** A string that uniquely identifies a filter. */ filter_id?: Ids + /** Skips the specified number of filters. */ from?: integer + /** Specifies the maximum number of filters to obtain. */ size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { filter_id?: never, from?: never, size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { filter_id?: never, from?: never, size?: never } } export interface MlGetFiltersResponse { @@ -15275,16 +18155,30 @@ export interface MlGetFiltersResponse { } export interface MlGetInfluencersRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** If true, the results are sorted in descending order. */ desc?: boolean + /** Returns influencers with timestamps earlier than this time. The default value means it is unset and results are not limited to specific timestamps. */ end?: DateTime + /** If true, the output excludes interim results. By default, interim results are included. */ exclude_interim?: boolean + /** Returns influencers with anomaly scores greater than or equal to this value. */ influencer_score?: double + /** Skips the specified number of influencers. */ from?: integer + /** Specifies the maximum number of influencers to obtain. */ size?: integer + /** Specifies the sort field for the requested influencers. By default, the influencers are sorted by the `influencer_score` value. */ sort?: Field + /** Returns influencers with timestamps after this time. The default value means it is unset and results are not limited to specific timestamps. */ start?: DateTime + /** Configures pagination. This parameter has the `from` and `size` properties. */ page?: MlPage + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, desc?: never, end?: never, exclude_interim?: never, influencer_score?: never, from?: never, size?: never, sort?: never, start?: never, page?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, desc?: never, end?: never, exclude_interim?: never, influencer_score?: never, from?: never, size?: never, sort?: never, start?: never, page?: never } } export interface MlGetInfluencersResponse { @@ -15293,8 +18187,14 @@ export interface MlGetInfluencersResponse { } export interface MlGetJobStatsRequest extends RequestBase { +/** Identifier for the anomaly detection job. It can be a job identifier, a group name, a comma-separated list of jobs, or a wildcard expression. If you do not specify one of these options, the API returns information for all anomaly detection jobs. */ job_id?: Id + /** Specifies what to do when the request: 1. Contains wildcard expressions and there are no jobs that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. If `true`, the API returns an empty `jobs` array when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a `404` status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, allow_no_match?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, allow_no_match?: never } } export interface MlGetJobStatsResponse { @@ -15303,9 +18203,16 @@ export interface MlGetJobStatsResponse { } export interface MlGetJobsRequest extends RequestBase { +/** Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. If you do not specify one of these options, the API returns information for all anomaly detection jobs. */ job_id?: Ids + /** Specifies what to do when the request: 1. Contains wildcard expressions and there are no jobs that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value is `true`, which returns an empty `jobs` array when there are no matches and the subset of results when there are partial matches. If this parameter is `false`, the request returns a `404` status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster. */ exclude_generated?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, allow_no_match?: never, exclude_generated?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, allow_no_match?: never, exclude_generated?: never } } export interface MlGetJobsResponse { @@ -15354,9 +18261,16 @@ export interface MlGetMemoryStatsMemory { } export interface MlGetMemoryStatsRequest extends RequestBase { +/** The names of particular nodes in the cluster to target. For example, `nodeId1,nodeId2` or `ml:true` */ node_id?: Id + /** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, master_timeout?: never, timeout?: never } } export interface MlGetMemoryStatsResponse { @@ -15366,9 +18280,16 @@ export interface MlGetMemoryStatsResponse { } export interface MlGetModelSnapshotUpgradeStatsRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** A numerical character string that uniquely identifies the model snapshot. You can get information for multiple snapshots by using a comma-separated list or a wildcard expression. You can get all snapshots by using `_all`, by specifying `*` as the snapshot ID, or by omitting the snapshot ID. */ snapshot_id: Id + /** Specifies what to do when the request: - Contains wildcard expressions and there are no jobs that match. - Contains the _all string or no identifiers and there are no matches. - Contains wildcard expressions and there are only partial matches. The default value is true, which returns an empty jobs array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, snapshot_id?: never, allow_no_match?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, snapshot_id?: never, allow_no_match?: never } } export interface MlGetModelSnapshotUpgradeStatsResponse { @@ -15377,15 +18298,27 @@ export interface MlGetModelSnapshotUpgradeStatsResponse { } export interface MlGetModelSnapshotsRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** A numerical character string that uniquely identifies the model snapshot. You can get information for multiple snapshots by using a comma-separated list or a wildcard expression. You can get all snapshots by using `_all`, by specifying `*` as the snapshot ID, or by omitting the snapshot ID. */ snapshot_id?: Id + /** Skips the specified number of snapshots. */ from?: integer + /** Specifies the maximum number of snapshots to obtain. */ size?: integer + /** Refer to the description for the `desc` query parameter. */ desc?: boolean + /** Refer to the description for the `end` query parameter. */ end?: DateTime page?: MlPage + /** Refer to the description for the `sort` query parameter. */ sort?: Field + /** Refer to the description for the `start` query parameter. */ start?: DateTime + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, snapshot_id?: never, from?: never, size?: never, desc?: never, end?: never, page?: never, sort?: never, start?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, snapshot_id?: never, from?: never, size?: never, desc?: never, end?: never, page?: never, sort?: never, start?: never } } export interface MlGetModelSnapshotsResponse { @@ -15394,14 +18327,26 @@ export interface MlGetModelSnapshotsResponse { } export interface MlGetOverallBucketsRequest extends RequestBase { +/** Identifier for the anomaly detection job. It can be a job identifier, a group name, a comma-separated list of jobs or groups, or a wildcard expression. You can summarize the bucket results for all anomaly detection jobs by using `_all` or by specifying `*` as the ``. */ job_id: Id + /** Refer to the description for the `allow_no_match` query parameter. */ allow_no_match?: boolean + /** Refer to the description for the `bucket_span` query parameter. */ bucket_span?: Duration + /** Refer to the description for the `end` query parameter. */ end?: DateTime + /** Refer to the description for the `exclude_interim` query parameter. */ exclude_interim?: boolean + /** Refer to the description for the `overall_score` query parameter. */ overall_score?: double | string + /** Refer to the description for the `start` query parameter. */ start?: DateTime + /** Refer to the description for the `top_n` query parameter. */ top_n?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, allow_no_match?: never, bucket_span?: never, end?: never, exclude_interim?: never, overall_score?: never, start?: never, top_n?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, allow_no_match?: never, bucket_span?: never, end?: never, exclude_interim?: never, overall_score?: never, start?: never, top_n?: never } } export interface MlGetOverallBucketsResponse { @@ -15410,16 +18355,29 @@ export interface MlGetOverallBucketsResponse { } export interface MlGetRecordsRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** Skips the specified number of records. */ from?: integer + /** Specifies the maximum number of records to obtain. */ size?: integer + /** Refer to the description for the `desc` query parameter. */ desc?: boolean + /** Refer to the description for the `end` query parameter. */ end?: DateTime + /** Refer to the description for the `exclude_interim` query parameter. */ exclude_interim?: boolean page?: MlPage + /** Refer to the description for the `record_score` query parameter. */ record_score?: double + /** Refer to the description for the `sort` query parameter. */ sort?: Field + /** Refer to the description for the `start` query parameter. */ start?: DateTime + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, from?: never, size?: never, desc?: never, end?: never, exclude_interim?: never, page?: never, record_score?: never, sort?: never, start?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, from?: never, size?: never, desc?: never, end?: never, exclude_interim?: never, page?: never, record_score?: never, sort?: never, start?: never } } export interface MlGetRecordsResponse { @@ -15428,15 +18386,28 @@ export interface MlGetRecordsResponse { } export interface MlGetTrainedModelsRequest extends RequestBase { +/** The unique identifier of the trained model or a model alias. You can get information for multiple trained models in a single API request by using a comma-separated list of model IDs or a wildcard expression. */ model_id?: Ids + /** Specifies what to do when the request: - Contains wildcard expressions and there are no models that match. - Contains the _all string or no identifiers and there are no matches. - Contains wildcard expressions and there are only partial matches. If true, it returns an empty array when there are no matches and the subset of results when there are partial matches. */ allow_no_match?: boolean + /** Specifies whether the included model definition should be returned as a JSON map (true) or in a custom compressed format (false). */ decompress_definition?: boolean + /** Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster. */ exclude_generated?: boolean + /** Skips the specified number of models. */ from?: integer + /** A comma delimited string of optional fields to include in the response body. */ include?: MlInclude + /** parameter is deprecated! Use [include=definition] instead */ include_model_definition?: boolean + /** Specifies the maximum number of models to obtain. */ size?: integer + /** A comma delimited string of tags. A trained model can have many tags, or none. When supplied, only trained models that contain all the supplied tags are returned. */ tags?: string | string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, allow_no_match?: never, decompress_definition?: never, exclude_generated?: never, from?: never, include?: never, include_model_definition?: never, size?: never, tags?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, allow_no_match?: never, decompress_definition?: never, exclude_generated?: never, from?: never, include?: never, include_model_definition?: never, size?: never, tags?: never } } export interface MlGetTrainedModelsResponse { @@ -15445,10 +18416,18 @@ export interface MlGetTrainedModelsResponse { } export interface MlGetTrainedModelsStatsRequest extends RequestBase { +/** The unique identifier of the trained model or a model alias. It can be a comma-separated list or a wildcard expression. */ model_id?: Ids + /** Specifies what to do when the request: - Contains wildcard expressions and there are no models that match. - Contains the _all string or no identifiers and there are no matches. - Contains wildcard expressions and there are only partial matches. If true, it returns an empty array when there are no matches and the subset of results when there are partial matches. */ allow_no_match?: boolean + /** Skips the specified number of models. */ from?: integer + /** Specifies the maximum number of models to obtain. */ size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, allow_no_match?: never, from?: never, size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, allow_no_match?: never, from?: never, size?: never } } export interface MlGetTrainedModelsStatsResponse { @@ -15457,10 +18436,18 @@ export interface MlGetTrainedModelsStatsResponse { } export interface MlInferTrainedModelRequest extends RequestBase { +/** The unique identifier of the trained model. */ model_id: Id + /** Controls the amount of time to wait for inference results. */ timeout?: Duration + /** An array of objects to pass to the model for inference. The objects should contain a fields matching your configured trained model input. Typically, for NLP models, the field name is `text_field`. Currently, for NLP models, only a single value is allowed. */ docs: Record[] + /** The inference configuration updates to apply on the API call */ inference_config?: MlInferenceConfigUpdateContainer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, timeout?: never, docs?: never, inference_config?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, timeout?: never, docs?: never, inference_config?: never } } export interface MlInferTrainedModelResponse { @@ -15498,6 +18485,10 @@ export interface MlInfoNativeCode { } export interface MlInfoRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface MlInfoResponse { @@ -15508,8 +18499,14 @@ export interface MlInfoResponse { } export interface MlOpenJobRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** Refer to the description for the `timeout` query parameter. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, timeout?: never } } export interface MlOpenJobResponse { @@ -15518,8 +18515,14 @@ export interface MlOpenJobResponse { } export interface MlPostCalendarEventsRequest extends RequestBase { +/** A string that uniquely identifies a calendar. */ calendar_id: Id + /** A list of one of more scheduled events. The event’s start and end times can be specified as integer milliseconds since the epoch or as a string in ISO 8601 format. */ events: MlCalendarEvent[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { calendar_id?: never, events?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { calendar_id?: never, events?: never } } export interface MlPostCalendarEventsResponse { @@ -15527,10 +18530,17 @@ export interface MlPostCalendarEventsResponse { } export interface MlPostDataRequest extends RequestBase { +/** Identifier for the anomaly detection job. The job must have a state of open to receive and process the data. */ job_id: Id + /** Specifies the end of the bucket resetting range. */ reset_end?: DateTime + /** Specifies the start of the bucket resetting range. */ reset_start?: DateTime data?: TData[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, reset_end?: never, reset_start?: never, data?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, reset_end?: never, reset_start?: never, data?: never } } export interface MlPostDataResponse { @@ -15563,8 +18573,14 @@ export interface MlPreviewDataFrameAnalyticsDataframePreviewConfig { } export interface MlPreviewDataFrameAnalyticsRequest extends RequestBase { +/** Identifier for the data frame analytics job. */ id?: Id + /** A data frame analytics config as described in create data frame analytics jobs. Note that `id` and `dest` don’t need to be provided in the context of this API. */ config?: MlPreviewDataFrameAnalyticsDataframePreviewConfig + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, config?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, config?: never } } export interface MlPreviewDataFrameAnalyticsResponse { @@ -15572,19 +18588,35 @@ export interface MlPreviewDataFrameAnalyticsResponse { } export interface MlPreviewDatafeedRequest extends RequestBase { +/** A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. NOTE: If you use this path parameter, you cannot provide datafeed or anomaly detection job configuration details in the request body. */ datafeed_id?: Id + /** The start time from where the datafeed preview should begin */ start?: DateTime + /** The end time when the datafeed preview should stop */ end?: DateTime + /** The datafeed definition to preview. */ datafeed_config?: MlDatafeedConfig + /** The configuration details for the anomaly detection job that is associated with the datafeed. If the `datafeed_config` object does not include a `job_id` that references an existing anomaly detection job, you must supply this `job_config` object. If you include both a `job_id` and a `job_config`, the latter information is used. You cannot specify a `job_config` object unless you also supply a `datafeed_config` object. */ job_config?: MlJobConfig + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { datafeed_id?: never, start?: never, end?: never, datafeed_config?: never, job_config?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { datafeed_id?: never, start?: never, end?: never, datafeed_config?: never, job_config?: never } } export type MlPreviewDatafeedResponse = TDocument[] export interface MlPutCalendarRequest extends RequestBase { +/** A string that uniquely identifies a calendar. */ calendar_id: Id + /** An array of anomaly detection job identifiers. */ job_ids?: Id[] + /** A description of the calendar. */ description?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { calendar_id?: never, job_ids?: never, description?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { calendar_id?: never, job_ids?: never, description?: never } } export interface MlPutCalendarResponse { @@ -15594,8 +18626,14 @@ export interface MlPutCalendarResponse { } export interface MlPutCalendarJobRequest extends RequestBase { +/** A string that uniquely identifies a calendar. */ calendar_id: Id + /** An identifier for the anomaly detection jobs. It can be a job identifier, a group name, or a comma-separated list of jobs or groups. */ job_id: Ids + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { calendar_id?: never, job_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { calendar_id?: never, job_id?: never } } export interface MlPutCalendarJobResponse { @@ -15605,18 +18643,31 @@ export interface MlPutCalendarJobResponse { } export interface MlPutDataFrameAnalyticsRequest extends RequestBase { +/** Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ id: Id + /** Specifies whether this job can start when there is insufficient machine learning node capacity for it to be immediately assigned to a node. If set to `false` and a machine learning node with capacity to run the job cannot be immediately found, the API returns an error. If set to `true`, the API does not return an error; the job waits in the `starting` state until sufficient machine learning node capacity is available. This behavior is also affected by the cluster-wide `xpack.ml.max_lazy_ml_nodes` setting. */ allow_lazy_start?: boolean + /** The analysis configuration, which contains the information necessary to perform one of the following types of analysis: classification, outlier detection, or regression. */ analysis: MlDataframeAnalysisContainer + /** Specifies `includes` and/or `excludes` patterns to select which fields will be included in the analysis. The patterns specified in `excludes` are applied last, therefore `excludes` takes precedence. In other words, if the same field is specified in both `includes` and `excludes`, then the field will not be included in the analysis. If `analyzed_fields` is not set, only the relevant fields will be included. For example, all the numeric fields for outlier detection. The supported fields vary for each type of analysis. Outlier detection requires numeric or `boolean` data to analyze. The algorithms don’t support missing values therefore fields that have data types other than numeric or boolean are ignored. Documents where included fields contain missing values, null values, or an array are also ignored. Therefore the `dest` index may contain documents that don’t have an outlier score. Regression supports fields that are numeric, `boolean`, `text`, `keyword`, and `ip` data types. It is also tolerant of missing values. Fields that are supported are included in the analysis, other fields are ignored. Documents where included fields contain an array with two or more values are also ignored. Documents in the `dest` index that don’t contain a results field are not included in the regression analysis. Classification supports fields that are numeric, `boolean`, `text`, `keyword`, and `ip` data types. It is also tolerant of missing values. Fields that are supported are included in the analysis, other fields are ignored. Documents where included fields contain an array with two or more values are also ignored. Documents in the `dest` index that don’t contain a results field are not included in the classification analysis. Classification analysis can be improved by mapping ordinal variable values to a single number. For example, in case of age ranges, you can model the values as `0-14 = 0`, `15-24 = 1`, `25-34 = 2`, and so on. */ analyzed_fields?: MlDataframeAnalysisAnalyzedFields | string[] + /** A description of the job. */ description?: string + /** The destination configuration. */ dest: MlDataframeAnalyticsDestination + /** The maximum number of threads to be used by the analysis. Using more threads may decrease the time necessary to complete the analysis at the cost of using more CPU. Note that the process may use additional threads for operational functionality other than the analysis itself. */ max_num_threads?: integer _meta?: Metadata + /** The approximate maximum amount of memory resources that are permitted for analytical processing. If your `elasticsearch.yml` file contains an `xpack.ml.max_model_memory_limit` setting, an error occurs when you try to create data frame analytics jobs that have `model_memory_limit` values greater than that setting. */ model_memory_limit?: string + /** The configuration of how to source the analysis data. */ source: MlDataframeAnalyticsSource headers?: HttpHeaders version?: VersionString + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, allow_lazy_start?: never, analysis?: never, analyzed_fields?: never, description?: never, dest?: never, max_num_threads?: never, _meta?: never, model_memory_limit?: never, source?: never, headers?: never, version?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, allow_lazy_start?: never, analysis?: never, analyzed_fields?: never, description?: never, dest?: never, max_num_threads?: never, _meta?: never, model_memory_limit?: never, source?: never, headers?: never, version?: never } } export interface MlPutDataFrameAnalyticsResponse { @@ -15636,29 +18687,53 @@ export interface MlPutDataFrameAnalyticsResponse { } export interface MlPutDatafeedRequest extends RequestBase { +/** A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ datafeed_id: Id + /** If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the `_all` string or when no indices are specified. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values. */ expand_wildcards?: ExpandWildcards + /** If true, concrete, expanded, or aliased indices are ignored when frozen. */ ignore_throttled?: boolean + /** If true, unavailable indices (missing or closed) are ignored. */ ignore_unavailable?: boolean + /** If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. */ aggregations?: Record /** @alias aggregations */ + /** If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. */ aggs?: Record + /** Datafeeds might be required to search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated; it is an advanced configuration option. */ chunking_config?: MlChunkingConfig + /** Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the `query_delay` is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds. */ delayed_data_check_config?: MlDelayedDataCheckConfig + /** The interval at which scheduled queries are made while the datafeed runs in real time. The default value is either the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket span. When `frequency` is shorter than the bucket span, interim results for the last (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value must be divisible by the interval of the date histogram aggregation. */ frequency?: Duration + /** An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the `remote_cluster_client` role. */ indices?: Indices /** @alias indices */ + /** An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the `remote_cluster_client` role. */ indexes?: Indices + /** Specifies index expansion options that are used during search */ indices_options?: IndicesOptions + /** Identifier for the anomaly detection job. */ job_id?: Id + /** If a real-time datafeed has never seen any data (including during any initial training period), it automatically stops and closes the associated job after this many real-time searches return no documents. In other words, it stops after `frequency` times `max_empty_searches` of real-time operation. If not set, a datafeed with no end time that sees no data remains started until it is explicitly stopped. By default, it is not set. */ max_empty_searches?: integer + /** The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. */ query?: QueryDslQueryContainer + /** The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default value is randomly selected between `60s` and `120s`. This randomness improves the query performance when there are multiple jobs running on the same node. */ query_delay?: Duration + /** Specifies runtime fields for the datafeed search. */ runtime_mappings?: MappingRuntimeFields + /** Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. */ script_fields?: Record + /** The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. The maximum value is the value of `index.max_result_window`, which is 10,000 by default. */ scroll_size?: integer headers?: HttpHeaders + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { datafeed_id?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, aggregations?: never, aggs?: never, chunking_config?: never, delayed_data_check_config?: never, frequency?: never, indices?: never, indexes?: never, indices_options?: never, job_id?: never, max_empty_searches?: never, query?: never, query_delay?: never, runtime_mappings?: never, script_fields?: never, scroll_size?: never, headers?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { datafeed_id?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, aggregations?: never, aggs?: never, chunking_config?: never, delayed_data_check_config?: never, frequency?: never, indices?: never, indexes?: never, indices_options?: never, job_id?: never, max_empty_searches?: never, query?: never, query_delay?: never, runtime_mappings?: never, script_fields?: never, scroll_size?: never, headers?: never } } export interface MlPutDatafeedResponse { @@ -15680,9 +18755,16 @@ export interface MlPutDatafeedResponse { } export interface MlPutFilterRequest extends RequestBase { +/** A string that uniquely identifies a filter. */ filter_id: Id + /** A description of the filter. */ description?: string + /** The items of the filter. A wildcard `*` can be used at the beginning or the end of an item. Up to 10000 items are allowed in each filter. */ items?: string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { filter_id?: never, description?: never, items?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { filter_id?: never, description?: never, items?: never } } export interface MlPutFilterResponse { @@ -15692,26 +18774,50 @@ export interface MlPutFilterResponse { } export interface MlPutJobRequest extends RequestBase { +/** The identifier for the anomaly detection job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ job_id: Id + /** If `true`, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the `_all` string or when no indices are specified. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: * `all`: Match any data stream or index, including hidden ones. * `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. * `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or both. * `none`: Wildcard patterns are not accepted. * `open`: Match open, non-hidden indices. Also matches any non-hidden data stream. */ expand_wildcards?: ExpandWildcards + /** If `true`, concrete, expanded or aliased indices are ignored when frozen. */ ignore_throttled?: boolean + /** If `true`, unavailable indices (missing or closed) are ignored. */ ignore_unavailable?: boolean + /** Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. By default, if a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide `xpack.ml.max_lazy_ml_nodes` setting. If this option is set to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. */ allow_lazy_open?: boolean + /** Specifies how to analyze the data. After you create a job, you cannot change the analysis configuration; all the properties are informational. */ analysis_config: MlAnalysisConfig + /** Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for example the Elasticsearch Java processes. */ analysis_limits?: MlAnalysisLimits + /** Advanced configuration option. The time between each periodic persistence of the model. The default value is a randomized value between 3 to 4 hours, which avoids all jobs persisting at exactly the same time. The smallest allowed value is 1 hour. For very large models (several GB), persistence could take 10-20 minutes, so do not set the `background_persist_interval` value too low. */ background_persist_interval?: Duration + /** Advanced configuration option. Contains custom meta data about the job. */ custom_settings?: MlCustomSettings + /** Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies a period of time (in days) after which only the first snapshot per day is retained. This period is relative to the timestamp of the most recent snapshot for this job. Valid values range from 0 to `model_snapshot_retention_days`. */ daily_model_snapshot_retention_after_days?: long + /** Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained. */ data_description: MlDataDescription + /** Defines a datafeed for the anomaly detection job. If Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. */ datafeed_config?: MlDatafeedConfig + /** A description of the job. */ description?: string + /** A list of job groups. A job can belong to no groups or many. */ groups?: string[] + /** This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced. */ model_plot_config?: MlModelPlotConfig + /** Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies the maximum period of time (in days) that snapshots are retained. This period is relative to the timestamp of the most recent snapshot for this job. By default, snapshots ten days older than the newest snapshot are deleted. */ model_snapshot_retention_days?: long + /** Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen. The default value is the longer of 30 days or 100 bucket spans. */ renormalization_window_days?: long + /** A text string that affects the name of the machine learning results index. By default, the job generates an index named `.ml-anomalies-shared`. */ results_index_name?: IndexName + /** Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. Annotations generated by the system also count as results for retention purposes; they are deleted after the same number of days as results. Annotations added by users are retained forever. */ results_retention_days?: long + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, allow_lazy_open?: never, analysis_config?: never, analysis_limits?: never, background_persist_interval?: never, custom_settings?: never, daily_model_snapshot_retention_after_days?: never, data_description?: never, datafeed_config?: never, description?: never, groups?: never, model_plot_config?: never, model_snapshot_retention_days?: never, renormalization_window_days?: never, results_index_name?: never, results_retention_days?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, allow_lazy_open?: never, analysis_config?: never, analysis_limits?: never, background_persist_interval?: never, custom_settings?: never, daily_model_snapshot_retention_after_days?: never, data_description?: never, datafeed_config?: never, description?: never, groups?: never, model_plot_config?: never, model_snapshot_retention_days?: never, renormalization_window_days?: never, results_index_name?: never, results_retention_days?: never } } export interface MlPutJobResponse { @@ -15779,20 +18885,38 @@ export interface MlPutTrainedModelPreprocessor { } export interface MlPutTrainedModelRequest extends RequestBase { +/** The unique identifier of the trained model. */ model_id: Id + /** If set to `true` and a `compressed_definition` is provided, the request defers definition decompression and skips relevant validations. */ defer_definition_decompression?: boolean + /** Whether to wait for all child operations (e.g. model download) to complete. */ wait_for_completion?: boolean + /** The compressed (GZipped and Base64 encoded) inference definition of the model. If compressed_definition is specified, then definition cannot be specified. */ compressed_definition?: string + /** The inference definition for the model. If definition is specified, then compressed_definition cannot be specified. */ definition?: MlPutTrainedModelDefinition + /** A human-readable description of the inference trained model. */ description?: string + /** The default configuration for inference. This can be either a regression or classification configuration. It must match the underlying definition.trained_model's target_type. For pre-packaged models such as ELSER the config is not required. */ inference_config?: MlInferenceConfigCreateContainer + /** The input field names for the model definition. */ input?: MlPutTrainedModelInput + /** An object map that contains metadata about the model. */ metadata?: any + /** The model type. */ model_type?: MlTrainedModelType + /** The estimated memory usage in bytes to keep the trained model in memory. This property is supported only if defer_definition_decompression is true or the model definition is not supplied. */ model_size_bytes?: long + /** The platform architecture (if applicable) of the trained mode. If the model only works on one platform, because it is heavily optimized for a particular processor architecture and OS combination, then this field specifies which. The format of the string must match the platform identifiers used by Elasticsearch, so one of, `linux-x86_64`, `linux-aarch64`, `darwin-x86_64`, `darwin-aarch64`, or `windows-x86_64`. For portable models (those that work independent of processor architecture or OS features), leave this field unset. */ platform_architecture?: string + /** An array of tags to organize the model. */ tags?: string[] + /** Optional prefix strings applied at inference */ prefix_strings?: MlTrainedModelPrefixStrings + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, defer_definition_decompression?: never, wait_for_completion?: never, compressed_definition?: never, definition?: never, description?: never, inference_config?: never, input?: never, metadata?: never, model_type?: never, model_size_bytes?: never, platform_architecture?: never, tags?: never, prefix_strings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, defer_definition_decompression?: never, wait_for_completion?: never, compressed_definition?: never, definition?: never, description?: never, inference_config?: never, input?: never, metadata?: never, model_type?: never, model_size_bytes?: never, platform_architecture?: never, tags?: never, prefix_strings?: never } } export type MlPutTrainedModelResponse = MlTrainedModelConfig @@ -15834,44 +18958,82 @@ export interface MlPutTrainedModelWeights { } export interface MlPutTrainedModelAliasRequest extends RequestBase { +/** The alias to create or update. This value cannot end in numbers. */ model_alias: Name + /** The identifier for the trained model that the alias refers to. */ model_id: Id + /** Specifies whether the alias gets reassigned to the specified trained model if it is already assigned to a different model. If the alias is already assigned and this parameter is false, the API returns an error. */ reassign?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_alias?: never, model_id?: never, reassign?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_alias?: never, model_id?: never, reassign?: never } } export type MlPutTrainedModelAliasResponse = AcknowledgedResponseBase export interface MlPutTrainedModelDefinitionPartRequest extends RequestBase { +/** The unique identifier of the trained model. */ model_id: Id + /** The definition part number. When the definition is loaded for inference the definition parts are streamed in the order of their part number. The first part must be `0` and the final part must be `total_parts - 1`. */ part: integer + /** The definition part for the model. Must be a base64 encoded string. */ definition: string + /** The total uncompressed definition length in bytes. Not base64 encoded. */ total_definition_length: long + /** The total number of parts that will be uploaded. Must be greater than 0. */ total_parts: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, part?: never, definition?: never, total_definition_length?: never, total_parts?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, part?: never, definition?: never, total_definition_length?: never, total_parts?: never } } export type MlPutTrainedModelDefinitionPartResponse = AcknowledgedResponseBase export interface MlPutTrainedModelVocabularyRequest extends RequestBase { +/** The unique identifier of the trained model. */ model_id: Id + /** The model vocabulary, which must not be empty. */ vocabulary: string[] + /** The optional model merges if required by the tokenizer. */ merges?: string[] + /** The optional vocabulary value scores if required by the tokenizer. */ scores?: double[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, vocabulary?: never, merges?: never, scores?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, vocabulary?: never, merges?: never, scores?: never } } export type MlPutTrainedModelVocabularyResponse = AcknowledgedResponseBase export interface MlResetJobRequest extends RequestBase { +/** The ID of the job to reset. */ job_id: Id + /** Should this request wait until the operation has completed before returning. */ wait_for_completion?: boolean + /** Specifies whether annotations that have been added by the user should be deleted along with any auto-generated annotations when the job is reset. */ delete_user_annotations?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, wait_for_completion?: never, delete_user_annotations?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, wait_for_completion?: never, delete_user_annotations?: never } } export type MlResetJobResponse = AcknowledgedResponseBase export interface MlRevertModelSnapshotRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** You can specify `empty` as the . Reverting to the empty snapshot means the anomaly detection job starts learning a new model from scratch when it is started. */ snapshot_id: Id + /** Refer to the description for the `delete_intervening_results` query parameter. */ delete_intervening_results?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, snapshot_id?: never, delete_intervening_results?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, snapshot_id?: never, delete_intervening_results?: never } } export interface MlRevertModelSnapshotResponse { @@ -15879,15 +19041,27 @@ export interface MlRevertModelSnapshotResponse { } export interface MlSetUpgradeModeRequest extends RequestBase { +/** When `true`, it enables `upgrade_mode` which temporarily halts all job and datafeed tasks and prohibits new job and datafeed tasks from starting. */ enabled?: boolean + /** The time to wait for the request to be completed. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { enabled?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { enabled?: never, timeout?: never } } export type MlSetUpgradeModeResponse = AcknowledgedResponseBase export interface MlStartDataFrameAnalyticsRequest extends RequestBase { +/** Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ id: Id + /** Controls the amount of time to wait until the data frame analytics job starts. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, timeout?: never } } export interface MlStartDataFrameAnalyticsResponse { @@ -15896,10 +19070,18 @@ export interface MlStartDataFrameAnalyticsResponse { } export interface MlStartDatafeedRequest extends RequestBase { +/** A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ datafeed_id: Id + /** Refer to the description for the `end` query parameter. */ end?: DateTime + /** Refer to the description for the `start` query parameter. */ start?: DateTime + /** Refer to the description for the `timeout` query parameter. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { datafeed_id?: never, end?: never, start?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { datafeed_id?: never, end?: never, start?: never, timeout?: never } } export interface MlStartDatafeedResponse { @@ -15908,15 +19090,28 @@ export interface MlStartDatafeedResponse { } export interface MlStartTrainedModelDeploymentRequest extends RequestBase { +/** The unique identifier of the trained model. Currently, only PyTorch models are supported. */ model_id: Id + /** The inference cache size (in memory outside the JVM heap) per node for the model. The default value is the same size as the `model_size_bytes`. To disable the cache, `0b` can be provided. */ cache_size?: ByteSize + /** A unique identifier for the deployment of the model. */ deployment_id?: string + /** The number of model allocations on each node where the model is deployed. All allocations on a node share the same copy of the model in memory but use a separate set of threads to evaluate the model. Increasing this value generally increases the throughput. If this setting is greater than the number of hardware threads it will automatically be changed to a value less than the number of hardware threads. */ number_of_allocations?: integer + /** The deployment priority. */ priority?: MlTrainingPriority + /** Specifies the number of inference requests that are allowed in the queue. After the number of requests exceeds this value, new requests are rejected with a 429 error. */ queue_capacity?: integer + /** Sets the number of threads used by each model allocation during inference. This generally increases the inference speed. The inference process is a compute-bound process; any number greater than the number of available hardware threads on the machine does not increase the inference speed. If this setting is greater than the number of hardware threads it will automatically be changed to a value less than the number of hardware threads. */ threads_per_allocation?: integer + /** Specifies the amount of time to wait for the model to deploy. */ timeout?: Duration + /** Specifies the allocation status to wait for before returning. */ wait_for?: MlDeploymentAllocationState + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, cache_size?: never, deployment_id?: never, number_of_allocations?: never, priority?: never, queue_capacity?: never, threads_per_allocation?: never, timeout?: never, wait_for?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, cache_size?: never, deployment_id?: never, number_of_allocations?: never, priority?: never, queue_capacity?: never, threads_per_allocation?: never, timeout?: never, wait_for?: never } } export interface MlStartTrainedModelDeploymentResponse { @@ -15924,10 +19119,18 @@ export interface MlStartTrainedModelDeploymentResponse { } export interface MlStopDataFrameAnalyticsRequest extends RequestBase { +/** Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ id: Id + /** Specifies what to do when the request: 1. Contains wildcard expressions and there are no data frame analytics jobs that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value is true, which returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** If true, the data frame analytics job is stopped forcefully. */ force?: boolean + /** Controls the amount of time to wait until the data frame analytics job stops. Defaults to 20 seconds. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, allow_no_match?: never, force?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, allow_no_match?: never, force?: never, timeout?: never } } export interface MlStopDataFrameAnalyticsResponse { @@ -15935,10 +19138,18 @@ export interface MlStopDataFrameAnalyticsResponse { } export interface MlStopDatafeedRequest extends RequestBase { +/** Identifier for the datafeed. You can stop multiple datafeeds in a single API request by using a comma-separated list of datafeeds or a wildcard expression. You can close all datafeeds by using `_all` or by specifying `*` as the identifier. */ datafeed_id: Id + /** Refer to the description for the `allow_no_match` query parameter. */ allow_no_match?: boolean + /** Refer to the description for the `force` query parameter. */ force?: boolean + /** Refer to the description for the `timeout` query parameter. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { datafeed_id?: never, allow_no_match?: never, force?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { datafeed_id?: never, allow_no_match?: never, force?: never, timeout?: never } } export interface MlStopDatafeedResponse { @@ -15946,9 +19157,16 @@ export interface MlStopDatafeedResponse { } export interface MlStopTrainedModelDeploymentRequest extends RequestBase { +/** The unique identifier of the trained model. */ model_id: Id + /** Specifies what to do when the request: contains wildcard expressions and there are no deployments that match; contains the `_all` string or no identifiers and there are no matches; or contains wildcard expressions and there are only partial matches. By default, it returns an empty array when there are no matches and the subset of results when there are partial matches. If `false`, the request returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** Forcefully stops the deployment, even if it is used by ingest pipelines. You can't use these pipelines until you restart the model deployment. */ force?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, allow_no_match?: never, force?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, allow_no_match?: never, force?: never } } export interface MlStopTrainedModelDeploymentResponse { @@ -15956,11 +19174,20 @@ export interface MlStopTrainedModelDeploymentResponse { } export interface MlUpdateDataFrameAnalyticsRequest extends RequestBase { +/** Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ id: Id + /** A description of the job. */ description?: string + /** The approximate maximum amount of memory resources that are permitted for analytical processing. If your `elasticsearch.yml` file contains an `xpack.ml.max_model_memory_limit` setting, an error occurs when you try to create data frame analytics jobs that have `model_memory_limit` values greater than that setting. */ model_memory_limit?: string + /** The maximum number of threads to be used by the analysis. Using more threads may decrease the time necessary to complete the analysis at the cost of using more CPU. Note that the process may use additional threads for operational functionality other than the analysis itself. */ max_num_threads?: integer + /** Specifies whether this job can start when there is insufficient machine learning node capacity for it to be immediately assigned to a node. */ allow_lazy_start?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, description?: never, model_memory_limit?: never, max_num_threads?: never, allow_lazy_start?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, description?: never, model_memory_limit?: never, max_num_threads?: never, allow_lazy_start?: never } } export interface MlUpdateDataFrameAnalyticsResponse { @@ -15979,26 +19206,48 @@ export interface MlUpdateDataFrameAnalyticsResponse { } export interface MlUpdateDatafeedRequest extends RequestBase { +/** A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. */ datafeed_id: Id + /** If `true`, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the `_all` string or when no indices are specified. */ allow_no_indices?: boolean + /** Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: * `all`: Match any data stream or index, including hidden ones. * `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. * `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or both. * `none`: Wildcard patterns are not accepted. * `open`: Match open, non-hidden indices. Also matches any non-hidden data stream. */ expand_wildcards?: ExpandWildcards + /** If `true`, concrete, expanded or aliased indices are ignored when frozen. */ ignore_throttled?: boolean + /** If `true`, unavailable indices (missing or closed) are ignored. */ ignore_unavailable?: boolean + /** If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. */ aggregations?: Record + /** Datafeeds might search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated; it is an advanced configuration option. */ chunking_config?: MlChunkingConfig + /** Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the `query_delay` is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds. */ delayed_data_check_config?: MlDelayedDataCheckConfig + /** The interval at which scheduled queries are made while the datafeed runs in real time. The default value is either the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket span. When `frequency` is shorter than the bucket span, interim results for the last (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value must be divisible by the interval of the date histogram aggregation. */ frequency?: Duration + /** An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the `remote_cluster_client` role. */ indices?: string[] /** @alias indices */ + /** An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the `remote_cluster_client` role. */ indexes?: string[] + /** Specifies index expansion options that are used during search. */ indices_options?: IndicesOptions job_id?: Id + /** If a real-time datafeed has never seen any data (including during any initial training period), it automatically stops and closes the associated job after this many real-time searches return no documents. In other words, it stops after `frequency` times `max_empty_searches` of real-time operation. If not set, a datafeed with no end time that sees no data remains started until it is explicitly stopped. By default, it is not set. */ max_empty_searches?: integer + /** The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. Note that if you change the query, the analyzed data is also changed. Therefore, the time required to learn might be long and the understandability of the results is unpredictable. If you want to make significant changes to the source data, it is recommended that you clone the job and datafeed and make the amendments in the clone. Let both run in parallel and close one when you are satisfied with the results of the job. */ query?: QueryDslQueryContainer + /** The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default value is randomly selected between `60s` and `120s`. This randomness improves the query performance when there are multiple jobs running on the same node. */ query_delay?: Duration + /** Specifies runtime fields for the datafeed search. */ runtime_mappings?: MappingRuntimeFields + /** Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. */ script_fields?: Record + /** The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. The maximum value is the value of `index.max_result_window`. */ scroll_size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { datafeed_id?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, aggregations?: never, chunking_config?: never, delayed_data_check_config?: never, frequency?: never, indices?: never, indexes?: never, indices_options?: never, job_id?: never, max_empty_searches?: never, query?: never, query_delay?: never, runtime_mappings?: never, script_fields?: never, scroll_size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { datafeed_id?: never, allow_no_indices?: never, expand_wildcards?: never, ignore_throttled?: never, ignore_unavailable?: never, aggregations?: never, chunking_config?: never, delayed_data_check_config?: never, frequency?: never, indices?: never, indexes?: never, indices_options?: never, job_id?: never, max_empty_searches?: never, query?: never, query_delay?: never, runtime_mappings?: never, script_fields?: never, scroll_size?: never } } export interface MlUpdateDatafeedResponse { @@ -16020,10 +19269,18 @@ export interface MlUpdateDatafeedResponse { } export interface MlUpdateFilterRequest extends RequestBase { +/** A string that uniquely identifies a filter. */ filter_id: Id + /** The items to add to the filter. */ add_items?: string[] + /** A description for the filter. */ description?: string + /** The items to remove from the filter. */ remove_items?: string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { filter_id?: never, add_items?: never, description?: never, remove_items?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { filter_id?: never, add_items?: never, description?: never, remove_items?: never } } export interface MlUpdateFilterResponse { @@ -16033,22 +19290,38 @@ export interface MlUpdateFilterResponse { } export interface MlUpdateJobRequest extends RequestBase { +/** Identifier for the job. */ job_id: Id + /** Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. If `false` and a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide `xpack.ml.max_lazy_ml_nodes` setting. If this option is set to `true`, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. */ allow_lazy_open?: boolean analysis_limits?: MlAnalysisMemoryLimit + /** Advanced configuration option. The time between each periodic persistence of the model. The default value is a randomized value between 3 to 4 hours, which avoids all jobs persisting at exactly the same time. The smallest allowed value is 1 hour. For very large models (several GB), persistence could take 10-20 minutes, so do not set the value too low. If the job is open when you make the update, you must stop the datafeed, close the job, then reopen the job and restart the datafeed for the changes to take effect. */ background_persist_interval?: Duration + /** Advanced configuration option. Contains custom meta data about the job. For example, it can contain custom URL information as shown in Adding custom URLs to machine learning results. */ custom_settings?: Record categorization_filters?: string[] + /** A description of the job. */ description?: string model_plot_config?: MlModelPlotConfig model_prune_window?: Duration + /** Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies a period of time (in days) after which only the first snapshot per day is retained. This period is relative to the timestamp of the most recent snapshot for this job. Valid values range from 0 to `model_snapshot_retention_days`. For jobs created before version 7.8.0, the default value matches `model_snapshot_retention_days`. */ daily_model_snapshot_retention_after_days?: long + /** Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies the maximum period of time (in days) that snapshots are retained. This period is relative to the timestamp of the most recent snapshot for this job. */ model_snapshot_retention_days?: long + /** Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen. */ renormalization_window_days?: long + /** Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. */ results_retention_days?: long + /** A list of job groups. A job can belong to no groups or many. */ groups?: string[] + /** An array of detector update objects. */ detectors?: MlDetectorUpdate[] + /** Settings related to how categorization interacts with partition fields. */ per_partition_categorization?: MlPerPartitionCategorization + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, allow_lazy_open?: never, analysis_limits?: never, background_persist_interval?: never, custom_settings?: never, categorization_filters?: never, description?: never, model_plot_config?: never, model_prune_window?: never, daily_model_snapshot_retention_after_days?: never, model_snapshot_retention_days?: never, renormalization_window_days?: never, results_retention_days?: never, groups?: never, detectors?: never, per_partition_categorization?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, allow_lazy_open?: never, analysis_limits?: never, background_persist_interval?: never, custom_settings?: never, categorization_filters?: never, description?: never, model_plot_config?: never, model_prune_window?: never, daily_model_snapshot_retention_after_days?: never, model_snapshot_retention_days?: never, renormalization_window_days?: never, results_retention_days?: never, groups?: never, detectors?: never, per_partition_categorization?: never } } export interface MlUpdateJobResponse { @@ -16076,10 +19349,18 @@ export interface MlUpdateJobResponse { } export interface MlUpdateModelSnapshotRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** Identifier for the model snapshot. */ snapshot_id: Id + /** A description of the model snapshot. */ description?: string + /** If `true`, this snapshot will not be deleted during automatic cleanup of snapshots older than `model_snapshot_retention_days`. However, this snapshot will be deleted when the job is deleted. */ retain?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, snapshot_id?: never, description?: never, retain?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, snapshot_id?: never, description?: never, retain?: never } } export interface MlUpdateModelSnapshotResponse { @@ -16088,8 +19369,14 @@ export interface MlUpdateModelSnapshotResponse { } export interface MlUpdateTrainedModelDeploymentRequest extends RequestBase { +/** The unique identifier of the trained model. Currently, only PyTorch models are supported. */ model_id: Id + /** The number of model allocations on each node where the model is deployed. All allocations on a node share the same copy of the model in memory but use a separate set of threads to evaluate the model. Increasing this value generally increases the throughput. If this setting is greater than the number of hardware threads it will automatically be changed to a value less than the number of hardware threads. */ number_of_allocations?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { model_id?: never, number_of_allocations?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { model_id?: never, number_of_allocations?: never } } export interface MlUpdateTrainedModelDeploymentResponse { @@ -16097,10 +19384,18 @@ export interface MlUpdateTrainedModelDeploymentResponse { } export interface MlUpgradeJobSnapshotRequest extends RequestBase { +/** Identifier for the anomaly detection job. */ job_id: Id + /** A numerical character string that uniquely identifies the model snapshot. */ snapshot_id: Id + /** When true, the API won’t respond until the upgrade is complete. Otherwise, it responds as soon as the upgrade task is assigned to a node. */ wait_for_completion?: boolean + /** Controls the time to wait for the request to complete. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, snapshot_id?: never, wait_for_completion?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, snapshot_id?: never, wait_for_completion?: never, timeout?: never } } export interface MlUpgradeJobSnapshotResponse { @@ -16118,22 +19413,38 @@ export interface MlValidateRequest extends RequestBase { model_snapshot_id?: Id model_snapshot_retention_days?: long results_index_name?: IndexName + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { job_id?: never, analysis_config?: never, analysis_limits?: never, data_description?: never, description?: never, model_plot?: never, model_snapshot_id?: never, model_snapshot_retention_days?: never, results_index_name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { job_id?: never, analysis_config?: never, analysis_limits?: never, data_description?: never, description?: never, model_plot?: never, model_snapshot_id?: never, model_snapshot_retention_days?: never, results_index_name?: never } } export type MlValidateResponse = AcknowledgedResponseBase export interface MlValidateDetectorRequest extends RequestBase { detector?: MlDetector + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { detector?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { detector?: never } } export type MlValidateDetectorResponse = AcknowledgedResponseBase export interface MonitoringBulkRequest extends RequestBase { +/** Default document type for items which don't provide one */ type?: string + /** Identifier of the monitored system */ system_id: string + /** */ system_api_version: string + /** Collection interval (e.g., '10s' or '10000ms') of the payload */ interval: Duration operations?: (BulkOperationContainer | BulkUpdateAction | TDocument)[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { type?: never, system_id?: never, system_api_version?: never, interval?: never, operations?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { type?: never, system_id?: never, system_api_version?: never, interval?: never, operations?: never } } export interface MonitoringBulkResponse { @@ -16636,8 +19947,14 @@ export interface NodesTransportHistogram { } export interface NodesClearRepositoriesMeteringArchiveRequest extends RequestBase { +/** Comma-separated list of node IDs or names used to limit returned information. */ node_id: NodeIds + /** Specifies the maximum `archive_version` to be cleared from the archive. */ max_archive_version: long + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, max_archive_version?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, max_archive_version?: never } } export type NodesClearRepositoriesMeteringArchiveResponse = NodesClearRepositoriesMeteringArchiveResponseBase @@ -16648,7 +19965,12 @@ export interface NodesClearRepositoriesMeteringArchiveResponseBase extends Nodes } export interface NodesGetRepositoriesMeteringInfoRequest extends RequestBase { +/** Comma-separated list of node IDs or names used to limit returned information. All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes). */ node_id: NodeIds + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never } } export type NodesGetRepositoriesMeteringInfoResponse = NodesGetRepositoriesMeteringInfoResponseBase @@ -16659,14 +19981,26 @@ export interface NodesGetRepositoriesMeteringInfoResponseBase extends NodesNodes } export interface NodesHotThreadsRequest extends RequestBase { +/** List of node IDs or names used to limit returned information. */ node_id?: NodeIds + /** If true, known idle threads (e.g. waiting in a socket select, or to get a task from an empty queue) are filtered out. */ ignore_idle_threads?: boolean + /** The interval to do the second sampling of threads. */ interval?: Duration + /** Number of samples of thread stacktrace. */ snapshots?: long + /** Specifies the number of hot threads to provide information for. */ threads?: long + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The type to sample. */ type?: ThreadType + /** The sort order for 'cpu' type (default: total) */ sort?: ThreadType + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, ignore_idle_threads?: never, interval?: never, snapshots?: never, threads?: never, timeout?: never, type?: never, sort?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, ignore_idle_threads?: never, interval?: never, snapshots?: never, threads?: never, timeout?: never, type?: never, sort?: never } } export interface NodesHotThreadsResponse { @@ -17021,10 +20355,18 @@ export interface NodesInfoNodeThreadPoolInfo { } export interface NodesInfoRequest extends RequestBase { +/** Comma-separated list of node IDs or names used to limit returned information. */ node_id?: NodeIds + /** Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest. */ metric?: Metrics + /** If true, returns settings in flat format. */ flat_settings?: boolean + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, metric?: never, flat_settings?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, metric?: never, flat_settings?: never, timeout?: never } } export type NodesInfoResponse = NodesInfoResponseBase @@ -17035,9 +20377,16 @@ export interface NodesInfoResponseBase extends NodesNodesResponseBase { } export interface NodesReloadSecureSettingsRequest extends RequestBase { +/** The names of particular nodes in the cluster to target. */ node_id?: NodeIds + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The password for the Elasticsearch keystore. */ secure_settings_password?: Password + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, timeout?: never, secure_settings_password?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, timeout?: never, secure_settings_password?: never } } export type NodesReloadSecureSettingsResponse = NodesReloadSecureSettingsResponseBase @@ -17048,18 +20397,34 @@ export interface NodesReloadSecureSettingsResponseBase extends NodesNodesRespons } export interface NodesStatsRequest extends RequestBase { +/** Comma-separated list of node IDs or names used to limit returned information. */ node_id?: NodeIds + /** Limit the information returned to the specified metrics */ metric?: Metrics + /** Limit the information returned for indices metric to the specific index metrics. It can be used only if indices (or all) metric is specified. */ index_metric?: Metrics + /** Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. */ completion_fields?: Fields + /** Comma-separated list or wildcard expressions of fields to include in fielddata statistics. */ fielddata_fields?: Fields + /** Comma-separated list or wildcard expressions of fields to include in the statistics. */ fields?: Fields + /** Comma-separated list of search groups to include in the search statistics. */ groups?: boolean + /** If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). */ include_segment_file_sizes?: boolean + /** Indicates whether statistics are aggregated at the cluster, index, or shard level. */ level?: Level + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** A comma-separated list of document types for the indexing index metric. */ types?: string[] + /** If `true`, the response includes information from segments that are not loaded into memory. */ include_unloaded_segments?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, metric?: never, index_metric?: never, completion_fields?: never, fielddata_fields?: never, fields?: never, groups?: never, include_segment_file_sizes?: never, level?: never, timeout?: never, types?: never, include_unloaded_segments?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, metric?: never, index_metric?: never, completion_fields?: never, fielddata_fields?: never, fields?: never, groups?: never, include_segment_file_sizes?: never, level?: never, timeout?: never, types?: never, include_unloaded_segments?: never } } export type NodesStatsResponse = NodesStatsResponseBase @@ -17077,9 +20442,16 @@ export interface NodesUsageNodeUsage { } export interface NodesUsageRequest extends RequestBase { +/** A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes */ node_id?: NodeIds + /** Limits the information returned to the specific metrics. A comma-separated list of the following options: `_all`, `rest_actions`. */ metric?: Metrics + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, metric?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, metric?: never, timeout?: never } } export type NodesUsageResponse = NodesUsageResponseBase @@ -17118,27 +20490,49 @@ export interface QueryRulesQueryRuleset { } export interface QueryRulesDeleteRuleRequest extends RequestBase { +/** The unique identifier of the query ruleset containing the rule to delete */ ruleset_id: Id + /** The unique identifier of the query rule within the specified ruleset to delete */ rule_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { ruleset_id?: never, rule_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { ruleset_id?: never, rule_id?: never } } export type QueryRulesDeleteRuleResponse = AcknowledgedResponseBase export interface QueryRulesDeleteRulesetRequest extends RequestBase { +/** The unique identifier of the query ruleset to delete */ ruleset_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { ruleset_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { ruleset_id?: never } } export type QueryRulesDeleteRulesetResponse = AcknowledgedResponseBase export interface QueryRulesGetRuleRequest extends RequestBase { +/** The unique identifier of the query ruleset containing the rule to retrieve */ ruleset_id: Id + /** The unique identifier of the query rule within the specified ruleset to retrieve */ rule_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { ruleset_id?: never, rule_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { ruleset_id?: never, rule_id?: never } } export type QueryRulesGetRuleResponse = QueryRulesQueryRule export interface QueryRulesGetRulesetRequest extends RequestBase { +/** The unique identifier of the query ruleset */ ruleset_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { ruleset_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { ruleset_id?: never } } export type QueryRulesGetRulesetResponse = QueryRulesQueryRuleset @@ -17151,8 +20545,14 @@ export interface QueryRulesListRulesetsQueryRulesetListItem { } export interface QueryRulesListRulesetsRequest extends RequestBase { +/** The offset from the first result to fetch. */ from?: integer + /** The maximum number of results to retrieve. */ size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { from?: never, size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { from?: never, size?: never } } export interface QueryRulesListRulesetsResponse { @@ -17161,12 +20561,21 @@ export interface QueryRulesListRulesetsResponse { } export interface QueryRulesPutRuleRequest extends RequestBase { +/** The unique identifier of the query ruleset containing the rule to be created or updated. */ ruleset_id: Id + /** The unique identifier of the query rule within the specified ruleset to be created or updated. */ rule_id: Id + /** The type of rule. */ type: QueryRulesQueryRuleType + /** The criteria that must be met for the rule to be applied. If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied. */ criteria: QueryRulesQueryRuleCriteria | QueryRulesQueryRuleCriteria[] + /** The actions to take when the rule is matched. The format of this action depends on the rule type. */ actions: QueryRulesQueryRuleActions priority?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { ruleset_id?: never, rule_id?: never, type?: never, criteria?: never, actions?: never, priority?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { ruleset_id?: never, rule_id?: never, type?: never, criteria?: never, actions?: never, priority?: never } } export interface QueryRulesPutRuleResponse { @@ -17174,8 +20583,13 @@ export interface QueryRulesPutRuleResponse { } export interface QueryRulesPutRulesetRequest extends RequestBase { +/** The unique identifier of the query ruleset to be created or updated. */ ruleset_id: Id rules: QueryRulesQueryRule | QueryRulesQueryRule[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { ruleset_id?: never, rules?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { ruleset_id?: never, rules?: never } } export interface QueryRulesPutRulesetResponse { @@ -17188,8 +20602,14 @@ export interface QueryRulesTestQueryRulesetMatchedRule { } export interface QueryRulesTestRequest extends RequestBase { +/** The unique identifier of the query ruleset to be created or updated */ ruleset_id: Id + /** The match criteria to apply to rules in the given query ruleset. Match criteria should match the keys defined in the `criteria.metadata` field of the rule. */ match_criteria: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { ruleset_id?: never, match_criteria?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { ruleset_id?: never, match_criteria?: never } } export interface QueryRulesTestResponse { @@ -17230,7 +20650,12 @@ export interface RollupTermsGrouping { } export interface RollupDeleteJobRequest extends RequestBase { +/** Identifier for the job. */ id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export interface RollupDeleteJobResponse { @@ -17241,7 +20666,12 @@ export interface RollupDeleteJobResponse { export type RollupGetJobsIndexingJobState = 'started' | 'indexing' | 'stopping' | 'stopped' | 'aborting' export interface RollupGetJobsRequest extends RequestBase { +/** Identifier for the rollup job. If it is `_all` or omitted, the API returns all rollup jobs. */ id?: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export interface RollupGetJobsResponse { @@ -17287,7 +20717,12 @@ export interface RollupGetJobsRollupJobStatus { } export interface RollupGetRollupCapsRequest extends RequestBase { +/** Index, indices or index-pattern to return rollup capabilities for. `_all` may be used to fetch rollup capabilities from all jobs. */ id?: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export type RollupGetRollupCapsResponse = Record @@ -17314,7 +20749,12 @@ export interface RollupGetRollupIndexCapsIndexCapabilities { } export interface RollupGetRollupIndexCapsRequest extends RequestBase { +/** Data stream or index to check for rollup capabilities. Wildcard (`*`) expressions are supported. */ index: Ids + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never } } export type RollupGetRollupIndexCapsResponse = Record @@ -17333,28 +20773,51 @@ export interface RollupGetRollupIndexCapsRollupJobSummaryField { } export interface RollupPutJobRequest extends RequestBase { +/** Identifier for the rollup job. This can be any alphanumeric string and uniquely identifies the data that is associated with the rollup job. The ID is persistent; it is stored with the rolled up data. If you create a job, let it run for a while, then delete the job, the data that the job rolled up is still be associated with this job ID. You cannot create a new job with the same ID since that could lead to problems with mismatched job configurations. */ id: Id + /** A cron string which defines the intervals when the rollup job should be executed. When the interval triggers, the indexer attempts to rollup the data in the index pattern. The cron pattern is unrelated to the time interval of the data being rolled up. For example, you may wish to create hourly rollups of your document but to only run the indexer on a daily basis at midnight, as defined by the cron. The cron pattern is defined just like a Watcher cron schedule. */ cron: string + /** Defines the grouping fields and aggregations that are defined for this rollup job. These fields will then be available later for aggregating into buckets. These aggs and fields can be used in any combination. Think of the groups configuration as defining a set of tools that can later be used in aggregations to partition the data. Unlike raw data, we have to think ahead to which fields and aggregations might be used. Rollups provide enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. */ groups: RollupGroupings + /** The index or index pattern to roll up. Supports wildcard-style patterns (`logstash-*`). The job attempts to rollup the entire index or index-pattern. */ index_pattern: string + /** Defines the metrics to collect for each grouping tuple. By default, only the doc_counts are collected for each group. To make rollup useful, you will often add metrics like averages, mins, maxes, etc. Metrics are defined on a per-field basis and for each field you configure which metric should be collected. */ metrics?: RollupFieldMetric[] + /** The number of bucket results that are processed on each iteration of the rollup indexer. A larger value tends to execute faster, but requires more memory during processing. This value has no effect on how the data is rolled up; it is merely used for tweaking the speed or memory cost of the indexer. */ page_size: integer + /** The index that contains the rollup results. The index can be shared with other rollup jobs. The data is stored so that it doesn’t interfere with unrelated jobs. */ rollup_index: IndexName + /** Time to wait for the request to complete. */ timeout?: Duration headers?: HttpHeaders + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, cron?: never, groups?: never, index_pattern?: never, metrics?: never, page_size?: never, rollup_index?: never, timeout?: never, headers?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, cron?: never, groups?: never, index_pattern?: never, metrics?: never, page_size?: never, rollup_index?: never, timeout?: never, headers?: never } } export type RollupPutJobResponse = AcknowledgedResponseBase export interface RollupRollupSearchRequest extends RequestBase { +/** A comma-separated list of data streams and indices used to limit the request. This parameter has the following rules: * At least one data stream, index, or wildcard expression must be specified. This target can include a rollup or non-rollup index. For data streams, the stream's backing indices can only serve as non-rollup indices. Omitting the parameter or using `_all` are not permitted. * Multiple non-rollup indices may be specified. * Only one rollup index may be specified. If more than one are supplied, an exception occurs. * Wildcard expressions (`*`) may be used. If they match more than one rollup index, an exception occurs. However, you can use an expression to match multiple non-rollup indices or data streams. */ index: Indices + /** Indicates whether hits.total should be rendered as an integer or an object in the rest search response */ rest_total_hits_as_int?: boolean + /** Specify whether aggregation and suggester names should be prefixed by their respective types in the response */ typed_keys?: boolean + /** Specifies aggregations. */ aggregations?: Record /** @alias aggregations */ + /** Specifies aggregations. */ aggs?: Record + /** Specifies a DSL query that is subject to some limitations. */ query?: QueryDslQueryContainer + /** Must be zero if set, as rollups work on pre-aggregated data. */ size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, rest_total_hits_as_int?: never, typed_keys?: never, aggregations?: never, aggs?: never, query?: never, size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, rest_total_hits_as_int?: never, typed_keys?: never, aggregations?: never, aggs?: never, query?: never, size?: never } } export interface RollupRollupSearchResponse> { @@ -17367,7 +20830,12 @@ export interface RollupRollupSearchResponse export interface SearchApplicationListRequest extends RequestBase { +/** Query in the Lucene query string syntax. */ q?: string + /** Starting offset. */ from?: integer + /** Specifies a max number of results to get. */ size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { q?: never, from?: never, size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { q?: never, from?: never, size?: never } } export interface SearchApplicationListResponse { @@ -17445,10 +20947,17 @@ export interface SearchApplicationListResponse { } export interface SearchApplicationPostBehavioralAnalyticsEventRequest extends RequestBase { +/** The name of the behavioral analytics collection. */ collection_name: Name + /** The analytics event type. */ event_type: SearchApplicationEventType + /** Whether the response type has to include more details */ debug?: boolean payload?: any + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { collection_name?: never, event_type?: never, debug?: never, payload?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { collection_name?: never, event_type?: never, debug?: never, payload?: never } } export interface SearchApplicationPostBehavioralAnalyticsEventResponse { @@ -17457,9 +20966,15 @@ export interface SearchApplicationPostBehavioralAnalyticsEventResponse { } export interface SearchApplicationPutRequest extends RequestBase { +/** The name of the search application to be created or updated. */ name: Name + /** If `true`, this request cannot replace or update existing Search Applications. */ create?: boolean search_application?: SearchApplicationSearchApplicationParameters + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, create?: never, search_application?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, create?: never, search_application?: never } } export interface SearchApplicationPutResponse { @@ -17471,23 +20986,40 @@ export interface SearchApplicationPutBehavioralAnalyticsAnalyticsAcknowledgeResp } export interface SearchApplicationPutBehavioralAnalyticsRequest extends RequestBase { +/** The name of the analytics collection to be created or updated. */ name: Name + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never } } export type SearchApplicationPutBehavioralAnalyticsResponse = SearchApplicationPutBehavioralAnalyticsAnalyticsAcknowledgeResponseBase export interface SearchApplicationRenderQueryRequest extends RequestBase { +/** The name of the search application to render teh query for. */ name: Name params?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, params?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, params?: never } } export interface SearchApplicationRenderQueryResponse { } export interface SearchApplicationSearchRequest extends RequestBase { +/** The name of the search application to be searched. */ name: Name + /** Determines whether aggregation names are prefixed by their respective types in the response. */ typed_keys?: boolean + /** Query parameters specific to this request, which will override any defaults specified in the template. */ params?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, typed_keys?: never, params?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, typed_keys?: never, params?: never } } export type SearchApplicationSearchResponse> = SearchResponseBody @@ -17499,8 +21031,13 @@ export interface SearchableSnapshotsCacheStatsNode { } export interface SearchableSnapshotsCacheStatsRequest extends RequestBase { +/** The names of the nodes in the cluster to target. */ node_id?: NodeIds master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, master_timeout?: never } } export interface SearchableSnapshotsCacheStatsResponse { @@ -17519,10 +21056,18 @@ export interface SearchableSnapshotsCacheStatsShared { } export interface SearchableSnapshotsClearCacheRequest extends RequestBase { +/** A comma-separated list of data streams, indices, and aliases to clear from the cache. It supports wildcards (`*`). */ index?: Indices + /** Whether to expand wildcard expression to concrete indices that are open, closed or both. */ expand_wildcards?: ExpandWildcards + /** Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) */ allow_no_indices?: boolean + /** Whether specified concrete indices should be ignored when unavailable (missing or closed) */ ignore_unavailable?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, expand_wildcards?: never, allow_no_indices?: never, ignore_unavailable?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, expand_wildcards?: never, allow_no_indices?: never, ignore_unavailable?: never } } export type SearchableSnapshotsClearCacheResponse = any @@ -17534,15 +21079,28 @@ export interface SearchableSnapshotsMountMountedSnapshot { } export interface SearchableSnapshotsMountRequest extends RequestBase { +/** The name of the repository containing the snapshot of the index to mount. */ repository: Name + /** The name of the snapshot of the index to mount. */ snapshot: Name + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** If true, the request blocks until the operation is complete. */ wait_for_completion?: boolean + /** The mount option for the searchable snapshot index. */ storage?: string + /** The name of the index contained in the snapshot whose data is to be mounted. If no `renamed_index` is specified, this name will also be used to create the new index. */ index: IndexName + /** The name of the index that will be created. */ renamed_index?: IndexName + /** The settings that should be added to the index when it is mounted. */ index_settings?: Record + /** The names of settings that should be removed from the index when it is mounted. */ ignore_index_settings?: string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { repository?: never, snapshot?: never, master_timeout?: never, wait_for_completion?: never, storage?: never, index?: never, renamed_index?: never, index_settings?: never, ignore_index_settings?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { repository?: never, snapshot?: never, master_timeout?: never, wait_for_completion?: never, storage?: never, index?: never, renamed_index?: never, index_settings?: never, ignore_index_settings?: never } } export interface SearchableSnapshotsMountResponse { @@ -17550,8 +21108,14 @@ export interface SearchableSnapshotsMountResponse { } export interface SearchableSnapshotsStatsRequest extends RequestBase { +/** A comma-separated list of data streams and indices to retrieve statistics for. */ index?: Indices + /** Return stats aggregated at cluster, index or shard level */ level?: SearchableSnapshotsStatsLevel + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, level?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, level?: never } } export interface SearchableSnapshotsStatsResponse { @@ -17800,10 +21364,18 @@ export interface SecurityUserProfileWithMetadata extends SecurityUserProfile { } export interface SecurityActivateUserProfileRequest extends RequestBase { +/** The user's Elasticsearch access token or JWT. Both `access` and `id` JWT token types are supported and they depend on the underlying JWT realm configuration. If you specify the `access_token` grant type, this parameter is required. It is not valid with other grant types. */ access_token?: string + /** The type of grant. */ grant_type: SecurityGrantType + /** The user's password. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. */ password?: string + /** The username that identifies the user. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. */ username?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { access_token?: never, grant_type?: never, password?: never, username?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { access_token?: never, grant_type?: never, password?: never, username?: never } } export type SecurityActivateUserProfileResponse = SecurityUserProfileWithMetadata @@ -17814,6 +21386,10 @@ export interface SecurityAuthenticateAuthenticateApiKey { } export interface SecurityAuthenticateRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface SecurityAuthenticateResponse { @@ -17836,8 +21412,14 @@ export interface SecurityAuthenticateToken { } export interface SecurityBulkDeleteRoleRequest extends RequestBase { +/** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** An array of role names to delete */ names: string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { refresh?: never, names?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { refresh?: never, names?: never } } export interface SecurityBulkDeleteRoleResponse { @@ -17847,8 +21429,14 @@ export interface SecurityBulkDeleteRoleResponse { } export interface SecurityBulkPutRoleRequest extends RequestBase { +/** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** A dictionary of role name to RoleDescriptor objects to add or update */ roles: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { refresh?: never, roles?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { refresh?: never, roles?: never } } export interface SecurityBulkPutRoleResponse { @@ -17859,10 +21447,18 @@ export interface SecurityBulkPutRoleResponse { } export interface SecurityBulkUpdateApiKeysRequest extends RequestBase { +/** Expiration time for the API keys. By default, API keys never expire. This property can be omitted to leave the value unchanged. */ expiration?: Duration + /** The API key identifiers. */ ids: string | string[] + /** Arbitrary nested metadata to associate with the API keys. Within the `metadata` object, top-level keys beginning with an underscore (`_`) are reserved for system usage. Any information specified with this parameter fully replaces metadata previously associated with the API key. */ metadata?: Metadata + /** The role descriptors to assign to the API keys. An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. You can assign new privileges by specifying them in this parameter. To remove assigned privileges, supply the `role_descriptors` parameter as an empty object `{}`. If an API key has no assigned privileges, it inherits the owner user's full permissions. The snapshot of the owner's permissions is always updated, whether you supply the `role_descriptors` parameter. The structure of a role descriptor is the same as the request for the create API keys API. */ role_descriptors?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { expiration?: never, ids?: never, metadata?: never, role_descriptors?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { expiration?: never, ids?: never, metadata?: never, role_descriptors?: never } } export interface SecurityBulkUpdateApiKeysResponse { @@ -17872,17 +21468,30 @@ export interface SecurityBulkUpdateApiKeysResponse { } export interface SecurityChangePasswordRequest extends RequestBase { +/** The user whose password you want to change. If you do not specify this parameter, the password is changed for the current user. */ username?: Username + /** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** The new password value. Passwords must be at least 6 characters long. */ password?: Password + /** A hash of the new password value. This must be produced using the same hashing algorithm as has been configured for password storage. For more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm` setting. */ password_hash?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { username?: never, refresh?: never, password?: never, password_hash?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { username?: never, refresh?: never, password?: never, password_hash?: never } } export interface SecurityChangePasswordResponse { } export interface SecurityClearApiKeyCacheRequest extends RequestBase { +/** Comma-separated list of API key IDs to evict from the API key cache. To evict all API keys, use `*`. Does not support other wildcard patterns. */ ids: Ids + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { ids?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { ids?: never } } export interface SecurityClearApiKeyCacheResponse { @@ -17892,7 +21501,12 @@ export interface SecurityClearApiKeyCacheResponse { } export interface SecurityClearCachedPrivilegesRequest extends RequestBase { +/** A comma-separated list of applications. To clear all applications, use an asterism (`*`). It does not support other wildcard patterns. */ application: Name + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { application?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { application?: never } } export interface SecurityClearCachedPrivilegesResponse { @@ -17902,8 +21516,14 @@ export interface SecurityClearCachedPrivilegesResponse { } export interface SecurityClearCachedRealmsRequest extends RequestBase { +/** A comma-separated list of realms. To clear all realms, use an asterisk (`*`). It does not support other wildcard patterns. */ realms: Names + /** A comma-separated list of the users to clear from the cache. If you do not specify this parameter, the API evicts all users from the user cache. */ usernames?: string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { realms?: never, usernames?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { realms?: never, usernames?: never } } export interface SecurityClearCachedRealmsResponse { @@ -17913,7 +21533,12 @@ export interface SecurityClearCachedRealmsResponse { } export interface SecurityClearCachedRolesRequest extends RequestBase { +/** A comma-separated list of roles to evict from the role cache. To evict all roles, use an asterisk (`*`). It does not support other wildcard patterns. */ name: Names + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never } } export interface SecurityClearCachedRolesResponse { @@ -17923,9 +21548,16 @@ export interface SecurityClearCachedRolesResponse { } export interface SecurityClearCachedServiceTokensRequest extends RequestBase { +/** The namespace, which is a top-level grouping of service accounts. */ namespace: Namespace + /** The name of the service, which must be unique within its namespace. */ service: Service + /** A comma-separated list of token names to evict from the service account token caches. Use a wildcard (`*`) to evict all tokens that belong to a service account. It does not support other wildcard patterns. */ name: Names + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { namespace?: never, service?: never, name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { namespace?: never, service?: never, name?: never } } export interface SecurityClearCachedServiceTokensResponse { @@ -17935,11 +21567,20 @@ export interface SecurityClearCachedServiceTokensResponse { } export interface SecurityCreateApiKeyRequest extends RequestBase { +/** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** The expiration time for the API key. By default, API keys never expire. */ expiration?: Duration + /** A name for the API key. */ name?: Name + /** An array of role descriptors for this API key. When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for the create role API. For more details, refer to the create or update roles API. NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. In this case, you must explicitly specify a role descriptor with no privileges. The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. */ role_descriptors?: Record + /** Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. */ metadata?: Metadata + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { refresh?: never, expiration?: never, name?: never, role_descriptors?: never, metadata?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { refresh?: never, expiration?: never, name?: never, role_descriptors?: never, metadata?: never } } export interface SecurityCreateApiKeyResponse { @@ -17951,10 +21592,18 @@ export interface SecurityCreateApiKeyResponse { } export interface SecurityCreateCrossClusterApiKeyRequest extends RequestBase { +/** The access to be granted to this API key. The access is composed of permissions for cross-cluster search and cross-cluster replication. At least one of them must be specified. NOTE: No explicit privileges should be specified for either search or replication access. The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. */ access: SecurityAccess + /** Expiration time for the API key. By default, API keys never expire. */ expiration?: Duration + /** Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. */ metadata?: Metadata + /** Specifies the name for this API key. */ name: Name + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { access?: never, expiration?: never, metadata?: never, name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { access?: never, expiration?: never, metadata?: never, name?: never } } export interface SecurityCreateCrossClusterApiKeyResponse { @@ -17966,10 +21615,18 @@ export interface SecurityCreateCrossClusterApiKeyResponse { } export interface SecurityCreateServiceTokenRequest extends RequestBase { +/** The name of the namespace, which is a top-level grouping of service accounts. */ namespace: Namespace + /** The name of the service. */ service: Service + /** The name for the service account token. If omitted, a random name will be generated. Token names must be at least one and no more than 256 characters. They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes (`-`), and underscores (`_`), but cannot begin with an underscore. NOTE: Token names must be unique in the context of the associated service account. They must also be globally unique with their fully qualified names, which are comprised of the service account principal and token name, such as `//`. */ name?: Name + /** If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { namespace?: never, service?: never, name?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { namespace?: never, service?: never, name?: never, refresh?: never } } export interface SecurityCreateServiceTokenResponse { @@ -18003,7 +21660,12 @@ export interface SecurityDelegatePkiAuthenticationRealm { } export interface SecurityDelegatePkiRequest extends RequestBase { +/** The X509Certificate chain, which is represented as an ordered string array. Each string in the array is a base64-encoded (Section 4 of RFC4648 - not base64url-encoded) of the certificate's DER encoding. The first element is the target certificate that contains the subject distinguished name that is requesting access. This may be followed by additional certificates; each subsequent certificate is used to certify the previous one. */ x509_certificate_chain: string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { x509_certificate_chain?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { x509_certificate_chain?: never } } export interface SecurityDelegatePkiResponse { @@ -18018,16 +21680,29 @@ export interface SecurityDeletePrivilegesFoundStatus { } export interface SecurityDeletePrivilegesRequest extends RequestBase { +/** The name of the application. Application privileges are always associated with exactly one application. */ application: Name + /** The name of the privilege. */ name: Names + /** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { application?: never, name?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { application?: never, name?: never, refresh?: never } } export type SecurityDeletePrivilegesResponse = Record> export interface SecurityDeleteRoleRequest extends RequestBase { +/** The name of the role. */ name: Name + /** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, refresh?: never } } export interface SecurityDeleteRoleResponse { @@ -18035,8 +21710,14 @@ export interface SecurityDeleteRoleResponse { } export interface SecurityDeleteRoleMappingRequest extends RequestBase { +/** The distinct name that identifies the role mapping. The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. */ name: Name + /** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, refresh?: never } } export interface SecurityDeleteRoleMappingResponse { @@ -18044,10 +21725,18 @@ export interface SecurityDeleteRoleMappingResponse { } export interface SecurityDeleteServiceTokenRequest extends RequestBase { +/** The namespace, which is a top-level grouping of service accounts. */ namespace: Namespace + /** The service name. */ service: Service + /** The name of the service account token. */ name: Name + /** If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { namespace?: never, service?: never, name?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { namespace?: never, service?: never, name?: never, refresh?: never } } export interface SecurityDeleteServiceTokenResponse { @@ -18055,8 +21744,14 @@ export interface SecurityDeleteServiceTokenResponse { } export interface SecurityDeleteUserRequest extends RequestBase { +/** An identifier for the user. */ username: Username + /** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { username?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { username?: never, refresh?: never } } export interface SecurityDeleteUserResponse { @@ -18064,36 +21759,64 @@ export interface SecurityDeleteUserResponse { } export interface SecurityDisableUserRequest extends RequestBase { +/** An identifier for the user. */ username: Username + /** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { username?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { username?: never, refresh?: never } } export interface SecurityDisableUserResponse { } export interface SecurityDisableUserProfileRequest extends RequestBase { +/** Unique identifier for the user profile. */ uid: SecurityUserProfileId + /** If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to make this operation visible to search. If 'false', it does nothing with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { uid?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { uid?: never, refresh?: never } } export type SecurityDisableUserProfileResponse = AcknowledgedResponseBase export interface SecurityEnableUserRequest extends RequestBase { +/** An identifier for the user. */ username: Username + /** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { username?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { username?: never, refresh?: never } } export interface SecurityEnableUserResponse { } export interface SecurityEnableUserProfileRequest extends RequestBase { +/** A unique identifier for the user profile. */ uid: SecurityUserProfileId + /** If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to make this operation visible to search. If 'false', nothing is done with refreshes. */ refresh?: Refresh + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { uid?: never, refresh?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { uid?: never, refresh?: never } } export type SecurityEnableUserProfileResponse = AcknowledgedResponseBase export interface SecurityEnrollKibanaRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface SecurityEnrollKibanaResponse { @@ -18107,6 +21830,10 @@ export interface SecurityEnrollKibanaToken { } export interface SecurityEnrollNodeRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface SecurityEnrollNodeResponse { @@ -18119,14 +21846,26 @@ export interface SecurityEnrollNodeResponse { } export interface SecurityGetApiKeyRequest extends RequestBase { +/** An API key id. This parameter cannot be used with any of `name`, `realm_name` or `username`. */ id?: Id + /** An API key name. This parameter cannot be used with any of `id`, `realm_name` or `username`. It supports prefix search with wildcard. */ name?: Name + /** A boolean flag that can be used to query API keys owned by the currently authenticated user. The `realm_name` or `username` parameters cannot be specified when this parameter is set to `true` as they are assumed to be the currently authenticated ones. */ owner?: boolean + /** The name of an authentication realm. This parameter cannot be used with either `id` or `name` or when `owner` flag is set to `true`. */ realm_name?: Name + /** The username of a user. This parameter cannot be used with either `id` or `name` or when `owner` flag is set to `true`. */ username?: Username + /** Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. */ with_limited_by?: boolean + /** A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together with other parameters such as `owner` or `name`. If `active_only` is false, the response will include both active and inactive (expired or invalidated) keys. */ active_only?: boolean + /** Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. */ with_profile_uid?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, name?: never, owner?: never, realm_name?: never, username?: never, with_limited_by?: never, active_only?: never, with_profile_uid?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, name?: never, owner?: never, realm_name?: never, username?: never, with_limited_by?: never, active_only?: never, with_profile_uid?: never } } export interface SecurityGetApiKeyResponse { @@ -18134,6 +21873,10 @@ export interface SecurityGetApiKeyResponse { } export interface SecurityGetBuiltinPrivilegesRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export interface SecurityGetBuiltinPrivilegesResponse { @@ -18143,14 +21886,25 @@ export interface SecurityGetBuiltinPrivilegesResponse { } export interface SecurityGetPrivilegesRequest extends RequestBase { +/** The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, the API returns information about all privileges for all applications. */ application?: Name + /** The name of the privilege. If you do not specify this parameter, the API returns information about all privileges for the requested application. */ name?: Names + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { application?: never, name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { application?: never, name?: never } } export type SecurityGetPrivilegesResponse = Record> export interface SecurityGetRoleRequest extends RequestBase { +/** The name of the role. You can specify multiple roles as a comma-separated list. If you do not specify this parameter, the API returns information about all roles. */ name?: Names + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never } } export type SecurityGetRoleResponse = Record @@ -18169,14 +21923,25 @@ export interface SecurityGetRoleRole { } export interface SecurityGetRoleMappingRequest extends RequestBase { +/** The distinct name that identifies the role mapping. The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. You can specify multiple mapping names as a comma-separated list. If you do not specify this parameter, the API returns information about all role mappings. */ name?: Names + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never } } export type SecurityGetRoleMappingResponse = Record export interface SecurityGetServiceAccountsRequest extends RequestBase { +/** The name of the namespace. Omit this parameter to retrieve information about all service accounts. If you omit this parameter, you must also omit the `service` parameter. */ namespace?: Namespace + /** The service name. Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. */ service?: Service + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { namespace?: never, service?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { namespace?: never, service?: never } } export type SecurityGetServiceAccountsResponse = Record @@ -18195,8 +21960,14 @@ export interface SecurityGetServiceCredentialsNodesCredentialsFileToken { } export interface SecurityGetServiceCredentialsRequest extends RequestBase { +/** The name of the namespace. */ namespace: Namespace + /** The service name. */ service: Name + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { namespace?: never, service?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { namespace?: never, service?: never } } export interface SecurityGetServiceCredentialsResponse { @@ -18207,7 +21978,12 @@ export interface SecurityGetServiceCredentialsResponse { } export interface SecurityGetSettingsRequest extends RequestBase { +/** 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 } & { master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never } } export interface SecurityGetSettingsResponse { @@ -18231,12 +22007,22 @@ export interface SecurityGetTokenAuthenticationProvider { } export interface SecurityGetTokenRequest extends RequestBase { +/** The type of grant. Supported grant types are: `password`, `_kerberos`, `client_credentials`, and `refresh_token`. */ grant_type?: SecurityGetTokenAccessTokenGrantType + /** The scope of the token. Currently tokens are only issued for a scope of FULL regardless of the value sent with the request. */ scope?: string + /** The user's password. If you specify the `password` grant type, this parameter is required. This parameter is not valid with any other supported grant type. */ password?: Password + /** The base64 encoded kerberos ticket. If you specify the `_kerberos` grant type, this parameter is required. This parameter is not valid with any other supported grant type. */ kerberos_ticket?: string + /** The string that was returned when you created the token, which enables you to extend its life. If you specify the `refresh_token` grant type, this parameter is required. This parameter is not valid with any other supported grant type. */ refresh_token?: string + /** The username that identifies the user. If you specify the `password` grant type, this parameter is required. This parameter is not valid with any other supported grant type. */ username?: Username + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { grant_type?: never, scope?: never, password?: never, kerberos_ticket?: never, refresh_token?: never, username?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { grant_type?: never, scope?: never, password?: never, kerberos_ticket?: never, refresh_token?: never, username?: never } } export interface SecurityGetTokenResponse { @@ -18255,16 +22041,28 @@ export interface SecurityGetTokenUserRealm { } export interface SecurityGetUserRequest extends RequestBase { +/** An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users. */ username?: Username | Username[] + /** Determines whether to retrieve the user profile UID, if it exists, for the users. */ with_profile_uid?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { username?: never, with_profile_uid?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { username?: never, with_profile_uid?: never } } export type SecurityGetUserResponse = Record export interface SecurityGetUserPrivilegesRequest extends RequestBase { +/** The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, the API returns information about all privileges for all applications. */ application?: Name + /** The name of the privilege. If you do not specify this parameter, the API returns information about all privileges for the requested application. */ priviledge?: Name username?: Name | null + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { application?: never, priviledge?: never, username?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { application?: never, priviledge?: never, username?: never } } export interface SecurityGetUserPrivilegesResponse { @@ -18281,8 +22079,14 @@ export interface SecurityGetUserProfileGetUserProfileErrors { } export interface SecurityGetUserProfileRequest extends RequestBase { +/** A unique identifier for the user profile. */ uid: SecurityUserProfileId | SecurityUserProfileId[] + /** A comma-separated list of filters for the `data` field of the profile document. To return all content use `data=*`. To return a subset of content use `data=` to retrieve content nested under the specified ``. By default returns no `data` content. */ data?: string | string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { uid?: never, data?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { uid?: never, data?: never } } export interface SecurityGetUserProfileResponse { @@ -18300,12 +22104,22 @@ export interface SecurityGrantApiKeyGrantApiKey { } export interface SecurityGrantApiKeyRequest extends RequestBase { +/** The API key. */ api_key: SecurityGrantApiKeyGrantApiKey + /** The type of grant. Supported grant types are: `access_token`, `password`. */ grant_type: SecurityGrantApiKeyApiKeyGrantType + /** The user's access token. If you specify the `access_token` grant type, this parameter is required. It is not valid with other grant types. */ access_token?: string + /** The user name that identifies the user. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. */ username?: Username + /** The user's password. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. */ password?: Password + /** The name of the user to be impersonated. */ run_as?: Username + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { api_key?: never, grant_type?: never, access_token?: never, username?: never, password?: never, run_as?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { api_key?: never, grant_type?: never, access_token?: never, username?: never, password?: never, run_as?: never } } export interface SecurityGrantApiKeyResponse { @@ -18333,10 +22147,16 @@ export interface SecurityHasPrivilegesIndexPrivilegesCheck { export type SecurityHasPrivilegesPrivileges = Record export interface SecurityHasPrivilegesRequest extends RequestBase { +/** Username */ user?: Name application?: SecurityHasPrivilegesApplicationPrivilegesCheck[] + /** A list of the cluster privileges that you want to check. */ cluster?: SecurityClusterPrivilege[] index?: SecurityHasPrivilegesIndexPrivilegesCheck[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { user?: never, application?: never, cluster?: never, index?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { user?: never, application?: never, cluster?: never, index?: never } } export type SecurityHasPrivilegesResourcePrivileges = Record @@ -18361,8 +22181,14 @@ export interface SecurityHasPrivilegesUserProfilePrivilegesCheck { } export interface SecurityHasPrivilegesUserProfileRequest extends RequestBase { +/** A list of profile IDs. The privileges are checked for associated users of the profiles. */ uids: SecurityUserProfileId[] + /** An object containing all the privileges to be checked. */ privileges: SecurityHasPrivilegesUserProfilePrivilegesCheck + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { uids?: never, privileges?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { uids?: never, privileges?: never } } export interface SecurityHasPrivilegesUserProfileResponse { @@ -18372,11 +22198,20 @@ export interface SecurityHasPrivilegesUserProfileResponse { export interface SecurityInvalidateApiKeyRequest extends RequestBase { id?: Id + /** A list of API key ids. This parameter cannot be used with any of `name`, `realm_name`, or `username`. */ ids?: Id[] + /** An API key name. This parameter cannot be used with any of `ids`, `realm_name` or `username`. */ name?: Name + /** Query API keys owned by the currently authenticated user. The `realm_name` or `username` parameters cannot be specified when this parameter is set to `true` as they are assumed to be the currently authenticated ones. NOTE: At least one of `ids`, `name`, `username`, and `realm_name` must be specified if `owner` is `false`. */ owner?: boolean + /** The name of an authentication realm. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. */ realm_name?: string + /** The username of a user. This parameter cannot be used with either `ids` or `name` or when `owner` flag is set to `true`. */ username?: Username + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, ids?: never, name?: never, owner?: never, realm_name?: never, username?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, ids?: never, name?: never, owner?: never, realm_name?: never, username?: never } } export interface SecurityInvalidateApiKeyResponse { @@ -18387,10 +22222,18 @@ export interface SecurityInvalidateApiKeyResponse { } export interface SecurityInvalidateTokenRequest extends RequestBase { +/** An access token. This parameter cannot be used if any of `refresh_token`, `realm_name`, or `username` are used. */ token?: string + /** A refresh token. This parameter cannot be used if any of `refresh_token`, `realm_name`, or `username` are used. */ refresh_token?: string + /** The name of an authentication realm. This parameter cannot be used with either `refresh_token` or `token`. */ realm_name?: Name + /** The username of a user. This parameter cannot be used with either `refresh_token` or `token`. */ username?: Username + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { token?: never, refresh_token?: never, realm_name?: never, username?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { token?: never, refresh_token?: never, realm_name?: never, username?: never } } export interface SecurityInvalidateTokenResponse { @@ -18401,10 +22244,18 @@ export interface SecurityInvalidateTokenResponse { } export interface SecurityOidcAuthenticateRequest extends RequestBase { +/** Associate a client session with an ID token and mitigate replay attacks. This value needs to be the same as the one that was provided to the `/_security/oidc/prepare` API or the one that was generated by Elasticsearch and included in the response to that call. */ nonce: string + /** The name of the OpenID Connect realm. This property is useful in cases where multiple realms are defined. */ realm?: string + /** The URL to which the OpenID Connect Provider redirected the User Agent in response to an authentication request after a successful authentication. This URL must be provided as-is (URL encoded), taken from the body of the response or as the value of a location header in the response from the OpenID Connect Provider. */ redirect_uri: string + /** Maintain state between the authentication request and the response. This value needs to be the same as the one that was provided to the `/_security/oidc/prepare` API or the one that was generated by Elasticsearch and included in the response to that call. */ state: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { nonce?: never, realm?: never, redirect_uri?: never, state?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { nonce?: never, realm?: never, redirect_uri?: never, state?: never } } export interface SecurityOidcAuthenticateResponse { @@ -18415,8 +22266,14 @@ export interface SecurityOidcAuthenticateResponse { } export interface SecurityOidcLogoutRequest extends RequestBase { +/** The access token to be invalidated. */ access_token: string + /** The refresh token to be invalidated. */ refresh_token?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { access_token?: never, refresh_token?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { access_token?: never, refresh_token?: never } } export interface SecurityOidcLogoutResponse { @@ -18424,11 +22281,20 @@ export interface SecurityOidcLogoutResponse { } export interface SecurityOidcPrepareAuthenticationRequest extends RequestBase { +/** In the case of a third party initiated single sign on, this is the issuer identifier for the OP that the RP is to send the authentication request to. It cannot be specified when *realm* is specified. One of *realm* or *iss* is required. */ iss?: string + /** In the case of a third party initiated single sign on, it is a string value that is included in the authentication request as the *login_hint* parameter. This parameter is not valid when *realm* is specified. */ login_hint?: string + /** The value used to associate a client session with an ID token and to mitigate replay attacks. If the caller of the API does not provide a value, Elasticsearch will generate one with sufficient entropy and return it in the response. */ nonce?: string + /** The name of the OpenID Connect realm in Elasticsearch the configuration of which should be used in order to generate the authentication request. It cannot be specified when *iss* is specified. One of *realm* or *iss* is required. */ realm?: string + /** The value used to maintain state between the authentication request and the response, typically used as a Cross-Site Request Forgery mitigation. If the caller of the API does not provide a value, Elasticsearch will generate one with sufficient entropy and return it in the response. */ state?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { iss?: never, login_hint?: never, nonce?: never, realm?: never, state?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { iss?: never, login_hint?: never, nonce?: never, realm?: never, state?: never } } export interface SecurityOidcPrepareAuthenticationResponse { @@ -18446,25 +22312,46 @@ export interface SecurityPutPrivilegesActions { } export interface SecurityPutPrivilegesRequest extends RequestBase { +/** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh privileges?: Record> + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { refresh?: never, privileges?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { refresh?: never, privileges?: never } } export type SecurityPutPrivilegesResponse = Record> export interface SecurityPutRoleRequest extends RequestBase { +/** The name of the role that is being created or updated. On Elasticsearch Serverless, the role name must begin with a letter or digit and can only contain letters, digits and the characters '_', '-', and '.'. Each role must have a unique name, as this will serve as the identifier for that role. */ name: Name + /** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** A list of application privilege entries. */ applications?: SecurityApplicationPrivileges[] + /** A list of cluster privileges. These privileges define the cluster-level actions for users with this role. */ cluster?: SecurityClusterPrivilege[] + /** An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. */ global?: Record + /** A list of indices permissions entries. */ indices?: SecurityIndicesPrivileges[] + /** A list of remote indices permissions entries. NOTE: Remote indices are effective for remote clusters configured with the API key based model. They have no effect for remote clusters configured with the certificate based model. */ remote_indices?: SecurityRemoteIndicesPrivileges[] + /** A list of remote cluster permissions entries. */ remote_cluster?: SecurityRemoteClusterPrivileges[] + /** Optional metadata. Within the metadata object, keys that begin with an underscore (`_`) are reserved for system use. */ metadata?: Metadata + /** A list of users that the owners of this role can impersonate. *Note*: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will be rejected. */ run_as?: string[] + /** Optional description of the role descriptor */ description?: string + /** Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If `enabled` is `false`, the role is ignored, but is still listed in the response from the authenticate API. */ transient_metadata?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, refresh?: never, applications?: never, cluster?: never, global?: never, indices?: never, remote_indices?: never, remote_cluster?: never, metadata?: never, run_as?: never, description?: never, transient_metadata?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, refresh?: never, applications?: never, cluster?: never, global?: never, indices?: never, remote_indices?: never, remote_cluster?: never, metadata?: never, run_as?: never, description?: never, transient_metadata?: never } } export interface SecurityPutRoleResponse { @@ -18472,14 +22359,25 @@ export interface SecurityPutRoleResponse { } export interface SecurityPutRoleMappingRequest extends RequestBase { +/** The distinct name that identifies the role mapping. The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. */ name: Name + /** If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. */ refresh?: Refresh + /** Mappings that have `enabled` set to `false` are ignored when role mapping is performed. */ enabled?: boolean + /** Additional metadata that helps define which roles are assigned to each user. Within the metadata object, keys beginning with `_` are reserved for system usage. */ metadata?: Metadata + /** A list of role names that are granted to the users that match the role mapping rules. Exactly one of `roles` or `role_templates` must be specified. */ roles?: string[] + /** A list of Mustache templates that will be evaluated to determine the roles names that should granted to the users that match the role mapping rules. Exactly one of `roles` or `role_templates` must be specified. */ role_templates?: SecurityRoleTemplate[] + /** The rules that determine which users should be matched by the mapping. A rule is a logical condition that is expressed by using a JSON DSL. */ rules?: SecurityRoleMappingRule run_as?: string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, refresh?: never, enabled?: never, metadata?: never, roles?: never, role_templates?: never, rules?: never, run_as?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, refresh?: never, enabled?: never, metadata?: never, roles?: never, role_templates?: never, rules?: never, run_as?: never } } export interface SecurityPutRoleMappingResponse { @@ -18488,15 +22386,28 @@ export interface SecurityPutRoleMappingResponse { } export interface SecurityPutUserRequest extends RequestBase { +/** An identifier for the user. NOTE: Usernames must be at least 1 and no more than 507 characters. They can contain alphanumeric characters (a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic Latin (ASCII) block. Leading or trailing whitespace is not allowed. */ username: Username + /** Valid values are `true`, `false`, and `wait_for`. These values have the same meaning as in the index API, but the default value for this API is true. */ refresh?: Refresh + /** The email of the user. */ email?: string | null + /** The full name of the user. */ full_name?: string | null + /** Arbitrary metadata that you want to associate with the user. */ metadata?: Metadata + /** The user's password. Passwords must be at least 6 characters long. When adding a user, one of `password` or `password_hash` is required. When updating an existing user, the password is optional, so that other fields on the user (such as their roles) may be updated without modifying the user's password */ password?: Password + /** A hash of the user's password. This must be produced using the same hashing algorithm as has been configured for password storage. For more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm` setting in the user cache and password hash algorithm documentation. Using this parameter allows the client to pre-hash the password for performance and/or confidentiality reasons. The `password` parameter and the `password_hash` parameter cannot be used in the same request. */ password_hash?: string + /** A set of roles the user has. The roles determine the user's access permissions. To create a user without any roles, specify an empty list (`[]`). */ roles?: string[] + /** Specifies whether the user is enabled. */ enabled?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { username?: never, refresh?: never, email?: never, full_name?: never, metadata?: never, password?: never, password_hash?: never, roles?: never, enabled?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { username?: never, refresh?: never, email?: never, full_name?: never, metadata?: never, password?: never, password_hash?: never, roles?: never, enabled?: never } } export interface SecurityPutUserResponse { @@ -18542,17 +22453,31 @@ export interface SecurityQueryApiKeysApiKeyQueryContainer { } export interface SecurityQueryApiKeysRequest extends RequestBase { +/** Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors (effectively limited by it). An API key cannot retrieve any API key’s limited-by role descriptors (including itself) unless it has `manage_api_key` or higher privileges. */ with_limited_by?: boolean + /** Determines whether to also retrieve the profile UID for the API key owner principal. If it exists, the profile UID is returned under the `profile_uid` response field for each API key. */ with_profile_uid?: boolean + /** Determines whether aggregation names are prefixed by their respective types in the response. */ typed_keys?: boolean + /** Any aggregations to run over the corpus of returned API keys. Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. This supports only a subset of aggregation types, namely: `terms`, `range`, `date_range`, `missing`, `cardinality`, `value_count`, `composite`, `filter`, and `filters`. Additionally, aggregations only run over the same subset of fields that query works with. */ aggregations?: Record /** @alias aggregations */ + /** Any aggregations to run over the corpus of returned API keys. Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. This supports only a subset of aggregation types, namely: `terms`, `range`, `date_range`, `missing`, `cardinality`, `value_count`, `composite`, `filter`, and `filters`. Additionally, aggregations only run over the same subset of fields that query works with. */ aggs?: Record + /** A query to filter which API keys to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following public information associated with an API key: `id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`, `username`, `realm`, and `metadata`. NOTE: The queryable string values associated with API keys are internally mapped as keywords. Consequently, if no `analyzer` parameter is specified for a `match` query, then the provided match query string is interpreted as a single keyword value. Such a match query is hence equivalent to a `term` query. */ query?: SecurityQueryApiKeysApiKeyQueryContainer + /** The starting document offset. It must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. */ from?: integer + /** The sort definition. Other than `id`, all public fields of an API key are eligible for sorting. In addition, sort can also be applied to the `_doc` field to sort by index order. */ sort?: Sort + /** The number of hits to return. It must not be negative. The `size` parameter can be set to `0`, in which case no API key matches are returned, only the aggregation results. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. */ size?: integer + /** The search after definition. */ search_after?: SortResults + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { with_limited_by?: never, with_profile_uid?: never, typed_keys?: never, aggregations?: never, aggs?: never, query?: never, from?: never, sort?: never, size?: never, search_after?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { with_limited_by?: never, with_profile_uid?: never, typed_keys?: never, aggregations?: never, aggs?: never, query?: never, from?: never, sort?: never, size?: never, search_after?: never } } export interface SecurityQueryApiKeysResponse { @@ -18568,11 +22493,20 @@ export interface SecurityQueryRoleQueryRole extends SecurityRoleDescriptor { } export interface SecurityQueryRoleRequest extends RequestBase { +/** A query to filter which roles to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with roles: `name`, `description`, `metadata`, `applications.application`, `applications.privileges`, and `applications.resources`. */ query?: SecurityQueryRoleRoleQueryContainer + /** The starting document offset. It must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. */ from?: integer + /** The sort definition. You can sort on `username`, `roles`, or `enabled`. In addition, sort can also be applied to the `_doc` field to sort by index order. */ sort?: Sort + /** The number of hits to return. It must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. */ size?: integer + /** The search after definition. */ search_after?: SortResults + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { query?: never, from?: never, sort?: never, size?: never, search_after?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { query?: never, from?: never, sort?: never, size?: never, search_after?: never } } export interface SecurityQueryRoleResponse { @@ -18600,12 +22534,22 @@ export interface SecurityQueryUserQueryUser extends SecurityUser { } export interface SecurityQueryUserRequest extends RequestBase { +/** Determines whether to retrieve the user profile UID, if it exists, for the users. */ with_profile_uid?: boolean + /** A query to filter which users to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with user: `username`, `roles`, `enabled`, `full_name`, and `email`. */ query?: SecurityQueryUserUserQueryContainer + /** The starting document offset. It must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. */ from?: integer + /** The sort definition. Fields eligible for sorting are: `username`, `roles`, `enabled`. In addition, sort can also be applied to the `_doc` field to sort by index order. */ sort?: Sort + /** The number of hits to return. It must not be negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. */ size?: integer + /** The search after definition */ search_after?: SortResults + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { with_profile_uid?: never, query?: never, from?: never, sort?: never, size?: never, search_after?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { with_profile_uid?: never, query?: never, from?: never, sort?: never, size?: never, search_after?: never } } export interface SecurityQueryUserResponse { @@ -18629,9 +22573,16 @@ export interface SecurityQueryUserUserQueryContainer { } export interface SecuritySamlAuthenticateRequest extends RequestBase { +/** The SAML response as it was sent by the user's browser, usually a Base64 encoded XML document. */ content: string + /** A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. */ ids: Ids + /** The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. */ realm?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { content?: never, ids?: never, realm?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { content?: never, ids?: never, realm?: never } } export interface SecuritySamlAuthenticateResponse { @@ -18643,18 +22594,33 @@ export interface SecuritySamlAuthenticateResponse { } export interface SecuritySamlCompleteLogoutRequest extends RequestBase { +/** The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. */ realm: string + /** A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. */ ids: Ids + /** If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI. */ query_string?: string + /** If the SAML IdP sends the logout response with the HTTP-Post binding, this field must be set to the value of the SAMLResponse form parameter from the logout response. */ content?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { realm?: never, ids?: never, query_string?: never, content?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { realm?: never, ids?: never, query_string?: never, content?: never } } export type SecuritySamlCompleteLogoutResponse = boolean export interface SecuritySamlInvalidateRequest extends RequestBase { +/** The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the `realm` parameter. */ acs?: string + /** The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. This query should include a single parameter named `SAMLRequest` that contains a SAML logout request that is deflated and Base64 encoded. If the SAML IdP has signed the logout request, the URL should include two extra parameters named `SigAlg` and `Signature` that contain the algorithm used for the signature and the signature value itself. In order for Elasticsearch to be able to verify the IdP's signature, the value of the `query_string` field must be an exact match to the string provided by the browser. The client application must not attempt to parse or process the string in any way. */ query_string: string + /** The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the `acs` parameter. */ realm?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { acs?: never, query_string?: never, realm?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { acs?: never, query_string?: never, realm?: never } } export interface SecuritySamlInvalidateResponse { @@ -18664,8 +22630,14 @@ export interface SecuritySamlInvalidateResponse { } export interface SecuritySamlLogoutRequest extends RequestBase { +/** The access token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent token that was received after refreshing the original one by using a `refresh_token`. */ token: string + /** The refresh token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent refresh token that was received after refreshing the original access token. */ refresh_token?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { token?: never, refresh_token?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { token?: never, refresh_token?: never } } export interface SecuritySamlLogoutResponse { @@ -18673,9 +22645,16 @@ export interface SecuritySamlLogoutResponse { } export interface SecuritySamlPrepareAuthenticationRequest extends RequestBase { +/** The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. The realm is used to generate the authentication request. You must specify either this parameter or the `realm` parameter. */ acs?: string + /** The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. You must specify either this parameter or the `acs` parameter. */ realm?: string + /** A string that will be included in the redirect URL that this API returns as the `RelayState` query parameter. If the Authentication Request is signed, this value is used as part of the signature computation. */ relay_state?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { acs?: never, realm?: never, relay_state?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { acs?: never, realm?: never, relay_state?: never } } export interface SecuritySamlPrepareAuthenticationResponse { @@ -18685,7 +22664,12 @@ export interface SecuritySamlPrepareAuthenticationResponse { } export interface SecuritySamlServiceProviderMetadataRequest extends RequestBase { +/** The name of the SAML realm in Elasticsearch. */ realm_name: Name + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { realm_name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { realm_name?: never } } export interface SecuritySamlServiceProviderMetadataResponse { @@ -18698,10 +22682,18 @@ export interface SecuritySuggestUserProfilesHint { } export interface SecuritySuggestUserProfilesRequest extends RequestBase { +/** A query string used to match name-related fields in user profile documents. Name-related fields are the user's `username`, `full_name`, and `email`. */ name?: string + /** The number of profiles to return. */ size?: long + /** A comma-separated list of filters for the `data` field of the profile document. To return all content use `data=*`. To return a subset of content, use `data=` to retrieve content nested under the specified ``. By default, the API returns no `data` content. It is an error to specify `data` as both the query parameter and the request body field. */ data?: string | string[] + /** Extra search criteria to improve relevance of the suggestion result. Profiles matching the spcified hint are ranked higher in the response. Profiles not matching the hint aren't excluded from the response as long as the profile matches the `name` field query. */ hint?: SecuritySuggestUserProfilesHint + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, size?: never, data?: never, hint?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, size?: never, data?: never, hint?: never } } export interface SecuritySuggestUserProfilesResponse { @@ -18716,10 +22708,18 @@ export interface SecuritySuggestUserProfilesTotalUserProfiles { } export interface SecurityUpdateApiKeyRequest extends RequestBase { +/** The ID of the API key to update. */ id: Id + /** The role descriptors to assign to this API key. The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. You can assign new privileges by specifying them in this parameter. To remove assigned privileges, you can supply an empty `role_descriptors` parameter, that is to say, an empty object `{}`. If an API key has no assigned privileges, it inherits the owner user's full permissions. The snapshot of the owner's permissions is always updated, whether you supply the `role_descriptors` parameter or not. The structure of a role descriptor is the same as the request for the create API keys API. */ role_descriptors?: Record + /** Arbitrary metadata that you want to associate with the API key. It supports a nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. When specified, this value fully replaces the metadata previously associated with the API key. */ metadata?: Metadata + /** The expiration time for the API key. By default, API keys never expire. This property can be omitted to leave the expiration unchanged. */ expiration?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, role_descriptors?: never, metadata?: never, expiration?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, role_descriptors?: never, metadata?: never, expiration?: never } } export interface SecurityUpdateApiKeyResponse { @@ -18727,10 +22727,18 @@ export interface SecurityUpdateApiKeyResponse { } export interface SecurityUpdateCrossClusterApiKeyRequest extends RequestBase { +/** The ID of the cross-cluster API key to update. */ id: Id + /** The access to be granted to this API key. The access is composed of permissions for cross cluster search and cross cluster replication. At least one of them must be specified. When specified, the new access assignment fully replaces the previously assigned access. */ access: SecurityAccess + /** The expiration time for the API key. By default, API keys never expire. This property can be omitted to leave the value unchanged. */ expiration?: Duration + /** Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. When specified, this information fully replaces metadata previously associated with the API key. */ metadata?: Metadata + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, access?: never, expiration?: never, metadata?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, access?: never, expiration?: never, metadata?: never } } export interface SecurityUpdateCrossClusterApiKeyResponse { @@ -18738,11 +22746,20 @@ export interface SecurityUpdateCrossClusterApiKeyResponse { } export interface SecurityUpdateSettingsRequest extends RequestBase { +/** 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 + /** Settings for the index used for most security configuration, including native realm users and roles configured with the API. */ security?: SecuritySecuritySettings + /** Settings for the index used to store profile information. */ 'security-profile'?: SecuritySecuritySettings + /** Settings for the index used to store tokens. */ 'security-tokens'?: SecuritySecuritySettings + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never, security?: never, 'security-profile'?: never, 'security-tokens'?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never, security?: never, 'security-profile'?: never, 'security-tokens'?: never } } export interface SecurityUpdateSettingsResponse { @@ -18750,12 +22767,22 @@ export interface SecurityUpdateSettingsResponse { } export interface SecurityUpdateUserProfileDataRequest extends RequestBase { +/** A unique identifier for the user profile. */ uid: SecurityUserProfileId + /** Only perform the operation if the document has this sequence number. */ if_seq_no?: SequenceNumber + /** Only perform the operation if the document has this primary term. */ if_primary_term?: long + /** If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to make this operation visible to search. If 'false', nothing is done with refreshes. */ refresh?: Refresh + /** Searchable data that you want to associate with the user profile. This field supports a nested data structure. Within the labels object, top-level keys cannot begin with an underscore (`_`) or contain a period (`.`). */ labels?: Record + /** Non-searchable data that you want to associate with the user profile. This field supports a nested data structure. Within the `data` object, top-level keys cannot begin with an underscore (`_`) or contain a period (`.`). The data object is not searchable, but can be retrieved with the get user profile API. */ data?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { uid?: never, if_seq_no?: never, if_primary_term?: never, refresh?: never, labels?: never, data?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { uid?: never, if_seq_no?: never, if_primary_term?: never, refresh?: never, labels?: never, data?: never } } export type SecurityUpdateUserProfileDataResponse = AcknowledgedResponseBase @@ -18763,9 +22790,16 @@ export type SecurityUpdateUserProfileDataResponse = AcknowledgedResponseBase export type ShutdownType = 'restart' | 'remove' | 'replace' export interface ShutdownDeleteNodeRequest extends RequestBase { +/** The node id of node to be removed from the shutdown state */ node_id: NodeId + /** 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?: TimeUnit + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, master_timeout?: never, timeout?: never } } export type ShutdownDeleteNodeResponse = AcknowledgedResponseBase @@ -18790,8 +22824,14 @@ export interface ShutdownGetNodePluginsStatus { } export interface ShutdownGetNodeRequest extends RequestBase { +/** Which node for which to retrieve the shutdown status */ node_id?: NodeIds + /** 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?: TimeUnit + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, master_timeout?: never } } export interface ShutdownGetNodeResponse { @@ -18807,25 +22847,46 @@ export type ShutdownGetNodeShutdownStatus = 'not_started' | 'in_progress' | 'sta export type ShutdownGetNodeShutdownType = 'remove' | 'restart' export interface ShutdownPutNodeRequest extends RequestBase { +/** The node identifier. This parameter is not validated against the cluster's active nodes. This enables you to register a node for shut down while it is offline. No error is thrown if you specify an invalid node ID. */ node_id: NodeId + /** 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?: TimeUnit + /** The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: TimeUnit + /** Valid values are restart, remove, or replace. Use restart when you need to temporarily shut down a node to perform an upgrade, make configuration changes, or perform other maintenance. Because the node is expected to rejoin the cluster, data is not migrated off of the node. Use remove when you need to permanently remove a node from the cluster. The node is not marked ready for shutdown until data is migrated off of the node Use replace to do a 1:1 replacement of a node with another node. Certain allocation decisions will be ignored (such as disk watermarks) in the interest of true replacement of the source node with the target node. During a replace-type shutdown, rollover and index creation may result in unassigned shards, and shrink may fail until the replacement is complete. */ type: ShutdownType + /** A human-readable reason that the node is being shut down. This field provides information for other cluster operators; it does not affect the shut down process. */ reason: string + /** Only valid if type is restart. Controls how long Elasticsearch will wait for the node to restart and join the cluster before reassigning its shards to other nodes. This works the same as delaying allocation with the index.unassigned.node_left.delayed_timeout setting. If you specify both a restart allocation delay and an index-level allocation delay, the longer of the two is used. */ allocation_delay?: string + /** Only valid if type is replace. Specifies the name of the node that is replacing the node being shut down. Shards from the shut down node are only allowed to be allocated to the target node, and no other data will be allocated to the target node. During relocation of data certain allocation rules are ignored, such as disk watermarks or user attribute filtering rules. */ target_node_name?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { node_id?: never, master_timeout?: never, timeout?: never, type?: never, reason?: never, allocation_delay?: never, target_node_name?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { node_id?: never, master_timeout?: never, timeout?: never, type?: never, reason?: never, allocation_delay?: never, target_node_name?: never } } export type ShutdownPutNodeResponse = AcknowledgedResponseBase export interface SimulateIngestRequest extends RequestBase { +/** The index to simulate ingesting into. This value can be overridden by specifying an index on each document. If you specify this parameter in the request path, it is used for any documents that do not explicitly specify an index argument. */ index?: IndexName + /** The pipeline to use as the default pipeline. This value can be used to override the default pipeline of the index. */ pipeline?: PipelineName + /** Sample documents to test in the pipeline. */ docs: IngestDocument[] + /** A map of component template names to substitute component template definition objects. */ component_template_substitutions?: Record + /** A map of index template names to substitute index template definition objects. */ index_template_subtitutions?: Record mapping_addition?: MappingTypeMapping + /** Pipelines to test. If you don’t specify the `pipeline` request path parameter, this parameter is required. If you specify both this and the request path parameter, the API only uses the request path parameter. */ pipeline_substitutions?: Record + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { index?: never, pipeline?: never, docs?: never, component_template_substitutions?: never, index_template_subtitutions?: never, mapping_addition?: never, pipeline_substitutions?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { index?: never, pipeline?: never, docs?: never, component_template_substitutions?: never, index_template_subtitutions?: never, mapping_addition?: never, pipeline_substitutions?: never } } export interface SimulateIngestResponse { @@ -18898,17 +22959,31 @@ export interface SlmStatistics { } export interface SlmDeleteLifecycleRequest extends RequestBase { +/** The id of the snapshot lifecycle policy to remove */ policy_id: Name + /** 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 + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { policy_id?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { policy_id?: never, master_timeout?: never, timeout?: never } } export type SlmDeleteLifecycleResponse = AcknowledgedResponseBase export interface SlmExecuteLifecycleRequest extends RequestBase { +/** The id of the snapshot lifecycle policy to be executed */ policy_id: Name + /** 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 + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { policy_id?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { policy_id?: never, master_timeout?: never, timeout?: never } } export interface SlmExecuteLifecycleResponse { @@ -18916,23 +22991,42 @@ export interface SlmExecuteLifecycleResponse { } export interface SlmExecuteRetentionRequest extends RequestBase { +/** 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 + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never } } export type SlmExecuteRetentionResponse = AcknowledgedResponseBase export interface SlmGetLifecycleRequest extends RequestBase { +/** Comma-separated list of snapshot lifecycle policies to retrieve */ policy_id?: Names + /** 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 + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { policy_id?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { policy_id?: never, master_timeout?: never, timeout?: never } } export type SlmGetLifecycleResponse = Record export interface SlmGetStatsRequest extends RequestBase { +/** 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 + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never } } export interface SlmGetStatsResponse { @@ -18949,8 +23043,14 @@ export interface SlmGetStatsResponse { } export interface SlmGetStatusRequest extends RequestBase { +/** 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. To indicate that the request should never timeout, set it to `-1`. */ 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. To indicate that the request should never timeout, set it to `-1`. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never } } export interface SlmGetStatusResponse { @@ -18958,28 +23058,52 @@ export interface SlmGetStatusResponse { } export interface SlmPutLifecycleRequest extends RequestBase { +/** The identifier for the snapshot lifecycle policy you want to create or update. */ policy_id: Name + /** 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. To indicate that the request should never timeout, set it to `-1`. */ 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. To indicate that the request should never timeout, set it to `-1`. */ timeout?: Duration + /** Configuration for each snapshot created by the policy. */ config?: SlmConfiguration + /** Name automatically assigned to each snapshot created by the policy. Date math is supported. To prevent conflicting snapshot names, a UUID is automatically appended to each snapshot name. */ name?: Name + /** Repository used to store snapshots created by this policy. This repository must exist prior to the policy’s creation. You can create a repository using the snapshot repository API. */ repository?: string + /** Retention rules used to retain and delete snapshots created by the policy. */ retention?: SlmRetention + /** Periodic or absolute schedule at which the policy creates snapshots. SLM applies schedule changes immediately. */ schedule?: WatcherCronExpression + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { policy_id?: never, master_timeout?: never, timeout?: never, config?: never, name?: never, repository?: never, retention?: never, schedule?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { policy_id?: never, master_timeout?: never, timeout?: never, config?: never, name?: never, repository?: never, retention?: never, schedule?: never } } export type SlmPutLifecycleResponse = AcknowledgedResponseBase export interface SlmStartRequest extends RequestBase { +/** 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. To indicate that the request should never timeout, set it to `-1`. */ 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. To indicate that the request should never timeout, set it to `-1`. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never } } export type SlmStartResponse = AcknowledgedResponseBase export interface SlmStopRequest extends RequestBase { +/** 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. To indicate that the request should never timeout, set it to `-1`. */ 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. To indicate that the request should never timeout, set it to `-1`. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never } } export type SlmStopResponse = AcknowledgedResponseBase @@ -19195,9 +23319,16 @@ export interface SnapshotCleanupRepositoryCleanupRepositoryResults { } export interface SnapshotCleanupRepositoryRequest extends RequestBase { +/** The name of the snapshot repository to clean up. */ name: Name + /** The period to wait for a connection to the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1` */ master_timeout?: Duration + /** The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. To indicate that the request should never timeout, set it to `-1`. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export interface SnapshotCleanupRepositoryResponse { @@ -19205,28 +23336,53 @@ export interface SnapshotCleanupRepositoryResponse { } export interface SnapshotCloneRequest extends RequestBase { +/** The name of the snapshot repository that both source and target snapshot belong to. */ repository: Name + /** The source snapshot name. */ snapshot: Name + /** The target snapshot name. */ target_snapshot: Name + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** The period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** A comma-separated list of indices to include in the snapshot. Multi-target syntax is supported. */ indices: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { repository?: never, snapshot?: never, target_snapshot?: never, master_timeout?: never, timeout?: never, indices?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { repository?: never, snapshot?: never, target_snapshot?: never, master_timeout?: never, timeout?: never, indices?: never } } export type SnapshotCloneResponse = AcknowledgedResponseBase export interface SnapshotCreateRequest extends RequestBase { +/** The name of the repository for the snapshot. */ repository: Name + /** The name of the snapshot. It supportes date math. It must be unique in the repository. */ snapshot: Name + /** 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 + /** If `true`, the request returns a response when the snapshot is complete. If `false`, the request returns a response when the snapshot initializes. */ wait_for_completion?: boolean + /** Determines how wildcard patterns in the `indices` parameter match data streams and indices. It supports comma-separated values such as `open,hidden`. */ expand_wildcards?: ExpandWildcards + /** The feature states to include in the snapshot. Each feature state includes one or more system indices containing related data. You can view a list of eligible features using the get features API. If `include_global_state` is `true`, all current feature states are included by default. If `include_global_state` is `false`, no feature states are included by default. Note that specifying an empty array will result in the default behavior. To exclude all feature states, regardless of the `include_global_state` value, specify an array with only the value `none` (`["none"]`). */ feature_states?: string[] + /** If `true`, the request ignores data streams and indices in `indices` that are missing or closed. If `false`, the request returns an error for any data stream or index that is missing or closed. */ ignore_unavailable?: boolean + /** If `true`, the current cluster state is included in the snapshot. The cluster state includes persistent cluster settings, composable index templates, legacy index templates, ingest pipelines, and ILM policies. It also includes data stored in system indices, such as Watches and task records (configurable via `feature_states`). */ include_global_state?: boolean + /** A comma-separated list of data streams and indices to include in the snapshot. It supports a multi-target syntax. The default is an empty array (`[]`), which includes all regular data streams and regular indices. To exclude all data streams and indices, use `-*`. You can't use this parameter to include or exclude system indices or system data streams from a snapshot. Use `feature_states` instead. */ indices?: Indices + /** Arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. It can have any contents but it must be less than 1024 bytes. This information is not automatically generated by Elasticsearch. */ metadata?: Metadata + /** If `true`, it enables you to restore a partial snapshot of indices with unavailable shards. Only shards that were successfully included in the snapshot will be restored. All missing shards will be recreated as empty. If `false`, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. */ partial?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { repository?: never, snapshot?: never, master_timeout?: never, wait_for_completion?: never, expand_wildcards?: never, feature_states?: never, ignore_unavailable?: never, include_global_state?: never, indices?: never, metadata?: never, partial?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { repository?: never, snapshot?: never, master_timeout?: never, wait_for_completion?: never, expand_wildcards?: never, feature_states?: never, ignore_unavailable?: never, include_global_state?: never, indices?: never, metadata?: never, partial?: never } } export interface SnapshotCreateResponse { @@ -19235,47 +23391,88 @@ export interface SnapshotCreateResponse { } export interface SnapshotCreateRepositoryRequest extends RequestBase { +/** The name of the snapshot repository to register or update. */ name: Name + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. To indicate that the request should never timeout, set it to `-1`. */ timeout?: Duration + /** If `true`, the request verifies the repository is functional on all master and data nodes in the cluster. If `false`, this verification is skipped. You can also perform this verification with the verify snapshot repository API. */ verify?: boolean repository?: SnapshotRepository + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never, verify?: never, repository?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never, verify?: never, repository?: never } } export type SnapshotCreateRepositoryResponse = AcknowledgedResponseBase export interface SnapshotDeleteRequest extends RequestBase { +/** The name of the repository to delete a snapshot from. */ repository: Name + /** A comma-separated list of snapshot names to delete. It also accepts wildcards (`*`). */ snapshot: Name + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { repository?: never, snapshot?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { repository?: never, snapshot?: never, master_timeout?: never } } export type SnapshotDeleteResponse = AcknowledgedResponseBase export interface SnapshotDeleteRepositoryRequest extends RequestBase { +/** The ame of the snapshot repositories to unregister. Wildcard (`*`) patterns are supported. */ name: Names + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. To indicate that the request should never timeout, set it to `-1`. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export type SnapshotDeleteRepositoryResponse = AcknowledgedResponseBase export interface SnapshotGetRequest extends RequestBase { +/** A comma-separated list of snapshot repository names used to limit the request. Wildcard (`*`) expressions are supported. */ repository: Name + /** A comma-separated list of snapshot names to retrieve Wildcards (`*`) are supported. * To get information about all snapshots in a registered repository, use a wildcard (`*`) or `_all`. * To get information about any snapshots that are currently running, use `_current`. */ snapshot: Names + /** An offset identifier to start pagination from as returned by the next field in the response body. */ after?: string + /** The value of the current sort column at which to start retrieval. It can be a string `snapshot-` or a repository name when sorting by snapshot or repository name. It can be a millisecond time value or a number when sorting by `index-` or shard count. */ from_sort_value?: string + /** If `false`, the request returns an error for any snapshots that are unavailable. */ ignore_unavailable?: boolean + /** If `true`, the response includes additional information about each index in the snapshot comprising the number of shards in the index, the total size of the index in bytes, and the maximum number of segments per shard in the index. The default is `false`, meaning that this information is omitted. */ index_details?: boolean + /** If `true`, the response includes the name of each index in each snapshot. */ index_names?: boolean + /** If `true`, the response includes the repository name in each snapshot. */ include_repository?: 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 sort order. Valid values are `asc` for ascending and `desc` for descending order. The default behavior is ascending order. */ order?: SortOrder + /** Numeric offset to start pagination from based on the snapshots matching this request. Using a non-zero value for this parameter is mutually exclusive with using the after parameter. Defaults to 0. */ offset?: integer + /** The maximum number of snapshots to return. The default is 0, which means to return all that match the request without limit. */ size?: integer + /** Filter snapshots by a comma-separated list of snapshot lifecycle management (SLM) policy names that snapshots belong to. You can use wildcards (`*`) and combinations of wildcards followed by exclude patterns starting with `-`. For example, the pattern `*,-policy-a-\*` will return all snapshots except for those that were created by an SLM policy with a name starting with `policy-a-`. Note that the wildcard pattern `*` matches all snapshots created by an SLM policy but not those snapshots that were not created by an SLM policy. To include snapshots that were not created by an SLM policy, you can use the special pattern `_none` that will match all snapshots without an SLM policy. */ slm_policy_filter?: Name + /** The sort order for the result. The default behavior is sorting by snapshot start time stamp. */ sort?: SnapshotSnapshotSort + /** If `true`, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted. NOTE: The parameters `size`, `order`, `after`, `from_sort_value`, `offset`, `slm_policy_filter`, and `sort` are not supported when you set `verbose=false` and the sort order for requests with `verbose=false` is undefined. */ verbose?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { repository?: never, snapshot?: never, after?: never, from_sort_value?: never, ignore_unavailable?: never, index_details?: never, index_names?: never, include_repository?: never, master_timeout?: never, order?: never, offset?: never, size?: never, slm_policy_filter?: never, sort?: never, verbose?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { repository?: never, snapshot?: never, after?: never, from_sort_value?: never, ignore_unavailable?: never, index_details?: never, index_names?: never, include_repository?: never, master_timeout?: never, order?: never, offset?: never, size?: never, slm_policy_filter?: never, sort?: never, verbose?: never } } export interface SnapshotGetResponse { @@ -19293,42 +23490,204 @@ export interface SnapshotGetSnapshotResponseItem { } export interface SnapshotGetRepositoryRequest extends RequestBase { +/** A comma-separated list of snapshot repository names used to limit the request. Wildcard (`*`) expressions are supported including combining wildcards with exclude patterns starting with `-`. To get information about all snapshot repositories registered in the cluster, omit this parameter or use `*` or `_all`. */ name?: Names + /** If `true`, the request gets information from the local node only. If `false`, the request gets information from the master node. */ local?: boolean + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, local?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, local?: never, master_timeout?: never } } export type SnapshotGetRepositoryResponse = Record +export interface SnapshotRepositoryAnalyzeBlobDetails { + name: string + overwritten: boolean + read_early: boolean + read_end: long + read_start: long + reads: SnapshotRepositoryAnalyzeReadBlobDetails + size: ByteSize + size_bytes: long +} + +export interface SnapshotRepositoryAnalyzeDetailsInfo { + blob: SnapshotRepositoryAnalyzeBlobDetails + overwrite_elapsed?: Duration + overwrite_elapsed_nanos?: DurationValue + write_elapsed: Duration + write_elapsed_nanos: DurationValue + write_throttled: Duration + write_throttled_nanos: DurationValue + writer_node: SnapshotRepositoryAnalyzeNodeInfo +} + +export interface SnapshotRepositoryAnalyzeNodeInfo { + id: Id + name: Name +} + +export interface SnapshotRepositoryAnalyzeReadBlobDetails { + before_write_complete?: boolean + elapsed?: Duration + elapsed_nanos?: DurationValue + first_byte_time?: Duration + first_byte_time_nanos: DurationValue + found: boolean + node: SnapshotRepositoryAnalyzeNodeInfo + throttled?: Duration + throttled_nanos?: DurationValue +} + +export interface SnapshotRepositoryAnalyzeReadSummaryInfo { + count: integer + max_wait: Duration + max_wait_nanos: DurationValue + total_elapsed: Duration + total_elapsed_nanos: DurationValue + total_size: ByteSize + total_size_bytes: long + total_throttled: Duration + total_throttled_nanos: DurationValue + total_wait: Duration + total_wait_nanos: DurationValue +} + +export interface SnapshotRepositoryAnalyzeRequest extends RequestBase { +/** The name of the repository. */ + name: Name + /** The total number of blobs to write to the repository during the test. For realistic experiments, you should set it to at least `2000`. */ + blob_count?: integer + /** The number of operations to run concurrently during the test. */ + concurrency?: integer + /** Indicates whether to return detailed results, including timing information for every operation performed during the analysis. If false, it returns only a summary of the analysis. */ + detailed?: boolean + /** The number of nodes on which to perform an early read operation while writing each blob. Early read operations are only rarely performed. */ + early_read_node_count?: integer + /** The maximum size of a blob to be written during the test. For realistic experiments, you should set it to at least `2gb`. */ + max_blob_size?: ByteSize + /** An upper limit on the total size of all the blobs written during the test. For realistic experiments, you should set it to at least `1tb`. */ + max_total_data_size?: ByteSize + /** The probability of performing a rare action such as an early read, an overwrite, or an aborted write on each blob. */ + rare_action_probability?: double + /** Indicates whether to rarely cancel writes before they complete. */ + rarely_abort_writes?: boolean + /** The number of nodes on which to read a blob after writing. */ + read_node_count?: integer + /** The minimum number of linearizable register operations to perform in total. For realistic experiments, you should set it to at least `100`. */ + register_operation_count?: integer + /** The seed for the pseudo-random number generator used to generate the list of operations performed during the test. To repeat the same set of operations in multiple experiments, use the same seed in each experiment. Note that the operations are performed concurrently so might not always happen in the same order on each run. */ + seed?: integer + /** The period of time to wait for the test to complete. If no response is received before the timeout expires, the test is cancelled and returns an error. */ + timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, blob_count?: never, concurrency?: never, detailed?: never, early_read_node_count?: never, max_blob_size?: never, max_total_data_size?: never, rare_action_probability?: never, rarely_abort_writes?: never, read_node_count?: never, register_operation_count?: never, seed?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, blob_count?: never, concurrency?: never, detailed?: never, early_read_node_count?: never, max_blob_size?: never, max_total_data_size?: never, rare_action_probability?: never, rarely_abort_writes?: never, read_node_count?: never, register_operation_count?: never, seed?: never, timeout?: never } +} + +export interface SnapshotRepositoryAnalyzeResponse { + blob_count: integer + blob_path: string + concurrency: integer + coordinating_node: SnapshotRepositoryAnalyzeNodeInfo + delete_elapsed: Duration + delete_elapsed_nanos: DurationValue + details: SnapshotRepositoryAnalyzeDetailsInfo + early_read_node_count: integer + issues_detected: string[] + listing_elapsed: Duration + listing_elapsed_nanos: DurationValue + max_blob_size: ByteSize + max_blob_size_bytes: long + max_total_data_size: ByteSize + max_total_data_size_bytes: long + rare_action_probability: double + read_node_count: integer + repository: string + seed: long + summary: SnapshotRepositoryAnalyzeSummaryInfo +} + +export interface SnapshotRepositoryAnalyzeSummaryInfo { + read: SnapshotRepositoryAnalyzeReadSummaryInfo + write: SnapshotRepositoryAnalyzeWriteSummaryInfo +} + +export interface SnapshotRepositoryAnalyzeWriteSummaryInfo { + count: integer + total_elapsed: Duration + total_elapsed_nanos: DurationValue + total_size: ByteSize + total_size_bytes: long + total_throttled: Duration + total_throttled_nanos: long +} + export interface SnapshotRepositoryVerifyIntegrityRequest extends RequestBase { +/** The name of the snapshot repository. */ name: Names + /** If `verify_blob_contents` is `true`, this parameter specifies how many blobs to verify at once. */ blob_thread_pool_concurrency?: integer + /** The maximum number of index snapshots to verify concurrently within each index verification. */ index_snapshot_verification_concurrency?: integer + /** The number of indices to verify concurrently. The default behavior is to use the entire `snapshot_meta` thread pool. */ index_verification_concurrency?: integer + /** If `verify_blob_contents` is `true`, this parameter specifies the maximum amount of data that Elasticsearch will read from the repository every second. */ max_bytes_per_sec?: string + /** The number of shard snapshot failures to track during integrity verification, in order to avoid excessive resource usage. If your repository contains more than this number of shard snapshot failures, the verification will fail. */ max_failed_shard_snapshots?: integer + /** The maximum number of snapshot metadata operations to run concurrently. The default behavior is to use at most half of the `snapshot_meta` thread pool at once. */ meta_thread_pool_concurrency?: integer + /** The number of snapshots to verify concurrently. The default behavior is to use at most half of the `snapshot_meta` thread pool at once. */ snapshot_verification_concurrency?: integer + /** Indicates whether to verify the checksum of every data blob in the repository. If this feature is enabled, Elasticsearch will read the entire repository contents, which may be extremely slow and expensive. */ verify_blob_contents?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, blob_thread_pool_concurrency?: never, index_snapshot_verification_concurrency?: never, index_verification_concurrency?: never, max_bytes_per_sec?: never, max_failed_shard_snapshots?: never, meta_thread_pool_concurrency?: never, snapshot_verification_concurrency?: never, verify_blob_contents?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, blob_thread_pool_concurrency?: never, index_snapshot_verification_concurrency?: never, index_verification_concurrency?: never, max_bytes_per_sec?: never, max_failed_shard_snapshots?: never, meta_thread_pool_concurrency?: never, snapshot_verification_concurrency?: never, verify_blob_contents?: never } } export type SnapshotRepositoryVerifyIntegrityResponse = any export interface SnapshotRestoreRequest extends RequestBase { +/** The name of the repository to restore a snapshot from. */ repository: Name + /** The name of the snapshot to restore. */ snapshot: Name + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** If `true`, the request returns a response when the restore operation completes. The operation is complete when it finishes all attempts to recover primary shards for restored indices. This applies even if one or more of the recovery attempts fail. If `false`, the request returns a response when the restore operation initializes. */ wait_for_completion?: boolean + /** The feature states to restore. If `include_global_state` is `true`, the request restores all feature states in the snapshot by default. If `include_global_state` is `false`, the request restores no feature states by default. Note that specifying an empty array will result in the default behavior. To restore no feature states, regardless of the `include_global_state` value, specify an array containing only the value `none` (`["none"]`). */ feature_states?: string[] + /** The index settings to not restore from the snapshot. You can't use this option to ignore `index.number_of_shards`. For data streams, this option applies only to restored backing indices. New backing indices are configured using the data stream's matching index template. */ ignore_index_settings?: string[] + /** If `true`, the request ignores any index or data stream in indices that's missing from the snapshot. If `false`, the request returns an error for any missing index or data stream. */ ignore_unavailable?: boolean + /** If `true`, the request restores aliases for any restored data streams and indices. If `false`, the request doesn’t restore aliases. */ include_aliases?: boolean + /** If `true`, restore the cluster state. The cluster state includes: * Persistent cluster settings * Index templates * Legacy index templates * Ingest pipelines * Index lifecycle management (ILM) policies * Stored scripts * For snapshots taken after 7.12.0, feature states If `include_global_state` is `true`, the restore operation merges the legacy index templates in your cluster with the templates contained in the snapshot, replacing any existing ones whose name matches one in the snapshot. It completely removes all persistent settings, non-legacy index templates, ingest pipelines, and ILM lifecycle policies that exist in your cluster and replaces them with the corresponding items from the snapshot. Use the `feature_states` parameter to configure how feature states are restored. If `include_global_state` is `true` and a snapshot was created without a global state then the restore request will fail. */ include_global_state?: boolean + /** Index settings to add or change in restored indices, including backing indices. You can't use this option to change `index.number_of_shards`. For data streams, this option applies only to restored backing indices. New backing indices are configured using the data stream's matching index template. */ index_settings?: IndicesIndexSettings + /** A comma-separated list of indices and data streams to restore. It supports a multi-target syntax. The default behavior is all regular indices and regular data streams in the snapshot. You can't use this parameter to restore system indices or system data streams. Use `feature_states` instead. */ indices?: Indices + /** If `false`, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. If true, it allows restoring a partial snapshot of indices with unavailable shards. Only shards that were successfully included in the snapshot will be restored. All missing shards will be recreated as empty. */ partial?: boolean + /** A rename pattern to apply to restored data streams and indices. Data streams and indices matching the rename pattern will be renamed according to `rename_replacement`. The rename pattern is applied as defined by the regular expression that supports referencing the original text, according to the `appendReplacement` logic. */ rename_pattern?: string + /** The rename replacement string that is used with the `rename_pattern`. */ rename_replacement?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { repository?: never, snapshot?: never, master_timeout?: never, wait_for_completion?: never, feature_states?: never, ignore_index_settings?: never, ignore_unavailable?: never, include_aliases?: never, include_global_state?: never, index_settings?: never, indices?: never, partial?: never, rename_pattern?: never, rename_replacement?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { repository?: never, snapshot?: never, master_timeout?: never, wait_for_completion?: never, feature_states?: never, ignore_index_settings?: never, ignore_unavailable?: never, include_aliases?: never, include_global_state?: never, index_settings?: never, indices?: never, partial?: never, rename_pattern?: never, rename_replacement?: never } } export interface SnapshotRestoreResponse { @@ -19343,10 +23702,18 @@ export interface SnapshotRestoreSnapshotRestore { } export interface SnapshotStatusRequest extends RequestBase { +/** The snapshot repository name used to limit the request. It supports wildcards (`*`) if `` isn't specified. */ repository?: Name + /** A comma-separated list of snapshots to retrieve status for. The default is currently running snapshots. Wildcards (`*`) are not supported. */ snapshot?: Names + /** If `false`, the request returns an error for any snapshots that are unavailable. If `true`, the request ignores snapshots that are unavailable, such as those that are corrupted or temporarily cannot be returned. */ ignore_unavailable?: boolean + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { repository?: never, snapshot?: never, ignore_unavailable?: never, master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { repository?: never, snapshot?: never, ignore_unavailable?: never, master_timeout?: never } } export interface SnapshotStatusResponse { @@ -19358,9 +23725,16 @@ export interface SnapshotVerifyRepositoryCompactNodeInfo { } export interface SnapshotVerifyRepositoryRequest extends RequestBase { +/** The name of the snapshot repository to verify. */ name: Name + /** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. To indicate that the request should never timeout, set it to `-1`. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { name?: never, master_timeout?: never, timeout?: never } } export interface SnapshotVerifyRepositoryResponse { @@ -19375,7 +23749,12 @@ export interface SqlColumn { export type SqlRow = any[] export interface SqlClearCursorRequest extends RequestBase { +/** Cursor to clear. */ cursor: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { cursor?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { cursor?: never } } export interface SqlClearCursorResponse { @@ -19383,17 +23762,31 @@ export interface SqlClearCursorResponse { } export interface SqlDeleteAsyncRequest extends RequestBase { +/** The identifier for the search. */ id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export type SqlDeleteAsyncResponse = AcknowledgedResponseBase export interface SqlGetAsyncRequest extends RequestBase { +/** The identifier for the search. */ id: Id + /** The separator for CSV results. The API supports this parameter only for CSV responses. */ delimiter?: string + /** The format for the response. You must specify a format using this parameter or the `Accept` HTTP header. If you specify both, the API uses this parameter. */ format?: string + /** The retention period for the search and its results. It defaults to the `keep_alive` period for the original SQL search. */ keep_alive?: Duration + /** The period to wait for complete results. It defaults to no timeout, meaning the request waits for complete search results. */ wait_for_completion_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, delimiter?: never, format?: never, keep_alive?: never, wait_for_completion_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, delimiter?: never, format?: never, keep_alive?: never, wait_for_completion_timeout?: never } } export interface SqlGetAsyncResponse { @@ -19406,7 +23799,12 @@ export interface SqlGetAsyncResponse { } export interface SqlGetAsyncStatusRequest extends RequestBase { +/** The identifier for the search. */ id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export interface SqlGetAsyncStatusResponse { @@ -19419,24 +23817,46 @@ export interface SqlGetAsyncStatusResponse { } export interface SqlQueryRequest extends RequestBase { +/** The format for the response. You can also specify a format using the `Accept` HTTP header. If you specify both this parameter and the `Accept` HTTP header, this parameter takes precedence. */ format?: SqlQuerySqlFormat + /** If `true`, the response has partial results when there are shard request timeouts or shard failures. If `false`, the API returns an error with no partial results. */ allow_partial_search_results?: boolean + /** The default catalog (cluster) for queries. If unspecified, the queries execute on the data in the local cluster only. */ catalog?: string + /** If `true`, the results are in a columnar fashion: one row represents all the values of a certain column from the current page of results. The API supports this parameter only for CBOR, JSON, SMILE, and YAML responses. */ columnar?: boolean + /** The cursor used to retrieve a set of paginated results. If you specify a cursor, the API only uses the `columnar` and `time_zone` request body parameters. It ignores other request body parameters. */ cursor?: string + /** The maximum number of rows (or entries) to return in one response. */ fetch_size?: integer + /** If `false`, the API returns an exception when encountering multiple values for a field. If `true`, the API is lenient and returns the first value from the array with no guarantee of consistent results. */ field_multi_value_leniency?: boolean + /** The Elasticsearch query DSL for additional filtering. */ filter?: QueryDslQueryContainer + /** If `true`, the search can run on frozen indices. */ index_using_frozen?: boolean + /** The retention period for an async or saved synchronous search. */ keep_alive?: Duration + /** If `true`, Elasticsearch stores synchronous searches if you also specify the `wait_for_completion_timeout` parameter. If `false`, Elasticsearch only stores async searches that don't finish before the `wait_for_completion_timeout`. */ keep_on_completion?: boolean + /** The minimum retention period for the scroll cursor. After this time period, a pagination request might fail because the scroll cursor is no longer available. Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of `page_timeout` in the scroll request. */ page_timeout?: Duration + /** The values for parameters in the query. */ params?: Record + /** The SQL query to run. */ query?: string + /** The timeout before the request fails. */ request_timeout?: Duration + /** One or more runtime fields for the search request. These fields take precedence over mapped fields with the same name. */ runtime_mappings?: MappingRuntimeFields + /** The ISO-8601 time zone ID for the search. */ time_zone?: TimeZone + /** The period to wait for complete results. It defaults to no timeout, meaning the request waits for complete search results. If the search doesn't finish within this period, the search becomes async. To save a synchronous search, you must specify this parameter and the `keep_on_completion` parameter. */ wait_for_completion_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { format?: never, allow_partial_search_results?: never, catalog?: never, columnar?: never, cursor?: never, fetch_size?: never, field_multi_value_leniency?: never, filter?: never, index_using_frozen?: never, keep_alive?: never, keep_on_completion?: never, page_timeout?: never, params?: never, query?: never, request_timeout?: never, runtime_mappings?: never, time_zone?: never, wait_for_completion_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { format?: never, allow_partial_search_results?: never, catalog?: never, columnar?: never, cursor?: never, fetch_size?: never, field_multi_value_leniency?: never, filter?: never, index_using_frozen?: never, keep_alive?: never, keep_on_completion?: never, page_timeout?: never, params?: never, query?: never, request_timeout?: never, runtime_mappings?: never, time_zone?: never, wait_for_completion_timeout?: never } } export interface SqlQueryResponse { @@ -19451,10 +23871,18 @@ export interface SqlQueryResponse { export type SqlQuerySqlFormat = 'csv' | 'json' | 'tsv' | 'txt' | 'yaml' | 'cbor' | 'smile' export interface SqlTranslateRequest extends RequestBase { +/** The maximum number of rows (or entries) to return in one response. */ fetch_size?: integer + /** The Elasticsearch query DSL for additional filtering. */ filter?: QueryDslQueryContainer + /** The SQL query to run. */ query: string + /** The ISO-8601 time zone ID for the search. */ time_zone?: TimeZone + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { fetch_size?: never, filter?: never, query?: never, time_zone?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { fetch_size?: never, filter?: never, query?: never, time_zone?: never } } export interface SqlTranslateResponse { @@ -19478,6 +23906,10 @@ export interface SslCertificatesCertificateInformation { } export interface SslCertificatesRequest extends RequestBase { + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } } export type SslCertificatesResponse = SslCertificatesCertificateInformation[] @@ -19500,22 +23932,40 @@ export interface SynonymsSynonymsUpdateResult { } export interface SynonymsDeleteSynonymRequest extends RequestBase { +/** The synonyms set identifier to delete. */ id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export type SynonymsDeleteSynonymResponse = AcknowledgedResponseBase export interface SynonymsDeleteSynonymRuleRequest extends RequestBase { +/** The ID of the synonym set to update. */ set_id: Id + /** The ID of the synonym rule to delete. */ rule_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { set_id?: never, rule_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { set_id?: never, rule_id?: never } } export type SynonymsDeleteSynonymRuleResponse = SynonymsSynonymsUpdateResult export interface SynonymsGetSynonymRequest extends RequestBase { +/** The synonyms set identifier to retrieve. */ id: Id + /** The starting offset for query rules to retrieve. */ from?: integer + /** The max number of query rules to retrieve. */ size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, from?: never, size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, from?: never, size?: never } } export interface SynonymsGetSynonymResponse { @@ -19524,15 +23974,27 @@ export interface SynonymsGetSynonymResponse { } export interface SynonymsGetSynonymRuleRequest extends RequestBase { +/** The ID of the synonym set to retrieve the synonym rule from. */ set_id: Id + /** The ID of the synonym rule to retrieve. */ rule_id: Id + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { set_id?: never, rule_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { set_id?: never, rule_id?: never } } export type SynonymsGetSynonymRuleResponse = SynonymsSynonymRuleRead export interface SynonymsGetSynonymsSetsRequest extends RequestBase { +/** The starting offset for synonyms sets to retrieve. */ from?: integer + /** The maximum number of synonyms sets to retrieve. */ size?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { from?: never, size?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { from?: never, size?: never } } export interface SynonymsGetSynonymsSetsResponse { @@ -19546,8 +24008,14 @@ export interface SynonymsGetSynonymsSetsSynonymsSetItem { } export interface SynonymsPutSynonymRequest extends RequestBase { +/** The ID of the synonyms set to be created or updated. */ id: Id + /** The synonym rules definitions for the synonyms set. */ synonyms_set: SynonymsSynonymRule | SynonymsSynonymRule[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, synonyms_set?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, synonyms_set?: never } } export interface SynonymsPutSynonymResponse { @@ -19556,9 +24024,16 @@ export interface SynonymsPutSynonymResponse { } export interface SynonymsPutSynonymRuleRequest extends RequestBase { +/** The ID of the synonym set. */ set_id: Id + /** The ID of the synonym rule to be updated or created. */ rule_id: Id + /** The synonym rule information definition, which must be in Solr format. */ synonyms: SynonymsSynonymString + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { set_id?: never, rule_id?: never, synonyms?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { set_id?: never, rule_id?: never, synonyms?: never } } export type SynonymsPutSynonymRuleResponse = SynonymsSynonymsUpdateResult @@ -19605,19 +24080,35 @@ export interface TasksTaskListResponseBase { } export interface TasksCancelRequest extends RequestBase { +/** The task identifier. */ task_id?: TaskId + /** A comma-separated list or wildcard expression of actions that is used to limit the request. */ actions?: string | string[] + /** A comma-separated list of node IDs or names that is used to limit the request. */ nodes?: string[] + /** A parent task ID that is used to limit the tasks. */ parent_task_id?: string + /** If true, the request blocks until all found tasks are complete. */ wait_for_completion?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_id?: never, actions?: never, nodes?: never, parent_task_id?: never, wait_for_completion?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_id?: never, actions?: never, nodes?: never, parent_task_id?: never, wait_for_completion?: never } } export type TasksCancelResponse = TasksTaskListResponseBase export interface TasksGetRequest extends RequestBase { +/** The task identifier. */ task_id: Id + /** 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 + /** If `true`, the request blocks until the task has completed. */ wait_for_completion?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { task_id?: never, timeout?: never, wait_for_completion?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { task_id?: never, timeout?: never, wait_for_completion?: never } } export interface TasksGetResponse { @@ -19628,13 +24119,24 @@ export interface TasksGetResponse { } export interface TasksListRequest extends RequestBase { +/** A comma-separated list or wildcard expression of actions used to limit the request. For example, you can use `cluser:*` to retrieve all cluster-related tasks. */ actions?: string | string[] + /** If `true`, the response includes detailed information about the running tasks. This information is useful to distinguish tasks from each other but is more costly to run. */ detailed?: boolean + /** A key that is used to group tasks in the response. The task lists can be grouped either by nodes or by parent tasks. */ group_by?: TasksGroupBy + /** A comma-separated list of node IDs or names that is used to limit the returned information. */ nodes?: NodeIds + /** A parent task identifier that is used to limit returned information. To return all tasks, omit this parameter or use a value of `-1`. If the parent task is not found, the API does not return a 404 response code. */ parent_task_id?: Id + /** The period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its information. However, timed out nodes are included in the `node_failures` property. */ timeout?: Duration + /** If `true`, the request blocks until the operation is complete. */ wait_for_completion?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { actions?: never, detailed?: never, group_by?: never, nodes?: never, parent_task_id?: never, timeout?: never, wait_for_completion?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { actions?: never, detailed?: never, group_by?: never, nodes?: never, parent_task_id?: never, timeout?: never, wait_for_completion?: never } } export type TasksListResponse = TasksTaskListResponseBase @@ -19661,20 +24163,38 @@ export interface TextStructureTopHit { } export interface TextStructureFindFieldStructureRequest extends RequestBase { +/** If `format` is set to `delimited`, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header row, columns are named "column1", "column2", "column3", for example. */ column_names?: string + /** If you have set `format` to `delimited`, you can specify the character used to delimit the values in each row. Only a single character is supported; the delimiter cannot have multiple characters. By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`). In this default scenario, all rows must have the same number of fields for the delimited format to be detected. If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. */ delimiter?: string + /** The number of documents to include in the structural analysis. The minimum value is 2. */ documents_to_sample?: uint + /** The mode of compatibility with ECS compliant Grok patterns. Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. This setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input. If the structure finder identifies a common structure but has no idea of the meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output. The intention in that situation is that a user who knows the meanings will rename the fields before using them. */ ecs_compatibility?: TextStructureEcsCompatibilityType + /** If `true`, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result. */ explain?: boolean + /** The field that should be analyzed. */ field: Field + /** The high level structure of the text. By default, the API chooses the format. In this default scenario, all rows must have the same number of fields for a delimited format to be detected. If the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. */ format?: TextStructureFormatType + /** If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text. The name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter. If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". If `grok_pattern` is not specified, the structure finder creates a Grok pattern. */ grok_pattern?: GrokPattern + /** The name of the index that contains the analyzed field. */ index: IndexName + /** If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. Only a single character is supported. If this parameter is not specified, the default value is a double quote (`"`). If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. */ quote?: string + /** If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. If this parameter is not specified and the delimiter is pipe (`|`), the default value is true. Otherwise, the default value is `false`. */ should_trim_fields?: boolean + /** The maximum amount of time that the structure analysis can take. If the analysis is still running when the timeout expires, it will be stopped. */ timeout?: Duration + /** The name of the field that contains the primary timestamp of each record in the text. In particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field. If the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`. Therefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified. For structured text, if you specify this parameter, the field must exist within the text. If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. For structured text, it is not compulsory to have a timestamp in the text. */ timestamp_field?: Field + /** The Java time format of the timestamp field in the text. Only a subset of Java time format letter groups are supported: * `a` * `d` * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM` * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`). Spacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes. For example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`. Another is when the timestamp format is one that the structure finder does not consider by default. If this parameter is not specified, the structure finder chooses the best format from a built-in set. If the special value `null` is specified, the structure finder will not look for a primary timestamp in the text. When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. */ timestamp_format?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { column_names?: never, delimiter?: never, documents_to_sample?: never, ecs_compatibility?: never, explain?: never, field?: never, format?: never, grok_pattern?: never, index?: never, quote?: never, should_trim_fields?: never, timeout?: never, timestamp_field?: never, timestamp_format?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { column_names?: never, delimiter?: never, documents_to_sample?: never, ecs_compatibility?: never, explain?: never, field?: never, format?: never, grok_pattern?: never, index?: never, quote?: never, should_trim_fields?: never, timeout?: never, timestamp_field?: never, timestamp_format?: never } } export interface TextStructureFindFieldStructureResponse { @@ -19696,18 +24216,34 @@ export interface TextStructureFindFieldStructureResponse { } export interface TextStructureFindMessageStructureRequest extends RequestBase { +/** If the format is `delimited`, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named "column1", "column2", "column3", for example. */ column_names?: string + /** If you the format is `delimited`, you can specify the character used to delimit the values in each row. Only a single character is supported; the delimiter cannot have multiple characters. By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`). In this default scenario, all rows must have the same number of fields for the delimited format to be detected. If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. */ delimiter?: string + /** The mode of compatibility with ECS compliant Grok patterns. Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. This setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input. If the structure finder identifies a common structure but has no idea of meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output, with the intention that a user who knows the meanings rename these fields before using it. */ ecs_compatibility?: TextStructureEcsCompatibilityType + /** If this parameter is set to true, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result. */ explain?: boolean + /** The high level structure of the text. By default, the API chooses the format. In this default scenario, all rows must have the same number of fields for a delimited format to be detected. If the format is `delimited` and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. */ format?: TextStructureFormatType + /** If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text. The name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter. If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". If `grok_pattern` is not specified, the structure finder creates a Grok pattern. */ grok_pattern?: GrokPattern + /** If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. Only a single character is supported. If this parameter is not specified, the default value is a double quote (`"`). If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. */ quote?: string + /** If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. If this parameter is not specified and the delimiter is pipe (`|`), the default value is true. Otherwise, the default value is `false`. */ should_trim_fields?: boolean + /** The maximum amount of time that the structure analysis can take. If the analysis is still running when the timeout expires, it will be stopped. */ timeout?: Duration + /** The name of the field that contains the primary timestamp of each record in the text. In particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field. If the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`. Therefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified. For structured text, if you specify this parameter, the field must exist within the text. If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. For structured text, it is not compulsory to have a timestamp in the text. */ timestamp_field?: Field + /** The Java time format of the timestamp field in the text. Only a subset of Java time format letter groups are supported: * `a` * `d` * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM` * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`). Spacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes. For example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`. Another is when the timestamp format is one that the structure finder does not consider by default. If this parameter is not specified, the structure finder chooses the best format from a built-in set. If the special value `null` is specified, the structure finder will not look for a primary timestamp in the text. When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. */ timestamp_format?: string + /** The list of messages you want to analyze. */ messages: string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { column_names?: never, delimiter?: never, ecs_compatibility?: never, explain?: never, format?: never, grok_pattern?: never, quote?: never, should_trim_fields?: never, timeout?: never, timestamp_field?: never, timestamp_format?: never, messages?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { column_names?: never, delimiter?: never, ecs_compatibility?: never, explain?: never, format?: never, grok_pattern?: never, quote?: never, should_trim_fields?: never, timeout?: never, timestamp_field?: never, timestamp_format?: never, messages?: never } } export interface TextStructureFindMessageStructureResponse { @@ -19729,22 +24265,41 @@ export interface TextStructureFindMessageStructureResponse { } export interface TextStructureFindStructureRequest { +/** The text's character set. It must be a character set that is supported by the JVM that Elasticsearch uses. For example, `UTF-8`, `UTF-16LE`, `windows-1252`, or `EUC-JP`. If this parameter is not specified, the structure finder chooses an appropriate character set. */ charset?: string + /** If you have set format to `delimited`, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named "column1", "column2", "column3", for example. */ column_names?: string + /** If you have set `format` to `delimited`, you can specify the character used to delimit the values in each row. Only a single character is supported; the delimiter cannot have multiple characters. By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`). In this default scenario, all rows must have the same number of fields for the delimited format to be detected. If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. */ delimiter?: string + /** The mode of compatibility with ECS compliant Grok patterns. Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. Valid values are `disabled` and `v1`. This setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input. If the structure finder identifies a common structure but has no idea of meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output, with the intention that a user who knows the meanings rename these fields before using it. */ ecs_compatibility?: string + /** If this parameter is set to `true`, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result. If the structure finder produces unexpected results for some text, use this query parameter to help you determine why the returned structure was chosen. */ explain?: boolean + /** The high level structure of the text. Valid values are `ndjson`, `xml`, `delimited`, and `semi_structured_text`. By default, the API chooses the format. In this default scenario, all rows must have the same number of fields for a delimited format to be detected. If the format is set to `delimited` and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. */ format?: string + /** If you have set `format` to `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text. The name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter. If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". If `grok_pattern` is not specified, the structure finder creates a Grok pattern. */ grok_pattern?: GrokPattern + /** If you have set `format` to `delimited`, you can use this parameter to indicate whether the column names are in the first row of the text. If this parameter is not specified, the structure finder guesses based on the similarity of the first row of the text to other rows. */ has_header_row?: boolean + /** The maximum number of characters in a message when lines are merged to form messages while analyzing semi-structured text. If you have extremely long messages you may need to increase this, but be aware that this may lead to very long processing times if the way to group lines into messages is misdetected. */ line_merge_size_limit?: uint + /** The number of lines to include in the structural analysis, starting from the beginning of the text. The minimum is 2. If the value of this parameter is greater than the number of lines in the text, the analysis proceeds (as long as there are at least two lines in the text) for all of the lines. NOTE: The number of lines and the variation of the lines affects the speed of the analysis. For example, if you upload text where the first 1000 lines are all variations on the same message, the analysis will find more commonality than would be seen with a bigger sample. If possible, however, it is more efficient to upload sample text with more variety in the first 1000 lines than to request analysis of 100000 lines to achieve some variety. */ lines_to_sample?: uint + /** If you have set `format` to `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. Only a single character is supported. If this parameter is not specified, the default value is a double quote (`"`). If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. */ quote?: string + /** If you have set `format` to `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. If this parameter is not specified and the delimiter is pipe (`|`), the default value is `true`. Otherwise, the default value is `false`. */ should_trim_fields?: boolean + /** The maximum amount of time that the structure analysis can take. If the analysis is still running when the timeout expires then it will be stopped. */ timeout?: Duration + /** The name of the field that contains the primary timestamp of each record in the text. In particular, if the text were ingested into an index, this is the field that would be used to populate the `@timestamp` field. If the `format` is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`. Therefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified. For structured text, if you specify this parameter, the field must exist within the text. If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. For structured text, it is not compulsory to have a timestamp in the text. */ timestamp_field?: Field + /** The Java time format of the timestamp field in the text. Only a subset of Java time format letter groups are supported: * `a` * `d` * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM` * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and separated from the `ss` by a `.`, `,` or `:`. Spacing and punctuation is also permitted with the exception of `?`, newline and carriage return, together with literal text enclosed in single quotes. For example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`. Another is when the timestamp format is one that the structure finder does not consider by default. If this parameter is not specified, the structure finder chooses the best format from a built-in set. If the special value `null` is specified the structure finder will not look for a primary timestamp in the text. When the format is semi-structured text this will result in the structure finder treating the text as single-line messages. */ timestamp_format?: string text_files?: TJsonDocument[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { charset?: never, column_names?: never, delimiter?: never, ecs_compatibility?: never, explain?: never, format?: never, grok_pattern?: never, has_header_row?: never, line_merge_size_limit?: never, lines_to_sample?: never, quote?: never, should_trim_fields?: never, timeout?: never, timestamp_field?: never, timestamp_format?: never, text_files?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { charset?: never, column_names?: never, delimiter?: never, ecs_compatibility?: never, explain?: never, format?: never, grok_pattern?: never, has_header_row?: never, line_merge_size_limit?: never, lines_to_sample?: never, quote?: never, should_trim_fields?: never, timeout?: never, timestamp_field?: never, timestamp_format?: never, text_files?: never } } export interface TextStructureFindStructureResponse { @@ -19784,9 +24339,16 @@ export interface TextStructureTestGrokPatternMatchedText { } export interface TextStructureTestGrokPatternRequest extends RequestBase { +/** The mode of compatibility with ECS compliant Grok patterns. Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. Valid values are `disabled` and `v1`. */ ecs_compatibility?: string + /** The Grok pattern to run on the text. */ grok_pattern: GrokPattern + /** The lines of text to run the Grok pattern on. */ text: string[] + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { ecs_compatibility?: never, grok_pattern?: never, text?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { ecs_compatibility?: never, grok_pattern?: never, text?: never } } export interface TextStructureTestGrokPatternResponse { @@ -19850,20 +24412,37 @@ export interface TransformTimeSync { } export interface TransformDeleteTransformRequest extends RequestBase { +/** Identifier for the transform. */ transform_id: Id + /** If this value is false, the transform must be stopped before it can be deleted. If true, the transform is deleted regardless of its current state. */ force?: boolean + /** If this value is true, the destination index is deleted together with the transform. If false, the destination index will not be deleted */ delete_dest_index?: boolean + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, force?: never, delete_dest_index?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, force?: never, delete_dest_index?: never, timeout?: never } } export type TransformDeleteTransformResponse = AcknowledgedResponseBase export interface TransformGetTransformRequest extends RequestBase { +/** Identifier for the transform. It can be a transform identifier or a wildcard expression. You can get information for all transforms by using `_all`, by specifying `*` as the ``, or by omitting the ``. */ transform_id?: Names + /** Specifies what to do when the request: 1. Contains wildcard expressions and there are no transforms that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** Skips the specified number of transforms. */ from?: integer + /** Specifies the maximum number of transforms to obtain. */ size?: integer + /** Excludes fields that were automatically added when creating the transform. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster. */ exclude_generated?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, allow_no_match?: never, from?: never, size?: never, exclude_generated?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, allow_no_match?: never, from?: never, size?: never, exclude_generated?: never } } export interface TransformGetTransformResponse { @@ -19907,11 +24486,20 @@ export interface TransformGetTransformStatsCheckpointing { } export interface TransformGetTransformStatsRequest extends RequestBase { +/** Identifier for the transform. It can be a transform identifier or a wildcard expression. You can get information for all transforms by using `_all`, by specifying `*` as the ``, or by omitting the ``. */ transform_id: Names + /** Specifies what to do when the request: 1. Contains wildcard expressions and there are no transforms that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** Skips the specified number of transforms. */ from?: long + /** Specifies the maximum number of transforms to obtain. */ size?: long + /** Controls the time to wait for the stats */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, allow_no_match?: never, from?: never, size?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, allow_no_match?: never, from?: never, size?: never, timeout?: never } } export interface TransformGetTransformStatsResponse { @@ -19962,17 +24550,32 @@ export interface TransformGetTransformStatsTransformStatsHealth { } export interface TransformPreviewTransformRequest extends RequestBase { +/** Identifier for the transform to preview. If you specify this path parameter, you cannot provide transform configuration details in the request body. */ transform_id?: Id + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The destination for the transform. */ dest?: TransformDestination + /** Free text description of the transform. */ description?: string + /** The interval between checks for changes in the source indices when the transform is running continuously. Also determines the retry interval in the event of transient failures while the transform is searching or indexing. The minimum value is 1s and the maximum is 1h. */ frequency?: Duration + /** The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields and the aggregation to reduce the data. */ pivot?: TransformPivot + /** The source of the data for the transform. */ source?: TransformSource + /** Defines optional transform settings. */ settings?: TransformSettings + /** Defines the properties transforms require to run continuously. */ sync?: TransformSyncContainer + /** Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the destination index. */ retention_policy?: TransformRetentionPolicyContainer + /** The latest method transforms the data by finding the latest document for each unique key. */ latest?: TransformLatest + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, timeout?: never, dest?: never, description?: never, frequency?: never, pivot?: never, source?: never, settings?: never, sync?: never, retention_policy?: never, latest?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, timeout?: never, dest?: never, description?: never, frequency?: never, pivot?: never, source?: never, settings?: never, sync?: never, retention_policy?: never, latest?: never } } export interface TransformPreviewTransformResponse { @@ -19981,69 +24584,131 @@ export interface TransformPreviewTransformResponse { } export interface TransformPutTransformRequest extends RequestBase { +/** Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. */ transform_id: Id + /** When the transform is created, a series of validations occur to ensure its success. For example, there is a check for the existence of the source indices and a check that the destination index is not part of the source index pattern. You can use this parameter to skip the checks, for example when the source index does not exist until after the transform is created. The validations are always run when you start the transform, however, with the exception of privilege checks. */ defer_validation?: boolean + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The destination for the transform. */ dest: TransformDestination + /** Free text description of the transform. */ description?: string + /** The interval between checks for changes in the source indices when the transform is running continuously. Also determines the retry interval in the event of transient failures while the transform is searching or indexing. The minimum value is `1s` and the maximum is `1h`. */ frequency?: Duration + /** The latest method transforms the data by finding the latest document for each unique key. */ latest?: TransformLatest + /** Defines optional transform metadata. */ _meta?: Metadata + /** The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields and the aggregation to reduce the data. */ pivot?: TransformPivot + /** Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the destination index. */ retention_policy?: TransformRetentionPolicyContainer + /** Defines optional transform settings. */ settings?: TransformSettings + /** The source of the data for the transform. */ source: TransformSource + /** Defines the properties transforms require to run continuously. */ sync?: TransformSyncContainer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, defer_validation?: never, timeout?: never, dest?: never, description?: never, frequency?: never, latest?: never, _meta?: never, pivot?: never, retention_policy?: never, settings?: never, source?: never, sync?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, defer_validation?: never, timeout?: never, dest?: never, description?: never, frequency?: never, latest?: never, _meta?: never, pivot?: never, retention_policy?: never, settings?: never, source?: never, sync?: never } } export type TransformPutTransformResponse = AcknowledgedResponseBase export interface TransformResetTransformRequest extends RequestBase { +/** Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. */ transform_id: Id + /** If this value is `true`, the transform is reset regardless of its current state. If it's `false`, the transform must be stopped before it can be reset. */ force?: boolean + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, force?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, force?: never, timeout?: never } } export type TransformResetTransformResponse = AcknowledgedResponseBase export interface TransformScheduleNowTransformRequest extends RequestBase { +/** Identifier for the transform. */ transform_id: Id + /** Controls the time to wait for the scheduling to take place */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, timeout?: never } } export type TransformScheduleNowTransformResponse = AcknowledgedResponseBase export interface TransformStartTransformRequest extends RequestBase { +/** Identifier for the transform. */ transform_id: Id + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** Restricts the set of transformed entities to those changed after this time. Relative times like now-30d are supported. Only applicable for continuous transforms. */ from?: string + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, timeout?: never, from?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, timeout?: never, from?: never } } export type TransformStartTransformResponse = AcknowledgedResponseBase export interface TransformStopTransformRequest extends RequestBase { +/** Identifier for the transform. To stop multiple transforms, use a comma-separated list or a wildcard expression. To stop all transforms, use `_all` or `*` as the identifier. */ transform_id: Name + /** Specifies what to do when the request: contains wildcard expressions and there are no transforms that match; contains the `_all` string or no identifiers and there are no matches; contains wildcard expressions and there are only partial matches. If it is true, the API returns a successful acknowledgement message when there are no matches. When there are only partial matches, the API stops the appropriate transforms. If it is false, the request returns a 404 status code when there are no matches or only partial matches. */ allow_no_match?: boolean + /** If it is true, the API forcefully stops the transforms. */ force?: boolean + /** Period to wait for a response when `wait_for_completion` is `true`. If no response is received before the timeout expires, the request returns a timeout exception. However, the request continues processing and eventually moves the transform to a STOPPED state. */ timeout?: Duration + /** If it is true, the transform does not completely stop until the current checkpoint is completed. If it is false, the transform stops as soon as possible. */ wait_for_checkpoint?: boolean + /** If it is true, the API blocks until the indexer state completely stops. If it is false, the API returns immediately and the indexer is stopped asynchronously in the background. */ wait_for_completion?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, allow_no_match?: never, force?: never, timeout?: never, wait_for_checkpoint?: never, wait_for_completion?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, allow_no_match?: never, force?: never, timeout?: never, wait_for_checkpoint?: never, wait_for_completion?: never } } export type TransformStopTransformResponse = AcknowledgedResponseBase export interface TransformUpdateTransformRequest extends RequestBase { +/** Identifier for the transform. */ transform_id: Id + /** When true, deferrable validations are not run. This behavior may be desired if the source index does not exist until after the transform is created. */ defer_validation?: boolean + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** The destination for the transform. */ dest?: TransformDestination + /** Free text description of the transform. */ description?: string + /** The interval between checks for changes in the source indices when the transform is running continuously. Also determines the retry interval in the event of transient failures while the transform is searching or indexing. The minimum value is 1s and the maximum is 1h. */ frequency?: Duration + /** Defines optional transform metadata. */ _meta?: Metadata + /** The source of the data for the transform. */ source?: TransformSource + /** Defines optional transform settings. */ settings?: TransformSettings + /** Defines the properties transforms require to run continuously. */ sync?: TransformSyncContainer + /** Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the destination index. */ retention_policy?: TransformRetentionPolicyContainer | null + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { transform_id?: never, defer_validation?: never, timeout?: never, dest?: never, description?: never, frequency?: never, _meta?: never, source?: never, settings?: never, sync?: never, retention_policy?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { transform_id?: never, defer_validation?: never, timeout?: never, dest?: never, description?: never, frequency?: never, _meta?: never, source?: never, settings?: never, sync?: never, retention_policy?: never } } export interface TransformUpdateTransformResponse { @@ -20064,8 +24729,14 @@ export interface TransformUpdateTransformResponse { } export interface TransformUpgradeTransformsRequest extends RequestBase { +/** When true, the request checks for updates but does not run them. */ dry_run?: boolean + /** Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. */ timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { dry_run?: never, timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { dry_run?: never, timeout?: never } } export interface TransformUpgradeTransformsResponse { @@ -20591,8 +25262,14 @@ export interface WatcherWebhookResult { } export interface WatcherAckWatchRequest extends RequestBase { +/** The watch identifier. */ watch_id: Name + /** A comma-separated list of the action identifiers to acknowledge. If you omit this parameter, all of the actions of the watch are acknowledged. */ action_id?: Names + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { watch_id?: never, action_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { watch_id?: never, action_id?: never } } export interface WatcherAckWatchResponse { @@ -20600,7 +25277,12 @@ export interface WatcherAckWatchResponse { } export interface WatcherActivateWatchRequest extends RequestBase { +/** The watch identifier. */ watch_id: Name + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { watch_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { watch_id?: never } } export interface WatcherActivateWatchResponse { @@ -20608,7 +25290,12 @@ export interface WatcherActivateWatchResponse { } export interface WatcherDeactivateWatchRequest extends RequestBase { +/** The watch identifier. */ watch_id: Name + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { watch_id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { watch_id?: never } } export interface WatcherDeactivateWatchResponse { @@ -20616,7 +25303,12 @@ export interface WatcherDeactivateWatchResponse { } export interface WatcherDeleteWatchRequest extends RequestBase { +/** The watch identifier. */ id: Name + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export interface WatcherDeleteWatchResponse { @@ -20626,15 +25318,27 @@ export interface WatcherDeleteWatchResponse { } export interface WatcherExecuteWatchRequest extends RequestBase { +/** The watch identifier. */ id?: Id + /** Defines whether the watch runs in debug mode. */ debug?: boolean + /** Determines how to handle the watch actions as part of the watch execution. */ action_modes?: Record + /** When present, the watch uses this object as a payload instead of executing its own input. */ alternative_input?: Record + /** When set to `true`, the watch execution uses the always condition. This can also be specified as an HTTP parameter. */ ignore_condition?: boolean + /** When set to `true`, the watch record representing the watch execution result is persisted to the `.watcher-history` index for the current time. In addition, the status of the watch is updated, possibly throttling subsequent runs. This can also be specified as an HTTP parameter. */ record_execution?: boolean simulated_actions?: WatcherSimulatedActions + /** This structure is parsed as the data of the trigger event that will be used during the watch execution. */ trigger_data?: WatcherScheduleTriggerEvent + /** When present, this watch is used instead of the one specified in the request. This watch is not persisted to the index and `record_execution` cannot be set. */ watch?: WatcherWatch + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, debug?: never, action_modes?: never, alternative_input?: never, ignore_condition?: never, record_execution?: never, simulated_actions?: never, trigger_data?: never, watch?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, debug?: never, action_modes?: never, alternative_input?: never, ignore_condition?: never, record_execution?: never, simulated_actions?: never, trigger_data?: never, watch?: never } } export interface WatcherExecuteWatchResponse { @@ -20657,7 +25361,12 @@ export interface WatcherExecuteWatchWatchRecord { } export interface WatcherGetSettingsRequest extends RequestBase { +/** 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 } & { master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never } } export interface WatcherGetSettingsResponse { @@ -20665,7 +25374,12 @@ export interface WatcherGetSettingsResponse { } export interface WatcherGetWatchRequest extends RequestBase { +/** The watch identifier. */ id: Name + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never } } export interface WatcherGetWatchResponse { @@ -20679,19 +25393,36 @@ export interface WatcherGetWatchResponse { } export interface WatcherPutWatchRequest extends RequestBase { +/** The identifier for the watch. */ id: Id + /** The initial state of the watch. The default value is `true`, which means the watch is active by default. */ active?: boolean + /** only update the watch if the last operation that has changed the watch has the specified primary term */ if_primary_term?: long + /** only update the watch if the last operation that has changed the watch has the specified sequence number */ if_seq_no?: SequenceNumber + /** Explicit version number for concurrency control */ version?: VersionNumber + /** The list of actions that will be run if the condition matches. */ actions?: Record + /** The condition that defines if the actions should be run. */ condition?: WatcherConditionContainer + /** The input that defines the input that loads the data for the watch. */ input?: WatcherInputContainer + /** Metadata JSON that will be copied into the history entries. */ metadata?: Metadata + /** The minimum time between actions being run. The default is 5 seconds. This default can be changed in the config file with the setting `xpack.watcher.throttle.period.default_period`. If both this value and the `throttle_period_in_millis` parameter are specified, Watcher uses the last parameter included in the request. */ throttle_period?: Duration + /** Minimum time in milliseconds between actions being run. Defaults to 5000. If both this value and the throttle_period parameter are specified, Watcher uses the last parameter included in the request. */ throttle_period_in_millis?: DurationValue + /** The transform that processes the watch payload to prepare it for the watch actions. */ transform?: TransformContainer + /** The trigger that defines when the watch should run. */ trigger?: WatcherTriggerContainer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { id?: never, active?: never, if_primary_term?: never, if_seq_no?: never, version?: never, actions?: never, condition?: never, input?: never, metadata?: never, throttle_period?: never, throttle_period_in_millis?: never, transform?: never, trigger?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { id?: never, active?: never, if_primary_term?: never, if_seq_no?: never, version?: never, actions?: never, condition?: never, input?: never, metadata?: never, throttle_period?: never, throttle_period_in_millis?: never, transform?: never, trigger?: never } } export interface WatcherPutWatchResponse { @@ -20703,11 +25434,20 @@ export interface WatcherPutWatchResponse { } export interface WatcherQueryWatchesRequest extends RequestBase { +/** The offset from the first result to fetch. It must be non-negative. */ from?: integer + /** The number of hits to return. It must be non-negative. */ size?: integer + /** A query that filters the watches to be returned. */ query?: QueryDslQueryContainer + /** One or more fields used to sort the search results. */ sort?: Sort + /** Retrieve the next page of hits using a set of sort values from the previous page. */ search_after?: SortResults + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { from?: never, size?: never, query?: never, sort?: never, search_after?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { from?: never, size?: never, query?: never, sort?: never, search_after?: never } } export interface WatcherQueryWatchesResponse { @@ -20716,14 +25456,25 @@ export interface WatcherQueryWatchesResponse { } export interface WatcherStartRequest extends RequestBase { +/** Period to wait for a connection to the master node. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never } } export type WatcherStartResponse = AcknowledgedResponseBase export interface WatcherStatsRequest extends RequestBase { +/** Defines which additional metrics are included in the response. */ metric?: WatcherStatsWatcherMetric | WatcherStatsWatcherMetric[] + /** Defines whether stack traces are generated for each watch that is running. */ emit_stacktraces?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { metric?: never, emit_stacktraces?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { metric?: never, emit_stacktraces?: never } } export interface WatcherStatsResponse { @@ -20759,16 +25510,27 @@ export interface WatcherStatsWatcherNodeStats { export type WatcherStatsWatcherState = 'stopped' | 'starting' | 'started' | 'stopping' export interface WatcherStopRequest extends RequestBase { +/** The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never } } export type WatcherStopResponse = AcknowledgedResponseBase export interface WatcherUpdateSettingsRequest extends RequestBase { +/** 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 'index.auto_expand_replicas'?: string 'index.number_of_replicas'?: integer + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never, timeout?: never, 'index.auto_expand_replicas'?: never, 'index.number_of_replicas'?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never, timeout?: never, 'index.auto_expand_replicas'?: never, 'index.number_of_replicas'?: never } } export interface WatcherUpdateSettingsResponse { @@ -20797,7 +25559,6 @@ export interface XpackInfoFeatures { enterprise_search: XpackInfoFeature eql: XpackInfoFeature esql: XpackInfoFeature - frozen_indices: XpackInfoFeature graph: XpackInfoFeature ilm: XpackInfoFeature logstash: XpackInfoFeature @@ -20832,9 +25593,16 @@ export interface XpackInfoNativeCodeInformation { } export interface XpackInfoRequest extends RequestBase { +/** A comma-separated list of the information categories to include in the response. For example, `build,license,features`. */ categories?: XpackInfoXPackCategory[] + /** If this param is used it must be set to true */ accept_enterprise?: boolean + /** Defines whether additional human-readable information is included in the response. In particular, it adds descriptions and a tag line. */ human?: boolean + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { categories?: never, accept_enterprise?: never, human?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { categories?: never, accept_enterprise?: never, human?: never } } export interface XpackInfoResponse { @@ -20968,10 +25736,6 @@ export interface XpackUsageFlattened extends XpackUsageBase { field_count: integer } -export interface XpackUsageFrozenIndices extends XpackUsageBase { - indices_count: long -} - export interface XpackUsageHealthStatistics extends XpackUsageBase { invocations: XpackUsageInvocations } @@ -20983,7 +25747,7 @@ export interface XpackUsageIlm { export interface XpackUsageIlmPolicyStatistics { indices_managed: integer - phases: IlmPhases + phases: XpackUsagePhases } export interface XpackUsageInvocations { @@ -21095,6 +25859,19 @@ export interface XpackUsageMonitoring extends XpackUsageBase { enabled_exporters: Record } +export interface XpackUsagePhase { + actions: string[] + min_age: DurationValue +} + +export interface XpackUsagePhases { + cold?: XpackUsagePhase + delete?: XpackUsagePhase + frozen?: XpackUsagePhase + hot?: XpackUsagePhase + warm?: XpackUsagePhase +} + export interface XpackUsageQuery { count?: integer failed?: integer @@ -21118,7 +25895,12 @@ export interface XpackUsageRealmCache { } export interface XpackUsageRequest extends RequestBase { +/** 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. To indicate that the request should never timeout, set it to `-1`. */ master_timeout?: Duration + /** All values in `body` will be added to the request body. */ + body?: string | { [key: string]: any } & { master_timeout?: never } + /** All values in `querystring` will be added to the request querystring. */ + querystring?: { [key: string]: any } & { master_timeout?: never } } export interface XpackUsageResponse { @@ -21134,7 +25916,6 @@ export interface XpackUsageResponse { enrich?: XpackUsageBase eql: XpackUsageEql flattened?: XpackUsageFlattened - frozen_indices: XpackUsageFrozenIndices graph: XpackUsageBase health_api?: XpackUsageHealthStatistics ilm: XpackUsageIlm