From 64e78147e66c69aefb4e802aede795535ae3e946 Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Mon, 1 Sep 2025 06:02:53 +0000 Subject: [PATCH] Auto-generated API code --- elasticsearch/_async/client/__init__.py | 18 +- elasticsearch/_async/client/cat.py | 134 +++++++- elasticsearch/_async/client/cluster.py | 9 +- elasticsearch/_async/client/esql.py | 19 +- elasticsearch/_async/client/indices.py | 2 +- elasticsearch/_async/client/inference.py | 116 ++++++- elasticsearch/_async/client/snapshot.py | 374 ++++++++++++++++------- elasticsearch/_async/client/sql.py | 2 +- elasticsearch/_async/client/transform.py | 60 ++++ elasticsearch/_sync/client/__init__.py | 18 +- elasticsearch/_sync/client/cat.py | 134 +++++++- elasticsearch/_sync/client/cluster.py | 9 +- elasticsearch/_sync/client/esql.py | 19 +- elasticsearch/_sync/client/indices.py | 2 +- elasticsearch/_sync/client/inference.py | 116 ++++++- elasticsearch/_sync/client/snapshot.py | 374 ++++++++++++++++------- elasticsearch/_sync/client/sql.py | 2 +- elasticsearch/_sync/client/transform.py | 60 ++++ elasticsearch/dsl/aggs.py | 20 ++ elasticsearch/dsl/field.py | 26 ++ elasticsearch/dsl/types.py | 151 ++++++++- 21 files changed, 1370 insertions(+), 295 deletions(-) diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 6f6c139a3..039806990 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -700,6 +700,7 @@ async def bulk(
  • JavaScript: Check out client.helpers.*
  • .NET: Check out BulkAllObservable
  • PHP: Check out bulk indexing.
  • +
  • Ruby: Check out Elasticsearch::Helpers::BulkHelper
  • 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. @@ -1416,7 +1417,7 @@ async def delete( ) @_rewrite_parameters( - body_fields=("max_docs", "query", "slice"), + body_fields=("max_docs", "query", "slice", "sort"), parameter_aliases={"from": "from_"}, ) async def delete_by_query( @@ -1460,7 +1461,12 @@ async def delete_by_query( ] = None, slice: t.Optional[t.Mapping[str, t.Any]] = None, slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None, - sort: t.Optional[t.Sequence[str]] = None, + sort: t.Optional[ + t.Union[ + t.Sequence[t.Union[str, t.Mapping[str, t.Any]]], + t.Union[str, t.Mapping[str, t.Any]], + ] + ] = None, stats: t.Optional[t.Sequence[str]] = None, terminate_after: t.Optional[int] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, @@ -1592,7 +1598,7 @@ async def delete_by_query( :param slice: Slice the request manually using the provided slice ID and total number of slices. :param slices: The number of slices this task should be divided into. - :param sort: A comma-separated list of `:` pairs. + :param sort: A sort object that specifies the order of deleted documents. :param stats: The specific `tag` of the request for logging and statistical purposes. :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. @@ -1682,8 +1688,6 @@ async def delete_by_query( __query["search_type"] = search_type if slices is not None: __query["slices"] = slices - if sort is not None: - __query["sort"] = sort if stats is not None: __query["stats"] = stats if terminate_after is not None: @@ -1703,6 +1707,8 @@ async def delete_by_query( __body["query"] = query if slice is not None: __body["slice"] = slice + if sort is not None: + __body["sort"] = sort __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", @@ -6010,7 +6016,7 @@ async def termvectors( doc: t.Optional[t.Mapping[str, t.Any]] = None, error_trace: t.Optional[bool] = None, field_statistics: t.Optional[bool] = None, - fields: t.Optional[t.Union[str, t.Sequence[str]]] = None, + fields: t.Optional[t.Sequence[str]] = None, filter: t.Optional[t.Mapping[str, t.Any]] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, diff --git a/elasticsearch/_async/client/cat.py b/elasticsearch/_async/client/cat.py index 681b51e59..c97d1ba63 100644 --- a/elasticsearch/_async/client/cat.py +++ b/elasticsearch/_async/client/cat.py @@ -47,7 +47,34 @@ async def aliases( ] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[ + str, + t.Literal[ + "alias", + "filter", + "index", + "is_write_index", + "routing.index", + "routing.search", + ], + ] + ], + t.Union[ + str, + t.Literal[ + "alias", + "filter", + "index", + "is_write_index", + "routing.index", + "routing.search", + ], + ], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, local: t.Optional[bool] = None, @@ -74,7 +101,8 @@ async def aliases( values, such as `open,hidden`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param local: If `true`, the request computes the list of selected nodes from @@ -137,7 +165,48 @@ async def allocation( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[ + str, + t.Literal[ + "disk.avail", + "disk.indices", + "disk.indices.forecast", + "disk.percent", + "disk.total", + "disk.used", + "host", + "ip", + "node", + "node.role", + "shards", + "shards.undesired", + "write_load.forecast", + ], + ] + ], + t.Union[ + str, + t.Literal[ + "disk.avail", + "disk.indices", + "disk.indices.forecast", + "disk.percent", + "disk.total", + "disk.used", + "host", + "ip", + "node", + "node.role", + "shards", + "shards.undesired", + "write_load.forecast", + ], + ], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, local: t.Optional[bool] = None, @@ -161,7 +230,8 @@ async def allocation( :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param local: If `true`, the request computes the list of selected nodes from @@ -224,7 +294,36 @@ async def component_templates( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[ + str, + t.Literal[ + "alias_count", + "included_in", + "mapping_count", + "metadata_count", + "name", + "settings_count", + "version", + ], + ] + ], + t.Union[ + str, + t.Literal[ + "alias_count", + "included_in", + "mapping_count", + "metadata_count", + "name", + "settings_count", + "version", + ], + ], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, local: t.Optional[bool] = None, @@ -249,7 +348,8 @@ async def component_templates( If it is omitted, all component templates are returned. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param local: If `true`, the request computes the list of selected nodes from @@ -310,7 +410,12 @@ async def count( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[t.Union[str, t.Literal["count", "epoch", "timestamp"]]], + t.Union[str, t.Literal["count", "epoch", "timestamp"]], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, @@ -334,7 +439,8 @@ async def count( and indices, omit this parameter or use `*` or `_all`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param s: List of columns that determine how the table should be sorted. Sorting @@ -389,7 +495,14 @@ async def fielddata( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]] + ], + t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, @@ -412,7 +525,8 @@ async def fielddata( :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param s: List of columns that determine how the table should be sorted. Sorting diff --git a/elasticsearch/_async/client/cluster.py b/elasticsearch/_async/client/cluster.py index 8b393a265..760b9a775 100644 --- a/elasticsearch/_async/client/cluster.py +++ b/elasticsearch/_async/client/cluster.py @@ -373,8 +373,13 @@ async def get_settings( ``_ :param flat_settings: If `true`, returns settings in flat format. - :param include_defaults: If `true`, returns default cluster settings from the - local node. + :param include_defaults: If `true`, also returns default values for all other + cluster settings, reflecting the values in the `elasticsearch.yml` file of + one of the nodes in the cluster. If the nodes in your cluster do not all + have the same values in their `elasticsearch.yml` config files then the values + returned by this API may vary from invocation to invocation and may not reflect + the values that Elasticsearch uses in all situations. Use the `GET _nodes/settings` + API to fetch the settings for each individual node in your cluster. :param master_timeout: 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. diff --git a/elasticsearch/_async/client/esql.py b/elasticsearch/_async/client/esql.py index bca1e4255..7b80fc656 100644 --- a/elasticsearch/_async/client/esql.py +++ b/elasticsearch/_async/client/esql.py @@ -44,7 +44,7 @@ class EsqlClient(NamespacedClient): async def async_query( self, *, - query: t.Optional[str] = None, + query: t.Optional[t.Union[str, "ESQLBase"]] = None, allow_partial_results: t.Optional[bool] = None, columnar: t.Optional[bool] = None, delimiter: t.Optional[str] = None, @@ -107,7 +107,12 @@ async def async_query( which has the name of all the columns. :param filter: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. - :param format: A short version of the Accept header, for example `json` or `yaml`. + :param format: A short version of the Accept header, e.g. json, yaml. `csv`, + `tsv`, and `txt` formats will return results in a tabular format, excluding + other metadata fields from the response. For async requests, nothing will + be returned if the async query doesn't finish within the timeout. The query + ID and running status are available in the `X-Elasticsearch-Async-Id` and + `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively. :param include_ccs_metadata: When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as @@ -161,7 +166,7 @@ async def async_query( __query["pretty"] = pretty if not __body: if query is not None: - __body["query"] = query + __body["query"] = str(query) if columnar is not None: __body["columnar"] = columnar if filter is not None: @@ -399,7 +404,7 @@ async def async_query_stop( async def query( self, *, - query: t.Optional[str] = None, + query: t.Optional[t.Union[str, "ESQLBase"]] = None, allow_partial_results: t.Optional[bool] = None, columnar: t.Optional[bool] = None, delimiter: t.Optional[str] = None, @@ -456,7 +461,9 @@ async def query( `all_columns` which has the name of all columns. :param filter: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. - :param format: A short version of the Accept header, e.g. json, yaml. + :param format: A short version of the Accept header, e.g. json, yaml. `csv`, + `tsv`, and `txt` formats will return results in a tabular format, excluding + other metadata fields from the response. :param include_ccs_metadata: When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as @@ -496,7 +503,7 @@ async def query( __query["pretty"] = pretty if not __body: if query is not None: - __body["query"] = query + __body["query"] = str(query) if columnar is not None: __body["columnar"] = columnar if filter is not None: diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index 77621b695..c3c27eb64 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -4581,7 +4581,7 @@ async def rollover( .. raw:: html

    Roll over to a new index. - TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.

    + TIP: We recommend using the index lifecycle rollover action to automate rollovers. However, Serverless does not support Index Lifecycle Management (ILM), so don't use this approach in the Serverless context.

    The rollover API creates a new index for a data stream or index alias. The API behavior depends on the rollover target.

    Roll over a data stream

    diff --git a/elasticsearch/_async/client/inference.py b/elasticsearch/_async/client/inference.py index 0083677f4..60182931e 100644 --- a/elasticsearch/_async/client/inference.py +++ b/elasticsearch/_async/client/inference.py @@ -391,21 +391,23 @@ async def put( @@ -659,6 +661,112 @@ async def put_amazonbedrock( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=( + "service", + "service_settings", + "chunking_settings", + "task_settings", + ), + ) + async def put_amazonsagemaker( + self, + *, + task_type: t.Union[ + str, + t.Literal[ + "chat_completion", + "completion", + "rerank", + "sparse_embedding", + "text_embedding", + ], + ], + amazonsagemaker_inference_id: str, + service: t.Optional[t.Union[str, t.Literal["amazon_sagemaker"]]] = None, + service_settings: t.Optional[t.Mapping[str, t.Any]] = None, + chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + task_settings: t.Optional[t.Mapping[str, t.Any]] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Create an Amazon SageMaker inference endpoint.

    +

    Create an inference endpoint to perform an inference task with the amazon_sagemaker service.

    + + + ``_ + + :param task_type: The type of the inference task that the model will perform. + :param amazonsagemaker_inference_id: The unique identifier of the inference endpoint. + :param service: The type of service supported for the specified task type. In + this case, `amazon_sagemaker`. + :param service_settings: Settings used to install the inference model. These + settings are specific to the `amazon_sagemaker` service and `service_settings.api` + you specified. + :param chunking_settings: The chunking configuration object. + :param task_settings: Settings to configure the inference task. These settings + are specific to the task type and `service_settings.api` you specified. + :param timeout: Specifies the amount of time to wait for the inference endpoint + to be created. + """ + if task_type in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'task_type'") + if amazonsagemaker_inference_id in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for parameter 'amazonsagemaker_inference_id'" + ) + if service is None and body is None: + raise ValueError("Empty value passed for parameter 'service'") + if service_settings is None and body is None: + raise ValueError("Empty value passed for parameter 'service_settings'") + __path_parts: t.Dict[str, str] = { + "task_type": _quote(task_type), + "amazonsagemaker_inference_id": _quote(amazonsagemaker_inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["amazonsagemaker_inference_id"]}' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if not __body: + if service is not None: + __body["service"] = service + if service_settings is not None: + __body["service_settings"] = service_settings + if chunking_settings is not None: + __body["chunking_settings"] = chunking_settings + if task_settings is not None: + __body["task_settings"] = task_settings + if not __body: + __body = None # type: ignore[assignment] + __headers = {"accept": "application/json"} + if __body is not None: + __headers["content-type"] = "application/json" + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="inference.put_amazonsagemaker", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "service", diff --git a/elasticsearch/_async/client/snapshot.py b/elasticsearch/_async/client/snapshot.py index cdc7eab2b..6ed65a1d7 100644 --- a/elasticsearch/_async/client/snapshot.py +++ b/elasticsearch/_async/client/snapshot.py @@ -52,9 +52,16 @@ async def cleanup_repository( ``_ - :param name: Snapshot repository to clean up. - :param master_timeout: Period to wait for a connection to the master node. - :param timeout: Period to wait for a response. + :param name: The name of the snapshot repository to clean up. + :param master_timeout: 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` + :param timeout: 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`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -109,11 +116,15 @@ async def clone( ``_ - :param repository: A repository name - :param snapshot: The name of the snapshot to clone from - :param target_snapshot: The name of the cloned snapshot to create - :param indices: - :param master_timeout: Explicit operation timeout for connection to master node + :param repository: The name of the snapshot repository that both source and target + snapshot belong to. + :param snapshot: The source snapshot name. + :param target_snapshot: The target snapshot name. + :param indices: A comma-separated list of indices to include in the snapshot. + Multi-target syntax is supported. + :param master_timeout: 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`. """ if repository in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'repository'") @@ -157,6 +168,7 @@ async def clone( @_rewrite_parameters( body_fields=( + "expand_wildcards", "feature_states", "ignore_unavailable", "include_global_state", @@ -171,6 +183,14 @@ async def create( repository: str, snapshot: str, error_trace: t.Optional[bool] = None, + expand_wildcards: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]] + ], + t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]], + ] + ] = None, feature_states: t.Optional[t.Sequence[str]] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, @@ -193,13 +213,20 @@ async def create( ``_ - :param repository: Repository for the snapshot. - :param snapshot: Name of the snapshot. Must be unique in the repository. - :param feature_states: Feature states to include in the snapshot. Each feature + :param repository: The name of the repository for the snapshot. + :param snapshot: The name of the snapshot. It supportes date math. It must be + unique in the repository. + :param expand_wildcards: Determines how wildcard patterns in the `indices` parameter + match data streams and indices. It supports comma-separated values such as + `open,hidden`. + :param feature_states: 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. + 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"]`). :param ignore_unavailable: 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. @@ -208,18 +235,24 @@ async def create( 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`). - :param indices: Data streams and indices to include in the snapshot. Supports - multi-target syntax. Includes all data streams and indices by default. - :param master_timeout: 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. - :param metadata: Optional metadata for the snapshot. May have any contents. Must - be less than 1024 bytes. This map is not automatically generated by Elasticsearch. - :param partial: If `true`, 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. If `false`, - the entire restore operation will fail if one or more indices included in - the snapshot do not have all primary shards available. + :param indices: 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. + :param master_timeout: 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. + :param metadata: 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. + :param partial: 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. :param wait_for_completion: If `true`, the request returns a response when the snapshot is complete. If `false`, the request returns a response when the snapshot initializes. @@ -248,6 +281,8 @@ async def create( if wait_for_completion is not None: __query["wait_for_completion"] = wait_for_completion if not __body: + if expand_wildcards is not None: + __body["expand_wildcards"] = expand_wildcards if feature_states is not None: __body["feature_states"] = feature_states if ignore_unavailable is not None: @@ -299,15 +334,26 @@ async def create_repository( IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. To register a snapshot repository, the cluster's global metadata must be writeable. Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access.

    +

    Several options for this API can be specified using a query parameter or a request body parameter. + If both parameters are specified, only the query parameter is used.

    - ``_ + ``_ - :param name: A repository name + :param name: The name of the snapshot repository to register or update. :param repository: - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout - :param verify: Whether to verify the repository after creation + :param master_timeout: 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`. + :param timeout: 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`. + :param verify: 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. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -367,9 +413,12 @@ async def delete( ``_ - :param repository: A repository name - :param snapshot: A comma-separated list of snapshot names - :param master_timeout: Explicit operation timeout for connection to master node + :param repository: The name of the repository to delete a snapshot from. + :param snapshot: A comma-separated list of snapshot names to delete. It also + accepts wildcards (`*`). + :param master_timeout: 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`. :param wait_for_completion: If `true`, the request returns a response when the matching snapshots are all deleted. If `false`, the request returns a response as soon as the deletes are scheduled. @@ -428,10 +477,16 @@ async def delete_repository( ``_ - :param name: Name of the snapshot repository to unregister. Wildcard (`*`) patterns - are supported. - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout + :param name: The ame of the snapshot repositories to unregister. Wildcard (`*`) + patterns are supported. + :param master_timeout: 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`. + :param timeout: 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`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -501,50 +556,64 @@ async def get( .. raw:: html

    Get snapshot information.

    +

    NOTE: The after parameter and next field enable you to iterate through snapshots with some consistency guarantees regarding concurrent creation or deletion of snapshots. + It is guaranteed that any snapshot that exists at the beginning of the iteration and is not concurrently deleted will be seen during the iteration. + Snapshots concurrently created may be seen during an iteration.

    ``_ - :param repository: Comma-separated list of snapshot repository names used to - limit the request. Wildcard (*) expressions are supported. - :param snapshot: Comma-separated list of snapshot names to retrieve. Also accepts - wildcards (*). - 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. - :param after: Offset identifier to start pagination from as returned by the next - field in the response body. - :param from_sort_value: Value of the current sort column at which to start retrieval. - Can either be a string snapshot- or repository name when sorting by snapshot - or repository name, a millisecond time value or a number when sorting by - index- or shard count. - :param ignore_unavailable: If false, the request returns an error for any snapshots + :param repository: A comma-separated list of snapshot repository names used to + limit the request. Wildcard (`*`) expressions are supported. + :param snapshot: 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`. + :param after: An offset identifier to start pagination from as returned by the + next field in the response body. + :param from_sort_value: 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. + :param ignore_unavailable: If `false`, the request returns an error for any snapshots that are unavailable. - :param include_repository: If true, returns the repository name in each snapshot. - :param index_details: If true, returns 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. Defaults to false, meaning that this information is omitted. - :param index_names: If true, returns the name of each index in each snapshot. - :param master_timeout: 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. + :param include_repository: If `true`, the response includes the repository name + in each snapshot. + :param index_details: 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. + :param index_names: If `true`, the response includes the name of each index in + each snapshot. + :param master_timeout: 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. :param offset: 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. - :param order: Sort order. Valid values are asc for ascending and desc for descending - order. Defaults to asc, meaning ascending order. - :param size: Maximum number of snapshots to return. Defaults to 0 which means - return all that match the request without limit. - :param slm_policy_filter: Filter snapshots by a comma-separated list of SLM policy - names that snapshots belong to. Also accepts wildcards (*) and combinations - of wildcards followed by exclude patterns starting with -. To include snapshots - not created by an SLM policy you can use the special pattern _none that will - match all snapshots without an SLM policy. - :param sort: Allows setting a sort order for the result. Defaults to start_time, - i.e. sorting by snapshot start time stamp. - :param verbose: 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. + :param order: The sort order. Valid values are `asc` for ascending and `desc` + for descending order. The default behavior is ascending order. + :param size: The maximum number of snapshots to return. The default is 0, which + means to return all that match the request without limit. + :param slm_policy_filter: 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. + :param sort: The sort order for the result. The default behavior is sorting by + snapshot start time stamp. + :param verbose: 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. """ if repository in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'repository'") @@ -620,10 +689,16 @@ async def get_repository( ``_ - :param name: A comma-separated list of repository names - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Explicit operation timeout for connection to master node + :param name: 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`. + :param local: If `true`, the request gets information from the local node only. + If `false`, the request gets information from the master node. + :param master_timeout: 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`. """ __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: @@ -881,21 +956,39 @@ async def repository_verify_integrity( It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting.

    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: This API may not work correctly in a mixed-version cluster.

    +

    The default values for the parameters of this API are designed to limit the impact of the integrity verification on other activities in your cluster. + For instance, by default it will only use at most half of the snapshot_meta threads to verify the integrity of each snapshot, allowing other snapshot operations to use the other half of this thread pool. + If you modify these parameters to speed up the verification process, you risk disrupting other snapshot-related operations in your cluster. + For large repositories, consider setting up a separate single-node Elasticsearch cluster just for running the integrity verification API.

    +

    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.

    ``_ - :param name: A repository name - :param blob_thread_pool_concurrency: Number of threads to use for reading blob - contents - :param index_snapshot_verification_concurrency: Number of snapshots to verify - concurrently within each index - :param index_verification_concurrency: Number of indices to verify concurrently - :param max_bytes_per_sec: Rate limit for individual blob verification - :param max_failed_shard_snapshots: Maximum permitted number of failed shard snapshots - :param meta_thread_pool_concurrency: Number of threads to use for reading metadata - :param snapshot_verification_concurrency: Number of snapshots to verify concurrently - :param verify_blob_contents: Whether to verify the contents of individual blobs + :param name: The name of the snapshot repository. + :param blob_thread_pool_concurrency: If `verify_blob_contents` is `true`, this + parameter specifies how many blobs to verify at once. + :param index_snapshot_verification_concurrency: The maximum number of index snapshots + to verify concurrently within each index verification. + :param index_verification_concurrency: The number of indices to verify concurrently. + The default behavior is to use the entire `snapshot_meta` thread pool. + :param max_bytes_per_sec: If `verify_blob_contents` is `true`, this parameter + specifies the maximum amount of data that Elasticsearch will read from the + repository every second. + :param max_failed_shard_snapshots: 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. + :param meta_thread_pool_concurrency: 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. + :param snapshot_verification_concurrency: The number of snapshots to verify concurrently. + The default behavior is to use at most half of the `snapshot_meta` thread + pool at once. + :param verify_blob_contents: 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. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -995,21 +1088,64 @@ async def restore( ``_ - :param repository: A repository name - :param snapshot: A snapshot name - :param feature_states: - :param ignore_index_settings: - :param ignore_unavailable: - :param include_aliases: - :param include_global_state: - :param index_settings: - :param indices: - :param master_timeout: Explicit operation timeout for connection to master node - :param partial: - :param rename_pattern: - :param rename_replacement: - :param wait_for_completion: Should this request wait until the operation has - completed before returning + :param repository: The name of the repository to restore a snapshot from. + :param snapshot: The name of the snapshot to restore. + :param feature_states: 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"]`). + :param ignore_index_settings: 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. + :param ignore_unavailable: 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. + :param include_aliases: If `true`, the request restores aliases for any restored + data streams and indices. If `false`, the request doesn’t restore aliases. + :param include_global_state: 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. + :param index_settings: 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. + :param indices: 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. + :param master_timeout: 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`. + :param partial: 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. + :param rename_pattern: 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. + :param rename_replacement: The rename replacement string that is used with the + `rename_pattern`. + :param wait_for_completion: 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. """ if repository in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'repository'") @@ -1087,9 +1223,12 @@ async def status( .. raw:: html

    Get the snapshot status. - Get a detailed description of the current state for each shard participating in the snapshot. - Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. + Get a detailed description of the current state for each shard participating in the snapshot.

    +

    Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API.

    +

    If you omit the <snapshot> request path parameter, the request retrieves information only for currently running snapshots. + This usage is preferred. + If needed, you can specify <repository> and <snapshot> to retrieve information for specific snapshots, even if they're not currently running.

    WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. The API requires a read from the repository for each shard in each snapshot. For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards).

    @@ -1099,11 +1238,16 @@ async def status( ``_ - :param repository: A repository name - :param snapshot: A comma-separated list of snapshot names - :param ignore_unavailable: Whether to ignore unavailable snapshots, defaults - to false which means a SnapshotMissingException is thrown - :param master_timeout: Explicit operation timeout for connection to master node + :param repository: The snapshot repository name used to limit the request. It + supports wildcards (`*`) if `` isn't specified. + :param snapshot: A comma-separated list of snapshots to retrieve status for. + The default is currently running snapshots. Wildcards (`*`) are not supported. + :param ignore_unavailable: 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. + :param master_timeout: 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`. """ __path_parts: t.Dict[str, str] if repository not in SKIP_IN_PATH and snapshot not in SKIP_IN_PATH: @@ -1162,9 +1306,15 @@ async def verify_repository( ``_ - :param name: A repository name - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout + :param name: The name of the snapshot repository to verify. + :param master_timeout: 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`. + :param timeout: 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`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") diff --git a/elasticsearch/_async/client/sql.py b/elasticsearch/_async/client/sql.py index 1763739c5..a744af06c 100644 --- a/elasticsearch/_async/client/sql.py +++ b/elasticsearch/_async/client/sql.py @@ -283,7 +283,7 @@ async def query( keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, keep_on_completion: t.Optional[bool] = None, page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - params: t.Optional[t.Mapping[str, t.Any]] = None, + params: t.Optional[t.Sequence[t.Any]] = None, pretty: t.Optional[bool] = None, query: t.Optional[str] = None, request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, diff --git a/elasticsearch/_async/client/transform.py b/elasticsearch/_async/client/transform.py index eae63619a..53d86d1c7 100644 --- a/elasticsearch/_async/client/transform.py +++ b/elasticsearch/_async/client/transform.py @@ -602,6 +602,66 @@ async def schedule_now_transform( path_parts=__path_parts, ) + @_rewrite_parameters() + async def set_upgrade_mode( + self, + *, + enabled: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Set upgrade_mode for transform indices. + Sets a cluster wide upgrade_mode setting that prepares transform + indices for an upgrade. + When upgrading your cluster, in some circumstances you must restart your + nodes and reindex your transform indices. In those circumstances, + there must be no transforms running. You can close the transforms, + do the upgrade, then open all the transforms again. Alternatively, + you can use this API to temporarily halt tasks associated with the transforms + and prevent new transforms from opening. You can also use this API + during upgrades that do not require you to reindex your transform + indices, though stopping transforms is not a requirement in that case. + You can see the current value for the upgrade_mode setting by using the get + transform info API.

    + + + ``_ + + :param enabled: When `true`, it enables `upgrade_mode` which temporarily halts + all transform tasks and prohibits new transform tasks from starting. + :param timeout: The time to wait for the request to be completed. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_transform/set_upgrade_mode" + __query: t.Dict[str, t.Any] = {} + if enabled is not None: + __query["enabled"] = enabled + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.set_upgrade_mode", + path_parts=__path_parts, + ) + @_rewrite_parameters( parameter_aliases={"from": "from_"}, ) diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 69389fcff..48ccb7170 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -698,6 +698,7 @@ def bulk(
  • JavaScript: Check out client.helpers.*
  • .NET: Check out BulkAllObservable
  • PHP: Check out bulk indexing.
  • +
  • Ruby: Check out Elasticsearch::Helpers::BulkHelper
  • 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. @@ -1414,7 +1415,7 @@ def delete( ) @_rewrite_parameters( - body_fields=("max_docs", "query", "slice"), + body_fields=("max_docs", "query", "slice", "sort"), parameter_aliases={"from": "from_"}, ) def delete_by_query( @@ -1458,7 +1459,12 @@ def delete_by_query( ] = None, slice: t.Optional[t.Mapping[str, t.Any]] = None, slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None, - sort: t.Optional[t.Sequence[str]] = None, + sort: t.Optional[ + t.Union[ + t.Sequence[t.Union[str, t.Mapping[str, t.Any]]], + t.Union[str, t.Mapping[str, t.Any]], + ] + ] = None, stats: t.Optional[t.Sequence[str]] = None, terminate_after: t.Optional[int] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, @@ -1590,7 +1596,7 @@ def delete_by_query( :param slice: Slice the request manually using the provided slice ID and total number of slices. :param slices: The number of slices this task should be divided into. - :param sort: A comma-separated list of `:` pairs. + :param sort: A sort object that specifies the order of deleted documents. :param stats: The specific `tag` of the request for logging and statistical purposes. :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. @@ -1680,8 +1686,6 @@ def delete_by_query( __query["search_type"] = search_type if slices is not None: __query["slices"] = slices - if sort is not None: - __query["sort"] = sort if stats is not None: __query["stats"] = stats if terminate_after is not None: @@ -1701,6 +1705,8 @@ def delete_by_query( __body["query"] = query if slice is not None: __body["slice"] = slice + if sort is not None: + __body["sort"] = sort __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", @@ -6008,7 +6014,7 @@ def termvectors( doc: t.Optional[t.Mapping[str, t.Any]] = None, error_trace: t.Optional[bool] = None, field_statistics: t.Optional[bool] = None, - fields: t.Optional[t.Union[str, t.Sequence[str]]] = None, + fields: t.Optional[t.Sequence[str]] = None, filter: t.Optional[t.Mapping[str, t.Any]] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, diff --git a/elasticsearch/_sync/client/cat.py b/elasticsearch/_sync/client/cat.py index a84d9be61..b1d6c6d4e 100644 --- a/elasticsearch/_sync/client/cat.py +++ b/elasticsearch/_sync/client/cat.py @@ -47,7 +47,34 @@ def aliases( ] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[ + str, + t.Literal[ + "alias", + "filter", + "index", + "is_write_index", + "routing.index", + "routing.search", + ], + ] + ], + t.Union[ + str, + t.Literal[ + "alias", + "filter", + "index", + "is_write_index", + "routing.index", + "routing.search", + ], + ], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, local: t.Optional[bool] = None, @@ -74,7 +101,8 @@ def aliases( values, such as `open,hidden`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param local: If `true`, the request computes the list of selected nodes from @@ -137,7 +165,48 @@ def allocation( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[ + str, + t.Literal[ + "disk.avail", + "disk.indices", + "disk.indices.forecast", + "disk.percent", + "disk.total", + "disk.used", + "host", + "ip", + "node", + "node.role", + "shards", + "shards.undesired", + "write_load.forecast", + ], + ] + ], + t.Union[ + str, + t.Literal[ + "disk.avail", + "disk.indices", + "disk.indices.forecast", + "disk.percent", + "disk.total", + "disk.used", + "host", + "ip", + "node", + "node.role", + "shards", + "shards.undesired", + "write_load.forecast", + ], + ], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, local: t.Optional[bool] = None, @@ -161,7 +230,8 @@ def allocation( :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param local: If `true`, the request computes the list of selected nodes from @@ -224,7 +294,36 @@ def component_templates( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[ + str, + t.Literal[ + "alias_count", + "included_in", + "mapping_count", + "metadata_count", + "name", + "settings_count", + "version", + ], + ] + ], + t.Union[ + str, + t.Literal[ + "alias_count", + "included_in", + "mapping_count", + "metadata_count", + "name", + "settings_count", + "version", + ], + ], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, local: t.Optional[bool] = None, @@ -249,7 +348,8 @@ def component_templates( If it is omitted, all component templates are returned. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param local: If `true`, the request computes the list of selected nodes from @@ -310,7 +410,12 @@ def count( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[t.Union[str, t.Literal["count", "epoch", "timestamp"]]], + t.Union[str, t.Literal["count", "epoch", "timestamp"]], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, @@ -334,7 +439,8 @@ def count( and indices, omit this parameter or use `*` or `_all`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param s: List of columns that determine how the table should be sorted. Sorting @@ -389,7 +495,14 @@ def fielddata( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, + h: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]] + ], + t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]], + ] + ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, @@ -412,7 +525,8 @@ def fielddata( :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. + :param h: A comma-separated list of columns names to display. It supports simple + wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param s: List of columns that determine how the table should be sorted. Sorting diff --git a/elasticsearch/_sync/client/cluster.py b/elasticsearch/_sync/client/cluster.py index 77ced5e60..d7322bf5f 100644 --- a/elasticsearch/_sync/client/cluster.py +++ b/elasticsearch/_sync/client/cluster.py @@ -373,8 +373,13 @@ def get_settings( ``_ :param flat_settings: If `true`, returns settings in flat format. - :param include_defaults: If `true`, returns default cluster settings from the - local node. + :param include_defaults: If `true`, also returns default values for all other + cluster settings, reflecting the values in the `elasticsearch.yml` file of + one of the nodes in the cluster. If the nodes in your cluster do not all + have the same values in their `elasticsearch.yml` config files then the values + returned by this API may vary from invocation to invocation and may not reflect + the values that Elasticsearch uses in all situations. Use the `GET _nodes/settings` + API to fetch the settings for each individual node in your cluster. :param master_timeout: 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. diff --git a/elasticsearch/_sync/client/esql.py b/elasticsearch/_sync/client/esql.py index e34a26fb8..67a4746ae 100644 --- a/elasticsearch/_sync/client/esql.py +++ b/elasticsearch/_sync/client/esql.py @@ -44,7 +44,7 @@ class EsqlClient(NamespacedClient): def async_query( self, *, - query: t.Optional[str] = None, + query: t.Optional[t.Union[str, "ESQLBase"]] = None, allow_partial_results: t.Optional[bool] = None, columnar: t.Optional[bool] = None, delimiter: t.Optional[str] = None, @@ -107,7 +107,12 @@ def async_query( which has the name of all the columns. :param filter: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. - :param format: A short version of the Accept header, for example `json` or `yaml`. + :param format: A short version of the Accept header, e.g. json, yaml. `csv`, + `tsv`, and `txt` formats will return results in a tabular format, excluding + other metadata fields from the response. For async requests, nothing will + be returned if the async query doesn't finish within the timeout. The query + ID and running status are available in the `X-Elasticsearch-Async-Id` and + `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively. :param include_ccs_metadata: When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as @@ -161,7 +166,7 @@ def async_query( __query["pretty"] = pretty if not __body: if query is not None: - __body["query"] = query + __body["query"] = str(query) if columnar is not None: __body["columnar"] = columnar if filter is not None: @@ -399,7 +404,7 @@ def async_query_stop( def query( self, *, - query: t.Optional[str] = None, + query: t.Optional[t.Union[str, "ESQLBase"]] = None, allow_partial_results: t.Optional[bool] = None, columnar: t.Optional[bool] = None, delimiter: t.Optional[str] = None, @@ -456,7 +461,9 @@ def query( `all_columns` which has the name of all columns. :param filter: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. - :param format: A short version of the Accept header, e.g. json, yaml. + :param format: A short version of the Accept header, e.g. json, yaml. `csv`, + `tsv`, and `txt` formats will return results in a tabular format, excluding + other metadata fields from the response. :param include_ccs_metadata: When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as @@ -496,7 +503,7 @@ def query( __query["pretty"] = pretty if not __body: if query is not None: - __body["query"] = query + __body["query"] = str(query) if columnar is not None: __body["columnar"] = columnar if filter is not None: diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index 90dcf60f4..44de58eac 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -4581,7 +4581,7 @@ def rollover( .. raw:: html

    Roll over to a new index. - TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.

    + TIP: We recommend using the index lifecycle rollover action to automate rollovers. However, Serverless does not support Index Lifecycle Management (ILM), so don't use this approach in the Serverless context.

    The rollover API creates a new index for a data stream or index alias. The API behavior depends on the rollover target.

    Roll over a data stream

    diff --git a/elasticsearch/_sync/client/inference.py b/elasticsearch/_sync/client/inference.py index 1478883e8..c2668ef09 100644 --- a/elasticsearch/_sync/client/inference.py +++ b/elasticsearch/_sync/client/inference.py @@ -391,21 +391,23 @@ def put(
    • AlibabaCloud AI Search (completion, rerank, sparse_embedding, text_embedding)
    • Amazon Bedrock (completion, text_embedding)
    • +
    • Amazon SageMaker (chat_completion, completion, rerank, sparse_embedding, text_embedding)
    • Anthropic (completion)
    • Azure AI Studio (completion, text_embedding)
    • Azure OpenAI (completion, text_embedding)
    • Cohere (completion, rerank, text_embedding)
    • -
    • DeepSeek (completion, chat_completion)
    • +
    • DeepSeek (chat_completion, completion)
    • Elasticsearch (rerank, sparse_embedding, text_embedding - this service is for built-in models and models uploaded through Eland)
    • ELSER (sparse_embedding)
    • Google AI Studio (completion, text_embedding)
    • -
    • Google Vertex AI (rerank, text_embedding)
    • +
    • Google Vertex AI (chat_completion, completion, rerank, text_embedding)
    • Hugging Face (chat_completion, completion, rerank, text_embedding)
    • +
    • JinaAI (rerank, text_embedding)
    • +
    • Llama (chat_completion, completion, text_embedding)
    • Mistral (chat_completion, completion, text_embedding)
    • OpenAI (chat_completion, completion, text_embedding)
    • -
    • VoyageAI (text_embedding, rerank)
    • +
    • VoyageAI (rerank, text_embedding)
    • Watsonx inference integration (text_embedding)
    • -
    • JinaAI (text_embedding, rerank)
    @@ -659,6 +661,112 @@ def put_amazonbedrock( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=( + "service", + "service_settings", + "chunking_settings", + "task_settings", + ), + ) + def put_amazonsagemaker( + self, + *, + task_type: t.Union[ + str, + t.Literal[ + "chat_completion", + "completion", + "rerank", + "sparse_embedding", + "text_embedding", + ], + ], + amazonsagemaker_inference_id: str, + service: t.Optional[t.Union[str, t.Literal["amazon_sagemaker"]]] = None, + service_settings: t.Optional[t.Mapping[str, t.Any]] = None, + chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + task_settings: t.Optional[t.Mapping[str, t.Any]] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Create an Amazon SageMaker inference endpoint.

    +

    Create an inference endpoint to perform an inference task with the amazon_sagemaker service.

    + + + ``_ + + :param task_type: The type of the inference task that the model will perform. + :param amazonsagemaker_inference_id: The unique identifier of the inference endpoint. + :param service: The type of service supported for the specified task type. In + this case, `amazon_sagemaker`. + :param service_settings: Settings used to install the inference model. These + settings are specific to the `amazon_sagemaker` service and `service_settings.api` + you specified. + :param chunking_settings: The chunking configuration object. + :param task_settings: Settings to configure the inference task. These settings + are specific to the task type and `service_settings.api` you specified. + :param timeout: Specifies the amount of time to wait for the inference endpoint + to be created. + """ + if task_type in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'task_type'") + if amazonsagemaker_inference_id in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for parameter 'amazonsagemaker_inference_id'" + ) + if service is None and body is None: + raise ValueError("Empty value passed for parameter 'service'") + if service_settings is None and body is None: + raise ValueError("Empty value passed for parameter 'service_settings'") + __path_parts: t.Dict[str, str] = { + "task_type": _quote(task_type), + "amazonsagemaker_inference_id": _quote(amazonsagemaker_inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["amazonsagemaker_inference_id"]}' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if not __body: + if service is not None: + __body["service"] = service + if service_settings is not None: + __body["service_settings"] = service_settings + if chunking_settings is not None: + __body["chunking_settings"] = chunking_settings + if task_settings is not None: + __body["task_settings"] = task_settings + if not __body: + __body = None # type: ignore[assignment] + __headers = {"accept": "application/json"} + if __body is not None: + __headers["content-type"] = "application/json" + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="inference.put_amazonsagemaker", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "service", diff --git a/elasticsearch/_sync/client/snapshot.py b/elasticsearch/_sync/client/snapshot.py index 8c98d6cd4..705161d89 100644 --- a/elasticsearch/_sync/client/snapshot.py +++ b/elasticsearch/_sync/client/snapshot.py @@ -52,9 +52,16 @@ def cleanup_repository( ``_ - :param name: Snapshot repository to clean up. - :param master_timeout: Period to wait for a connection to the master node. - :param timeout: Period to wait for a response. + :param name: The name of the snapshot repository to clean up. + :param master_timeout: 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` + :param timeout: 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`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -109,11 +116,15 @@ def clone( ``_ - :param repository: A repository name - :param snapshot: The name of the snapshot to clone from - :param target_snapshot: The name of the cloned snapshot to create - :param indices: - :param master_timeout: Explicit operation timeout for connection to master node + :param repository: The name of the snapshot repository that both source and target + snapshot belong to. + :param snapshot: The source snapshot name. + :param target_snapshot: The target snapshot name. + :param indices: A comma-separated list of indices to include in the snapshot. + Multi-target syntax is supported. + :param master_timeout: 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`. """ if repository in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'repository'") @@ -157,6 +168,7 @@ def clone( @_rewrite_parameters( body_fields=( + "expand_wildcards", "feature_states", "ignore_unavailable", "include_global_state", @@ -171,6 +183,14 @@ def create( repository: str, snapshot: str, error_trace: t.Optional[bool] = None, + expand_wildcards: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]] + ], + t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]], + ] + ] = None, feature_states: t.Optional[t.Sequence[str]] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, @@ -193,13 +213,20 @@ def create( ``_ - :param repository: Repository for the snapshot. - :param snapshot: Name of the snapshot. Must be unique in the repository. - :param feature_states: Feature states to include in the snapshot. Each feature + :param repository: The name of the repository for the snapshot. + :param snapshot: The name of the snapshot. It supportes date math. It must be + unique in the repository. + :param expand_wildcards: Determines how wildcard patterns in the `indices` parameter + match data streams and indices. It supports comma-separated values such as + `open,hidden`. + :param feature_states: 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. + 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"]`). :param ignore_unavailable: 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. @@ -208,18 +235,24 @@ def create( 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`). - :param indices: Data streams and indices to include in the snapshot. Supports - multi-target syntax. Includes all data streams and indices by default. - :param master_timeout: 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. - :param metadata: Optional metadata for the snapshot. May have any contents. Must - be less than 1024 bytes. This map is not automatically generated by Elasticsearch. - :param partial: If `true`, 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. If `false`, - the entire restore operation will fail if one or more indices included in - the snapshot do not have all primary shards available. + :param indices: 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. + :param master_timeout: 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. + :param metadata: 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. + :param partial: 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. :param wait_for_completion: If `true`, the request returns a response when the snapshot is complete. If `false`, the request returns a response when the snapshot initializes. @@ -248,6 +281,8 @@ def create( if wait_for_completion is not None: __query["wait_for_completion"] = wait_for_completion if not __body: + if expand_wildcards is not None: + __body["expand_wildcards"] = expand_wildcards if feature_states is not None: __body["feature_states"] = feature_states if ignore_unavailable is not None: @@ -299,15 +334,26 @@ def create_repository( IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. To register a snapshot repository, the cluster's global metadata must be writeable. Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access.

    +

    Several options for this API can be specified using a query parameter or a request body parameter. + If both parameters are specified, only the query parameter is used.

    - ``_ + ``_ - :param name: A repository name + :param name: The name of the snapshot repository to register or update. :param repository: - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout - :param verify: Whether to verify the repository after creation + :param master_timeout: 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`. + :param timeout: 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`. + :param verify: 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. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -367,9 +413,12 @@ def delete( ``_ - :param repository: A repository name - :param snapshot: A comma-separated list of snapshot names - :param master_timeout: Explicit operation timeout for connection to master node + :param repository: The name of the repository to delete a snapshot from. + :param snapshot: A comma-separated list of snapshot names to delete. It also + accepts wildcards (`*`). + :param master_timeout: 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`. :param wait_for_completion: If `true`, the request returns a response when the matching snapshots are all deleted. If `false`, the request returns a response as soon as the deletes are scheduled. @@ -428,10 +477,16 @@ def delete_repository( ``_ - :param name: Name of the snapshot repository to unregister. Wildcard (`*`) patterns - are supported. - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout + :param name: The ame of the snapshot repositories to unregister. Wildcard (`*`) + patterns are supported. + :param master_timeout: 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`. + :param timeout: 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`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -501,50 +556,64 @@ def get( .. raw:: html

    Get snapshot information.

    +

    NOTE: The after parameter and next field enable you to iterate through snapshots with some consistency guarantees regarding concurrent creation or deletion of snapshots. + It is guaranteed that any snapshot that exists at the beginning of the iteration and is not concurrently deleted will be seen during the iteration. + Snapshots concurrently created may be seen during an iteration.

    ``_ - :param repository: Comma-separated list of snapshot repository names used to - limit the request. Wildcard (*) expressions are supported. - :param snapshot: Comma-separated list of snapshot names to retrieve. Also accepts - wildcards (*). - 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. - :param after: Offset identifier to start pagination from as returned by the next - field in the response body. - :param from_sort_value: Value of the current sort column at which to start retrieval. - Can either be a string snapshot- or repository name when sorting by snapshot - or repository name, a millisecond time value or a number when sorting by - index- or shard count. - :param ignore_unavailable: If false, the request returns an error for any snapshots + :param repository: A comma-separated list of snapshot repository names used to + limit the request. Wildcard (`*`) expressions are supported. + :param snapshot: 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`. + :param after: An offset identifier to start pagination from as returned by the + next field in the response body. + :param from_sort_value: 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. + :param ignore_unavailable: If `false`, the request returns an error for any snapshots that are unavailable. - :param include_repository: If true, returns the repository name in each snapshot. - :param index_details: If true, returns 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. Defaults to false, meaning that this information is omitted. - :param index_names: If true, returns the name of each index in each snapshot. - :param master_timeout: 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. + :param include_repository: If `true`, the response includes the repository name + in each snapshot. + :param index_details: 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. + :param index_names: If `true`, the response includes the name of each index in + each snapshot. + :param master_timeout: 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. :param offset: 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. - :param order: Sort order. Valid values are asc for ascending and desc for descending - order. Defaults to asc, meaning ascending order. - :param size: Maximum number of snapshots to return. Defaults to 0 which means - return all that match the request without limit. - :param slm_policy_filter: Filter snapshots by a comma-separated list of SLM policy - names that snapshots belong to. Also accepts wildcards (*) and combinations - of wildcards followed by exclude patterns starting with -. To include snapshots - not created by an SLM policy you can use the special pattern _none that will - match all snapshots without an SLM policy. - :param sort: Allows setting a sort order for the result. Defaults to start_time, - i.e. sorting by snapshot start time stamp. - :param verbose: 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. + :param order: The sort order. Valid values are `asc` for ascending and `desc` + for descending order. The default behavior is ascending order. + :param size: The maximum number of snapshots to return. The default is 0, which + means to return all that match the request without limit. + :param slm_policy_filter: 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. + :param sort: The sort order for the result. The default behavior is sorting by + snapshot start time stamp. + :param verbose: 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. """ if repository in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'repository'") @@ -620,10 +689,16 @@ def get_repository( ``_ - :param name: A comma-separated list of repository names - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Explicit operation timeout for connection to master node + :param name: 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`. + :param local: If `true`, the request gets information from the local node only. + If `false`, the request gets information from the master node. + :param master_timeout: 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`. """ __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: @@ -881,21 +956,39 @@ def repository_verify_integrity( It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting.

    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: This API may not work correctly in a mixed-version cluster.

    +

    The default values for the parameters of this API are designed to limit the impact of the integrity verification on other activities in your cluster. + For instance, by default it will only use at most half of the snapshot_meta threads to verify the integrity of each snapshot, allowing other snapshot operations to use the other half of this thread pool. + If you modify these parameters to speed up the verification process, you risk disrupting other snapshot-related operations in your cluster. + For large repositories, consider setting up a separate single-node Elasticsearch cluster just for running the integrity verification API.

    +

    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.

    ``_ - :param name: A repository name - :param blob_thread_pool_concurrency: Number of threads to use for reading blob - contents - :param index_snapshot_verification_concurrency: Number of snapshots to verify - concurrently within each index - :param index_verification_concurrency: Number of indices to verify concurrently - :param max_bytes_per_sec: Rate limit for individual blob verification - :param max_failed_shard_snapshots: Maximum permitted number of failed shard snapshots - :param meta_thread_pool_concurrency: Number of threads to use for reading metadata - :param snapshot_verification_concurrency: Number of snapshots to verify concurrently - :param verify_blob_contents: Whether to verify the contents of individual blobs + :param name: The name of the snapshot repository. + :param blob_thread_pool_concurrency: If `verify_blob_contents` is `true`, this + parameter specifies how many blobs to verify at once. + :param index_snapshot_verification_concurrency: The maximum number of index snapshots + to verify concurrently within each index verification. + :param index_verification_concurrency: The number of indices to verify concurrently. + The default behavior is to use the entire `snapshot_meta` thread pool. + :param max_bytes_per_sec: If `verify_blob_contents` is `true`, this parameter + specifies the maximum amount of data that Elasticsearch will read from the + repository every second. + :param max_failed_shard_snapshots: 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. + :param meta_thread_pool_concurrency: 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. + :param snapshot_verification_concurrency: The number of snapshots to verify concurrently. + The default behavior is to use at most half of the `snapshot_meta` thread + pool at once. + :param verify_blob_contents: 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. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -995,21 +1088,64 @@ def restore( ``_ - :param repository: A repository name - :param snapshot: A snapshot name - :param feature_states: - :param ignore_index_settings: - :param ignore_unavailable: - :param include_aliases: - :param include_global_state: - :param index_settings: - :param indices: - :param master_timeout: Explicit operation timeout for connection to master node - :param partial: - :param rename_pattern: - :param rename_replacement: - :param wait_for_completion: Should this request wait until the operation has - completed before returning + :param repository: The name of the repository to restore a snapshot from. + :param snapshot: The name of the snapshot to restore. + :param feature_states: 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"]`). + :param ignore_index_settings: 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. + :param ignore_unavailable: 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. + :param include_aliases: If `true`, the request restores aliases for any restored + data streams and indices. If `false`, the request doesn’t restore aliases. + :param include_global_state: 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. + :param index_settings: 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. + :param indices: 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. + :param master_timeout: 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`. + :param partial: 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. + :param rename_pattern: 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. + :param rename_replacement: The rename replacement string that is used with the + `rename_pattern`. + :param wait_for_completion: 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. """ if repository in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'repository'") @@ -1087,9 +1223,12 @@ def status( .. raw:: html

    Get the snapshot status. - Get a detailed description of the current state for each shard participating in the snapshot. - Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. + Get a detailed description of the current state for each shard participating in the snapshot.

    +

    Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API.

    +

    If you omit the <snapshot> request path parameter, the request retrieves information only for currently running snapshots. + This usage is preferred. + If needed, you can specify <repository> and <snapshot> to retrieve information for specific snapshots, even if they're not currently running.

    WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. The API requires a read from the repository for each shard in each snapshot. For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards).

    @@ -1099,11 +1238,16 @@ def status( ``_ - :param repository: A repository name - :param snapshot: A comma-separated list of snapshot names - :param ignore_unavailable: Whether to ignore unavailable snapshots, defaults - to false which means a SnapshotMissingException is thrown - :param master_timeout: Explicit operation timeout for connection to master node + :param repository: The snapshot repository name used to limit the request. It + supports wildcards (`*`) if `` isn't specified. + :param snapshot: A comma-separated list of snapshots to retrieve status for. + The default is currently running snapshots. Wildcards (`*`) are not supported. + :param ignore_unavailable: 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. + :param master_timeout: 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`. """ __path_parts: t.Dict[str, str] if repository not in SKIP_IN_PATH and snapshot not in SKIP_IN_PATH: @@ -1162,9 +1306,15 @@ def verify_repository( ``_ - :param name: A repository name - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout + :param name: The name of the snapshot repository to verify. + :param master_timeout: 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`. + :param timeout: 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`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") diff --git a/elasticsearch/_sync/client/sql.py b/elasticsearch/_sync/client/sql.py index cde458be5..094a1b016 100644 --- a/elasticsearch/_sync/client/sql.py +++ b/elasticsearch/_sync/client/sql.py @@ -283,7 +283,7 @@ def query( keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, keep_on_completion: t.Optional[bool] = None, page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - params: t.Optional[t.Mapping[str, t.Any]] = None, + params: t.Optional[t.Sequence[t.Any]] = None, pretty: t.Optional[bool] = None, query: t.Optional[str] = None, request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, diff --git a/elasticsearch/_sync/client/transform.py b/elasticsearch/_sync/client/transform.py index 7afb9d45d..9ba26507e 100644 --- a/elasticsearch/_sync/client/transform.py +++ b/elasticsearch/_sync/client/transform.py @@ -602,6 +602,66 @@ def schedule_now_transform( path_parts=__path_parts, ) + @_rewrite_parameters() + def set_upgrade_mode( + self, + *, + enabled: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Set upgrade_mode for transform indices. + Sets a cluster wide upgrade_mode setting that prepares transform + indices for an upgrade. + When upgrading your cluster, in some circumstances you must restart your + nodes and reindex your transform indices. In those circumstances, + there must be no transforms running. You can close the transforms, + do the upgrade, then open all the transforms again. Alternatively, + you can use this API to temporarily halt tasks associated with the transforms + and prevent new transforms from opening. You can also use this API + during upgrades that do not require you to reindex your transform + indices, though stopping transforms is not a requirement in that case. + You can see the current value for the upgrade_mode setting by using the get + transform info API.

    + + + ``_ + + :param enabled: When `true`, it enables `upgrade_mode` which temporarily halts + all transform tasks and prohibits new transform tasks from starting. + :param timeout: The time to wait for the request to be completed. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_transform/set_upgrade_mode" + __query: t.Dict[str, t.Any] = {} + if enabled is not None: + __query["enabled"] = enabled + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.set_upgrade_mode", + path_parts=__path_parts, + ) + @_rewrite_parameters( parameter_aliases={"from": "from_"}, ) diff --git a/elasticsearch/dsl/aggs.py b/elasticsearch/dsl/aggs.py index 3b7a8e8ba..7f1019b56 100644 --- a/elasticsearch/dsl/aggs.py +++ b/elasticsearch/dsl/aggs.py @@ -372,6 +372,12 @@ class Boxplot(Agg[_R]): :arg compression: Limits the maximum number of nodes used by the underlying TDigest algorithm to `20 * compression`, enabling control of memory usage and approximation error. + :arg execution_hint: The default implementation of TDigest is + optimized for performance, scaling to millions or even billions of + sample values while maintaining acceptable accuracy levels (close + to 1% relative error for millions of samples in some cases). To + use an implementation optimized for accuracy, set this parameter + to high_accuracy instead. Defaults to `default` if omitted. :arg field: The field on which to run the aggregation. :arg missing: The value to apply to documents that do not have a value. By default, documents without a value are ignored. @@ -384,6 +390,9 @@ def __init__( self, *, compression: Union[float, "DefaultType"] = DEFAULT, + execution_hint: Union[ + Literal["default", "high_accuracy"], "DefaultType" + ] = DEFAULT, field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT, missing: Union[str, int, float, bool, "DefaultType"] = DEFAULT, script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT, @@ -391,6 +400,7 @@ def __init__( ): super().__init__( compression=compression, + execution_hint=execution_hint, field=field, missing=missing, script=script, @@ -1897,6 +1907,12 @@ class MedianAbsoluteDeviation(Agg[_R]): underlying TDigest algorithm to `20 * compression`, enabling control of memory usage and approximation error. Defaults to `1000` if omitted. + :arg execution_hint: The default implementation of TDigest is + optimized for performance, scaling to millions or even billions of + sample values while maintaining acceptable accuracy levels (close + to 1% relative error for millions of samples in some cases). To + use an implementation optimized for accuracy, set this parameter + to high_accuracy instead. Defaults to `default` if omitted. :arg format: :arg field: The field on which to run the aggregation. :arg missing: The value to apply to documents that do not have a @@ -1910,6 +1926,9 @@ def __init__( self, *, compression: Union[float, "DefaultType"] = DEFAULT, + execution_hint: Union[ + Literal["default", "high_accuracy"], "DefaultType" + ] = DEFAULT, format: Union[str, "DefaultType"] = DEFAULT, field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT, missing: Union[str, int, float, bool, "DefaultType"] = DEFAULT, @@ -1918,6 +1937,7 @@ def __init__( ): super().__init__( compression=compression, + execution_hint=execution_hint, format=format, field=field, missing=missing, diff --git a/elasticsearch/dsl/field.py b/elasticsearch/dsl/field.py index d4c5a6e76..84dbe0c4a 100644 --- a/elasticsearch/dsl/field.py +++ b/elasticsearch/dsl/field.py @@ -3862,6 +3862,14 @@ class SemanticText(Field): by using the Update mapping API. Use the Create inference API to create the endpoint. If not specified, the inference endpoint defined by inference_id will be used at both index and query time. + :arg index_options: Settings for index_options that override any + defaults used by semantic_text, for example specific quantization + settings. + :arg chunking_settings: Settings for chunking text into smaller + passages. If specified, these will override the chunking settings + sent in the inference endpoint associated with inference_id. If + chunking settings are updated, they will not be applied to + existing documents until they are reindexed. """ name = "semantic_text" @@ -3872,6 +3880,12 @@ def __init__( meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT, inference_id: Union[str, "DefaultType"] = DEFAULT, search_inference_id: Union[str, "DefaultType"] = DEFAULT, + index_options: Union[ + "types.SemanticTextIndexOptions", Dict[str, Any], "DefaultType" + ] = DEFAULT, + chunking_settings: Union[ + "types.ChunkingSettings", Dict[str, Any], "DefaultType" + ] = DEFAULT, **kwargs: Any, ): if meta is not DEFAULT: @@ -3880,6 +3894,10 @@ def __init__( kwargs["inference_id"] = inference_id if search_inference_id is not DEFAULT: kwargs["search_inference_id"] = search_inference_id + if index_options is not DEFAULT: + kwargs["index_options"] = index_options + if chunking_settings is not DEFAULT: + kwargs["chunking_settings"] = chunking_settings super().__init__(*args, **kwargs) @@ -4076,6 +4094,9 @@ def __init__( class SparseVector(Field): """ :arg store: + :arg index_options: Additional index options for the sparse vector + field that controls the token pruning behavior of the sparse + vector field. :arg meta: Metadata about the field. :arg properties: :arg ignore_above: @@ -4094,6 +4115,9 @@ def __init__( self, *args: Any, store: Union[bool, "DefaultType"] = DEFAULT, + index_options: Union[ + "types.SparseVectorIndexOptions", Dict[str, Any], "DefaultType" + ] = DEFAULT, meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT, properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT, ignore_above: Union[int, "DefaultType"] = DEFAULT, @@ -4108,6 +4132,8 @@ def __init__( ): if store is not DEFAULT: kwargs["store"] = store + if index_options is not DEFAULT: + kwargs["index_options"] = index_options if meta is not DEFAULT: kwargs["meta"] = meta if properties is not DEFAULT: diff --git a/elasticsearch/dsl/types.py b/elasticsearch/dsl/types.py index 2e616f644..0dfce4543 100644 --- a/elasticsearch/dsl/types.py +++ b/elasticsearch/dsl/types.py @@ -170,6 +170,48 @@ def __init__( super().__init__(kwargs) +class ChunkingSettings(AttrDict[Any]): + """ + :arg strategy: (required) The chunking strategy: `sentence` or `word`. + Defaults to `sentence` if omitted. + :arg max_chunk_size: (required) The maximum size of a chunk in words. + This value cannot be higher than `300` or lower than `20` (for + `sentence` strategy) or `10` (for `word` strategy). Defaults to + `250` if omitted. + :arg overlap: The number of overlapping words for chunks. It is + applicable only to a `word` chunking strategy. This value cannot + be higher than half the `max_chunk_size` value. Defaults to `100` + if omitted. + :arg sentence_overlap: The number of overlapping sentences for chunks. + It is applicable only for a `sentence` chunking strategy. It can + be either `1` or `0`. Defaults to `1` if omitted. + """ + + strategy: Union[str, DefaultType] + max_chunk_size: Union[int, DefaultType] + overlap: Union[int, DefaultType] + sentence_overlap: Union[int, DefaultType] + + def __init__( + self, + *, + strategy: Union[str, DefaultType] = DEFAULT, + max_chunk_size: Union[int, DefaultType] = DEFAULT, + overlap: Union[int, DefaultType] = DEFAULT, + sentence_overlap: Union[int, DefaultType] = DEFAULT, + **kwargs: Any, + ): + if strategy is not DEFAULT: + kwargs["strategy"] = strategy + if max_chunk_size is not DEFAULT: + kwargs["max_chunk_size"] = max_chunk_size + if overlap is not DEFAULT: + kwargs["overlap"] = overlap + if sentence_overlap is not DEFAULT: + kwargs["sentence_overlap"] = sentence_overlap + super().__init__(kwargs) + + class ClassificationInferenceOptions(AttrDict[Any]): """ :arg num_top_classes: Specifies the number of top class predictions to @@ -3119,6 +3161,26 @@ def __init__( super().__init__(kwargs) +class SemanticTextIndexOptions(AttrDict[Any]): + """ + :arg dense_vector: + """ + + dense_vector: Union["DenseVectorIndexOptions", Dict[str, Any], DefaultType] + + def __init__( + self, + *, + dense_vector: Union[ + "DenseVectorIndexOptions", Dict[str, Any], DefaultType + ] = DEFAULT, + **kwargs: Any, + ): + if dense_vector is not DEFAULT: + kwargs["dense_vector"] = dense_vector + super().__init__(kwargs) + + class ShapeFieldQuery(AttrDict[Any]): """ :arg indexed_shape: Queries using a pre-indexed shape. @@ -3196,10 +3258,15 @@ def __init__( class SourceFilter(AttrDict[Any]): """ - :arg excludes: - :arg includes: + :arg exclude_vectors: If `true`, vector fields are excluded from the + returned source. This option takes precedence over `includes`: + any vector field will remain excluded even if it matches an + `includes` rule. + :arg excludes: A list of fields to exclude from the returned source. + :arg includes: A list of fields to include in the returned source. """ + exclude_vectors: Union[bool, DefaultType] excludes: Union[ Union[str, InstrumentedField], Sequence[Union[str, InstrumentedField]], @@ -3214,6 +3281,7 @@ class SourceFilter(AttrDict[Any]): def __init__( self, *, + exclude_vectors: Union[bool, DefaultType] = DEFAULT, excludes: Union[ Union[str, InstrumentedField], Sequence[Union[str, InstrumentedField]], @@ -3226,6 +3294,8 @@ def __init__( ] = DEFAULT, **kwargs: Any, ): + if exclude_vectors is not DEFAULT: + kwargs["exclude_vectors"] = exclude_vectors if excludes is not DEFAULT: kwargs["excludes"] = str(excludes) if includes is not DEFAULT: @@ -3675,6 +3745,38 @@ def __init__( super().__init__(kwargs) +class SparseVectorIndexOptions(AttrDict[Any]): + """ + :arg prune: Whether to perform pruning, omitting the non-significant + tokens from the query to improve query performance. If prune is + true but the pruning_config is not specified, pruning will occur + but default values will be used. Default: false + :arg pruning_config: Optional pruning configuration. If enabled, this + will omit non-significant tokens from the query in order to + improve query performance. This is only used if prune is set to + true. If prune is set to true but pruning_config is not specified, + default values will be used. + """ + + prune: Union[bool, DefaultType] + pruning_config: Union["TokenPruningConfig", Dict[str, Any], DefaultType] + + def __init__( + self, + *, + prune: Union[bool, DefaultType] = DEFAULT, + pruning_config: Union[ + "TokenPruningConfig", Dict[str, Any], DefaultType + ] = DEFAULT, + **kwargs: Any, + ): + if prune is not DEFAULT: + kwargs["prune"] = prune + if pruning_config is not DEFAULT: + kwargs["pruning_config"] = pruning_config + super().__init__(kwargs) + + class SuggestContext(AttrDict[Any]): """ :arg name: (required) @@ -3713,15 +3815,30 @@ class TDigest(AttrDict[Any]): :arg compression: Limits the maximum number of nodes used by the underlying TDigest algorithm to `20 * compression`, enabling control of memory usage and approximation error. + :arg execution_hint: The default implementation of TDigest is + optimized for performance, scaling to millions or even billions of + sample values while maintaining acceptable accuracy levels (close + to 1% relative error for millions of samples in some cases). To + use an implementation optimized for accuracy, set this parameter + to high_accuracy instead. Defaults to `default` if omitted. """ compression: Union[int, DefaultType] + execution_hint: Union[Literal["default", "high_accuracy"], DefaultType] def __init__( - self, *, compression: Union[int, DefaultType] = DEFAULT, **kwargs: Any + self, + *, + compression: Union[int, DefaultType] = DEFAULT, + execution_hint: Union[ + Literal["default", "high_accuracy"], DefaultType + ] = DEFAULT, + **kwargs: Any, ): if compression is not DEFAULT: kwargs["compression"] = compression + if execution_hint is not DEFAULT: + kwargs["execution_hint"] = execution_hint super().__init__(kwargs) @@ -4444,7 +4561,7 @@ class ArrayPercentilesItem(AttrDict[Any]): :arg value_as_string: """ - key: str + key: float value: Union[float, None] value_as_string: str @@ -5290,7 +5407,9 @@ class HdrPercentileRanksAggregate(AttrDict[Any]): :arg meta: """ - values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]] + values: Union[ + Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"] + ] meta: Mapping[str, Any] @@ -5300,7 +5419,9 @@ class HdrPercentilesAggregate(AttrDict[Any]): :arg meta: """ - values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]] + values: Union[ + Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"] + ] meta: Mapping[str, Any] @@ -5809,7 +5930,9 @@ class PercentilesBucketAggregate(AttrDict[Any]): :arg meta: """ - values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]] + values: Union[ + Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"] + ] meta: Mapping[str, Any] @@ -6010,17 +6133,19 @@ class SearchProfile(AttrDict[Any]): class ShardFailure(AttrDict[Any]): """ :arg reason: (required) - :arg shard: (required) :arg index: :arg node: + :arg shard: :arg status: + :arg primary: """ reason: "ErrorCause" - shard: int index: str node: str + shard: int status: str + primary: bool class ShardProfile(AttrDict[Any]): @@ -6344,7 +6469,9 @@ class TDigestPercentileRanksAggregate(AttrDict[Any]): :arg meta: """ - values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]] + values: Union[ + Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"] + ] meta: Mapping[str, Any] @@ -6354,7 +6481,9 @@ class TDigestPercentilesAggregate(AttrDict[Any]): :arg meta: """ - values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]] + values: Union[ + Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"] + ] meta: Mapping[str, Any]