diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 33eb810a0..71154ec4a 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -5,7 +5,7 @@ steps: env: PYTHON_VERSION: "{{ matrix.python }}" TEST_SUITE: "platinum" - STACK_VERSION: "9.1.0-SNAPSHOT" + STACK_VERSION: "9.2.0-SNAPSHOT" PYTHON_CONNECTION_CLASS: "{{ matrix.connection }}" NOX_SESSION: "{{ matrix.nox_session }}" matrix: diff --git a/docs/sphinx/api/indices.rst b/docs/sphinx/api/indices.rst index 9523a3558..8d310a3b8 100644 --- a/docs/sphinx/api/indices.rst +++ b/docs/sphinx/api/indices.rst @@ -6,4 +6,4 @@ Indices :no-index: .. autoclass:: IndicesClient - :members: \ No newline at end of file + :members: diff --git a/docs/sphinx/api/project.rst b/docs/sphinx/api/project.rst new file mode 100644 index 000000000..0ab68dc2d --- /dev/null +++ b/docs/sphinx/api/project.rst @@ -0,0 +1,9 @@ +.. _project: + +Project +------- +.. py:module:: elasticsearch.client + :no-index: + +.. autoclass:: ProjectClient + :members: diff --git a/docs/sphinx/api/streams.rst b/docs/sphinx/api/streams.rst new file mode 100644 index 000000000..d5f45b6e7 --- /dev/null +++ b/docs/sphinx/api/streams.rst @@ -0,0 +1,9 @@ +.. _streams: + +Streams +------- +.. py:module:: elasticsearch.client + :no-index: + +.. autoclass:: StreamsClient + :members: diff --git a/docs/sphinx/es_api.rst b/docs/sphinx/es_api.rst index d246ec6f5..5d42e7d2c 100644 --- a/docs/sphinx/es_api.rst +++ b/docs/sphinx/es_api.rst @@ -39,6 +39,7 @@ arguments are required for all calls. api/ml api/monitoring api/nodes + api/project api/query-rules api/rollup-indices api/search-application @@ -50,6 +51,7 @@ arguments are required for all calls. api/snapshots api/snapshottable-features api/sql + api/streams api/synonyms api/tls-ssl api/tasks diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index e4fee64cc..8c7466a45 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -63,6 +63,7 @@ from .ml import MlClient from .monitoring import MonitoringClient from .nodes import NodesClient +from .project import ProjectClient from .query_rules import QueryRulesClient from .rollup import RollupClient from .search_application import SearchApplicationClient @@ -74,6 +75,7 @@ from .snapshot import SnapshotClient from .sql import SqlClient from .ssl import SslClient +from .streams import StreamsClient from .synonyms import SynonymsClient from .tasks import TasksClient from .text_structure import TextStructureClient @@ -368,6 +370,7 @@ def __init__( self.migration = MigrationClient(self) self.ml = MlClient(self) self.monitoring = MonitoringClient(self) + self.project = ProjectClient(self) self.query_rules = QueryRulesClient(self) self.rollup = RollupClient(self) self.search_application = SearchApplicationClient(self) @@ -378,6 +381,7 @@ def __init__( self.shutdown = ShutdownClient(self) self.sql = SqlClient(self) self.ssl = SslClient(self) + self.streams = StreamsClient(self) self.synonyms = SynonymsClient(self) self.text_structure = TextStructureClient(self) self.transform = TransformClient(self) @@ -845,11 +849,7 @@ async def close_point_in_time( if not __body: if id is not None: __body["id"] = id - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -889,6 +889,7 @@ async def count( min_score: t.Optional[float] = None, preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, q: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, routing: t.Optional[str] = None, @@ -922,8 +923,8 @@ async def count( This parameter can be used only when the `q` query string parameter is specified. :param analyzer: The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. - :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for query string query: `and` or + `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter @@ -943,6 +944,10 @@ async def count( in the result. :param preference: The node or shard the operation should be performed on. By default, it is random. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param q: The query in Lucene query string syntax. This parameter cannot be used with a request body. :param query: Defines the search query using Query DSL. A request body query @@ -995,6 +1000,8 @@ async def count( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if q is not None: __query["q"] = q if routing is not None: @@ -1044,7 +1051,7 @@ async def create( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, wait_for_active_shards: t.Optional[ t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]] @@ -1223,7 +1230,7 @@ async def delete( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, wait_for_active_shards: t.Optional[ t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]] @@ -1468,8 +1475,8 @@ async def delete_by_query( used only when the `q` query string parameter is specified. :param conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. - :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for query string query: `and` or + `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter @@ -1763,7 +1770,7 @@ async def exists( stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, ) -> HeadApiResponse: """ @@ -1892,7 +1899,7 @@ async def exists_source( source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, ) -> HeadApiResponse: """ @@ -2021,8 +2028,8 @@ async def explain( This parameter can be used only when the `q` query string parameter is specified. :param analyzer: The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. - :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for query string query: `and` or + `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter @@ -2133,6 +2140,7 @@ async def field_caps( include_unmapped: t.Optional[bool] = None, index_filter: t.Optional[t.Mapping[str, t.Any]] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, types: t.Optional[t.Sequence[str]] = None, body: t.Optional[t.Dict[str, t.Any]] = None, @@ -2176,6 +2184,11 @@ async def field_caps( deleted documents) are outside of the provided range. However, not all queries can rewrite to `match_none` so this API may return an index even if the provided filter matches no document. + :param project_routing: Specifies a subset of projects to target for the field-caps + query using project metadata tags in a subset of Lucene query syntax. Allowed + Lucene queries: the _alias tag and a single value (possibly wildcarded). + Examples: _alias:my-project _alias:_origin _alias:*pr* Supported in serverless + only. :param runtime_mappings: Define ad-hoc runtime fields in the request similar to the way it is done in search requests. These fields exist only as part of the query and take precedence over fields defined with the same name in @@ -2213,6 +2226,8 @@ async def field_caps( __query["include_unmapped"] = include_unmapped if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if types is not None: __query["types"] = types if not __body: @@ -2266,7 +2281,7 @@ async def get( stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -2556,7 +2571,7 @@ async def get_source( source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -2736,7 +2751,7 @@ async def index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, wait_for_active_shards: t.Optional[ t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]] @@ -3151,6 +3166,7 @@ async def msearch( max_concurrent_shard_requests: t.Optional[int] = None, pre_filter_shard_size: t.Optional[int] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, rest_total_hits_as_int: t.Optional[bool] = None, routing: t.Optional[str] = None, search_type: t.Optional[ @@ -3212,6 +3228,10 @@ async def msearch( roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. + :param project_routing: Specifies a subset of projects to target for a search + using project metadata tags in a subset Lucene syntax. Allowed Lucene queries: + the _alias tag and a single value (possible wildcarded). Examples: _alias:my-project + _alias:_origin _alias:*pr* Supported in serverless only. :param rest_total_hits_as_int: If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. :param routing: Custom routing value used to route search operations to a specific @@ -3261,6 +3281,8 @@ async def msearch( __query["pre_filter_shard_size"] = pre_filter_shard_size if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if rest_total_hits_as_int is not None: __query["rest_total_hits_as_int"] = rest_total_hits_as_int if routing is not None: @@ -3299,6 +3321,7 @@ async def msearch_template( human: t.Optional[bool] = None, max_concurrent_searches: t.Optional[int] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, rest_total_hits_as_int: t.Optional[bool] = None, search_type: t.Optional[ t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]] @@ -3332,6 +3355,10 @@ async def msearch_template( for cross-cluster search requests. :param max_concurrent_searches: The maximum number of concurrent searches the API can run. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param rest_total_hits_as_int: If `true`, the response returns `hits.total` as an integer. If `false`, it returns `hits.total` as an object. :param search_type: The type of the search operation. @@ -3364,6 +3391,8 @@ async def msearch_template( __query["max_concurrent_searches"] = max_concurrent_searches if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if rest_total_hits_as_int is not None: __query["rest_total_hits_as_int"] = rest_total_hits_as_int if search_type is not None: @@ -3409,7 +3438,7 @@ async def mtermvectors( term_statistics: t.Optional[bool] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: @@ -3534,6 +3563,7 @@ async def open_point_in_time( max_concurrent_shard_requests: t.Optional[int] = None, preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, routing: t.Optional[str] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: @@ -3590,6 +3620,11 @@ async def open_point_in_time( that each sub-search request executes per node. :param preference: The node or shard the operation should be performed on. By default, it is random. + :param project_routing: Specifies a subset of projects to target for the PIT + request using project metadata tags in a subset of Lucene query syntax. Allowed + Lucene queries: the _alias tag and a single value (possibly wildcarded). + Examples: _alias:my-project _alias:_origin _alias:*pr* Supported in serverless + only. :param routing: A custom value that is used to route operations to a specific shard. """ @@ -3621,6 +3656,8 @@ async def open_point_in_time( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if routing is not None: __query["routing"] = routing if not __body: @@ -3819,7 +3856,7 @@ async def rank_eval( ) @_rewrite_parameters( - body_fields=("dest", "source", "conflicts", "max_docs", "script", "size"), + body_fields=("dest", "source", "conflicts", "max_docs", "script"), ) async def reindex( self, @@ -3837,7 +3874,6 @@ async def reindex( require_alias: t.Optional[bool] = None, script: t.Optional[t.Mapping[str, t.Any]] = None, scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - size: t.Optional[int] = None, slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, wait_for_active_shards: t.Optional[ @@ -3913,7 +3949,6 @@ async def reindex( reindexing. :param scroll: The period of time that a consistent view of the index should be maintained for scrolled search. - :param size: :param slices: The number of slices this task should be divided into. It defaults to one slice, which means the task isn't sliced into subtasks. Reindex supports sliced scroll to parallelize the reindexing process. This parallelization @@ -3978,8 +4013,6 @@ async def reindex( __body["max_docs"] = max_docs if script is not None: __body["script"] = script - if size is not None: - __body["size"] = size __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", @@ -4106,11 +4139,7 @@ async def render_search_template( __body["params"] = params if source is not None: __body["source"] = source - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4193,11 +4222,7 @@ async def scripts_painless_execute( __body["context_setup"] = context_setup if script is not None: __body["script"] = script - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4377,6 +4402,7 @@ async def search( preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, q: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, rank: t.Optional[t.Mapping[str, t.Any]] = None, @@ -4474,8 +4500,8 @@ async def search( node and the remote clusters are minimized when running cross-cluster search (CCS) requests. :param collapse: Collapses search results the values of the specified field. - :param default_operator: The default operator for the query string query: `AND` - or `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for the query string query: `and` + or `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter @@ -4560,6 +4586,10 @@ async def search( :param profile: Set to `true` to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param q: A query in the Lucene query string syntax. Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing. IMPORTANT: This parameter overrides the query parameter in the request body. @@ -4714,6 +4744,8 @@ async def search( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if q is not None: __query["q"] = q if request_cache is not None: @@ -4868,6 +4900,7 @@ async def search_mvt( ] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, size: t.Optional[int] = None, @@ -5185,6 +5218,10 @@ async def search_mvt( In the aggs layer, each feature represents a `geotile_grid` cell. If `grid, each feature is a polygon of the cells bounding box. If `point`, each feature is a Point that is the centroid of the cell. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param query: The query DSL used to filter documents for the search. :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. @@ -5248,6 +5285,8 @@ async def search_mvt( __query["human"] = human if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if not __body: if aggs is not None: __body["aggs"] = aggs @@ -5421,6 +5460,7 @@ async def search_template( preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, rest_total_hits_as_int: t.Optional[bool] = None, routing: t.Optional[str] = None, scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, @@ -5466,6 +5506,10 @@ async def search_template( :param preference: The node or shard the operation should be performed on. It is random by default. :param profile: If `true`, the query execution is profiled. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param rest_total_hits_as_int: If `true`, `hits.total` is rendered as an integer in the response. If `false`, it is rendered as an object. :param routing: A custom value used to route operations to a specific shard. @@ -5507,6 +5551,8 @@ async def search_template( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if rest_total_hits_as_int is not None: __query["rest_total_hits_as_int"] = rest_total_hits_as_int if routing is not None: @@ -5633,11 +5679,7 @@ async def terms_enum( __body["string"] = string if timeout is not None: __body["timeout"] = timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5687,7 +5729,7 @@ async def termvectors( term_statistics: t.Optional[bool] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: @@ -6163,8 +6205,8 @@ async def update_by_query( be used only when the `q` query string parameter is specified. :param conflicts: The preferred behavior when update by query hits version conflicts: `abort` or `proceed`. - :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for query string query: `and` or + `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter diff --git a/elasticsearch/_async/client/async_search.py b/elasticsearch/_async/client/async_search.py index 4d1c32974..5ebe24cd0 100644 --- a/elasticsearch/_async/client/async_search.py +++ b/elasticsearch/_async/client/async_search.py @@ -287,6 +287,7 @@ async def submit( preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, q: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, request_cache: t.Optional[bool] = None, @@ -408,6 +409,10 @@ async def submit( :param preference: Specify the node or shard the operation should be performed on (default: random) :param profile: + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param q: Query in the Lucene query string syntax :param query: Defines the search definition using the Query DSL. :param request_cache: Specify if request cache should be used for this request @@ -528,6 +533,8 @@ async def submit( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if q is not None: __query["q"] = q if request_cache is not None: diff --git a/elasticsearch/_async/client/cat.py b/elasticsearch/_async/client/cat.py index 84f946f5c..f033a97ec 100644 --- a/elasticsearch/_async/client/cat.py +++ b/elasticsearch/_async/client/cat.py @@ -36,6 +36,9 @@ async def aliases( self, *, name: t.Optional[t.Union[str, t.Sequence[str]]] = 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[ @@ -80,6 +83,9 @@ async def aliases( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -95,6 +101,14 @@ async def aliases( :param name: A comma-separated list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated @@ -112,6 +126,12 @@ async def aliases( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -122,6 +142,8 @@ async def aliases( __path_parts = {} __path = "/_cat/aliases" __query: t.Dict[str, t.Any] = {} + 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: @@ -142,6 +164,8 @@ async def aliases( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -213,6 +237,9 @@ async def allocation( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -227,7 +254,14 @@ async def allocation( :param node_id: A comma-separated list of node identifiers or names used to limit the returned information. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -242,6 +276,12 @@ async def allocation( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -274,6 +314,8 @@ async def allocation( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -291,6 +333,9 @@ async def component_templates( self, *, name: t.Optional[str] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -330,6 +375,9 @@ async def component_templates( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -346,6 +394,14 @@ async def component_templates( :param name: The name of the component template. It accepts wildcard expressions. If it is omitted, all component templates are returned. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -360,6 +416,12 @@ async def component_templates( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -370,6 +432,8 @@ async def component_templates( __path_parts = {} __path = "/_cat/component_templates" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -390,6 +454,8 @@ async def component_templates( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -407,6 +473,9 @@ async def count( self, *, index: t.Optional[t.Union[str, t.Sequence[str]]] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -419,7 +488,11 @@ async def count( help: t.Optional[bool] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -437,15 +510,33 @@ async def count( :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. It supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -456,6 +547,8 @@ async def count( __path_parts = {} __path = "/_cat/count" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -470,8 +563,12 @@ async def count( __query["human"] = human if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -507,6 +604,9 @@ async def fielddata( human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -522,7 +622,14 @@ async def fielddata( :param fields: Comma-separated list of fields used to limit returned information. To retrieve all fields, omit this parameter. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -532,6 +639,12 @@ async def fielddata( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -560,6 +673,8 @@ async def fielddata( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -576,6 +691,9 @@ async def fielddata( async def health( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -652,6 +770,14 @@ async def health( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -661,13 +787,20 @@ async def health( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param ts: If true, returns `HH:MM:SS` and Unix epoch timestamps. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/health" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -1092,7 +1225,14 @@ async def indices( :param index: 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 bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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: The type of index that wildcard patterns can match. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -1109,7 +1249,12 @@ async def indices( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -1166,6 +1311,9 @@ async def indices( async def master( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -1181,6 +1329,9 @@ async def master( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -1193,6 +1344,14 @@ async def master( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -1207,11 +1366,19 @@ async def master( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/master" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -1232,6 +1399,8 @@ async def master( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -1374,8 +1543,15 @@ async def ml_data_frame_analytics( :param id: The ID of the data frame analytics to fetch :param allow_no_match: Whether to ignore if a wildcard expression matches no - configs. (This includes `_all` string or when no configs have been specified) - :param bytes: The unit in which to display byte values + configs. (This includes `_all` string or when no configs have been specified.) + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: Comma-separated list of column names to display. @@ -1383,7 +1559,12 @@ async def ml_data_frame_analytics( be combined with any other query string option. :param s: Comma-separated list of column names or column aliases used to sort the response. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -1434,6 +1615,9 @@ async def ml_datafeeds( *, datafeed_id: t.Optional[str] = None, allow_no_match: 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, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -1549,6 +1733,14 @@ async def ml_datafeeds( array when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a 404 status code when there are no matches or only partial matches. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: Comma-separated list of column names to display. @@ -1556,7 +1748,12 @@ async def ml_datafeeds( be combined with any other query string option. :param s: Comma-separated list of column names or column aliases used to sort the response. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -1569,6 +1766,8 @@ async def ml_datafeeds( __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -1914,7 +2113,14 @@ async def ml_jobs( array when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a 404 status code when there are no matches or only partial matches. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: Comma-separated list of column names to display. @@ -1922,7 +2128,12 @@ async def ml_jobs( be combined with any other query string option. :param s: Comma-separated list of column names or column aliases used to sort the response. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2099,7 +2310,14 @@ async def ml_trained_models( when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a 404 status code when there are no matches or only partial matches. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param from_: Skips the specified number of transforms. @@ -2109,7 +2327,12 @@ async def ml_trained_models( :param s: A comma-separated list of column names or aliases used to sort the response. :param size: The maximum number of transforms to display. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2162,6 +2385,9 @@ async def ml_trained_models( async def nodeattrs( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -2189,6 +2415,9 @@ async def nodeattrs( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -2201,6 +2430,14 @@ async def nodeattrs( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -2215,11 +2452,19 @@ async def nodeattrs( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/nodeattrs" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -2240,6 +2485,8 @@ async def nodeattrs( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2262,7 +2509,7 @@ async def nodes( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - full_id: t.Optional[t.Union[bool, str]] = None, + full_id: t.Optional[bool] = None, h: t.Optional[ t.Union[ t.Sequence[ @@ -2478,7 +2725,14 @@ async def nodes( ``_ - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param full_id: If `true`, return the full node ID. If `false`, return the shortened @@ -2493,7 +2747,12 @@ async def nodes( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} @@ -2541,6 +2800,9 @@ async def nodes( async def pending_tasks( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -2578,6 +2840,14 @@ async def pending_tasks( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -2592,12 +2862,19 @@ async def pending_tasks( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/pending_tasks" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -2636,6 +2913,9 @@ async def pending_tasks( async def plugins( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -2659,6 +2939,9 @@ async def plugins( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -2671,6 +2954,14 @@ async def plugins( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -2686,11 +2977,19 @@ async def plugins( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/plugins" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -2713,6 +3012,8 @@ async def plugins( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2831,7 +3132,14 @@ async def recovery( to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. :param active_only: If `true`, the response only includes ongoing shard recoveries. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 detailed: If `true`, the response includes detailed information about shard recoveries. :param format: Specifies the format to return the columnar data in, can be set @@ -2843,7 +3151,12 @@ async def recovery( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2894,6 +3207,9 @@ async def recovery( async def repositories( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -2904,6 +3220,9 @@ async def repositories( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -2916,6 +3235,14 @@ async def repositories( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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. @@ -2929,11 +3256,19 @@ async def repositories( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/repositories" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -2954,6 +3289,8 @@ async def repositories( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -3029,6 +3366,9 @@ async def segments( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -3045,7 +3385,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 bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -3060,6 +3407,12 @@ async def segments( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3092,6 +3445,8 @@ async def segments( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -3295,7 +3650,14 @@ async def shards( :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 bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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. @@ -3305,7 +3667,12 @@ async def shards( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3355,6 +3722,9 @@ async def snapshots( self, *, repository: t.Optional[t.Union[str, t.Sequence[str]]] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -3425,6 +3795,14 @@ async def snapshots( :param repository: A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. If any repository fails during the request, Elasticsearch returns an error. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -3437,7 +3815,12 @@ async def snapshots( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3448,6 +3831,8 @@ async def snapshots( __path_parts = {} __path = "/_cat/snapshots" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -3488,6 +3873,9 @@ async def tasks( self, *, actions: t.Optional[t.Sequence[str]] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, detailed: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, @@ -3562,6 +3950,14 @@ async def tasks( ``_ :param actions: The task action names, which are used to limit the response. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 detailed: If `true`, the response includes detailed information about shard recoveries. :param format: Specifies the format to return the columnar data in, can be set @@ -3576,7 +3972,12 @@ async def tasks( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :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 v: When set to `true` will enable verbose output. @@ -3588,6 +3989,8 @@ async def tasks( __query: t.Dict[str, t.Any] = {} if actions is not None: __query["actions"] = actions + if bytes is not None: + __query["bytes"] = bytes if detailed is not None: __query["detailed"] = detailed if error_trace is not None: @@ -3633,6 +4036,9 @@ async def templates( self, *, name: t.Optional[str] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -3660,6 +4066,9 @@ async def templates( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -3675,6 +4084,14 @@ async def templates( :param name: The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -3689,6 +4106,12 @@ async def templates( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3699,6 +4122,8 @@ async def templates( __path_parts = {} __path = "/_cat/templates" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -3719,6 +4144,8 @@ async def templates( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -3736,6 +4163,9 @@ async def thread_pool( self, *, thread_pool_patterns: t.Optional[t.Union[str, t.Sequence[str]]] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -3819,6 +4249,14 @@ async def thread_pool( :param thread_pool_patterns: A comma-separated list of thread pool names used to limit the request. Accepts wildcard expressions. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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. @@ -3832,7 +4270,12 @@ async def thread_pool( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3843,6 +4286,8 @@ async def thread_pool( __path_parts = {} __path = "/_cat/thread_pool" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -3885,6 +4330,9 @@ async def transforms( *, transform_id: t.Optional[str] = None, allow_no_match: 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, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -4084,6 +4532,14 @@ async def transforms( array when there are no matches and the subset of results when there are partial matches. If `false`, the request returns a 404 status code when there are no matches or only partial matches. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param from_: Skips the specified number of transforms. @@ -4093,7 +4549,12 @@ async def transforms( :param s: Comma-separated list of column names or column aliases used to sort the response. :param size: The maximum number of transforms to obtain. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -4106,6 +4567,8 @@ async def transforms( __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: diff --git a/elasticsearch/_async/client/connector.py b/elasticsearch/_async/client/connector.py index 6c4bca043..70e468db7 100644 --- a/elasticsearch/_async/client/connector.py +++ b/elasticsearch/_async/client/connector.py @@ -103,7 +103,7 @@ async def delete( :param connector_id: The unique identifier of the connector to be deleted :param delete_sync_jobs: A flag indicating if associated sync jobs should be - also removed. Defaults to false. + also removed. :param hard: A flag indicating if the connector should be hard deleted. """ if connector_id in SKIP_IN_PATH: @@ -360,7 +360,7 @@ async def list( :param connector_name: A comma-separated list of connector names to fetch connector documents for - :param from_: Starting offset (default: 0) + :param from_: Starting offset :param include_deleted: A flag to indicate if the desired connector should be fetched, even if it was soft-deleted. :param index_name: A comma-separated list of connector index names to fetch connector @@ -955,7 +955,7 @@ async def sync_job_list( ``_ :param connector_id: A connector id to fetch connector sync jobs for - :param from_: Starting offset (default: 0) + :param from_: Starting offset :param job_type: A comma-separated list of job types to fetch the sync jobs for :param size: Specifies a max number of results to get :param status: A sync job status to fetch connector sync jobs for diff --git a/elasticsearch/_async/client/eql.py b/elasticsearch/_async/client/eql.py index 98ee4f4e8..66e70037c 100644 --- a/elasticsearch/_async/client/eql.py +++ b/elasticsearch/_async/client/eql.py @@ -229,6 +229,7 @@ async def search( keep_on_completion: t.Optional[bool] = None, max_samples_per_key: t.Optional[int] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, result_position: t.Optional[t.Union[str, t.Literal["head", "tail"]]] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, size: t.Optional[int] = None, @@ -285,6 +286,10 @@ async def search( `size` parameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the `max_samples_per_key` parameter. Pipes are not supported for sample queries. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param result_position: :param runtime_mappings: :param size: For basic queries, the maximum number of matching events to return. @@ -318,6 +323,8 @@ async def search( __query["ignore_unavailable"] = ignore_unavailable if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if not __body: if query is not None: __body["query"] = query diff --git a/elasticsearch/_async/client/esql.py b/elasticsearch/_async/client/esql.py index 38e642779..79f28a8a3 100644 --- a/elasticsearch/_async/client/esql.py +++ b/elasticsearch/_async/client/esql.py @@ -40,6 +40,7 @@ class EsqlClient(NamespacedClient): "columnar", "filter", "include_ccs_metadata", + "include_execution_metadata", "keep_alive", "keep_on_completion", "locale", @@ -71,6 +72,7 @@ async def async_query( ] = None, human: t.Optional[bool] = None, include_ccs_metadata: t.Optional[bool] = None, + include_execution_metadata: t.Optional[bool] = None, keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, keep_on_completion: t.Optional[bool] = None, locale: t.Optional[str] = None, @@ -120,7 +122,11 @@ async def async_query( 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 + :param include_ccs_metadata: When set to `true` and performing a cross-cluster/cross-project + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. + :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as shards count. @@ -180,6 +186,8 @@ async def async_query( __body["filter"] = filter if include_ccs_metadata is not None: __body["include_ccs_metadata"] = include_ccs_metadata + if include_execution_metadata is not None: + __body["include_execution_metadata"] = include_execution_metadata if keep_alive is not None: __body["keep_alive"] = keep_alive if keep_on_completion is not None: @@ -486,6 +494,7 @@ async def list_queries( "columnar", "filter", "include_ccs_metadata", + "include_execution_metadata", "locale", "params", "profile", @@ -514,8 +523,16 @@ async def query( ] = None, human: t.Optional[bool] = None, include_ccs_metadata: t.Optional[bool] = None, + include_execution_metadata: t.Optional[bool] = None, locale: t.Optional[str] = None, - params: t.Optional[t.Sequence[t.Union[None, bool, float, int, str]]] = None, + params: t.Optional[ + t.Sequence[ + t.Union[ + t.Sequence[t.Union[None, bool, float, int, str]], + t.Union[None, bool, float, int, str], + ] + ] + ] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, tables: t.Optional[ @@ -554,7 +571,11 @@ async def query( :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 + :param include_ccs_metadata: When set to `true` and performing a cross-cluster/cross-project + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. + :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as shards count. @@ -600,6 +621,8 @@ async def query( __body["filter"] = filter if include_ccs_metadata is not None: __body["include_ccs_metadata"] = include_ccs_metadata + if include_execution_metadata is not None: + __body["include_execution_metadata"] = include_execution_metadata if locale is not None: __body["locale"] = locale if params is not None: diff --git a/elasticsearch/_async/client/fleet.py b/elasticsearch/_async/client/fleet.py index f1ea60007..de2be54cb 100644 --- a/elasticsearch/_async/client/fleet.py +++ b/elasticsearch/_async/client/fleet.py @@ -642,11 +642,7 @@ async def search( __body["track_total_hits"] = track_total_hits if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/graph.py b/elasticsearch/_async/client/graph.py index a8c35dbfe..d239cf4ae 100644 --- a/elasticsearch/_async/client/graph.py +++ b/elasticsearch/_async/client/graph.py @@ -97,11 +97,7 @@ async def explore( __body["query"] = query if vertices is not None: __body["vertices"] = vertices - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/ilm.py b/elasticsearch/_async/client/ilm.py index c15aaa807..acc7f14b8 100644 --- a/elasticsearch/_async/client/ilm.py +++ b/elasticsearch/_async/client/ilm.py @@ -383,11 +383,7 @@ async def move_to_step( __body["current_step"] = current_step if next_step is not None: __body["next_step"] = next_step - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -453,11 +449,7 @@ async def put_lifecycle( if not __body: if policy is not None: __body["policy"] = policy - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index 7beaa591a..082b860c3 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -232,11 +232,7 @@ async def analyze( __body["text"] = text if tokenizer is not None: __body["tokenizer"] = tokenizer - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -812,11 +808,7 @@ async def create_from( raise ValueError("Empty value passed for parameter 'source'") if dest in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'dest'") - if create_from is None and body is None: - raise ValueError( - "Empty value passed for parameters 'create_from' and 'body', one of them should be set." - ) - elif create_from is not None and body is not None: + if create_from is not None and body is not None: raise ValueError("Cannot set both 'create_from' and 'body'") __path_parts: t.Dict[str, str] = { "source": _quote(source), @@ -833,7 +825,11 @@ async def create_from( if pretty is not None: __query["pretty"] = pretty __body = create_from if create_from is not None else body - __headers = {"accept": "application/json", "content-type": "application/json"} + if not __body: + __body = None + __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, @@ -1393,6 +1389,7 @@ async def disk_usage(

NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. The stored size of the _id field is likely underestimated while the _source field is overestimated.

+

For usage examples see the External documentation or refer to Analyze the index disk usage example for an example.

``_ @@ -3689,11 +3686,7 @@ async def put_data_lifecycle( __body["downsampling"] = downsampling if enabled is not None: __body["enabled"] = enabled - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3849,11 +3842,7 @@ async def put_data_stream_options( if not __body: if failure_store is not None: __body["failure_store"] = failure_store - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4677,6 +4666,7 @@ async def refresh( For data streams, the API runs the refresh operation on the stream’s backing indices.

By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. You can change this default interval with the index.refresh_interval setting.

+

In Elastic Cloud Serverless, the default refresh interval is 5 seconds across all indices.

Refresh requests are synchronous and do not return a response until the refresh operation completes.

Refreshes are resource-intensive. To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.

@@ -5076,6 +5066,7 @@ async def resolve_index( ] ] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -5103,6 +5094,10 @@ async def resolve_index( a missing or closed index. :param mode: Filter indices by index mode - standard, lookup, time_series, etc. Comma-separated list of IndexMode. Empty means no filter. + :param project_routing: Specifies a subset of projects to target using project + metadata tags in a subset of Lucene query syntax. Allowed Lucene queries: + the _alias tag and a single value (possibly wildcarded). Examples: _alias:my-project + _alias:_origin _alias:*pr* Supported in serverless only. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -5125,6 +5120,8 @@ async def resolve_index( __query["mode"] = mode if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "GET", @@ -5541,11 +5538,7 @@ async def shrink( __body["aliases"] = aliases if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5556,7 +5549,9 @@ async def shrink( path_parts=__path_parts, ) - @_rewrite_parameters() + @_rewrite_parameters( + body_name="index_template", + ) async def simulate_index_template( self, *, @@ -5567,6 +5562,8 @@ async def simulate_index_template( filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, include_defaults: t.Optional[bool] = None, + index_template: t.Optional[t.Mapping[str, t.Any]] = None, + body: t.Optional[t.Mapping[str, t.Any]] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: @@ -5586,12 +5583,15 @@ async def simulate_index_template( only be dry-run added if new or can also replace an existing one :param include_defaults: If true, returns all relevant default configurations for the index template. + :param index_template: :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. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") + if index_template is not None and body is not None: + raise ValueError("Cannot set both 'index_template' and 'body'") __path_parts: t.Dict[str, str] = {"name": _quote(name)} __path = f'/_index_template/_simulate_index/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} @@ -5611,12 +5611,18 @@ async def simulate_index_template( __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + __body = index_template if index_template is not None else body + if not __body: + __body = None __headers = {"accept": "application/json"} + if __body is not None: + __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] "POST", __path, params=__query, headers=__headers, + body=__body, endpoint_id="indices.simulate_index_template", path_parts=__path_parts, ) @@ -5884,11 +5890,7 @@ async def split( __body["aliases"] = aliases if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5965,8 +5967,8 @@ async def stats( are requested). :param include_unloaded_segments: If true, the response includes information from segments that are not loaded into memory. - :param level: Indicates whether statistics are aggregated at the cluster, index, - or shard level. + :param level: Indicates whether statistics are aggregated at the cluster, indices, + or shards level. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: @@ -6132,8 +6134,8 @@ async def validate_query( :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. :param analyzer: Analyzer to use for the query string. This parameter can only be used when the `q` query string parameter is specified. - :param default_operator: The default operator for query string query: `AND` or - `OR`. + :param default_operator: The default operator for query string query: `and` or + `or`. :param df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. diff --git a/elasticsearch/_async/client/inference.py b/elasticsearch/_async/client/inference.py index 16e63938d..934395f17 100644 --- a/elasticsearch/_async/client/inference.py +++ b/elasticsearch/_async/client/inference.py @@ -78,11 +78,7 @@ async def completion( __body["input"] = input 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -338,11 +334,7 @@ async def inference( __body["query"] = query 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -529,11 +521,7 @@ async def put_ai21( __body["service"] = service if service_settings is not None: __body["service_settings"] = service_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -627,11 +615,7 @@ async def put_alibabacloud( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -727,11 +711,7 @@ async def put_amazonbedrock( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -833,11 +813,7 @@ async def put_amazonsagemaker( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -930,11 +906,7 @@ async def put_anthropic( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1026,11 +998,7 @@ async def put_azureaistudio( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1130,11 +1098,7 @@ async def put_azureopenai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1224,11 +1188,7 @@ async def put_cohere( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1239,6 +1199,99 @@ async def put_cohere( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=( + "service", + "service_settings", + "chunking_settings", + "task_settings", + ), + ) + async def put_contextualai( + self, + *, + task_type: t.Union[str, t.Literal["rerank"]], + contextualai_inference_id: str, + service: t.Optional[t.Union[str, t.Literal["contextualai"]]] = 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 Contextual AI inference endpoint.

+

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

+

To review the available rerank models, refer to https://docs.contextual.ai/api-reference/rerank/rerank#body-model.

+ + + ``_ + + :param task_type: The type of the inference task that the model will perform. + :param contextualai_inference_id: The unique identifier of the inference endpoint. + :param service: The type of service supported for the specified task type. In + this case, `contextualai`. + :param service_settings: Settings used to install the inference model. These + settings are specific to the `contextualai` service. + :param chunking_settings: The chunking configuration object. + :param task_settings: Settings to configure the inference task. These settings + are specific to the task type 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 contextualai_inference_id in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for parameter 'contextualai_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), + "contextualai_inference_id": _quote(contextualai_inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["contextualai_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 + __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="inference.put_contextualai", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "service", @@ -1355,11 +1408,7 @@ async def put_custom( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1439,11 +1488,7 @@ async def put_deepseek( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1551,11 +1596,7 @@ async def put_elasticsearch( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1650,11 +1691,7 @@ async def put_elser( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1736,11 +1773,7 @@ async def put_googleaistudio( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1834,11 +1867,7 @@ async def put_googlevertexai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1966,11 +1995,7 @@ async def put_hugging_face( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2062,11 +2087,7 @@ async def put_jinaai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2148,11 +2169,7 @@ async def put_llama( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2234,11 +2251,7 @@ async def put_mistral( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2332,11 +2345,7 @@ async def put_openai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2427,11 +2436,7 @@ async def put_voyageai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2511,11 +2516,7 @@ async def put_watsonx( __body["service"] = service if service_settings is not None: __body["service_settings"] = service_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2588,11 +2589,7 @@ async def rerank( __body["query"] = query 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2656,11 +2653,7 @@ async def sparse_embedding( __body["input"] = input 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2672,7 +2665,7 @@ async def sparse_embedding( ) @_rewrite_parameters( - body_fields=("input", "task_settings"), + body_fields=("input", "input_type", "task_settings"), ) async def text_embedding( self, @@ -2682,6 +2675,7 @@ async def text_embedding( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + input_type: t.Optional[str] = None, pretty: t.Optional[bool] = None, task_settings: t.Optional[t.Any] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, @@ -2697,6 +2691,13 @@ async def text_embedding( :param inference_id: The inference Id :param input: Inference input. Either a string or an array of strings. + :param input_type: The input data type for the text embedding model. Possible + values include: * `SEARCH` * `INGEST` * `CLASSIFICATION` * `CLUSTERING` Not + all services support all values. Unsupported values will trigger a validation + exception. Accepted values depend on the configured inference service, refer + to the relevant service-specific documentation for more info. > info > The + `input_type` parameter specified on the root level of the request body will + take precedence over the `input_type` parameter specified in `task_settings`. :param task_settings: Optional task settings :param timeout: Specifies the amount of time to wait for the inference request to complete. @@ -2722,13 +2723,11 @@ async def text_embedding( if not __body: if input is not None: __body["input"] = input + if input_type is not None: + __body["input_type"] = input_type 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/ingest.py b/elasticsearch/_async/client/ingest.py index 3cd0260d5..336169a90 100644 --- a/elasticsearch/_async/client/ingest.py +++ b/elasticsearch/_async/client/ingest.py @@ -580,6 +580,7 @@ async def put_ip_location_database( body_fields=( "deprecated", "description", + "field_access_pattern", "meta", "on_failure", "processors", @@ -594,6 +595,9 @@ async def put_pipeline( deprecated: t.Optional[bool] = None, description: t.Optional[str] = None, error_trace: t.Optional[bool] = None, + field_access_pattern: t.Optional[ + t.Union[str, t.Literal["classic", "flexible"]] + ] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, if_version: t.Optional[int] = None, @@ -621,6 +625,8 @@ async def put_pipeline( or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. :param description: Description of the ingest pipeline. + :param field_access_pattern: Controls how processors in this pipeline should + read and write data on a document's source. :param if_version: Required version for optimistic concurrency control for pipeline updates :param master_timeout: Period to wait for a connection to the master node. If @@ -667,6 +673,8 @@ async def put_pipeline( __body["deprecated"] = deprecated if description is not None: __body["description"] = description + if field_access_pattern is not None: + __body["field_access_pattern"] = field_access_pattern if meta is not None: __body["_meta"] = meta if on_failure is not None: diff --git a/elasticsearch/_async/client/license.py b/elasticsearch/_async/client/license.py index ba389d0d5..2a5c35189 100644 --- a/elasticsearch/_async/client/license.py +++ b/elasticsearch/_async/client/license.py @@ -104,8 +104,10 @@ async def get( license types. If `false`, this parameter returns platinum for both platinum and enterprise license types. This behavior is maintained for backwards compatibility. This parameter is deprecated and will always be set to true in 8.x. - :param local: Specifies whether to retrieve local information. The default value - is `false`, which means the information is retrieved from the master node. + :param local: Specifies whether to retrieve local information. From 9.2 onwards + the default value is `true`, which means the information is retrieved from + the responding node. In earlier versions the default is `false`, which means + the information is retrieved from the elected master node. """ __path_parts: t.Dict[str, str] = {} __path = "/_license" diff --git a/elasticsearch/_async/client/logstash.py b/elasticsearch/_async/client/logstash.py index c63983710..c724911dc 100644 --- a/elasticsearch/_async/client/logstash.py +++ b/elasticsearch/_async/client/logstash.py @@ -141,7 +141,9 @@ async def put_pipeline( ``_ - :param id: An identifier for the pipeline. + :param id: An identifier for the pipeline. Pipeline IDs must begin with a letter + or underscore and contain only letters, underscores, dashes, hyphens and + numbers. :param pipeline: """ if id in SKIP_IN_PATH: diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index fb5af673f..4fba07482 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -2390,7 +2390,7 @@ async def get_overall_buckets( exclude_interim: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, - overall_score: t.Optional[t.Union[float, str]] = None, + overall_score: t.Optional[float] = None, pretty: t.Optional[bool] = None, start: t.Optional[t.Union[str, t.Any]] = None, top_n: t.Optional[int] = None, @@ -5716,7 +5716,7 @@ async def validate(

Validate an anomaly detection job.

- ``_ + ``_ :param analysis_config: :param analysis_limits: diff --git a/elasticsearch/_async/client/nodes.py b/elasticsearch/_async/client/nodes.py index 1b007e7cb..1ed5cd5eb 100644 --- a/elasticsearch/_async/client/nodes.py +++ b/elasticsearch/_async/client/nodes.py @@ -368,9 +368,7 @@ async def stats( human: t.Optional[bool] = None, include_segment_file_sizes: t.Optional[bool] = None, include_unloaded_segments: t.Optional[bool] = None, - level: t.Optional[ - t.Union[str, t.Literal["cluster", "indices", "shards"]] - ] = None, + level: t.Optional[t.Union[str, t.Literal["indices", "node", "shards"]]] = None, pretty: t.Optional[bool] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, types: t.Optional[t.Sequence[str]] = None, @@ -404,8 +402,8 @@ async def stats( are requested). :param include_unloaded_segments: If `true`, the response includes information from segments that are not loaded into memory. - :param level: Indicates whether statistics are aggregated at the cluster, index, - or shard level. + :param level: Indicates whether statistics are aggregated at the node, indices, + or shards level. :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 types: A comma-separated list of document types for the indexing index diff --git a/elasticsearch/_async/client/project.py b/elasticsearch/_async/client/project.py new file mode 100644 index 000000000..6e1e1a63a --- /dev/null +++ b/elasticsearch/_async/client/project.py @@ -0,0 +1,67 @@ +# 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. + +import typing as t + +from elastic_transport import ObjectApiResponse + +from ._base import NamespacedClient +from .utils import ( + Stability, + _rewrite_parameters, + _stability_warning, +) + + +class ProjectClient(NamespacedClient): + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def tags( + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Return tags defined for the project

+ + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_project/tags" + __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="project.tags", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_async/client/security.py b/elasticsearch/_async/client/security.py index 516906ce8..de094aa03 100644 --- a/elasticsearch/_async/client/security.py +++ b/elasticsearch/_async/client/security.py @@ -2052,6 +2052,45 @@ async def get_settings( path_parts=__path_parts, ) + @_rewrite_parameters() + async def get_stats( + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get security stats.

+

Gather security usage statistics from all node(s) within the cluster.

+ + + ``_ + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_security/stats" + __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="security.get_stats", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "grant_type", diff --git a/elasticsearch/_async/client/shutdown.py b/elasticsearch/_async/client/shutdown.py index 5dbc33e92..9502d1fe6 100644 --- a/elasticsearch/_async/client/shutdown.py +++ b/elasticsearch/_async/client/shutdown.py @@ -33,13 +33,9 @@ async def delete_node( 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["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = 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["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -97,9 +93,7 @@ async def get_node( 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["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -162,14 +156,10 @@ async def put_node( 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["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, target_node_name: t.Optional[str] = None, - timeout: t.Optional[ - t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = 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]: """ diff --git a/elasticsearch/_async/client/slm.py b/elasticsearch/_async/client/slm.py index 3eaafd865..88f0d910b 100644 --- a/elasticsearch/_async/client/slm.py +++ b/elasticsearch/_async/client/slm.py @@ -431,11 +431,7 @@ async def put_lifecycle( __body["retention"] = retention if schedule is not None: __body["schedule"] = schedule - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/sql.py b/elasticsearch/_async/client/sql.py index de423ea66..9e146e0f8 100644 --- a/elasticsearch/_async/client/sql.py +++ b/elasticsearch/_async/client/sql.py @@ -285,6 +285,7 @@ async def query( page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, params: t.Optional[t.Sequence[t.Any]] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, query: t.Optional[str] = None, request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, @@ -332,6 +333,10 @@ async def query( is no longer available. Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of `page_timeout` in the scroll request. :param params: The values for parameters in the query. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param query: The SQL query to run. :param request_timeout: The timeout before the request fails. :param runtime_mappings: One or more runtime fields for the search request. These @@ -357,6 +362,8 @@ async def query( __query["human"] = human if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if not __body: if allow_partial_search_results is not None: __body["allow_partial_search_results"] = allow_partial_search_results diff --git a/elasticsearch/_async/client/streams.py b/elasticsearch/_async/client/streams.py new file mode 100644 index 000000000..65e934646 --- /dev/null +++ b/elasticsearch/_async/client/streams.py @@ -0,0 +1,185 @@ +# 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. + + +import typing as t + +from elastic_transport import ObjectApiResponse, TextApiResponse + +from ._base import NamespacedClient +from .utils import ( + Stability, + _rewrite_parameters, + _stability_warning, +) + + +class StreamsClient(NamespacedClient): + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def logs_disable( + 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, + ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: + """ + .. raw:: html + +

Disable logs stream.

+

Turn off the logs stream feature for this cluster.

+ + + ``_ + + :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 timeout: The 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 = "/_streams/logs/_disable" + __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,text/plain"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="streams.logs_disable", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def logs_enable( + 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, + ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: + """ + .. raw:: html + +

Enable logs stream.

+

Turn on the logs stream feature for this cluster.

+

NOTE: To protect existing data, this feature can be turned on only if the + cluster does not have existing indices or data streams that match the pattern logs|logs.*. + If those indices or data streams exist, a 409 - Conflict response and error is returned.

+ + + ``_ + + :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 timeout: The 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 = "/_streams/logs/_enable" + __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,text/plain"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="streams.logs_enable", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get the status of streams.

+

Get the current status for all types of streams.

+ + + ``_ + + :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. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_streams/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 + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="streams.status", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_async/client/watcher.py b/elasticsearch/_async/client/watcher.py index e0b7b39ec..8558b9920 100644 --- a/elasticsearch/_async/client/watcher.py +++ b/elasticsearch/_async/client/watcher.py @@ -552,11 +552,7 @@ async def put_watch( __body["transform"] = transform if trigger is not None: __body["trigger"] = trigger - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 4f97411c1..498f411c1 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -63,6 +63,7 @@ from .ml import MlClient from .monitoring import MonitoringClient from .nodes import NodesClient +from .project import ProjectClient from .query_rules import QueryRulesClient from .rollup import RollupClient from .search_application import SearchApplicationClient @@ -74,6 +75,7 @@ from .snapshot import SnapshotClient from .sql import SqlClient from .ssl import SslClient +from .streams import StreamsClient from .synonyms import SynonymsClient from .tasks import TasksClient from .text_structure import TextStructureClient @@ -368,6 +370,7 @@ def __init__( self.migration = MigrationClient(self) self.ml = MlClient(self) self.monitoring = MonitoringClient(self) + self.project = ProjectClient(self) self.query_rules = QueryRulesClient(self) self.rollup = RollupClient(self) self.search_application = SearchApplicationClient(self) @@ -378,6 +381,7 @@ def __init__( self.shutdown = ShutdownClient(self) self.sql = SqlClient(self) self.ssl = SslClient(self) + self.streams = StreamsClient(self) self.synonyms = SynonymsClient(self) self.text_structure = TextStructureClient(self) self.transform = TransformClient(self) @@ -843,11 +847,7 @@ def close_point_in_time( if not __body: if id is not None: __body["id"] = id - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -887,6 +887,7 @@ def count( min_score: t.Optional[float] = None, preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, q: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, routing: t.Optional[str] = None, @@ -920,8 +921,8 @@ def count( This parameter can be used only when the `q` query string parameter is specified. :param analyzer: The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. - :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for query string query: `and` or + `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter @@ -941,6 +942,10 @@ def count( in the result. :param preference: The node or shard the operation should be performed on. By default, it is random. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param q: The query in Lucene query string syntax. This parameter cannot be used with a request body. :param query: Defines the search query using Query DSL. A request body query @@ -993,6 +998,8 @@ def count( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if q is not None: __query["q"] = q if routing is not None: @@ -1042,7 +1049,7 @@ def create( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, wait_for_active_shards: t.Optional[ t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]] @@ -1221,7 +1228,7 @@ def delete( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, wait_for_active_shards: t.Optional[ t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]] @@ -1466,8 +1473,8 @@ def delete_by_query( used only when the `q` query string parameter is specified. :param conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. - :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for query string query: `and` or + `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter @@ -1761,7 +1768,7 @@ def exists( stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, ) -> HeadApiResponse: """ @@ -1890,7 +1897,7 @@ def exists_source( source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, ) -> HeadApiResponse: """ @@ -2019,8 +2026,8 @@ def explain( This parameter can be used only when the `q` query string parameter is specified. :param analyzer: The analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified. - :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for query string query: `and` or + `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter @@ -2131,6 +2138,7 @@ def field_caps( include_unmapped: t.Optional[bool] = None, index_filter: t.Optional[t.Mapping[str, t.Any]] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, types: t.Optional[t.Sequence[str]] = None, body: t.Optional[t.Dict[str, t.Any]] = None, @@ -2174,6 +2182,11 @@ def field_caps( deleted documents) are outside of the provided range. However, not all queries can rewrite to `match_none` so this API may return an index even if the provided filter matches no document. + :param project_routing: Specifies a subset of projects to target for the field-caps + query using project metadata tags in a subset of Lucene query syntax. Allowed + Lucene queries: the _alias tag and a single value (possibly wildcarded). + Examples: _alias:my-project _alias:_origin _alias:*pr* Supported in serverless + only. :param runtime_mappings: Define ad-hoc runtime fields in the request similar to the way it is done in search requests. These fields exist only as part of the query and take precedence over fields defined with the same name in @@ -2211,6 +2224,8 @@ def field_caps( __query["include_unmapped"] = include_unmapped if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if types is not None: __query["types"] = types if not __body: @@ -2264,7 +2279,7 @@ def get( stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -2554,7 +2569,7 @@ def get_source( source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -2734,7 +2749,7 @@ def index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, wait_for_active_shards: t.Optional[ t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]] @@ -3149,6 +3164,7 @@ def msearch( max_concurrent_shard_requests: t.Optional[int] = None, pre_filter_shard_size: t.Optional[int] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, rest_total_hits_as_int: t.Optional[bool] = None, routing: t.Optional[str] = None, search_type: t.Optional[ @@ -3210,6 +3226,10 @@ def msearch( roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. + :param project_routing: Specifies a subset of projects to target for a search + using project metadata tags in a subset Lucene syntax. Allowed Lucene queries: + the _alias tag and a single value (possible wildcarded). Examples: _alias:my-project + _alias:_origin _alias:*pr* Supported in serverless only. :param rest_total_hits_as_int: If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. :param routing: Custom routing value used to route search operations to a specific @@ -3259,6 +3279,8 @@ def msearch( __query["pre_filter_shard_size"] = pre_filter_shard_size if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if rest_total_hits_as_int is not None: __query["rest_total_hits_as_int"] = rest_total_hits_as_int if routing is not None: @@ -3297,6 +3319,7 @@ def msearch_template( human: t.Optional[bool] = None, max_concurrent_searches: t.Optional[int] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, rest_total_hits_as_int: t.Optional[bool] = None, search_type: t.Optional[ t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]] @@ -3330,6 +3353,10 @@ def msearch_template( for cross-cluster search requests. :param max_concurrent_searches: The maximum number of concurrent searches the API can run. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param rest_total_hits_as_int: If `true`, the response returns `hits.total` as an integer. If `false`, it returns `hits.total` as an object. :param search_type: The type of the search operation. @@ -3362,6 +3389,8 @@ def msearch_template( __query["max_concurrent_searches"] = max_concurrent_searches if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if rest_total_hits_as_int is not None: __query["rest_total_hits_as_int"] = rest_total_hits_as_int if search_type is not None: @@ -3407,7 +3436,7 @@ def mtermvectors( term_statistics: t.Optional[bool] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: @@ -3532,6 +3561,7 @@ def open_point_in_time( max_concurrent_shard_requests: t.Optional[int] = None, preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, routing: t.Optional[str] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: @@ -3588,6 +3618,11 @@ def open_point_in_time( that each sub-search request executes per node. :param preference: The node or shard the operation should be performed on. By default, it is random. + :param project_routing: Specifies a subset of projects to target for the PIT + request using project metadata tags in a subset of Lucene query syntax. Allowed + Lucene queries: the _alias tag and a single value (possibly wildcarded). + Examples: _alias:my-project _alias:_origin _alias:*pr* Supported in serverless + only. :param routing: A custom value that is used to route operations to a specific shard. """ @@ -3619,6 +3654,8 @@ def open_point_in_time( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if routing is not None: __query["routing"] = routing if not __body: @@ -3817,7 +3854,7 @@ def rank_eval( ) @_rewrite_parameters( - body_fields=("dest", "source", "conflicts", "max_docs", "script", "size"), + body_fields=("dest", "source", "conflicts", "max_docs", "script"), ) def reindex( self, @@ -3835,7 +3872,6 @@ def reindex( require_alias: t.Optional[bool] = None, script: t.Optional[t.Mapping[str, t.Any]] = None, scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - size: t.Optional[int] = None, slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, wait_for_active_shards: t.Optional[ @@ -3911,7 +3947,6 @@ def reindex( reindexing. :param scroll: The period of time that a consistent view of the index should be maintained for scrolled search. - :param size: :param slices: The number of slices this task should be divided into. It defaults to one slice, which means the task isn't sliced into subtasks. Reindex supports sliced scroll to parallelize the reindexing process. This parallelization @@ -3976,8 +4011,6 @@ def reindex( __body["max_docs"] = max_docs if script is not None: __body["script"] = script - if size is not None: - __body["size"] = size __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", @@ -4104,11 +4137,7 @@ def render_search_template( __body["params"] = params if source is not None: __body["source"] = source - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4191,11 +4220,7 @@ def scripts_painless_execute( __body["context_setup"] = context_setup if script is not None: __body["script"] = script - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4375,6 +4400,7 @@ def search( preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, q: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, rank: t.Optional[t.Mapping[str, t.Any]] = None, @@ -4472,8 +4498,8 @@ def search( node and the remote clusters are minimized when running cross-cluster search (CCS) requests. :param collapse: Collapses search results the values of the specified field. - :param default_operator: The default operator for the query string query: `AND` - or `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for the query string query: `and` + or `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter @@ -4558,6 +4584,10 @@ def search( :param profile: Set to `true` to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param q: A query in the Lucene query string syntax. Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing. IMPORTANT: This parameter overrides the query parameter in the request body. @@ -4712,6 +4742,8 @@ def search( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if q is not None: __query["q"] = q if request_cache is not None: @@ -4866,6 +4898,7 @@ def search_mvt( ] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, size: t.Optional[int] = None, @@ -5183,6 +5216,10 @@ def search_mvt( In the aggs layer, each feature represents a `geotile_grid` cell. If `grid, each feature is a polygon of the cells bounding box. If `point`, each feature is a Point that is the centroid of the cell. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param query: The query DSL used to filter documents for the search. :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. @@ -5246,6 +5283,8 @@ def search_mvt( __query["human"] = human if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if not __body: if aggs is not None: __body["aggs"] = aggs @@ -5419,6 +5458,7 @@ def search_template( preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, rest_total_hits_as_int: t.Optional[bool] = None, routing: t.Optional[str] = None, scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, @@ -5464,6 +5504,10 @@ def search_template( :param preference: The node or shard the operation should be performed on. It is random by default. :param profile: If `true`, the query execution is profiled. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param rest_total_hits_as_int: If `true`, `hits.total` is rendered as an integer in the response. If `false`, it is rendered as an object. :param routing: A custom value used to route operations to a specific shard. @@ -5505,6 +5549,8 @@ def search_template( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if rest_total_hits_as_int is not None: __query["rest_total_hits_as_int"] = rest_total_hits_as_int if routing is not None: @@ -5631,11 +5677,7 @@ def terms_enum( __body["string"] = string if timeout is not None: __body["timeout"] = timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5685,7 +5727,7 @@ def termvectors( term_statistics: t.Optional[bool] = None, version: t.Optional[int] = None, version_type: t.Optional[ - t.Union[str, t.Literal["external", "external_gte", "force", "internal"]] + t.Union[str, t.Literal["external", "external_gte", "internal"]] ] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: @@ -6161,8 +6203,8 @@ def update_by_query( be used only when the `q` query string parameter is specified. :param conflicts: The preferred behavior when update by query hits version conflicts: `abort` or `proceed`. - :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can be used only when the `q` query string parameter + :param default_operator: The default operator for query string query: `and` or + `or`. This parameter can be used only when the `q` query string parameter is specified. :param df: The field to use as default where no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter diff --git a/elasticsearch/_sync/client/async_search.py b/elasticsearch/_sync/client/async_search.py index 3042ae07a..31e53f89b 100644 --- a/elasticsearch/_sync/client/async_search.py +++ b/elasticsearch/_sync/client/async_search.py @@ -287,6 +287,7 @@ def submit( preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, q: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, request_cache: t.Optional[bool] = None, @@ -408,6 +409,10 @@ def submit( :param preference: Specify the node or shard the operation should be performed on (default: random) :param profile: + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param q: Query in the Lucene query string syntax :param query: Defines the search definition using the Query DSL. :param request_cache: Specify if request cache should be used for this request @@ -528,6 +533,8 @@ def submit( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if q is not None: __query["q"] = q if request_cache is not None: diff --git a/elasticsearch/_sync/client/cat.py b/elasticsearch/_sync/client/cat.py index 5349a32ec..2461c6097 100644 --- a/elasticsearch/_sync/client/cat.py +++ b/elasticsearch/_sync/client/cat.py @@ -36,6 +36,9 @@ def aliases( self, *, name: t.Optional[t.Union[str, t.Sequence[str]]] = 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[ @@ -80,6 +83,9 @@ def aliases( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -95,6 +101,14 @@ def aliases( :param name: A comma-separated list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated @@ -112,6 +126,12 @@ def aliases( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -122,6 +142,8 @@ def aliases( __path_parts = {} __path = "/_cat/aliases" __query: t.Dict[str, t.Any] = {} + 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: @@ -142,6 +164,8 @@ def aliases( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -213,6 +237,9 @@ def allocation( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -227,7 +254,14 @@ def allocation( :param node_id: A comma-separated list of node identifiers or names used to limit the returned information. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -242,6 +276,12 @@ def allocation( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -274,6 +314,8 @@ def allocation( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -291,6 +333,9 @@ def component_templates( self, *, name: t.Optional[str] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -330,6 +375,9 @@ def component_templates( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -346,6 +394,14 @@ def component_templates( :param name: The name of the component template. It accepts wildcard expressions. If it is omitted, all component templates are returned. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -360,6 +416,12 @@ def component_templates( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -370,6 +432,8 @@ def component_templates( __path_parts = {} __path = "/_cat/component_templates" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -390,6 +454,8 @@ def component_templates( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -407,6 +473,9 @@ def count( self, *, index: t.Optional[t.Union[str, t.Sequence[str]]] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -419,7 +488,11 @@ def count( help: t.Optional[bool] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -437,15 +510,33 @@ def count( :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. It supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -456,6 +547,8 @@ def count( __path_parts = {} __path = "/_cat/count" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -470,8 +563,12 @@ def count( __query["human"] = human if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -507,6 +604,9 @@ def fielddata( human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -522,7 +622,14 @@ def fielddata( :param fields: Comma-separated list of fields used to limit returned information. To retrieve all fields, omit this parameter. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -532,6 +639,12 @@ def fielddata( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -560,6 +673,8 @@ def fielddata( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -576,6 +691,9 @@ def fielddata( def health( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -652,6 +770,14 @@ def health( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -661,13 +787,20 @@ def health( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param ts: If true, returns `HH:MM:SS` and Unix epoch timestamps. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/health" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -1092,7 +1225,14 @@ def indices( :param index: 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 bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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: The type of index that wildcard patterns can match. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -1109,7 +1249,12 @@ def indices( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -1166,6 +1311,9 @@ def indices( def master( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -1181,6 +1329,9 @@ def master( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -1193,6 +1344,14 @@ def master( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -1207,11 +1366,19 @@ def master( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/master" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -1232,6 +1399,8 @@ def master( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -1374,8 +1543,15 @@ def ml_data_frame_analytics( :param id: The ID of the data frame analytics to fetch :param allow_no_match: Whether to ignore if a wildcard expression matches no - configs. (This includes `_all` string or when no configs have been specified) - :param bytes: The unit in which to display byte values + configs. (This includes `_all` string or when no configs have been specified.) + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: Comma-separated list of column names to display. @@ -1383,7 +1559,12 @@ def ml_data_frame_analytics( be combined with any other query string option. :param s: Comma-separated list of column names or column aliases used to sort the response. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -1434,6 +1615,9 @@ def ml_datafeeds( *, datafeed_id: t.Optional[str] = None, allow_no_match: 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, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -1549,6 +1733,14 @@ def ml_datafeeds( array when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a 404 status code when there are no matches or only partial matches. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: Comma-separated list of column names to display. @@ -1556,7 +1748,12 @@ def ml_datafeeds( be combined with any other query string option. :param s: Comma-separated list of column names or column aliases used to sort the response. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -1569,6 +1766,8 @@ def ml_datafeeds( __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -1914,7 +2113,14 @@ def ml_jobs( array when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a 404 status code when there are no matches or only partial matches. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: Comma-separated list of column names to display. @@ -1922,7 +2128,12 @@ def ml_jobs( be combined with any other query string option. :param s: Comma-separated list of column names or column aliases used to sort the response. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2099,7 +2310,14 @@ def ml_trained_models( when there are no matches and the subset of results when there are partial matches. If `false`, the API returns a 404 status code when there are no matches or only partial matches. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param from_: Skips the specified number of transforms. @@ -2109,7 +2327,12 @@ def ml_trained_models( :param s: A comma-separated list of column names or aliases used to sort the response. :param size: The maximum number of transforms to display. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2162,6 +2385,9 @@ def ml_trained_models( def nodeattrs( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -2189,6 +2415,9 @@ def nodeattrs( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -2201,6 +2430,14 @@ def nodeattrs( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -2215,11 +2452,19 @@ def nodeattrs( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/nodeattrs" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -2240,6 +2485,8 @@ def nodeattrs( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2262,7 +2509,7 @@ def nodes( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, - full_id: t.Optional[t.Union[bool, str]] = None, + full_id: t.Optional[bool] = None, h: t.Optional[ t.Union[ t.Sequence[ @@ -2478,7 +2725,14 @@ def nodes( ``_ - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param full_id: If `true`, return the full node ID. If `false`, return the shortened @@ -2493,7 +2747,12 @@ def nodes( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} @@ -2541,6 +2800,9 @@ def nodes( def pending_tasks( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -2578,6 +2840,14 @@ def pending_tasks( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -2592,12 +2862,19 @@ def pending_tasks( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/pending_tasks" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -2636,6 +2913,9 @@ def pending_tasks( def plugins( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -2659,6 +2939,9 @@ def plugins( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -2671,6 +2954,14 @@ def plugins( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -2686,11 +2977,19 @@ def plugins( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/plugins" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -2713,6 +3012,8 @@ def plugins( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2831,7 +3132,14 @@ def recovery( to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. :param active_only: If `true`, the response only includes ongoing shard recoveries. - :param bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 detailed: If `true`, the response includes detailed information about shard recoveries. :param format: Specifies the format to return the columnar data in, can be set @@ -2843,7 +3151,12 @@ def recovery( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2894,6 +3207,9 @@ def recovery( def repositories( self, *, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -2904,6 +3220,9 @@ def repositories( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -2916,6 +3235,14 @@ def repositories( ``_ + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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. @@ -2929,11 +3256,19 @@ def repositories( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/repositories" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -2954,6 +3289,8 @@ def repositories( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -3029,6 +3366,9 @@ def segments( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -3045,7 +3385,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 bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -3060,6 +3407,12 @@ def segments( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3092,6 +3445,8 @@ def segments( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -3295,7 +3650,14 @@ def shards( :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 bytes: The unit used to display byte values. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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. @@ -3305,7 +3667,12 @@ def shards( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3355,6 +3722,9 @@ def snapshots( self, *, repository: t.Optional[t.Union[str, t.Sequence[str]]] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -3425,6 +3795,14 @@ def snapshots( :param repository: A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. If any repository fails during the request, Elasticsearch returns an error. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -3437,7 +3815,12 @@ def snapshots( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3448,6 +3831,8 @@ def snapshots( __path_parts = {} __path = "/_cat/snapshots" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -3488,6 +3873,9 @@ def tasks( self, *, actions: t.Optional[t.Sequence[str]] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, detailed: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, @@ -3562,6 +3950,14 @@ def tasks( ``_ :param actions: The task action names, which are used to limit the response. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 detailed: If `true`, the response includes detailed information about shard recoveries. :param format: Specifies the format to return the columnar data in, can be set @@ -3576,7 +3972,12 @@ def tasks( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: Unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :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 v: When set to `true` will enable verbose output. @@ -3588,6 +3989,8 @@ def tasks( __query: t.Dict[str, t.Any] = {} if actions is not None: __query["actions"] = actions + if bytes is not None: + __query["bytes"] = bytes if detailed is not None: __query["detailed"] = detailed if error_trace is not None: @@ -3633,6 +4036,9 @@ def templates( self, *, name: t.Optional[str] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -3660,6 +4066,9 @@ def templates( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ @@ -3675,6 +4084,14 @@ def templates( :param name: The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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 @@ -3689,6 +4106,12 @@ def templates( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3699,6 +4122,8 @@ def templates( __path_parts = {} __path = "/_cat/templates" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -3719,6 +4144,8 @@ def templates( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -3736,6 +4163,9 @@ def thread_pool( self, *, thread_pool_patterns: t.Optional[t.Union[str, t.Sequence[str]]] = None, + bytes: t.Optional[ + t.Union[str, t.Literal["b", "gb", "kb", "mb", "pb", "tb"]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -3819,6 +4249,14 @@ def thread_pool( :param thread_pool_patterns: A comma-separated list of thread pool names used to limit the request. Accepts wildcard expressions. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 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. @@ -3832,7 +4270,12 @@ def thread_pool( :param s: A comma-separated list of column names or aliases that determines the sort order. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -3843,6 +4286,8 @@ def thread_pool( __path_parts = {} __path = "/_cat/thread_pool" __query: t.Dict[str, t.Any] = {} + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: @@ -3885,6 +4330,9 @@ def transforms( *, transform_id: t.Optional[str] = None, allow_no_match: 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, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, format: t.Optional[str] = None, @@ -4084,6 +4532,14 @@ def transforms( array when there are no matches and the subset of results when there are partial matches. If `false`, the request returns a 404 status code when there are no matches or only partial matches. + :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 + rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the + numeric value of the column is as small as possible whilst still being at + 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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param from_: Skips the specified number of transforms. @@ -4093,7 +4549,12 @@ def transforms( :param s: Comma-separated list of column names or column aliases used to sort the response. :param size: The maximum number of transforms to obtain. - :param time: The unit used to display time values. + :param time: Sets the units for columns that contain a time duration. If omitted, + time duration values are rendered with a suffix such as `ms`, `s`, `m` or + `h`, chosen such that the numeric value of the column is as small as possible + whilst still being at least `1.0`. If given, time duration values are rendered + as an integer with no suffix. Values that are not an exact multiple of the + chosen unit are rounded down. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -4106,6 +4567,8 @@ def transforms( __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match + if bytes is not None: + __query["bytes"] = bytes if error_trace is not None: __query["error_trace"] = error_trace if filter_path is not None: diff --git a/elasticsearch/_sync/client/connector.py b/elasticsearch/_sync/client/connector.py index 58771108a..c28a4c823 100644 --- a/elasticsearch/_sync/client/connector.py +++ b/elasticsearch/_sync/client/connector.py @@ -103,7 +103,7 @@ def delete( :param connector_id: The unique identifier of the connector to be deleted :param delete_sync_jobs: A flag indicating if associated sync jobs should be - also removed. Defaults to false. + also removed. :param hard: A flag indicating if the connector should be hard deleted. """ if connector_id in SKIP_IN_PATH: @@ -360,7 +360,7 @@ def list( :param connector_name: A comma-separated list of connector names to fetch connector documents for - :param from_: Starting offset (default: 0) + :param from_: Starting offset :param include_deleted: A flag to indicate if the desired connector should be fetched, even if it was soft-deleted. :param index_name: A comma-separated list of connector index names to fetch connector @@ -955,7 +955,7 @@ def sync_job_list( ``_ :param connector_id: A connector id to fetch connector sync jobs for - :param from_: Starting offset (default: 0) + :param from_: Starting offset :param job_type: A comma-separated list of job types to fetch the sync jobs for :param size: Specifies a max number of results to get :param status: A sync job status to fetch connector sync jobs for diff --git a/elasticsearch/_sync/client/eql.py b/elasticsearch/_sync/client/eql.py index 1fe0234dd..aa53d77b9 100644 --- a/elasticsearch/_sync/client/eql.py +++ b/elasticsearch/_sync/client/eql.py @@ -229,6 +229,7 @@ def search( keep_on_completion: t.Optional[bool] = None, max_samples_per_key: t.Optional[int] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, result_position: t.Optional[t.Union[str, t.Literal["head", "tail"]]] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, size: t.Optional[int] = None, @@ -285,6 +286,10 @@ def search( `size` parameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the `max_samples_per_key` parameter. Pipes are not supported for sample queries. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param result_position: :param runtime_mappings: :param size: For basic queries, the maximum number of matching events to return. @@ -318,6 +323,8 @@ def search( __query["ignore_unavailable"] = ignore_unavailable if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if not __body: if query is not None: __body["query"] = query diff --git a/elasticsearch/_sync/client/esql.py b/elasticsearch/_sync/client/esql.py index 80843c2d3..b76111b20 100644 --- a/elasticsearch/_sync/client/esql.py +++ b/elasticsearch/_sync/client/esql.py @@ -40,6 +40,7 @@ class EsqlClient(NamespacedClient): "columnar", "filter", "include_ccs_metadata", + "include_execution_metadata", "keep_alive", "keep_on_completion", "locale", @@ -71,6 +72,7 @@ def async_query( ] = None, human: t.Optional[bool] = None, include_ccs_metadata: t.Optional[bool] = None, + include_execution_metadata: t.Optional[bool] = None, keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, keep_on_completion: t.Optional[bool] = None, locale: t.Optional[str] = None, @@ -120,7 +122,11 @@ def async_query( 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 + :param include_ccs_metadata: When set to `true` and performing a cross-cluster/cross-project + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. + :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as shards count. @@ -180,6 +186,8 @@ def async_query( __body["filter"] = filter if include_ccs_metadata is not None: __body["include_ccs_metadata"] = include_ccs_metadata + if include_execution_metadata is not None: + __body["include_execution_metadata"] = include_execution_metadata if keep_alive is not None: __body["keep_alive"] = keep_alive if keep_on_completion is not None: @@ -486,6 +494,7 @@ def list_queries( "columnar", "filter", "include_ccs_metadata", + "include_execution_metadata", "locale", "params", "profile", @@ -514,8 +523,16 @@ def query( ] = None, human: t.Optional[bool] = None, include_ccs_metadata: t.Optional[bool] = None, + include_execution_metadata: t.Optional[bool] = None, locale: t.Optional[str] = None, - params: t.Optional[t.Sequence[t.Union[None, bool, float, int, str]]] = None, + params: t.Optional[ + t.Sequence[ + t.Union[ + t.Sequence[t.Union[None, bool, float, int, str]], + t.Union[None, bool, float, int, str], + ] + ] + ] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, tables: t.Optional[ @@ -554,7 +571,11 @@ def query( :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 + :param include_ccs_metadata: When set to `true` and performing a cross-cluster/cross-project + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. + :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as shards count. @@ -600,6 +621,8 @@ def query( __body["filter"] = filter if include_ccs_metadata is not None: __body["include_ccs_metadata"] = include_ccs_metadata + if include_execution_metadata is not None: + __body["include_execution_metadata"] = include_execution_metadata if locale is not None: __body["locale"] = locale if params is not None: diff --git a/elasticsearch/_sync/client/fleet.py b/elasticsearch/_sync/client/fleet.py index 44178398d..c6fdaa4a4 100644 --- a/elasticsearch/_sync/client/fleet.py +++ b/elasticsearch/_sync/client/fleet.py @@ -642,11 +642,7 @@ def search( __body["track_total_hits"] = track_total_hits if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/graph.py b/elasticsearch/_sync/client/graph.py index 735917b80..7b6543e05 100644 --- a/elasticsearch/_sync/client/graph.py +++ b/elasticsearch/_sync/client/graph.py @@ -97,11 +97,7 @@ def explore( __body["query"] = query if vertices is not None: __body["vertices"] = vertices - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/ilm.py b/elasticsearch/_sync/client/ilm.py index 26424284a..a61afea52 100644 --- a/elasticsearch/_sync/client/ilm.py +++ b/elasticsearch/_sync/client/ilm.py @@ -383,11 +383,7 @@ def move_to_step( __body["current_step"] = current_step if next_step is not None: __body["next_step"] = next_step - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -453,11 +449,7 @@ def put_lifecycle( if not __body: if policy is not None: __body["policy"] = policy - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index 1da7357a4..ffb05d766 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -232,11 +232,7 @@ def analyze( __body["text"] = text if tokenizer is not None: __body["tokenizer"] = tokenizer - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -812,11 +808,7 @@ def create_from( raise ValueError("Empty value passed for parameter 'source'") if dest in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'dest'") - if create_from is None and body is None: - raise ValueError( - "Empty value passed for parameters 'create_from' and 'body', one of them should be set." - ) - elif create_from is not None and body is not None: + if create_from is not None and body is not None: raise ValueError("Cannot set both 'create_from' and 'body'") __path_parts: t.Dict[str, str] = { "source": _quote(source), @@ -833,7 +825,11 @@ def create_from( if pretty is not None: __query["pretty"] = pretty __body = create_from if create_from is not None else body - __headers = {"accept": "application/json", "content-type": "application/json"} + if not __body: + __body = None + __headers = {"accept": "application/json"} + if __body is not None: + __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1393,6 +1389,7 @@ def disk_usage(

NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. The stored size of the _id field is likely underestimated while the _source field is overestimated.

+

For usage examples see the External documentation or refer to Analyze the index disk usage example for an example.

``_ @@ -3689,11 +3686,7 @@ def put_data_lifecycle( __body["downsampling"] = downsampling if enabled is not None: __body["enabled"] = enabled - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3849,11 +3842,7 @@ def put_data_stream_options( if not __body: if failure_store is not None: __body["failure_store"] = failure_store - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4677,6 +4666,7 @@ def refresh( For data streams, the API runs the refresh operation on the stream’s backing indices.

By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. You can change this default interval with the index.refresh_interval setting.

+

In Elastic Cloud Serverless, the default refresh interval is 5 seconds across all indices.

Refresh requests are synchronous and do not return a response until the refresh operation completes.

Refreshes are resource-intensive. To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.

@@ -5076,6 +5066,7 @@ def resolve_index( ] ] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -5103,6 +5094,10 @@ def resolve_index( a missing or closed index. :param mode: Filter indices by index mode - standard, lookup, time_series, etc. Comma-separated list of IndexMode. Empty means no filter. + :param project_routing: Specifies a subset of projects to target using project + metadata tags in a subset of Lucene query syntax. Allowed Lucene queries: + the _alias tag and a single value (possibly wildcarded). Examples: _alias:my-project + _alias:_origin _alias:*pr* Supported in serverless only. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -5125,6 +5120,8 @@ def resolve_index( __query["mode"] = mode if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "GET", @@ -5541,11 +5538,7 @@ def shrink( __body["aliases"] = aliases if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5556,7 +5549,9 @@ def shrink( path_parts=__path_parts, ) - @_rewrite_parameters() + @_rewrite_parameters( + body_name="index_template", + ) def simulate_index_template( self, *, @@ -5567,6 +5562,8 @@ def simulate_index_template( filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, include_defaults: t.Optional[bool] = None, + index_template: t.Optional[t.Mapping[str, t.Any]] = None, + body: t.Optional[t.Mapping[str, t.Any]] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: @@ -5586,12 +5583,15 @@ def simulate_index_template( only be dry-run added if new or can also replace an existing one :param include_defaults: If true, returns all relevant default configurations for the index template. + :param index_template: :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. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") + if index_template is not None and body is not None: + raise ValueError("Cannot set both 'index_template' and 'body'") __path_parts: t.Dict[str, str] = {"name": _quote(name)} __path = f'/_index_template/_simulate_index/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} @@ -5611,12 +5611,18 @@ def simulate_index_template( __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + __body = index_template if index_template is not None else body + if not __body: + __body = None __headers = {"accept": "application/json"} + if __body is not None: + __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] "POST", __path, params=__query, headers=__headers, + body=__body, endpoint_id="indices.simulate_index_template", path_parts=__path_parts, ) @@ -5884,11 +5890,7 @@ def split( __body["aliases"] = aliases if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5965,8 +5967,8 @@ def stats( are requested). :param include_unloaded_segments: If true, the response includes information from segments that are not loaded into memory. - :param level: Indicates whether statistics are aggregated at the cluster, index, - or shard level. + :param level: Indicates whether statistics are aggregated at the cluster, indices, + or shards level. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: @@ -6132,8 +6134,8 @@ def validate_query( :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. :param analyzer: Analyzer to use for the query string. This parameter can only be used when the `q` query string parameter is specified. - :param default_operator: The default operator for query string query: `AND` or - `OR`. + :param default_operator: The default operator for query string query: `and` or + `or`. :param df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. diff --git a/elasticsearch/_sync/client/inference.py b/elasticsearch/_sync/client/inference.py index 7f34eba93..8c906f86c 100644 --- a/elasticsearch/_sync/client/inference.py +++ b/elasticsearch/_sync/client/inference.py @@ -78,11 +78,7 @@ def completion( __body["input"] = input 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -338,11 +334,7 @@ def inference( __body["query"] = query 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -529,11 +521,7 @@ def put_ai21( __body["service"] = service if service_settings is not None: __body["service_settings"] = service_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -627,11 +615,7 @@ def put_alibabacloud( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -727,11 +711,7 @@ def put_amazonbedrock( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -833,11 +813,7 @@ def put_amazonsagemaker( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -930,11 +906,7 @@ def put_anthropic( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1026,11 +998,7 @@ def put_azureaistudio( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1130,11 +1098,7 @@ def put_azureopenai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1224,11 +1188,7 @@ def put_cohere( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1239,6 +1199,99 @@ def put_cohere( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=( + "service", + "service_settings", + "chunking_settings", + "task_settings", + ), + ) + def put_contextualai( + self, + *, + task_type: t.Union[str, t.Literal["rerank"]], + contextualai_inference_id: str, + service: t.Optional[t.Union[str, t.Literal["contextualai"]]] = 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 Contextual AI inference endpoint.

+

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

+

To review the available rerank models, refer to https://docs.contextual.ai/api-reference/rerank/rerank#body-model.

+ + + ``_ + + :param task_type: The type of the inference task that the model will perform. + :param contextualai_inference_id: The unique identifier of the inference endpoint. + :param service: The type of service supported for the specified task type. In + this case, `contextualai`. + :param service_settings: Settings used to install the inference model. These + settings are specific to the `contextualai` service. + :param chunking_settings: The chunking configuration object. + :param task_settings: Settings to configure the inference task. These settings + are specific to the task type 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 contextualai_inference_id in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for parameter 'contextualai_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), + "contextualai_inference_id": _quote(contextualai_inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["contextualai_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 + __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="inference.put_contextualai", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "service", @@ -1355,11 +1408,7 @@ def put_custom( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1439,11 +1488,7 @@ def put_deepseek( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1551,11 +1596,7 @@ def put_elasticsearch( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1650,11 +1691,7 @@ def put_elser( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1736,11 +1773,7 @@ def put_googleaistudio( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1834,11 +1867,7 @@ def put_googlevertexai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1966,11 +1995,7 @@ def put_hugging_face( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2062,11 +2087,7 @@ def put_jinaai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2148,11 +2169,7 @@ def put_llama( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2234,11 +2251,7 @@ def put_mistral( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2332,11 +2345,7 @@ def put_openai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2427,11 +2436,7 @@ def put_voyageai( __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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2511,11 +2516,7 @@ def put_watsonx( __body["service"] = service if service_settings is not None: __body["service_settings"] = service_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2588,11 +2589,7 @@ def rerank( __body["query"] = query 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2656,11 +2653,7 @@ def sparse_embedding( __body["input"] = input 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2672,7 +2665,7 @@ def sparse_embedding( ) @_rewrite_parameters( - body_fields=("input", "task_settings"), + body_fields=("input", "input_type", "task_settings"), ) def text_embedding( self, @@ -2682,6 +2675,7 @@ def text_embedding( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + input_type: t.Optional[str] = None, pretty: t.Optional[bool] = None, task_settings: t.Optional[t.Any] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, @@ -2697,6 +2691,13 @@ def text_embedding( :param inference_id: The inference Id :param input: Inference input. Either a string or an array of strings. + :param input_type: The input data type for the text embedding model. Possible + values include: * `SEARCH` * `INGEST` * `CLASSIFICATION` * `CLUSTERING` Not + all services support all values. Unsupported values will trigger a validation + exception. Accepted values depend on the configured inference service, refer + to the relevant service-specific documentation for more info. > info > The + `input_type` parameter specified on the root level of the request body will + take precedence over the `input_type` parameter specified in `task_settings`. :param task_settings: Optional task settings :param timeout: Specifies the amount of time to wait for the inference request to complete. @@ -2722,13 +2723,11 @@ def text_embedding( if not __body: if input is not None: __body["input"] = input + if input_type is not None: + __body["input_type"] = input_type 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" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/ingest.py b/elasticsearch/_sync/client/ingest.py index 5fd38bd78..1286d3627 100644 --- a/elasticsearch/_sync/client/ingest.py +++ b/elasticsearch/_sync/client/ingest.py @@ -580,6 +580,7 @@ def put_ip_location_database( body_fields=( "deprecated", "description", + "field_access_pattern", "meta", "on_failure", "processors", @@ -594,6 +595,9 @@ def put_pipeline( deprecated: t.Optional[bool] = None, description: t.Optional[str] = None, error_trace: t.Optional[bool] = None, + field_access_pattern: t.Optional[ + t.Union[str, t.Literal["classic", "flexible"]] + ] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, if_version: t.Optional[int] = None, @@ -621,6 +625,8 @@ def put_pipeline( or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. :param description: Description of the ingest pipeline. + :param field_access_pattern: Controls how processors in this pipeline should + read and write data on a document's source. :param if_version: Required version for optimistic concurrency control for pipeline updates :param master_timeout: Period to wait for a connection to the master node. If @@ -667,6 +673,8 @@ def put_pipeline( __body["deprecated"] = deprecated if description is not None: __body["description"] = description + if field_access_pattern is not None: + __body["field_access_pattern"] = field_access_pattern if meta is not None: __body["_meta"] = meta if on_failure is not None: diff --git a/elasticsearch/_sync/client/license.py b/elasticsearch/_sync/client/license.py index aca82098d..d352d114c 100644 --- a/elasticsearch/_sync/client/license.py +++ b/elasticsearch/_sync/client/license.py @@ -104,8 +104,10 @@ def get( license types. If `false`, this parameter returns platinum for both platinum and enterprise license types. This behavior is maintained for backwards compatibility. This parameter is deprecated and will always be set to true in 8.x. - :param local: Specifies whether to retrieve local information. The default value - is `false`, which means the information is retrieved from the master node. + :param local: Specifies whether to retrieve local information. From 9.2 onwards + the default value is `true`, which means the information is retrieved from + the responding node. In earlier versions the default is `false`, which means + the information is retrieved from the elected master node. """ __path_parts: t.Dict[str, str] = {} __path = "/_license" diff --git a/elasticsearch/_sync/client/logstash.py b/elasticsearch/_sync/client/logstash.py index f8abefa14..ae8e2a1dc 100644 --- a/elasticsearch/_sync/client/logstash.py +++ b/elasticsearch/_sync/client/logstash.py @@ -141,7 +141,9 @@ def put_pipeline( ``_ - :param id: An identifier for the pipeline. + :param id: An identifier for the pipeline. Pipeline IDs must begin with a letter + or underscore and contain only letters, underscores, dashes, hyphens and + numbers. :param pipeline: """ if id in SKIP_IN_PATH: diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index 690197642..08ef976fb 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -2390,7 +2390,7 @@ def get_overall_buckets( exclude_interim: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, - overall_score: t.Optional[t.Union[float, str]] = None, + overall_score: t.Optional[float] = None, pretty: t.Optional[bool] = None, start: t.Optional[t.Union[str, t.Any]] = None, top_n: t.Optional[int] = None, @@ -5716,7 +5716,7 @@ def validate(

Validate an anomaly detection job.

- ``_ + ``_ :param analysis_config: :param analysis_limits: diff --git a/elasticsearch/_sync/client/nodes.py b/elasticsearch/_sync/client/nodes.py index ef6c67b10..9cf656d16 100644 --- a/elasticsearch/_sync/client/nodes.py +++ b/elasticsearch/_sync/client/nodes.py @@ -368,9 +368,7 @@ def stats( human: t.Optional[bool] = None, include_segment_file_sizes: t.Optional[bool] = None, include_unloaded_segments: t.Optional[bool] = None, - level: t.Optional[ - t.Union[str, t.Literal["cluster", "indices", "shards"]] - ] = None, + level: t.Optional[t.Union[str, t.Literal["indices", "node", "shards"]]] = None, pretty: t.Optional[bool] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, types: t.Optional[t.Sequence[str]] = None, @@ -404,8 +402,8 @@ def stats( are requested). :param include_unloaded_segments: If `true`, the response includes information from segments that are not loaded into memory. - :param level: Indicates whether statistics are aggregated at the cluster, index, - or shard level. + :param level: Indicates whether statistics are aggregated at the node, indices, + or shards level. :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 types: A comma-separated list of document types for the indexing index diff --git a/elasticsearch/_sync/client/project.py b/elasticsearch/_sync/client/project.py new file mode 100644 index 000000000..57b4e8218 --- /dev/null +++ b/elasticsearch/_sync/client/project.py @@ -0,0 +1,67 @@ +# 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. + +import typing as t + +from elastic_transport import ObjectApiResponse + +from ._base import NamespacedClient +from .utils import ( + Stability, + _rewrite_parameters, + _stability_warning, +) + + +class ProjectClient(NamespacedClient): + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def tags( + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Return tags defined for the project

+ + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_project/tags" + __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="project.tags", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_sync/client/security.py b/elasticsearch/_sync/client/security.py index 2672a7951..c605f27e3 100644 --- a/elasticsearch/_sync/client/security.py +++ b/elasticsearch/_sync/client/security.py @@ -2052,6 +2052,45 @@ def get_settings( path_parts=__path_parts, ) + @_rewrite_parameters() + def get_stats( + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get security stats.

+

Gather security usage statistics from all node(s) within the cluster.

+ + + ``_ + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_security/stats" + __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="security.get_stats", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "grant_type", diff --git a/elasticsearch/_sync/client/shutdown.py b/elasticsearch/_sync/client/shutdown.py index d7ec41511..28b360ca3 100644 --- a/elasticsearch/_sync/client/shutdown.py +++ b/elasticsearch/_sync/client/shutdown.py @@ -33,13 +33,9 @@ def delete_node( 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["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = 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["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html @@ -97,9 +93,7 @@ def get_node( 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["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -162,14 +156,10 @@ def put_node( 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["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, target_node_name: t.Optional[str] = None, - timeout: t.Optional[ - t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] - ] = 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]: """ diff --git a/elasticsearch/_sync/client/slm.py b/elasticsearch/_sync/client/slm.py index 9b701de80..2541d70f6 100644 --- a/elasticsearch/_sync/client/slm.py +++ b/elasticsearch/_sync/client/slm.py @@ -431,11 +431,7 @@ def put_lifecycle( __body["retention"] = retention if schedule is not None: __body["schedule"] = schedule - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/sql.py b/elasticsearch/_sync/client/sql.py index b2750ede1..bee0ba437 100644 --- a/elasticsearch/_sync/client/sql.py +++ b/elasticsearch/_sync/client/sql.py @@ -285,6 +285,7 @@ def query( page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, params: t.Optional[t.Sequence[t.Any]] = None, pretty: t.Optional[bool] = None, + project_routing: t.Optional[str] = None, query: t.Optional[str] = None, request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, @@ -332,6 +333,10 @@ def query( is no longer available. Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of `page_timeout` in the scroll request. :param params: The values for parameters in the query. + :param project_routing: Specifies a subset of projects to target for the search + using project metadata tags in a subset of Lucene query syntax. Allowed Lucene + queries: the _alias tag and a single value (possibly wildcarded). Examples: + _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only. :param query: The SQL query to run. :param request_timeout: The timeout before the request fails. :param runtime_mappings: One or more runtime fields for the search request. These @@ -357,6 +362,8 @@ def query( __query["human"] = human if pretty is not None: __query["pretty"] = pretty + if project_routing is not None: + __query["project_routing"] = project_routing if not __body: if allow_partial_search_results is not None: __body["allow_partial_search_results"] = allow_partial_search_results diff --git a/elasticsearch/_sync/client/streams.py b/elasticsearch/_sync/client/streams.py new file mode 100644 index 000000000..ba6ff1062 --- /dev/null +++ b/elasticsearch/_sync/client/streams.py @@ -0,0 +1,185 @@ +# 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. + + +import typing as t + +from elastic_transport import ObjectApiResponse, TextApiResponse + +from ._base import NamespacedClient +from .utils import ( + Stability, + _rewrite_parameters, + _stability_warning, +) + + +class StreamsClient(NamespacedClient): + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def logs_disable( + 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, + ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: + """ + .. raw:: html + +

Disable logs stream.

+

Turn off the logs stream feature for this cluster.

+ + + ``_ + + :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 timeout: The 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 = "/_streams/logs/_disable" + __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,text/plain"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="streams.logs_disable", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def logs_enable( + 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, + ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: + """ + .. raw:: html + +

Enable logs stream.

+

Turn on the logs stream feature for this cluster.

+

NOTE: To protect existing data, this feature can be turned on only if the + cluster does not have existing indices or data streams that match the pattern logs|logs.*. + If those indices or data streams exist, a 409 - Conflict response and error is returned.

+ + + ``_ + + :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 timeout: The 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 = "/_streams/logs/_enable" + __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,text/plain"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="streams.logs_enable", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + 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, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get the status of streams.

+

Get the current status for all types of streams.

+ + + ``_ + + :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. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_streams/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 + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="streams.status", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_sync/client/watcher.py b/elasticsearch/_sync/client/watcher.py index 9839cb80b..d14f8481d 100644 --- a/elasticsearch/_sync/client/watcher.py +++ b/elasticsearch/_sync/client/watcher.py @@ -552,11 +552,7 @@ def put_watch( __body["transform"] = transform if trigger is not None: __body["trigger"] = trigger - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_version.py b/elasticsearch/_version.py index 8e8baef62..284a52950 100644 --- a/elasticsearch/_version.py +++ b/elasticsearch/_version.py @@ -16,3 +16,4 @@ # under the License. __versionstr__ = "9.1.1" +__es_specification_commit__ = "2f74c26e0a1d66c42232ce2830652c01e8717f00" diff --git a/elasticsearch/client.py b/elasticsearch/client.py index 926ed5fe3..ff511a047 100644 --- a/elasticsearch/client.py +++ b/elasticsearch/client.py @@ -47,6 +47,7 @@ from ._sync.client.ml import MlClient as MlClient # noqa: F401 from ._sync.client.monitoring import MonitoringClient as MonitoringClient # noqa: F401 from ._sync.client.nodes import NodesClient as NodesClient # noqa: F401 +from ._sync.client.project import ProjectClient as ProjectClient # noqa: F401 from ._sync.client.query_rules import QueryRulesClient as QueryRulesClient # noqa: F401 from ._sync.client.rollup import RollupClient as RollupClient # noqa: F401 from ._sync.client.search_application import ( # noqa: F401 @@ -62,6 +63,7 @@ from ._sync.client.snapshot import SnapshotClient as SnapshotClient # noqa: F401 from ._sync.client.sql import SqlClient as SqlClient # noqa: F401 from ._sync.client.ssl import SslClient as SslClient # noqa: F401 +from ._sync.client.streams import StreamsClient as StreamsClient # noqa: F401 from ._sync.client.synonyms import SynonymsClient as SynonymsClient # noqa: F401 from ._sync.client.tasks import TasksClient as TasksClient # noqa: F401 from ._sync.client.text_structure import ( # noqa: F401 @@ -105,6 +107,7 @@ "MlClient", "MonitoringClient", "NodesClient", + "ProjectClient", "RollupClient", "SearchApplicationClient", "SearchableSnapshotsClient", @@ -115,6 +118,7 @@ "SnapshotClient", "SqlClient", "SslClient", + "StreamsClient", "TasksClient", "TextStructureClient", "TransformClient", diff --git a/elasticsearch/dsl/aggs.py b/elasticsearch/dsl/aggs.py index 802d6eca0..2a6b2ff91 100644 --- a/elasticsearch/dsl/aggs.py +++ b/elasticsearch/dsl/aggs.py @@ -653,6 +653,54 @@ def __init__( ) +class CartesianBounds(Agg[_R]): + """ + A metric aggregation that computes the spatial bounding box containing + all values for a Point or Shape field. + + :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. + :arg script: + """ + + name = "cartesian_bounds" + + def __init__( + self, + *, + field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT, + missing: Union[str, int, float, bool, "DefaultType"] = DEFAULT, + script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT, + **kwargs: Any, + ): + super().__init__(field=field, missing=missing, script=script, **kwargs) + + +class CartesianCentroid(Agg[_R]): + """ + A metric aggregation that computes the weighted centroid from all + coordinate values for point and shape fields. + + :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. + :arg script: + """ + + name = "cartesian_centroid" + + def __init__( + self, + *, + field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT, + missing: Union[str, int, float, bool, "DefaultType"] = DEFAULT, + script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT, + **kwargs: Any, + ): + super().__init__(field=field, missing=missing, script=script, **kwargs) + + class CategorizeText(Bucket[_R]): """ A multi-bucket aggregation that groups semi-structured text into @@ -735,6 +783,43 @@ def __init__( ) +class ChangePoint(Pipeline[_R]): + """ + A sibling pipeline that detects, spikes, dips, and change points in a + metric. Given a distribution of values provided by the sibling multi- + bucket aggregation, this aggregation indicates the bucket of any spike + or dip and/or the bucket at which the largest change in the + distribution of values, if they are statistically significant. There + must be at least 22 bucketed values. Fewer than 1,000 is preferred. + + :arg format: `DecimalFormat` pattern for the output value. If + specified, the formatted value is returned in the aggregation’s + `value_as_string` property. + :arg gap_policy: Policy to apply when gaps are found in the data. + Defaults to `skip` if omitted. + :arg buckets_path: Path to the buckets that contain one set of values + to correlate. + """ + + name = "change_point" + + def __init__( + self, + *, + format: Union[str, "DefaultType"] = DEFAULT, + gap_policy: Union[ + Literal["skip", "insert_zeros", "keep_values"], "DefaultType" + ] = DEFAULT, + buckets_path: Union[ + str, Sequence[str], Mapping[str, str], "DefaultType" + ] = DEFAULT, + **kwargs: Any, + ): + super().__init__( + format=format, gap_policy=gap_policy, buckets_path=buckets_path, **kwargs + ) + + class Children(Bucket[_R]): """ A single bucket aggregation that selects child documents that have the @@ -2980,6 +3065,14 @@ class SignificantTerms(Bucket[_R]): the foreground sample with a term divided by the number of documents in the background with the term. :arg script_heuristic: Customized score, implemented via a script. + :arg p_value: Significant terms heuristic that calculates the p-value + between the term existing in foreground and background sets. The + p-value is the probability of obtaining test results at least as + extreme as the results actually observed, under the assumption + that the null hypothesis is correct. The p-value is calculated + assuming that the foreground set and the background set are + independent https://en.wikipedia.org/wiki/Bernoulli_trial, with + the null hypothesis that the probabilities are the same. :arg shard_min_doc_count: Regulates the certainty a shard has if the term should actually be added to the candidate list or not with respect to the `min_doc_count`. Terms will only be considered if @@ -3033,6 +3126,9 @@ def __init__( script_heuristic: Union[ "types.ScriptedHeuristic", Dict[str, Any], "DefaultType" ] = DEFAULT, + p_value: Union[ + "types.PValueHeuristic", Dict[str, Any], "DefaultType" + ] = DEFAULT, shard_min_doc_count: Union[int, "DefaultType"] = DEFAULT, shard_size: Union[int, "DefaultType"] = DEFAULT, size: Union[int, "DefaultType"] = DEFAULT, @@ -3051,6 +3147,7 @@ def __init__( mutual_information=mutual_information, percentage=percentage, script_heuristic=script_heuristic, + p_value=p_value, shard_min_doc_count=shard_min_doc_count, shard_size=shard_size, size=size, diff --git a/elasticsearch/dsl/field.py b/elasticsearch/dsl/field.py index f7314e441..3b5075287 100644 --- a/elasticsearch/dsl/field.py +++ b/elasticsearch/dsl/field.py @@ -3874,9 +3874,13 @@ class SemanticText(Field): 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. + :arg fields: """ name = "semantic_text" + _param_defs = { + "fields": {"type": "field", "hash": True}, + } def __init__( self, @@ -3888,8 +3892,9 @@ def __init__( "types.SemanticTextIndexOptions", Dict[str, Any], "DefaultType" ] = DEFAULT, chunking_settings: Union[ - "types.ChunkingSettings", Dict[str, Any], "DefaultType" + "types.ChunkingSettings", None, Dict[str, Any], "DefaultType" ] = DEFAULT, + fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT, **kwargs: Any, ): if meta is not DEFAULT: @@ -3902,6 +3907,8 @@ def __init__( kwargs["index_options"] = index_options if chunking_settings is not DEFAULT: kwargs["chunking_settings"] = chunking_settings + if fields is not DEFAULT: + kwargs["fields"] = fields super().__init__(*args, **kwargs) diff --git a/elasticsearch/dsl/query.py b/elasticsearch/dsl/query.py index 0a2cef032..927af6ad4 100644 --- a/elasticsearch/dsl/query.py +++ b/elasticsearch/dsl/query.py @@ -1079,6 +1079,8 @@ class Knn(Query): a query_vector_builder or query_vector, but not both. :arg num_candidates: The number of nearest neighbor candidates to consider per shard + :arg visit_percentage: The percentage of vectors to explore per shard + while doing knn search with bbq_disk :arg k: The final number of nearest neighbors to return as top hits :arg filter: Filters for the kNN search query :arg similarity: The minimum similarity for a vector to be considered @@ -1107,6 +1109,7 @@ def __init__( "types.QueryVectorBuilder", Dict[str, Any], "DefaultType" ] = DEFAULT, num_candidates: Union[int, "DefaultType"] = DEFAULT, + visit_percentage: Union[float, "DefaultType"] = DEFAULT, k: Union[int, "DefaultType"] = DEFAULT, filter: Union[Query, Sequence[Query], "DefaultType"] = DEFAULT, similarity: Union[float, "DefaultType"] = DEFAULT, @@ -1122,6 +1125,7 @@ def __init__( query_vector=query_vector, query_vector_builder=query_vector_builder, num_candidates=num_candidates, + visit_percentage=visit_percentage, k=k, filter=filter, similarity=similarity, @@ -1433,7 +1437,7 @@ def __init__( ] = DEFAULT, version: Union[int, "DefaultType"] = DEFAULT, version_type: Union[ - Literal["internal", "external", "external_gte", "force"], "DefaultType" + Literal["internal", "external", "external_gte"], "DefaultType" ] = DEFAULT, boost: Union[float, "DefaultType"] = DEFAULT, _name: Union[str, "DefaultType"] = DEFAULT, diff --git a/elasticsearch/dsl/response/__init__.py b/elasticsearch/dsl/response/__init__.py index 712cda27b..b58464e16 100644 --- a/elasticsearch/dsl/response/__init__.py +++ b/elasticsearch/dsl/response/__init__.py @@ -233,10 +233,13 @@ def search_after(self) -> "SearchBase[_R]": "types.SimpleValueAggregate", "types.DerivativeAggregate", "types.BucketMetricValueAggregate", + "types.ChangePointAggregate", "types.StatsAggregate", "types.StatsBucketAggregate", "types.ExtendedStatsAggregate", "types.ExtendedStatsBucketAggregate", + "types.CartesianBoundsAggregate", + "types.CartesianCentroidAggregate", "types.GeoBoundsAggregate", "types.GeoCentroidAggregate", "types.HistogramAggregate", diff --git a/elasticsearch/dsl/types.py b/elasticsearch/dsl/types.py index 146ad125b..b62fad025 100644 --- a/elasticsearch/dsl/types.py +++ b/elasticsearch/dsl/types.py @@ -398,14 +398,17 @@ class DenseVectorIndexOptions(AttrDict[Any]): HNSW graph. Only applicable to `hnsw`, `int8_hnsw`, `bbq_hnsw`, and `int4_hnsw` index types. Defaults to `16` if omitted. :arg rescore_vector: The rescore vector options. This is only - applicable to `bbq_hnsw`, `int4_hnsw`, `int8_hnsw`, `bbq_flat`, - `int4_flat`, and `int8_flat` index types. + applicable to `bbq_disk`, `bbq_hnsw`, `int4_hnsw`, `int8_hnsw`, + `bbq_flat`, `int4_flat`, and `int8_flat` index types. + :arg on_disk_rescore: `true` if vector rescoring should be done on- + disk Only applicable to `bbq_hnsw` """ type: Union[ Literal[ "bbq_flat", "bbq_hnsw", + "bbq_disk", "flat", "hnsw", "int4_flat", @@ -421,6 +424,7 @@ class DenseVectorIndexOptions(AttrDict[Any]): rescore_vector: Union[ "DenseVectorIndexOptionsRescoreVector", Dict[str, Any], DefaultType ] + on_disk_rescore: Union[bool, DefaultType] def __init__( self, @@ -429,6 +433,7 @@ def __init__( Literal[ "bbq_flat", "bbq_hnsw", + "bbq_disk", "flat", "hnsw", "int4_flat", @@ -444,6 +449,7 @@ def __init__( rescore_vector: Union[ "DenseVectorIndexOptionsRescoreVector", Dict[str, Any], DefaultType ] = DEFAULT, + on_disk_rescore: Union[bool, DefaultType] = DEFAULT, **kwargs: Any, ): if type is not DEFAULT: @@ -456,6 +462,8 @@ def __init__( kwargs["m"] = m if rescore_vector is not DEFAULT: kwargs["rescore_vector"] = rescore_vector + if on_disk_rescore is not DEFAULT: + kwargs["on_disk_rescore"] = on_disk_rescore super().__init__(kwargs) @@ -2327,9 +2335,7 @@ class LikeDocument(AttrDict[Any]): per_field_analyzer: Union[Mapping[Union[str, InstrumentedField], str], DefaultType] routing: Union[str, DefaultType] version: Union[int, DefaultType] - version_type: Union[ - Literal["internal", "external", "external_gte", "force"], DefaultType - ] + version_type: Union[Literal["internal", "external", "external_gte"], DefaultType] def __init__( self, @@ -2344,7 +2350,7 @@ def __init__( routing: Union[str, DefaultType] = DEFAULT, version: Union[int, DefaultType] = DEFAULT, version_type: Union[ - Literal["internal", "external", "external_gte", "force"], DefaultType + Literal["internal", "external", "external_gte"], DefaultType ] = DEFAULT, **kwargs: Any, ): @@ -2775,6 +2781,31 @@ def __init__( super().__init__(kwargs) +class PValueHeuristic(AttrDict[Any]): + """ + :arg background_is_superset: + :arg normalize_above: Should the results be normalized when above the + given value. Allows for consistent significance results at various + scales. Note: `0` is a special value which means no normalization + """ + + background_is_superset: Union[bool, DefaultType] + normalize_above: Union[int, DefaultType] + + def __init__( + self, + *, + background_is_superset: Union[bool, DefaultType] = DEFAULT, + normalize_above: Union[int, DefaultType] = DEFAULT, + **kwargs: Any, + ): + if background_is_superset is not DEFAULT: + kwargs["background_is_superset"] = background_is_superset + if normalize_above is not DEFAULT: + kwargs["normalize_above"] = normalize_above + super().__init__(kwargs) + + class PercentageScoreHeuristic(AttrDict[Any]): pass @@ -3168,9 +3199,11 @@ def __init__( class SemanticTextIndexOptions(AttrDict[Any]): """ :arg dense_vector: + :arg sparse_vector: """ dense_vector: Union["DenseVectorIndexOptions", Dict[str, Any], DefaultType] + sparse_vector: Union["SparseVectorIndexOptions", Dict[str, Any], DefaultType] def __init__( self, @@ -3178,10 +3211,15 @@ def __init__( dense_vector: Union[ "DenseVectorIndexOptions", Dict[str, Any], DefaultType ] = DEFAULT, + sparse_vector: Union[ + "SparseVectorIndexOptions", Dict[str, Any], DefaultType + ] = DEFAULT, **kwargs: Any, ): if dense_vector is not DEFAULT: kwargs["dense_vector"] = dense_vector + if sparse_vector is not DEFAULT: + kwargs["sparse_vector"] = sparse_vector super().__init__(kwargs) @@ -4030,24 +4068,25 @@ def __init__( class TextEmbedding(AttrDict[Any]): """ - :arg model_id: (required) :arg model_text: (required) + :arg model_id: Model ID is required for all dense_vector fields but + may be inferred for semantic_text fields """ - model_id: Union[str, DefaultType] model_text: Union[str, DefaultType] + model_id: Union[str, DefaultType] def __init__( self, *, - model_id: Union[str, DefaultType] = DEFAULT, model_text: Union[str, DefaultType] = DEFAULT, + model_id: Union[str, DefaultType] = DEFAULT, **kwargs: Any, ): - if model_id is not DEFAULT: - kwargs["model_id"] = model_id if model_text is not DEFAULT: kwargs["model_text"] = model_text + if model_id is not DEFAULT: + kwargs["model_id"] = model_id super().__init__(kwargs) @@ -4680,6 +4719,82 @@ class CardinalityAggregate(AttrDict[Any]): meta: Mapping[str, Any] +class CartesianBoundsAggregate(AttrDict[Any]): + """ + :arg bounds: + :arg meta: + """ + + bounds: "TopLeftBottomRightGeoBounds" + meta: Mapping[str, Any] + + +class CartesianCentroidAggregate(AttrDict[Any]): + """ + :arg count: (required) + :arg location: + :arg meta: + """ + + count: int + location: "CartesianPoint" + meta: Mapping[str, Any] + + +class CartesianPoint(AttrDict[Any]): + """ + :arg x: (required) + :arg y: (required) + """ + + x: float + y: float + + +class ChangePointAggregate(AttrDict[Any]): + """ + :arg type: (required) + :arg bucket: + :arg meta: + """ + + type: "ChangeType" + bucket: "ChangePointBucket" + meta: Mapping[str, Any] + + +class ChangePointBucket(AttrDict[Any]): + """ + :arg key: (required) + :arg doc_count: (required) + """ + + key: Union[int, float, str, bool, None] + doc_count: int + + +class ChangeType(AttrDict[Any]): + """ + :arg dip: + :arg distribution_change: + :arg indeterminable: + :arg non_stationary: + :arg spike: + :arg stationary: + :arg step_change: + :arg trend_change: + """ + + dip: "Dip" + distribution_change: "DistributionChange" + indeterminable: "Indeterminable" + non_stationary: "NonStationary" + spike: "Spike" + stationary: "Stationary" + step_change: "StepChange" + trend_change: "TrendChange" + + class ChildrenAggregate(AttrDict[Any]): """ :arg doc_count: (required) @@ -4957,6 +5072,26 @@ class DfsStatisticsProfile(AttrDict[Any]): children: Sequence["DfsStatisticsProfile"] +class Dip(AttrDict[Any]): + """ + :arg p_value: (required) + :arg change_point: (required) + """ + + p_value: float + change_point: int + + +class DistributionChange(AttrDict[Any]): + """ + :arg p_value: (required) + :arg change_point: (required) + """ + + p_value: float + change_point: int + + class DoubleTermsAggregate(AttrDict[Any]): """ Result of a `terms` aggregation when the field is some kind of decimal @@ -5518,6 +5653,14 @@ class HitsMetadata(AttrDict[Any]): max_score: Union[float, None] +class Indeterminable(AttrDict[Any]): + """ + :arg reason: (required) + """ + + reason: str + + class InferenceAggregate(AttrDict[Any]): """ :arg value: @@ -5920,6 +6063,18 @@ class NestedIdentity(AttrDict[Any]): _nested: "NestedIdentity" +class NonStationary(AttrDict[Any]): + """ + :arg p_value: (required) + :arg r_value: (required) + :arg trend: (required) + """ + + p_value: float + r_value: float + trend: str + + class ParentAggregate(AttrDict[Any]): """ :arg doc_count: (required) @@ -6277,6 +6432,16 @@ class SimpleValueAggregate(AttrDict[Any]): meta: Mapping[str, Any] +class Spike(AttrDict[Any]): + """ + :arg p_value: (required) + :arg change_point: (required) + """ + + p_value: float + change_point: int + + class StandardDeviationBounds(AttrDict[Any]): """ :arg upper: (required) @@ -6313,6 +6478,10 @@ class StandardDeviationBoundsAsString(AttrDict[Any]): lower_sampling: str +class Stationary(AttrDict[Any]): + pass + + class StatsAggregate(AttrDict[Any]): """ Statistics aggregation result. `min`, `max` and `avg` are missing if @@ -6368,6 +6537,16 @@ class StatsBucketAggregate(AttrDict[Any]): meta: Mapping[str, Any] +class StepChange(AttrDict[Any]): + """ + :arg p_value: (required) + :arg change_point: (required) + """ + + p_value: float + change_point: int + + class StringRareTermsAggregate(AttrDict[Any]): """ Result of the `rare_terms` aggregation when the field is a string. @@ -6599,6 +6778,18 @@ class TotalHits(AttrDict[Any]): value: int +class TrendChange(AttrDict[Any]): + """ + :arg p_value: (required) + :arg r_value: (required) + :arg change_point: (required) + """ + + p_value: float + r_value: float + change_point: int + + class UnmappedRareTermsAggregate(AttrDict[Any]): """ Result of a `rare_terms` aggregation when the field is unmapped. diff --git a/pyproject.toml b/pyproject.toml index c12a5a9df..572d90b1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -101,7 +101,7 @@ Homepage = "https://github.com/elastic/elasticsearch-py" [tool.hatch.version] path = "elasticsearch/_version.py" -pattern = "__versionstr__ = \"(?P[^']+)\"" +pattern = "__versionstr__ = \"(?P[^']+?)\"" [tool.hatch.build.targets.sdist] include = [