From 11f7d5aeeb4301e744036c20b9244d63b49145e1 Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Mon, 1 Dec 2025 06:03:35 +0000 Subject: [PATCH] Auto-generated API code --- elasticsearch/_async/client/__init__.py | 92 ++++- elasticsearch/_async/client/_internal.py | 326 ++++++++++++++++++ elasticsearch/_async/client/cat.py | 38 ++ elasticsearch/_async/client/cluster.py | 3 +- elasticsearch/_async/client/connector.py | 190 +++++++++- .../_async/client/dangling_indices.py | 8 +- elasticsearch/_async/client/eql.py | 2 +- elasticsearch/_async/client/fleet.py | 134 +++++++ elasticsearch/_async/client/indices.py | 6 +- elasticsearch/_async/client/profiling.py | 177 ++++++++++ elasticsearch/_async/client/text_structure.py | 6 +- elasticsearch/_sync/client/__init__.py | 92 ++++- elasticsearch/_sync/client/_internal.py | 326 ++++++++++++++++++ elasticsearch/_sync/client/cat.py | 38 ++ elasticsearch/_sync/client/cluster.py | 3 +- elasticsearch/_sync/client/connector.py | 190 +++++++++- .../_sync/client/dangling_indices.py | 8 +- elasticsearch/_sync/client/eql.py | 2 +- elasticsearch/_sync/client/fleet.py | 134 +++++++ elasticsearch/_sync/client/indices.py | 6 +- elasticsearch/_sync/client/profiling.py | 177 ++++++++++ elasticsearch/_sync/client/text_structure.py | 6 +- elasticsearch/_version.py | 2 +- elasticsearch/dsl/aggs.py | 14 +- 24 files changed, 1926 insertions(+), 54 deletions(-) create mode 100644 elasticsearch/_async/client/_internal.py create mode 100644 elasticsearch/_async/client/profiling.py create mode 100644 elasticsearch/_sync/client/_internal.py create mode 100644 elasticsearch/_sync/client/profiling.py diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index cd64c279c..0f7a2151f 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -706,6 +706,7 @@ async def bulk(
  • Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll
  • Python: Check out elasticsearch.helpers.*
  • JavaScript: Check out client.helpers.*
  • +
  • Java: Check out co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester
  • .NET: Check out BulkAllObservable
  • PHP: Check out bulk indexing.
  • Ruby: Check out Elasticsearch::Helpers::BulkHelper
  • @@ -845,6 +846,73 @@ async def bulk( path_parts=__path_parts, ) + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def capabilities( + self, + *, + capabilities: t.Optional[t.Union[str, t.Sequence[str]]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + local_only: t.Optional[bool] = None, + method: t.Optional[ + t.Union[str, t.Literal["DELETE", "GET", "HEAD", "POST", "PUT"]] + ] = None, + parameters: t.Optional[t.Union[str, t.Sequence[str]]] = None, + path: t.Optional[str] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Checks if the specified combination of method, API, parameters, and arbitrary capabilities are supported.

    + + + ``_ + + :param capabilities: Comma-separated list of arbitrary API capabilities to check + :param local_only: True if only the node being called should be considered + :param method: REST method to check + :param parameters: Comma-separated list of API parameters to check + :param path: API path to check + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_capabilities" + __query: t.Dict[str, t.Any] = {} + if capabilities is not None: + __query["capabilities"] = capabilities + 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 local_only is not None: + __query["local_only"] = local_only + if method is not None: + __query["method"] = method + if parameters is not None: + __query["parameters"] = parameters + if path is not None: + __query["path"] = path + 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] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="capabilities", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("scroll_id",), ) @@ -1729,11 +1797,11 @@ async def delete_by_query_rethrottle( self, *, task_id: t.Union[int, str], + requests_per_second: float, 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, - requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -1751,9 +1819,13 @@ async def delete_by_query_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") + if requests_per_second is None: + raise ValueError("Empty value passed for parameter 'requests_per_second'") __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} __path = f'/_delete_by_query/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} + if requests_per_second is not None: + __query["requests_per_second"] = requests_per_second if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -1762,8 +1834,6 @@ async def delete_by_query_rethrottle( __query["human"] = human if pretty is not None: __query["pretty"] = pretty - if requests_per_second is not None: - __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", @@ -4293,11 +4363,11 @@ async def reindex_rethrottle( self, *, task_id: str, + requests_per_second: float, 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, - requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -4321,9 +4391,13 @@ async def reindex_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") + if requests_per_second is None: + raise ValueError("Empty value passed for parameter 'requests_per_second'") __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} __path = f'/_reindex/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} + if requests_per_second is not None: + __query["requests_per_second"] = requests_per_second if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -4332,8 +4406,6 @@ async def reindex_rethrottle( __query["human"] = human if pretty is not None: __query["pretty"] = pretty - if requests_per_second is not None: - __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", @@ -6670,11 +6742,11 @@ async def update_by_query_rethrottle( self, *, task_id: str, + requests_per_second: float, 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, - requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -6692,9 +6764,13 @@ async def update_by_query_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") + if requests_per_second is None: + raise ValueError("Empty value passed for parameter 'requests_per_second'") __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} __path = f'/_update_by_query/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} + if requests_per_second is not None: + __query["requests_per_second"] = requests_per_second if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -6703,8 +6779,6 @@ async def update_by_query_rethrottle( __query["human"] = human if pretty is not None: __query["pretty"] = pretty - if requests_per_second is not None: - __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", diff --git a/elasticsearch/_async/client/_internal.py b/elasticsearch/_async/client/_internal.py new file mode 100644 index 000000000..927c08b1e --- /dev/null +++ b/elasticsearch/_async/client/_internal.py @@ -0,0 +1,326 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class C: + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def delete_desired_balance( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    This API is a diagnostics API and the output should not be relied upon for building applications.

    + + + :param master_timeout: Period to wait for a connection to the master node. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/desired_balance" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="_internal.delete_desired_balance", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def delete_desired_nodes( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Designed for indirect use by ECE/ESS and ECK, direct use is not supported.

    + + + :param master_timeout: Period to wait for a connection to the master node. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/desired_nodes" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + 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] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="_internal.delete_desired_nodes", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def get_desired_balance( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    This API is a diagnostics API and the output should not be relied upon for building applications.

    + + + :param master_timeout: Period to wait for a connection to the master node. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/desired_balance" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="_internal.get_desired_balance", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def get_desired_nodes( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Gets the latest desired nodes.

    + + + :param master_timeout: Period to wait for a connection to the master node. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/desired_nodes/_latest" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="_internal.get_desired_nodes", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def prevalidate_node_removal( + self, + *, + error_trace: t.Optional[bool] = None, + external_ids: t.Optional[t.Sequence[str]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + ids: t.Optional[t.Sequence[str]] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + names: t.Optional[t.Sequence[str]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Prevalidates node removal from the cluster.

    + + + :param external_ids: A comma-separated list of node external IDs to prevalidate + :param ids: A comma-separated list of node IDs to prevalidate + :param master_timeout: Period to wait for a connection to the master node. + :param names: A comma-separated list of node names to prevalidate + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/prevalidate_node_removal" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if external_ids is not None: + __query["external_ids"] = external_ids + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if ids is not None: + __query["ids"] = ids + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if names is not None: + __query["names"] = names + 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="_internal.prevalidate_node_removal", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_name="body", + ignore_deprecated_options={"body"}, + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def update_desired_nodes( + self, + *, + history_id: str, + version: int, + body: t.Optional[t.Any] = None, + body: t.Optional[t.Any] = None, + dry_run: 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, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Designed for indirect use by ECE/ESS and ECK, direct use is not supported.

    + + + :param history_id: The history ID + :param version: The version number + :param body: + :param dry_run: Simulate the update + :param master_timeout: Period to wait for a connection to the master node. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + if history_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'history_id'") + if version in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'version'") + if body is None and body is None: + raise ValueError( + "Empty value passed for parameters 'body' and 'body', one of them should be set." + ) + elif body is not None and body is not None: + raise ValueError("Cannot set both 'body' and 'body'") + __path_parts: t.Dict[str, str] = { + "history_id": _quote(history_id), + "version": _quote(version), + } + __path = f'/_internal/desired_nodes/{__path_parts["history_id"]}/{__path_parts["version"]}' + __query: t.Dict[str, t.Any] = {} + if dry_run is not None: + __query["dry_run"] = dry_run + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __body = body if body is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="_internal.update_desired_nodes", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_async/client/cat.py b/elasticsearch/_async/client/cat.py index 8a048de5f..81fbc03ab 100644 --- a/elasticsearch/_async/client/cat.py +++ b/elasticsearch/_async/client/cat.py @@ -2895,10 +2895,20 @@ async def segments( self, *, index: t.Optional[t.Union[str, t.Sequence[str]]] = None, + allow_closed: t.Optional[bool] = None, + allow_no_indices: t.Optional[bool] = None, bytes: t.Optional[ t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] ] = None, 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, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, h: t.Optional[ @@ -2949,6 +2959,8 @@ async def segments( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, + ignore_throttled: t.Optional[bool] = None, + ignore_unavailable: t.Optional[bool] = None, local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, @@ -2972,6 +2984,14 @@ async def segments( :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. + :param allow_closed: If true, allow closed indices to be returned in the response + otherwise if false, keep the legacy behaviour of throwing an exception if + index pattern matches closed indices + :param allow_no_indices: If false, the request returns an error if any wildcard + expression, index alias, or _all value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting foo*,bar* returns an error if an index starts + with foo but no index starts with bar. :param bytes: Sets the units for columns that contain a byte-size value. Note that byte-size value units work in terms of powers of 1024. For instance `1kb` means 1024 bytes, not 1000 bytes. If omitted, byte-size values are @@ -2980,12 +3000,20 @@ async def segments( least `1.0`. If given, byte-size values are rendered as an integer with no suffix, representing the value of the column in the chosen unit. Values that are not an exact multiple of the chosen unit are rounded down. + :param expand_wildcards: Type of index that wildcard expressions can match. If + the request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as open,hidden. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :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 ignore_throttled: If true, concrete, expanded or aliased indices are ignored + when frozen. + :param ignore_unavailable: If true, missing or closed indices are not included + in the response. :param local: If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating @@ -3010,10 +3038,16 @@ async def segments( __path_parts = {} __path = "/_cat/segments" __query: t.Dict[str, t.Any] = {} + if allow_closed is not None: + __query["allow_closed"] = allow_closed + if allow_no_indices is not None: + __query["allow_no_indices"] = allow_no_indices if bytes is not None: __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace + if expand_wildcards is not None: + __query["expand_wildcards"] = expand_wildcards if filter_path is not None: __query["filter_path"] = filter_path if format is not None: @@ -3024,6 +3058,10 @@ async def segments( __query["help"] = help if human is not None: __query["human"] = human + if ignore_throttled is not None: + __query["ignore_throttled"] = ignore_throttled + if ignore_unavailable is not None: + __query["ignore_unavailable"] = ignore_unavailable if local is not None: __query["local"] = local if master_timeout is not None: diff --git a/elasticsearch/_async/client/cluster.py b/elasticsearch/_async/client/cluster.py index 760b9a775..c641a38ad 100644 --- a/elasticsearch/_async/client/cluster.py +++ b/elasticsearch/_async/client/cluster.py @@ -1123,7 +1123,8 @@ async def state( when unavailable (missing or closed) :param local: Return local information, do not retrieve the state from master node (default: false) - :param master_timeout: Specify timeout for connection to master + :param master_timeout: Timeout for waiting for new cluster state in case it is + blocked :param wait_for_metadata_version: Wait for the metadata version to be equal or greater than the specified metadata version :param wait_for_timeout: The maximum time to wait for wait_for_metadata_version diff --git a/elasticsearch/_async/client/connector.py b/elasticsearch/_async/client/connector.py index 3ad9943ad..7f6d849d4 100644 --- a/elasticsearch/_async/client/connector.py +++ b/elasticsearch/_async/client/connector.py @@ -565,6 +565,192 @@ async def put( path_parts=__path_parts, ) + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def secret_delete( + self, + *, + id: str, + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Deletes a connector secret.

    + + + :param id: The ID of the secret + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_connector/_secret/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + 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 + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="connector.secret_delete", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def secret_get( + self, + *, + id: str, + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Retrieves a secret stored by Connectors.

    + + + :param id: The ID of the secret + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_connector/_secret/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + 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 + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="connector.secret_get", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("value",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def secret_post( + self, + *, + 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, + value: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Creates a secret for a Connector.

    + + + :param value: + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_connector/_secret" + __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 not __body: + if value is not None: + __body["value"] = value + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.secret_post", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("value",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def secret_put( + self, + *, + id: str, + value: t.Optional[str] = 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, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Creates or updates a secret for a Connector.

    + + + :param id: The ID of the secret + :param value: + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if value is None and body is None: + raise ValueError("Empty value passed for parameter 'value'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_connector/_secret/{__path_parts["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 not __body: + if value is not None: + __body["value"] = value + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.secret_put", + path_parts=__path_parts, + ) + @_rewrite_parameters() @_stability_warning(Stability.BETA) async def sync_job_cancel( @@ -1525,7 +1711,7 @@ async def update_filtering_validation(

    Update the draft filtering validation info for a connector.

    - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param validation: @@ -1696,7 +1882,7 @@ async def update_native(

    Update the connector is_native flag.

    - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param is_native: diff --git a/elasticsearch/_async/client/dangling_indices.py b/elasticsearch/_async/client/dangling_indices.py index b792b815b..56945c0b1 100644 --- a/elasticsearch/_async/client/dangling_indices.py +++ b/elasticsearch/_async/client/dangling_indices.py @@ -30,7 +30,7 @@ async def delete_dangling_index( self, *, index_uuid: str, - accept_data_loss: bool, + accept_data_loss: 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, @@ -57,8 +57,6 @@ async def delete_dangling_index( """ if index_uuid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index_uuid'") - if accept_data_loss is None: - raise ValueError("Empty value passed for parameter 'accept_data_loss'") __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)} __path = f'/_dangling/{__path_parts["index_uuid"]}' __query: t.Dict[str, t.Any] = {} @@ -91,7 +89,7 @@ async def import_dangling_index( self, *, index_uuid: str, - accept_data_loss: bool, + accept_data_loss: 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, @@ -121,8 +119,6 @@ async def import_dangling_index( """ if index_uuid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index_uuid'") - if accept_data_loss is None: - raise ValueError("Empty value passed for parameter 'accept_data_loss'") __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)} __path = f'/_dangling/{__path_parts["index_uuid"]}' __query: t.Dict[str, t.Any] = {} diff --git a/elasticsearch/_async/client/eql.py b/elasticsearch/_async/client/eql.py index a1725df33..dbf634f85 100644 --- a/elasticsearch/_async/client/eql.py +++ b/elasticsearch/_async/client/eql.py @@ -291,7 +291,7 @@ async def search( Defaults to 10 :param tiebreaker_field: Field used to sort hits with the same timestamp in ascending order - :param timestamp_field: Field containing event timestamp. Default "@timestamp" + :param timestamp_field: Field containing event timestamp. :param wait_for_completion_timeout: """ if index in SKIP_IN_PATH: diff --git a/elasticsearch/_async/client/fleet.py b/elasticsearch/_async/client/fleet.py index ef534dcfd..360837de1 100644 --- a/elasticsearch/_async/client/fleet.py +++ b/elasticsearch/_async/client/fleet.py @@ -31,6 +31,90 @@ class FleetClient(NamespacedClient): + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def delete_secret( + self, + *, + id: str, + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Deletes a secret stored by Fleet.

    + + + :param id: The ID of the secret + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_fleet/secret/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + 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 + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="fleet.delete_secret", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def get_secret( + self, + *, + id: str, + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Retrieves a secret stored by Fleet.

    + + + :param id: The ID of the secret + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_fleet/secret/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + 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 + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="fleet.get_secret", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def global_checkpoints( self, @@ -250,6 +334,56 @@ async def msearch( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("value",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def post_secret( + self, + *, + value: t.Optional[str] = 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, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Creates a secret stored by Fleet.

    + + + :param value: + """ + if value is None and body is None: + raise ValueError("Empty value passed for parameter 'value'") + __path_parts: t.Dict[str, str] = {} + __path = "/_fleet/secret" + __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 not __body: + if value is not None: + __body["value"] = value + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="fleet.post_secret", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "aggregations", diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index 1b31232f5..478f4c350 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -2629,8 +2629,8 @@ async def get_index_template( ``_ - :param name: Comma-separated list of index template names used to limit the request. - Wildcard (*) expressions are supported. + :param name: Name of index template to retrieve. Wildcard (*) expressions are + supported. :param flat_settings: If true, returns settings in flat format. :param include_defaults: If true, returns all relevant default configurations for the index template. @@ -3427,7 +3427,7 @@ async def put_data_lifecycle( *, name: t.Union[str, t.Sequence[str]], data_retention: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - downsampling: t.Optional[t.Mapping[str, t.Any]] = None, + downsampling: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, enabled: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ diff --git a/elasticsearch/_async/client/profiling.py b/elasticsearch/_async/client/profiling.py new file mode 100644 index 000000000..6d7e379c9 --- /dev/null +++ b/elasticsearch/_async/client/profiling.py @@ -0,0 +1,177 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class C: + + @_rewrite_parameters( + body_name="conditions", + ) + async def flamegraph( + self, + *, + conditions: t.Optional[t.Any] = None, + body: t.Optional[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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Returns basic information about the status of Universal Profiling.

    + + + ``_ + + :param conditions: + """ + if conditions is None and body is None: + raise ValueError( + "Empty value passed for parameters 'conditions' and 'body', one of them should be set." + ) + elif conditions is not None and body is not None: + raise ValueError("Cannot set both 'conditions' and 'body'") + __path_parts: t.Dict[str, str] = {} + __path = "/_profiling/flamegraph" + __query: t.Dict[str, t.Any] = {} + 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 + __body = conditions if conditions is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="profiling.flamegraph", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_name="conditions", + ) + async def stacktraces( + self, + *, + conditions: t.Optional[t.Any] = None, + body: t.Optional[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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Extracts raw stacktrace information from Universal Profiling.

    + + + ``_ + + :param conditions: + """ + if conditions is None and body is None: + raise ValueError( + "Empty value passed for parameters 'conditions' and 'body', one of them should be set." + ) + elif conditions is not None and body is not None: + raise ValueError("Cannot set both 'conditions' and 'body'") + __path_parts: t.Dict[str, str] = {} + __path = "/_profiling/stacktraces" + __query: t.Dict[str, t.Any] = {} + 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 + __body = conditions if conditions is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="profiling.stacktraces", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + async def status( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + wait_for_resources_created: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Returns basic information about the status of Universal Profiling.

    + + + ``_ + + :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 timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_resources_created: Whether to return immediately or wait until + resources have been created + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_profiling/status" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if wait_for_resources_created is not None: + __query["wait_for_resources_created"] = wait_for_resources_created + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="profiling.status", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_async/client/text_structure.py b/elasticsearch/_async/client/text_structure.py index 35e4df9b0..0d629f8f6 100644 --- a/elasticsearch/_async/client/text_structure.py +++ b/elasticsearch/_async/client/text_structure.py @@ -402,7 +402,11 @@ async def find_structure( delimiter: t.Optional[str] = None, ecs_compatibility: t.Optional[str] = None, explain: t.Optional[bool] = None, - format: t.Optional[str] = None, + format: t.Optional[ + t.Union[ + str, t.Literal["delimited", "ndjson", "semi_structured_text", "xml"] + ] + ] = None, grok_pattern: t.Optional[str] = None, has_header_row: t.Optional[bool] = None, line_merge_size_limit: t.Optional[int] = None, diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 05c7a7cea..656237dfb 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -706,6 +706,7 @@ def bulk(
  • Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll
  • Python: Check out elasticsearch.helpers.*
  • JavaScript: Check out client.helpers.*
  • +
  • Java: Check out co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester
  • .NET: Check out BulkAllObservable
  • PHP: Check out bulk indexing.
  • Ruby: Check out Elasticsearch::Helpers::BulkHelper
  • @@ -845,6 +846,73 @@ def bulk( path_parts=__path_parts, ) + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def capabilities( + self, + *, + capabilities: t.Optional[t.Union[str, t.Sequence[str]]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + local_only: t.Optional[bool] = None, + method: t.Optional[ + t.Union[str, t.Literal["DELETE", "GET", "HEAD", "POST", "PUT"]] + ] = None, + parameters: t.Optional[t.Union[str, t.Sequence[str]]] = None, + path: t.Optional[str] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Checks if the specified combination of method, API, parameters, and arbitrary capabilities are supported.

    + + + ``_ + + :param capabilities: Comma-separated list of arbitrary API capabilities to check + :param local_only: True if only the node being called should be considered + :param method: REST method to check + :param parameters: Comma-separated list of API parameters to check + :param path: API path to check + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_capabilities" + __query: t.Dict[str, t.Any] = {} + if capabilities is not None: + __query["capabilities"] = capabilities + 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 local_only is not None: + __query["local_only"] = local_only + if method is not None: + __query["method"] = method + if parameters is not None: + __query["parameters"] = parameters + if path is not None: + __query["path"] = path + 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] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="capabilities", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("scroll_id",), ) @@ -1729,11 +1797,11 @@ def delete_by_query_rethrottle( self, *, task_id: t.Union[int, str], + requests_per_second: float, 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, - requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -1751,9 +1819,13 @@ def delete_by_query_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") + if requests_per_second is None: + raise ValueError("Empty value passed for parameter 'requests_per_second'") __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} __path = f'/_delete_by_query/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} + if requests_per_second is not None: + __query["requests_per_second"] = requests_per_second if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -1762,8 +1834,6 @@ def delete_by_query_rethrottle( __query["human"] = human if pretty is not None: __query["pretty"] = pretty - if requests_per_second is not None: - __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", @@ -4293,11 +4363,11 @@ def reindex_rethrottle( self, *, task_id: str, + requests_per_second: float, 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, - requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -4321,9 +4391,13 @@ def reindex_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") + if requests_per_second is None: + raise ValueError("Empty value passed for parameter 'requests_per_second'") __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} __path = f'/_reindex/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} + if requests_per_second is not None: + __query["requests_per_second"] = requests_per_second if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -4332,8 +4406,6 @@ def reindex_rethrottle( __query["human"] = human if pretty is not None: __query["pretty"] = pretty - if requests_per_second is not None: - __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", @@ -6670,11 +6742,11 @@ def update_by_query_rethrottle( self, *, task_id: str, + requests_per_second: float, 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, - requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -6692,9 +6764,13 @@ def update_by_query_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") + if requests_per_second is None: + raise ValueError("Empty value passed for parameter 'requests_per_second'") __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} __path = f'/_update_by_query/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} + if requests_per_second is not None: + __query["requests_per_second"] = requests_per_second if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -6703,8 +6779,6 @@ def update_by_query_rethrottle( __query["human"] = human if pretty is not None: __query["pretty"] = pretty - if requests_per_second is not None: - __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", diff --git a/elasticsearch/_sync/client/_internal.py b/elasticsearch/_sync/client/_internal.py new file mode 100644 index 000000000..9c5bb1a1b --- /dev/null +++ b/elasticsearch/_sync/client/_internal.py @@ -0,0 +1,326 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class C: + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def delete_desired_balance( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    This API is a diagnostics API and the output should not be relied upon for building applications.

    + + + :param master_timeout: Period to wait for a connection to the master node. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/desired_balance" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="_internal.delete_desired_balance", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def delete_desired_nodes( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Designed for indirect use by ECE/ESS and ECK, direct use is not supported.

    + + + :param master_timeout: Period to wait for a connection to the master node. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/desired_nodes" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + 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] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="_internal.delete_desired_nodes", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def get_desired_balance( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    This API is a diagnostics API and the output should not be relied upon for building applications.

    + + + :param master_timeout: Period to wait for a connection to the master node. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/desired_balance" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="_internal.get_desired_balance", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def get_desired_nodes( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Gets the latest desired nodes.

    + + + :param master_timeout: Period to wait for a connection to the master node. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/desired_nodes/_latest" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="_internal.get_desired_nodes", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def prevalidate_node_removal( + self, + *, + error_trace: t.Optional[bool] = None, + external_ids: t.Optional[t.Sequence[str]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + ids: t.Optional[t.Sequence[str]] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + names: t.Optional[t.Sequence[str]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Prevalidates node removal from the cluster.

    + + + :param external_ids: A comma-separated list of node external IDs to prevalidate + :param ids: A comma-separated list of node IDs to prevalidate + :param master_timeout: Period to wait for a connection to the master node. + :param names: A comma-separated list of node names to prevalidate + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_internal/prevalidate_node_removal" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if external_ids is not None: + __query["external_ids"] = external_ids + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if ids is not None: + __query["ids"] = ids + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if names is not None: + __query["names"] = names + 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="_internal.prevalidate_node_removal", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_name="body", + ignore_deprecated_options={"body"}, + ) + @_stability_warning(Stability.EXPERIMENTAL) + def update_desired_nodes( + self, + *, + history_id: str, + version: int, + body: t.Optional[t.Any] = None, + body: t.Optional[t.Any] = None, + dry_run: 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, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Designed for indirect use by ECE/ESS and ECK, direct use is not supported.

    + + + :param history_id: The history ID + :param version: The version number + :param body: + :param dry_run: Simulate the update + :param master_timeout: Period to wait for a connection to the master node. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + if history_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'history_id'") + if version in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'version'") + if body is None and body is None: + raise ValueError( + "Empty value passed for parameters 'body' and 'body', one of them should be set." + ) + elif body is not None and body is not None: + raise ValueError("Cannot set both 'body' and 'body'") + __path_parts: t.Dict[str, str] = { + "history_id": _quote(history_id), + "version": _quote(version), + } + __path = f'/_internal/desired_nodes/{__path_parts["history_id"]}/{__path_parts["version"]}' + __query: t.Dict[str, t.Any] = {} + if dry_run is not None: + __query["dry_run"] = dry_run + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __body = body if body is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="_internal.update_desired_nodes", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_sync/client/cat.py b/elasticsearch/_sync/client/cat.py index 5be8efaba..59674a13e 100644 --- a/elasticsearch/_sync/client/cat.py +++ b/elasticsearch/_sync/client/cat.py @@ -2895,10 +2895,20 @@ def segments( self, *, index: t.Optional[t.Union[str, t.Sequence[str]]] = None, + allow_closed: t.Optional[bool] = None, + allow_no_indices: t.Optional[bool] = None, bytes: t.Optional[ t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] ] = None, 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, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, h: t.Optional[ @@ -2949,6 +2959,8 @@ def segments( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, + ignore_throttled: t.Optional[bool] = None, + ignore_unavailable: t.Optional[bool] = None, local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, @@ -2972,6 +2984,14 @@ def segments( :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. + :param allow_closed: If true, allow closed indices to be returned in the response + otherwise if false, keep the legacy behaviour of throwing an exception if + index pattern matches closed indices + :param allow_no_indices: If false, the request returns an error if any wildcard + expression, index alias, or _all value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting foo*,bar* returns an error if an index starts + with foo but no index starts with bar. :param bytes: Sets the units for columns that contain a byte-size value. Note that byte-size value units work in terms of powers of 1024. For instance `1kb` means 1024 bytes, not 1000 bytes. If omitted, byte-size values are @@ -2980,12 +3000,20 @@ def segments( least `1.0`. If given, byte-size values are rendered as an integer with no suffix, representing the value of the column in the chosen unit. Values that are not an exact multiple of the chosen unit are rounded down. + :param expand_wildcards: Type of index that wildcard expressions can match. If + the request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as open,hidden. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :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 ignore_throttled: If true, concrete, expanded or aliased indices are ignored + when frozen. + :param ignore_unavailable: If true, missing or closed indices are not included + in the response. :param local: If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating @@ -3010,10 +3038,16 @@ def segments( __path_parts = {} __path = "/_cat/segments" __query: t.Dict[str, t.Any] = {} + if allow_closed is not None: + __query["allow_closed"] = allow_closed + if allow_no_indices is not None: + __query["allow_no_indices"] = allow_no_indices if bytes is not None: __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace + if expand_wildcards is not None: + __query["expand_wildcards"] = expand_wildcards if filter_path is not None: __query["filter_path"] = filter_path if format is not None: @@ -3024,6 +3058,10 @@ def segments( __query["help"] = help if human is not None: __query["human"] = human + if ignore_throttled is not None: + __query["ignore_throttled"] = ignore_throttled + if ignore_unavailable is not None: + __query["ignore_unavailable"] = ignore_unavailable if local is not None: __query["local"] = local if master_timeout is not None: diff --git a/elasticsearch/_sync/client/cluster.py b/elasticsearch/_sync/client/cluster.py index d7322bf5f..675dc97af 100644 --- a/elasticsearch/_sync/client/cluster.py +++ b/elasticsearch/_sync/client/cluster.py @@ -1123,7 +1123,8 @@ def state( when unavailable (missing or closed) :param local: Return local information, do not retrieve the state from master node (default: false) - :param master_timeout: Specify timeout for connection to master + :param master_timeout: Timeout for waiting for new cluster state in case it is + blocked :param wait_for_metadata_version: Wait for the metadata version to be equal or greater than the specified metadata version :param wait_for_timeout: The maximum time to wait for wait_for_metadata_version diff --git a/elasticsearch/_sync/client/connector.py b/elasticsearch/_sync/client/connector.py index b31f6f654..9f594fa34 100644 --- a/elasticsearch/_sync/client/connector.py +++ b/elasticsearch/_sync/client/connector.py @@ -565,6 +565,192 @@ def put( path_parts=__path_parts, ) + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def secret_delete( + self, + *, + id: str, + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Deletes a connector secret.

    + + + :param id: The ID of the secret + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_connector/_secret/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + 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 + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="connector.secret_delete", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def secret_get( + self, + *, + id: str, + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Retrieves a secret stored by Connectors.

    + + + :param id: The ID of the secret + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_connector/_secret/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + 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 + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="connector.secret_get", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("value",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + def secret_post( + self, + *, + 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, + value: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Creates a secret for a Connector.

    + + + :param value: + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_connector/_secret" + __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 not __body: + if value is not None: + __body["value"] = value + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.secret_post", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("value",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + def secret_put( + self, + *, + id: str, + value: t.Optional[str] = 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, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Creates or updates a secret for a Connector.

    + + + :param id: The ID of the secret + :param value: + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if value is None and body is None: + raise ValueError("Empty value passed for parameter 'value'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_connector/_secret/{__path_parts["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 not __body: + if value is not None: + __body["value"] = value + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.secret_put", + path_parts=__path_parts, + ) + @_rewrite_parameters() @_stability_warning(Stability.BETA) def sync_job_cancel( @@ -1525,7 +1711,7 @@ def update_filtering_validation(

    Update the draft filtering validation info for a connector.

    - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param validation: @@ -1696,7 +1882,7 @@ def update_native(

    Update the connector is_native flag.

    - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param is_native: diff --git a/elasticsearch/_sync/client/dangling_indices.py b/elasticsearch/_sync/client/dangling_indices.py index dd1cee4c3..7cf9ab958 100644 --- a/elasticsearch/_sync/client/dangling_indices.py +++ b/elasticsearch/_sync/client/dangling_indices.py @@ -30,7 +30,7 @@ def delete_dangling_index( self, *, index_uuid: str, - accept_data_loss: bool, + accept_data_loss: 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, @@ -57,8 +57,6 @@ def delete_dangling_index( """ if index_uuid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index_uuid'") - if accept_data_loss is None: - raise ValueError("Empty value passed for parameter 'accept_data_loss'") __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)} __path = f'/_dangling/{__path_parts["index_uuid"]}' __query: t.Dict[str, t.Any] = {} @@ -91,7 +89,7 @@ def import_dangling_index( self, *, index_uuid: str, - accept_data_loss: bool, + accept_data_loss: 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, @@ -121,8 +119,6 @@ def import_dangling_index( """ if index_uuid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index_uuid'") - if accept_data_loss is None: - raise ValueError("Empty value passed for parameter 'accept_data_loss'") __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)} __path = f'/_dangling/{__path_parts["index_uuid"]}' __query: t.Dict[str, t.Any] = {} diff --git a/elasticsearch/_sync/client/eql.py b/elasticsearch/_sync/client/eql.py index 6c9d60365..df5090d73 100644 --- a/elasticsearch/_sync/client/eql.py +++ b/elasticsearch/_sync/client/eql.py @@ -291,7 +291,7 @@ def search( Defaults to 10 :param tiebreaker_field: Field used to sort hits with the same timestamp in ascending order - :param timestamp_field: Field containing event timestamp. Default "@timestamp" + :param timestamp_field: Field containing event timestamp. :param wait_for_completion_timeout: """ if index in SKIP_IN_PATH: diff --git a/elasticsearch/_sync/client/fleet.py b/elasticsearch/_sync/client/fleet.py index 96c8334c1..5db43db7f 100644 --- a/elasticsearch/_sync/client/fleet.py +++ b/elasticsearch/_sync/client/fleet.py @@ -31,6 +31,90 @@ class FleetClient(NamespacedClient): + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def delete_secret( + self, + *, + id: str, + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Deletes a secret stored by Fleet.

    + + + :param id: The ID of the secret + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_fleet/secret/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + 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 + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="fleet.delete_secret", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def get_secret( + self, + *, + id: str, + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Retrieves a secret stored by Fleet.

    + + + :param id: The ID of the secret + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_fleet/secret/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + 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 + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="fleet.get_secret", + path_parts=__path_parts, + ) + @_rewrite_parameters() def global_checkpoints( self, @@ -250,6 +334,56 @@ def msearch( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("value",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + def post_secret( + self, + *, + value: t.Optional[str] = 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, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Creates a secret stored by Fleet.

    + + + :param value: + """ + if value is None and body is None: + raise ValueError("Empty value passed for parameter 'value'") + __path_parts: t.Dict[str, str] = {} + __path = "/_fleet/secret" + __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 not __body: + if value is not None: + __body["value"] = value + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="fleet.post_secret", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "aggregations", diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index d09c243cf..c7d76803b 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -2629,8 +2629,8 @@ def get_index_template( ``_ - :param name: Comma-separated list of index template names used to limit the request. - Wildcard (*) expressions are supported. + :param name: Name of index template to retrieve. Wildcard (*) expressions are + supported. :param flat_settings: If true, returns settings in flat format. :param include_defaults: If true, returns all relevant default configurations for the index template. @@ -3427,7 +3427,7 @@ def put_data_lifecycle( *, name: t.Union[str, t.Sequence[str]], data_retention: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - downsampling: t.Optional[t.Mapping[str, t.Any]] = None, + downsampling: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, enabled: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ diff --git a/elasticsearch/_sync/client/profiling.py b/elasticsearch/_sync/client/profiling.py new file mode 100644 index 000000000..6c7bdb5b9 --- /dev/null +++ b/elasticsearch/_sync/client/profiling.py @@ -0,0 +1,177 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class C: + + @_rewrite_parameters( + body_name="conditions", + ) + def flamegraph( + self, + *, + conditions: t.Optional[t.Any] = None, + body: t.Optional[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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Returns basic information about the status of Universal Profiling.

    + + + ``_ + + :param conditions: + """ + if conditions is None and body is None: + raise ValueError( + "Empty value passed for parameters 'conditions' and 'body', one of them should be set." + ) + elif conditions is not None and body is not None: + raise ValueError("Cannot set both 'conditions' and 'body'") + __path_parts: t.Dict[str, str] = {} + __path = "/_profiling/flamegraph" + __query: t.Dict[str, t.Any] = {} + 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 + __body = conditions if conditions is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="profiling.flamegraph", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_name="conditions", + ) + def stacktraces( + self, + *, + conditions: t.Optional[t.Any] = None, + body: t.Optional[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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Extracts raw stacktrace information from Universal Profiling.

    + + + ``_ + + :param conditions: + """ + if conditions is None and body is None: + raise ValueError( + "Empty value passed for parameters 'conditions' and 'body', one of them should be set." + ) + elif conditions is not None and body is not None: + raise ValueError("Cannot set both 'conditions' and 'body'") + __path_parts: t.Dict[str, str] = {} + __path = "/_profiling/stacktraces" + __query: t.Dict[str, t.Any] = {} + 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 + __body = conditions if conditions is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="profiling.stacktraces", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + def status( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + wait_for_resources_created: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Returns basic information about the status of Universal Profiling.

    + + + ``_ + + :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 timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_resources_created: Whether to return immediately or wait until + resources have been created + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_profiling/status" + __query: t.Dict[str, t.Any] = {} + 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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if wait_for_resources_created is not None: + __query["wait_for_resources_created"] = wait_for_resources_created + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="profiling.status", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_sync/client/text_structure.py b/elasticsearch/_sync/client/text_structure.py index 4050bcc16..3913f480f 100644 --- a/elasticsearch/_sync/client/text_structure.py +++ b/elasticsearch/_sync/client/text_structure.py @@ -402,7 +402,11 @@ def find_structure( delimiter: t.Optional[str] = None, ecs_compatibility: t.Optional[str] = None, explain: t.Optional[bool] = None, - format: t.Optional[str] = None, + format: t.Optional[ + t.Union[ + str, t.Literal["delimited", "ndjson", "semi_structured_text", "xml"] + ] + ] = None, grok_pattern: t.Optional[str] = None, has_header_row: t.Optional[bool] = None, line_merge_size_limit: t.Optional[int] = None, diff --git a/elasticsearch/_version.py b/elasticsearch/_version.py index 41c149a22..8dd978e29 100644 --- a/elasticsearch/_version.py +++ b/elasticsearch/_version.py @@ -16,4 +16,4 @@ # under the License. __versionstr__ = "8.19.2" -__es_specification_commit__ = "f4816bb41c52c1bfda93c48191f0a0e4e2d575be" +__es_specification_commit__ = "9b3d2acffa2daac217b5362bfa8431a5fa117294" diff --git a/elasticsearch/dsl/aggs.py b/elasticsearch/dsl/aggs.py index 9d0e9cc1d..831973d2d 100644 --- a/elasticsearch/dsl/aggs.py +++ b/elasticsearch/dsl/aggs.py @@ -1513,9 +1513,9 @@ class GeoLine(Agg[_R]): ordered by the chosen sort field. :arg point: (required) The name of the geo_point field. - :arg sort: (required) The name of the numeric field to use as the sort - key for ordering the points. When the `geo_line` aggregation is - nested inside a `time_series` aggregation, this field defaults to + :arg sort: The name of the numeric field to use as the sort key for + ordering the points. When the `geo_line` aggregation is nested + inside a `time_series` aggregation, this field defaults to `@timestamp`, and any other value will result in error. :arg include_sort: When `true`, returns an additional array of the sort values in the feature properties. @@ -1852,9 +1852,9 @@ def __init__( class Line(Agg[_R]): """ :arg point: (required) The name of the geo_point field. - :arg sort: (required) The name of the numeric field to use as the sort - key for ordering the points. When the `geo_line` aggregation is - nested inside a `time_series` aggregation, this field defaults to + :arg sort: The name of the numeric field to use as the sort key for + ordering the points. When the `geo_line` aggregation is nested + inside a `time_series` aggregation, this field defaults to `@timestamp`, and any other value will result in error. :arg include_sort: When `true`, returns an additional array of the sort values in the feature properties. @@ -2677,7 +2677,7 @@ def __init__( self, *, keyed: Union[bool, "DefaultType"] = DEFAULT, - percents: Union[Sequence[float], "DefaultType"] = DEFAULT, + percents: Union[float, Sequence[float], "DefaultType"] = DEFAULT, hdr: Union["types.HdrMethod", Dict[str, Any], "DefaultType"] = DEFAULT, tdigest: Union["types.TDigest", Dict[str, Any], "DefaultType"] = DEFAULT, format: Union[str, "DefaultType"] = DEFAULT,