From 71389c113f6ecaad2f20dfe756f5262d11a2def3 Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Wed, 19 Jul 2023 06:06:21 +0000 Subject: [PATCH] Auto-generated API code --- elasticsearch/_async/client/__init__.py | 235 +++++++++++++++--------- elasticsearch/_async/client/cat.py | 89 +++++---- elasticsearch/_async/client/cluster.py | 125 ++++++++++--- elasticsearch/_async/client/indices.py | 105 ++++++----- elasticsearch/_async/client/ml.py | 15 +- elasticsearch/_async/client/security.py | 75 +++++--- elasticsearch/_sync/client/__init__.py | 235 +++++++++++++++--------- elasticsearch/_sync/client/cat.py | 89 +++++---- elasticsearch/_sync/client/cluster.py | 125 ++++++++++--- elasticsearch/_sync/client/indices.py | 105 ++++++----- elasticsearch/_sync/client/ml.py | 15 +- elasticsearch/_sync/client/security.py | 75 +++++--- 12 files changed, 842 insertions(+), 446 deletions(-) diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 75fd301bb..bd6f94898 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -3581,129 +3581,186 @@ async def search( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param aggregations: - :param aggs: - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param allow_partial_search_results: Indicate if an error should be returned - if there is a partial search failure or timeout - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string + :param index: Comma-separated list of data streams, indices, and aliases to search. + Supports wildcards (`*`). To search all data streams and indices, omit this + parameter or use `*` or `_all`. + :param aggregations: Defines the aggregations that are run as part of the search + request. + :param aggs: Defines the aggregations that are run as part of the search request. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. + :param allow_partial_search_results: If true, returns partial results if there + are shard request timeouts or shard failures. If false, returns an error + with no partial results. + :param analyze_wildcard: If true, wildcard and prefix queries are analyzed. This + parameter can only be used when the q query string parameter is specified. + :param analyzer: Analyzer to use for the query string. This parameter can only + be used when the q query string parameter is specified. :param batched_reduce_size: The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. - :param ccs_minimize_roundtrips: Indicates whether network round-trips should - be minimized as part of cross-cluster search requests execution - :param collapse: - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param docvalue_fields: Array of wildcard (*) patterns. The request returns doc - values for field names matching these patterns in the hits.fields property + :param ccs_minimize_roundtrips: If true, network round-trips between the coordinating + node and the remote clusters are minimized when executing cross-cluster search + (CCS) requests. + :param collapse: Collapses search results the values of the specified field. + :param default_operator: The default operator for query string query: AND or + OR. This parameter can only be used when the `q` query string parameter is + specified. + :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. + :param docvalue_fields: Array of wildcard (`*`) patterns. The request returns + doc values for field names matching these patterns in the `hits.fields` property of the response. - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. :param explain: If true, returns detailed information about score computation as part of a hit. :param ext: Configuration of search extensions defined by Elasticsearch plugins. - :param fields: Array of wildcard (*) patterns. The request returns values for - field names matching these patterns in the hits.fields property of the response. - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the search_after parameter. - :param highlight: - :param ignore_throttled: Whether specified concrete, expanded or aliased indices - should be ignored when throttled - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) + :param fields: Array of wildcard (`*`) patterns. The request returns values for + field names matching these patterns in the `hits.fields` property of the + response. + :param from_: Starting document offset. Needs to be non-negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param highlight: Specifies the highlighter to use for retrieving highlighted + snippets from one or more fields in your search results. + :param ignore_throttled: If `true`, concrete, expanded or aliased indices will + be ignored when frozen. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. :param indices_boost: Boosts the _score of documents from specified indices. :param knn: Defines the approximate kNN search to run. - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param max_concurrent_shard_requests: The number of concurrent shard requests - per node this search executes concurrently. This value should be used to - limit the impact of the search on the cluster in order to limit the number - of concurrent shard requests - :param min_compatible_shard_node: The minimum compatible version that all shards - involved in search should have for this request to be successful - :param min_score: Minimum _score for matching documents. Documents with a lower - _score are not included in the search results. + :param lenient: If `true`, format-based query failures (such as providing text + to a numeric field) in the query string will be ignored. This parameter can + only be used when the `q` query string parameter is specified. + :param max_concurrent_shard_requests: Defines the number of concurrent shard + requests per node this search executes concurrently. This value should be + used to limit the impact of the search on the cluster in order to limit the + number of concurrent shard requests. + :param min_compatible_shard_node: The minimum version of the node that can handle + the request Any handling node with a lower version will fail the request. + :param min_score: Minimum `_score` for matching documents. Documents with a lower + `_score` are not included in the search results. :param pit: Limits the search to a point in time (PIT). If you provide a PIT, - you cannot specify an in the request path. - :param post_filter: - :param pre_filter_shard_size: A threshold that enforces a pre-filter roundtrip - to prefilter search shards based on query rewriting if the number of shards - the search request expands to exceeds the threshold. This filter roundtrip - can limit the number of shards significantly if for instance a shard can - not match any documents based on its rewrite method ie. if date filters are - mandatory to match but the shard bounds and the query are disjoint. - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param profile: - :param q: Query in the Lucene query string syntax + you cannot specify an `` in the request path. + :param post_filter: Use the `post_filter` parameter to filter search results. + The search hits are filtered after the aggregations are calculated. A post + filter has no impact on the aggregation results. + :param pre_filter_shard_size: Defines a threshold that enforces a pre-filter + roundtrip to prefilter search shards based on query rewriting if the number + of shards the search request expands to exceeds the threshold. This filter + roundtrip can limit the number of shards significantly if for instance a + shard can not match any documents based on its rewrite method (if date filters + are mandatory to match but the shard bounds and the query are disjoint). + When unspecified, the pre-filter phase is executed if any of these conditions + is met: the request targets more than 128 shards; the request targets one + or more read-only index; the primary sort of the query targets an indexed + field. + :param preference: Nodes and shards used for the search. By default, Elasticsearch + selects from eligible nodes and shards using adaptive replica selection, + accounting for allocation awareness. Valid values are: `_only_local` to run + the search only on shards on the local node; `_local` to, if possible, run + the search on shards on the local node, or if not, select shards using the + default method; `_only_nodes:,` to run the search on only + the specified nodes IDs, where, if suitable shards exist on more than one + selected node, use shards on those nodes using the default method, or if + none of the specified nodes are available, select shards from any available + node using the default method; `_prefer_nodes:,` to if + possible, run the search on the specified nodes IDs, or if not, select shards + using the default method; `_shards:,` to run the search only + on the specified shards; `` (any string that does not start + with `_`) to route searches with the same `` to the same shards + in the same order. + :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 q: Query in the Lucene query string syntax using query parameter search. + Query parameter searches do not support the full Elasticsearch Query DSL + but are handy for testing. :param query: Defines the search definition using the Query DSL. - :param rank: Defines the Reciprocal Rank Fusion (RRF) to use - :param request_cache: Specify if request cache should be used for this request - or not, defaults to index level setting - :param rescore: - :param rest_total_hits_as_int: Indicates whether hits.total should be rendered - as an integer or an object in the rest search response - :param routing: A comma-separated list of specific routing values + :param rank: Defines the Reciprocal Rank Fusion (RRF) to use. + :param request_cache: If `true`, the caching of search results is enabled for + requests where `size` is `0`. Defaults to index level settings. + :param rescore: Can be used to improve precision by reordering just the top (for + example 100 - 500) documents returned by the `query` and `post_filter` phases. + :param rest_total_hits_as_int: Indicates whether `hits.total` should be rendered + as an integer or an object in the rest search response. + :param routing: Custom value used to route operations to a specific shard. :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. :param script_fields: Retrieve a script evaluation (based on different fields) for each hit. - :param scroll: Specify how long a consistent view of the index should be maintained - for scrolled search - :param search_after: - :param search_type: Search operation type - :param seq_no_primary_term: If true, returns sequence number and primary term - of the last modification of each hit. See Optimistic concurrency control. + :param scroll: Period to retain the search context for scrolling. See Scroll + search results. By default, this value cannot exceed `1d` (24 hours). You + can change this limit using the `search.max_keep_alive` cluster-level setting. + :param search_after: Used to retrieve the next page of hits using a set of sort + values from the previous page. + :param search_type: How distributed term frequencies are calculated for relevance + scoring. + :param seq_no_primary_term: If `true`, returns sequence number and primary term + of the last modification of each hit. :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the from and size parameters. To page through - more hits, use the search_after parameter. - :param slice: - :param sort: + more than 10,000 hits using the `from` and `size` parameters. To page through + more hits, use the `search_after` parameter. + :param slice: Can be used to split a scrolled search into multiple slices that + can be consumed independently. + :param sort: A comma-separated list of : pairs. :param source: Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response. - :param source_excludes: A list of fields to exclude from the returned _source - field - :param source_includes: A list of fields to extract and return from the _source - field + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. + :param source_includes: A comma-separated list of source fields to include in + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. :param stats: Stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API. :param stored_fields: List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this - field is specified, the _source parameter defaults to false. You can pass - _source: true to return both source fields and stored fields in the search - response. - :param suggest: + field is specified, the `_source` parameter defaults to `false`. You can + pass `_source: true` to return both source fields and stored fields in the + search response. + :param suggest: Defines a suggester that provides similar looking terms based + on a provided text. :param suggest_field: Specifies which field to use for suggestions. - :param suggest_mode: Specify suggest mode - :param suggest_size: How many suggestions to return in response + :param suggest_mode: Specifies the suggest mode. This parameter can only be used + when the `suggest_field` and `suggest_text` query string parameters are specified. + :param suggest_size: Number of suggestions to return. This parameter can only + be used when the `suggest_field` and `suggest_text` query string parameters + are specified. :param suggest_text: The source text for which the suggestions should be returned. + This parameter can only be used when the `suggest_field` and `suggest_text` + query string parameters are specified. :param terminate_after: Maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - Elasticsearch collects documents before sorting. Defaults to 0, which does - not terminate query execution early. + Elasticsearch collects documents before sorting. Use with caution. Elasticsearch + applies this parameter to each shard handling the request. When possible, + let Elasticsearch perform early termination automatically. Avoid specifying + this parameter for requests that target data streams with backing indices + across multiple data tiers. If set to `0` (default), the query does not terminate + early. :param timeout: Specifies the period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout. :param track_scores: If true, calculate and return document scores, even if the scores are not used for sorting. :param track_total_hits: Number of hits matching the query to count accurately. - If true, the exact number of hits is returned at the cost of some performance. - If false, the response does not include the total number of hits matching - the query. Defaults to 10,000 hits. - :param typed_keys: Specify whether aggregation and suggester names should be - prefixed by their respective types in the response + If `true`, the exact number of hits is returned at the cost of some performance. + If `false`, the response does not include the total number of hits matching + the query. + :param typed_keys: If `true`, aggregation and suggester names are be prefixed + by their respective types in the response. :param version: If true, returns document version as part of a hit. """ if index not in SKIP_IN_PATH: diff --git a/elasticsearch/_async/client/cat.py b/elasticsearch/_async/client/cat.py index f45c87a06..6f5cda39d 100644 --- a/elasticsearch/_async/client/cat.py +++ b/elasticsearch/_async/client/cat.py @@ -1266,15 +1266,19 @@ async def ml_trained_models( ``_ - :param model_id: The ID of the trained models stats to fetch - :param allow_no_match: Whether to ignore if a wildcard expression matches no - trained models. (This includes `_all` string or when no trained models have - been specified) - :param bytes: The unit in which to display byte values + :param model_id: A unique identifier for the trained model. + :param allow_no_match: Specifies what to do when the request: contains wildcard + expressions and there are no models that match; contains the `_all` string + or no identifiers and there are no matches; contains wildcard expressions + and there are only partial matches. If `true`, the API returns an empty array + when there are no matches and the subset of results when there are partial + matches. If `false`, the API returns a 404 status code when there are no + matches or only partial matches. + :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param from_: skips a number of trained models - :param h: Comma-separated list of column names to display + :param from_: Skips the specified number of transforms. + :param h: A comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param local: If `true`, the request computes the list of selected nodes from @@ -1282,8 +1286,9 @@ async def ml_trained_models( from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. - :param s: Comma-separated list of column names or column aliases to sort by - :param size: specifies a max number of trained models to get + :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 v: When set to `true` will enable verbose output. """ if model_id not in SKIP_IN_PATH: @@ -1807,8 +1812,10 @@ async def segments( ``_ - :param index: A comma-separated list of index names to limit the returned information - :param bytes: The unit in which to display byte values + :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 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. @@ -1887,8 +1894,10 @@ async def shards( ``_ - :param index: A comma-separated list of index names to limit the returned information - :param bytes: The unit in which to display byte values + :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 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. @@ -1967,13 +1976,16 @@ async def snapshots( ``_ - :param repository: Name of repository from which to fetch the snapshot information + :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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param ignore_unavailable: Set to true to ignore unavailable snapshots + :param ignore_unavailable: If `true`, the response does not include information + from unavailable snapshots. :param local: If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating @@ -2037,7 +2049,7 @@ async def tasks( t.Union["t.Literal[-1]", "t.Literal[0]", str] ] = None, node_id: t.Optional[t.Union[t.List[str], t.Tuple[str, ...]]] = None, - parent_task: t.Optional[int] = None, + parent_task_id: t.Optional[str] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]] = None, v: t.Optional[bool] = None, @@ -2048,9 +2060,9 @@ async def tasks( ``_ - :param actions: A comma-separated list of actions that should be returned. Leave - empty to return all. - :param detailed: Return detailed task information (default: false) + :param actions: The task action names, which are used to limit the response. + :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 to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -2061,8 +2073,9 @@ async def tasks( from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. - :param node_id: - :param parent_task: + :param node_id: Unique node identifiers, which are used to limit the response. + :param parent_task_id: The parent task identifier, which is used to limit the + response. :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. @@ -2092,8 +2105,8 @@ async def tasks( __query["master_timeout"] = master_timeout if node_id is not None: __query["node_id"] = node_id - if parent_task is not None: - __query["parent_task"] = parent_task + if parent_task_id is not None: + __query["parent_task_id"] = parent_task_id if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -2131,7 +2144,8 @@ async def templates( ``_ - :param name: A pattern that returned template names must match + :param name: The name of the template to return. Accepts wildcard expressions. + If omitted, all templates are returned. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -2211,8 +2225,8 @@ async def thread_pool( ``_ - :param thread_pool_patterns: List of thread pool names used to limit the request. - Accepts wildcard expressions. + :param thread_pool_patterns: A comma-separated list of thread pool names used + to limit the request. Accepts wildcard expressions. :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. @@ -2226,7 +2240,7 @@ async def thread_pool( :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: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ if thread_pool_patterns not in SKIP_IN_PATH: @@ -2341,14 +2355,19 @@ async def transforms( ``_ - :param transform_id: The id of the transform for which to get stats. '_all' or - '*' implies all transforms - :param allow_no_match: Whether to ignore if a wildcard expression matches no - transforms. (This includes `_all` string or when no transforms have been - specified) + :param transform_id: A transform identifier or a wildcard expression. If you + do not specify one of these options, the API returns information for all + transforms. + :param allow_no_match: Specifies what to do when the request: contains wildcard + expressions and there are no transforms that match; contains the `_all` string + or no identifiers and there are no matches; contains wildcard expressions + and there are only partial matches. If `true`, it returns an empty transforms + array when there are no matches and the subset of results when there are + partial matches. If `false`, the request returns a 404 status code when there + are no matches or only partial matches. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param from_: skips a number of transform configs, defaults to 0 + :param from_: Skips the specified number of transforms. :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. @@ -2359,8 +2378,8 @@ async def transforms( :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. - :param size: specifies a max number of transforms to get, defaults to 100 - :param time: Unit used to display time values. + :param size: The maximum number of transforms to obtain. + :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ if transform_id not in SKIP_IN_PATH: diff --git a/elasticsearch/_async/client/cluster.py b/elasticsearch/_async/client/cluster.py index 50527b8e8..775a0460a 100644 --- a/elasticsearch/_async/client/cluster.py +++ b/elasticsearch/_async/client/cluster.py @@ -115,8 +115,11 @@ async def delete_component_template( :param name: Comma-separated list or wildcard expression of component template names used to limit the request. - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -254,13 +257,16 @@ async def get_component_template( ``_ - :param name: The comma separated names of the component templates - :param flat_settings: + :param name: Comma-separated list of component template names used to limit the + request. Wildcard (`*`) expressions are supported. + :param flat_settings: If `true`, returns settings in flat format. :param include_defaults: Return all default configurations for the component template (default: false) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Explicit operation timeout for connection to master node + :param local: If `true`, the request retrieves information from the local node + only. If `false`, information is retrieved from the master node. + :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 not in SKIP_IN_PATH: __path = f"/_component_template/{_quote(name)}" @@ -310,10 +316,14 @@ async def get_settings( ``_ - :param flat_settings: Return settings in flat format (default: false) - :param include_defaults: Whether to return all default clusters setting. - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout + :param flat_settings: If `true`, returns settings in flat format. + :param include_defaults: If `true`, returns default cluster settings from the + local node. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ __path = "/_cluster/settings" __query: t.Dict[str, t.Any] = {} @@ -470,6 +480,62 @@ async def health( "GET", __path, params=__query, headers=__headers ) + @_rewrite_parameters() + async def info( + self, + *, + target: t.Union[ + t.Union[ + "t.Literal['_all', 'http', 'ingest', 'script', 'thread_pool']", str + ], + t.Union[ + t.List[ + t.Union[ + "t.Literal['_all', 'http', 'ingest', 'script', 'thread_pool']", + str, + ] + ], + t.Tuple[ + t.Union[ + "t.Literal['_all', 'http', 'ingest', 'script', 'thread_pool']", + str, + ], + ..., + ], + ], + ], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Returns different information about the cluster. + + ``_ + + :param target: Limits the information returned to the specific target. Supports + a comma-separated list, such as http,ingest. + """ + if target in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'target'") + __path = f"/_info/{_quote(target)}" + __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 + ) + @_rewrite_parameters() async def pending_tasks( self, @@ -491,9 +557,11 @@ async def pending_tasks( ``_ - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Specify timeout for connection to master + :param local: If `true`, the request retrieves information from the local node + only. If `false`, information is retrieved from the master node. + :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 = "/_cluster/pending_tasks" __query: t.Dict[str, t.Any] = {} @@ -596,7 +664,15 @@ async def put_component_template( ``_ - :param name: The name of the template + :param name: Name of the component template to create. Elasticsearch includes + the following built-in component templates: `logs-mappings`; 'logs-settings`; + `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. + Elastic Agent uses these templates to configure backing indices for its data + streams. If you use Elastic Agent and want to overwrite one of these templates, + set the `version` for your replacement template higher than the current version. + If you don’t use Elastic Agent and want to disable all built-in component + and index templates, set `stack.templates.enabled` to `false` using the cluster + update settings API. :param template: The template to be applied which includes mappings, settings, or aliases configuration. :param allow_auto_create: This setting overrides the value of the `action.auto_create_index` @@ -604,13 +680,18 @@ async def put_component_template( created using that template even if auto-creation of indices is disabled via `actions.auto_create_index`. If set to `false` then data streams matching the template must always be explicitly created. - :param create: Whether the index template should only be added if new or can - also replace an existing one - :param master_timeout: Specify timeout for connection to master + :param create: If `true`, this request cannot replace or update existing component + templates. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. :param meta: Optional user metadata about the component template. May have any - contents. This map is not automatically generated by Elasticsearch. + contents. This map is not automatically generated by Elasticsearch. This + information is stored in the cluster state, so keeping it short is preferable. + To unset `_meta`, replace the template without specifying this information. :param version: Version number used to manage component templates externally. This number isn't automatically generated or incremented by Elasticsearch. + To unset a version, replace the template without specifying a version. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -940,11 +1021,11 @@ async def stats( :param node_id: Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. - :param flat_settings: Return settings in flat format (default: false) + :param flat_settings: If `true`, returns settings in flat format. :param timeout: Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, - timed out nodes are included in the response’s _nodes.failed property. Defaults - to no timeout. + timed out nodes are included in the response’s `_nodes.failed` property. + Defaults to no timeout. """ if node_id not in SKIP_IN_PATH: __path = f"/_cluster/stats/nodes/{_quote(node_id)}" diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index a01b46244..df06ab052 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -535,7 +535,11 @@ async def create_data_stream( ``_ - :param name: The name of the data stream + :param name: Name of the data stream, which must meet the following criteria: + Lowercase only; Cannot include `\\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, + `#`, `:`, or a space character; Cannot start with `-`, `_`, `+`, or `.ds-`; + Cannot be `.` or `..`; Cannot be longer than 255 bytes. Multi-byte characters + count towards this limit faster. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -589,9 +593,11 @@ async def data_streams_stats( ``_ - :param name: A comma-separated list of data stream names; use `_all` or empty - string to perform the operation on all data streams - :param expand_wildcards: + :param name: Comma-separated list of data streams used to limit the request. + Wildcard expressions (`*`) are supported. To target all data streams in a + cluster, omit this parameter or use `*`. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values, such as `open,hidden`. """ if name not in SKIP_IN_PATH: __path = f"/_data_stream/{_quote(name)}/_stats" @@ -847,10 +853,10 @@ async def delete_data_stream( ``_ - :param name: A comma-separated list of data streams to delete; use `*` to delete - all data streams - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) + :param name: Comma-separated list of data streams to delete. Wildcard (`*`) expressions + are supported. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values,such as `open,hidden`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -1978,10 +1984,11 @@ async def get_data_stream( ``_ - :param name: A comma-separated list of data streams to get; use `*` to get all - data streams - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) + :param name: Comma-separated list of data stream names used to limit the request. + Wildcard (`*`) expressions are supported. If omitted, all data streams are + returned. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values, such as `open,hidden`. :param include_defaults: If true, returns all relevant default configurations for the index template. """ @@ -2279,22 +2286,28 @@ async def get_settings( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param name: The name of the settings that should be included - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param flat_settings: Return settings in flat format (default: false) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param include_defaults: Whether to return all default setting for each of the - indices. - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Specify timeout for connection to master + :param 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 name: Comma-separated list or wildcard expression of settings to retrieve. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with foo but no index starts with `bar`. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. + :param flat_settings: If `true`, returns settings in flat format. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param include_defaults: If `true`, return all default settings in the response. + :param local: If `true`, the request retrieves information from the local node + only. If `false`, information is retrieved from the master node. + :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 index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_settings/{_quote(name)}" @@ -2401,7 +2414,7 @@ async def migrate_to_data_stream( ``_ - :param name: The name of the alias to migrate + :param name: Name of the index alias to convert to a data stream. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3024,20 +3037,26 @@ async def put_settings( ``_ :param settings: - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param flat_settings: Return settings in flat format (default: false) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param preserve_existing: Whether to update existing settings. If set to `true` - existing settings on an index remain unchanged, the default is `false` - :param timeout: Explicit operation timeout + :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 allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. + :param flat_settings: If `true`, returns settings in flat format. + :param ignore_unavailable: If `true`, returns settings in flat format. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param preserve_existing: If `true`, existing index settings remain unchanged. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if settings is None: raise ValueError("Empty value passed for parameter 'settings'") diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index 262240b69..aeca216b5 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -3217,7 +3217,6 @@ async def put_trained_model( self, *, model_id: str, - inference_config: t.Mapping[str, t.Any], compressed_definition: t.Optional[str] = None, defer_definition_decompression: t.Optional[bool] = None, definition: t.Optional[t.Mapping[str, t.Any]] = None, @@ -3227,6 +3226,7 @@ async def put_trained_model( t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] ] = None, human: t.Optional[bool] = None, + inference_config: t.Optional[t.Mapping[str, t.Any]] = None, input: t.Optional[t.Mapping[str, t.Any]] = None, metadata: t.Optional[t.Any] = None, model_size_bytes: t.Optional[int] = None, @@ -3242,9 +3242,6 @@ async def put_trained_model( ``_ :param model_id: The unique identifier of the trained model. - :param inference_config: The default configuration for inference. This can be - either a regression or classification configuration. It must match the underlying - definition.trained_model's target_type. :param compressed_definition: The compressed (GZipped and Base64 encoded) inference definition of the model. If compressed_definition is specified, then definition cannot be specified. @@ -3254,6 +3251,10 @@ async def put_trained_model( :param definition: The inference definition for the model. If definition is specified, then compressed_definition cannot be specified. :param description: A human-readable description of the inference trained model. + :param inference_config: The default configuration for inference. This can be + either a regression or classification configuration. It must match the underlying + definition.trained_model's target_type. For pre-packaged models such as ELSER + the config is not required. :param input: The input field names for the model definition. :param metadata: An object map that contains metadata about the model. :param model_size_bytes: The estimated memory usage in bytes to keep the trained @@ -3264,13 +3265,9 @@ async def put_trained_model( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - if inference_config is None: - raise ValueError("Empty value passed for parameter 'inference_config'") __path = f"/_ml/trained_models/{_quote(model_id)}" __body: t.Dict[str, t.Any] = {} __query: t.Dict[str, t.Any] = {} - if inference_config is not None: - __body["inference_config"] = inference_config if compressed_definition is not None: __body["compressed_definition"] = compressed_definition if defer_definition_decompression is not None: @@ -3285,6 +3282,8 @@ async def put_trained_model( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if inference_config is not None: + __body["inference_config"] = inference_config if input is not None: __body["input"] = input if metadata is not None: diff --git a/elasticsearch/_async/client/security.py b/elasticsearch/_async/client/security.py index b983651b7..c74383631 100644 --- a/elasticsearch/_async/client/security.py +++ b/elasticsearch/_async/client/security.py @@ -187,7 +187,8 @@ async def clear_api_key_cache( ``_ - :param ids: A comma-separated list of IDs of API keys to clear from the cache + :param ids: Comma-separated list of API key IDs to evict from the API key cache. + To evict all API keys, use `*`. Does not support other wildcard patterns. """ if ids in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'ids'") @@ -392,7 +393,7 @@ async def create_api_key( expire. :param metadata: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning - with _ are reserved for system usage. + with `_` are reserved for system usage. :param name: Specifies the name for this API key. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to @@ -986,11 +987,18 @@ async def get_api_key( ``_ - :param id: API key id of the API key to be retrieved - :param name: API key name of the API key to be retrieved - :param owner: flag to query API keys owned by the currently authenticated user - :param realm_name: realm name of the user who created this API key to be retrieved - :param username: user name of the user who created this API key to be retrieved + :param id: An API key id. This parameter cannot be used with any of `name`, `realm_name` + or `username`. + :param name: An API key name. This parameter cannot be used with any of `id`, + `realm_name` or `username`. It supports prefix search with wildcard. + :param owner: A boolean flag that can be used to query API keys owned by the + currently authenticated user. The `realm_name` or `username` parameters cannot + be specified when this parameter is set to `true` as they are assumed to + be the currently authenticated ones. + :param realm_name: The name of an authentication realm. This parameter cannot + be used with either `id` or `name` or when `owner` flag is set to `true`. + :param username: The username of a user. This parameter cannot be used with either + `id` or `name` or when `owner` flag is set to `true`. :param with_limited_by: Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. @@ -1484,12 +1492,18 @@ async def grant_api_key( ``_ - :param api_key: - :param grant_type: - :param access_token: - :param password: - :param run_as: - :param username: + :param api_key: Defines the API key. + :param grant_type: The type of grant. Supported grant types are: `access_token`, + `password`. + :param access_token: The user’s access token. If you specify the `access_token` + grant type, this parameter is required. It is not valid with other grant + types. + :param password: The user’s password. If you specify the `password` grant type, + this parameter is required. It is not valid with other grant types. + :param run_as: The name of the user to be impersonated. + :param username: The user name that identifies the user. If you specify the `password` + grant type, this parameter is required. It is not valid with other grant + types. """ if api_key is None: raise ValueError("Empty value passed for parameter 'api_key'") @@ -1669,11 +1683,18 @@ async def invalidate_api_key( ``_ :param id: - :param ids: - :param name: - :param owner: - :param realm_name: - :param username: + :param ids: A list of API key ids. This parameter cannot be used with any of + `name`, `realm_name`, or `username`. + :param name: An API key name. This parameter cannot be used with any of `ids`, + `realm_name` or `username`. + :param owner: Can be used to query API keys owned by the currently authenticated + user. The `realm_name` or `username` parameters cannot be specified when + this parameter is set to `true` as they are assumed to be the currently authenticated + ones. + :param realm_name: The name of an authentication realm. This parameter cannot + be used with either `ids` or `name`, or when `owner` flag is set to `true`. + :param username: The username of a user. This parameter cannot be used with either + `ids` or `name`, or when `owner` flag is set to `true`. """ __path = "/_security/api_key" __query: t.Dict[str, t.Any] = {} @@ -2089,16 +2110,18 @@ async def query_api_keys( :param from_: Starting document offset. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more - hits, use the search_after parameter. + hits, use the `search_after` parameter. :param query: A query to filter which API keys to return. The query supports - a subset of query types, including match_all, bool, term, terms, ids, prefix, - wildcard, and range. You can query all public information associated with - an API key - :param search_after: + a subset of query types, including `match_all`, `bool`, `term`, `terms`, + `ids`, `prefix`, `wildcard`, and `range`. You can query all public information + associated with an API key. + :param search_after: Search after definition :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the from and size parameters. To page through - more hits, use the search_after parameter. - :param sort: + more than 10,000 hits using the `from` and `size` parameters. To page through + more hits, use the `search_after` parameter. + :param sort: Other than `id`, all public fields of an API key are eligible for + sorting. In addition, sort can also be applied to the `_doc` field to sort + by index order. :param with_limited_by: Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index a572580be..fbaa03bb0 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -3579,129 +3579,186 @@ def search( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param aggregations: - :param aggs: - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param allow_partial_search_results: Indicate if an error should be returned - if there is a partial search failure or timeout - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string + :param index: Comma-separated list of data streams, indices, and aliases to search. + Supports wildcards (`*`). To search all data streams and indices, omit this + parameter or use `*` or `_all`. + :param aggregations: Defines the aggregations that are run as part of the search + request. + :param aggs: Defines the aggregations that are run as part of the search request. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. + :param allow_partial_search_results: If true, returns partial results if there + are shard request timeouts or shard failures. If false, returns an error + with no partial results. + :param analyze_wildcard: If true, wildcard and prefix queries are analyzed. This + parameter can only be used when the q query string parameter is specified. + :param analyzer: Analyzer to use for the query string. This parameter can only + be used when the q query string parameter is specified. :param batched_reduce_size: The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. - :param ccs_minimize_roundtrips: Indicates whether network round-trips should - be minimized as part of cross-cluster search requests execution - :param collapse: - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param docvalue_fields: Array of wildcard (*) patterns. The request returns doc - values for field names matching these patterns in the hits.fields property + :param ccs_minimize_roundtrips: If true, network round-trips between the coordinating + node and the remote clusters are minimized when executing cross-cluster search + (CCS) requests. + :param collapse: Collapses search results the values of the specified field. + :param default_operator: The default operator for query string query: AND or + OR. This parameter can only be used when the `q` query string parameter is + specified. + :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. + :param docvalue_fields: Array of wildcard (`*`) patterns. The request returns + doc values for field names matching these patterns in the `hits.fields` property of the response. - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. :param explain: If true, returns detailed information about score computation as part of a hit. :param ext: Configuration of search extensions defined by Elasticsearch plugins. - :param fields: Array of wildcard (*) patterns. The request returns values for - field names matching these patterns in the hits.fields property of the response. - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the search_after parameter. - :param highlight: - :param ignore_throttled: Whether specified concrete, expanded or aliased indices - should be ignored when throttled - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) + :param fields: Array of wildcard (`*`) patterns. The request returns values for + field names matching these patterns in the `hits.fields` property of the + response. + :param from_: Starting document offset. Needs to be non-negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param highlight: Specifies the highlighter to use for retrieving highlighted + snippets from one or more fields in your search results. + :param ignore_throttled: If `true`, concrete, expanded or aliased indices will + be ignored when frozen. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. :param indices_boost: Boosts the _score of documents from specified indices. :param knn: Defines the approximate kNN search to run. - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param max_concurrent_shard_requests: The number of concurrent shard requests - per node this search executes concurrently. This value should be used to - limit the impact of the search on the cluster in order to limit the number - of concurrent shard requests - :param min_compatible_shard_node: The minimum compatible version that all shards - involved in search should have for this request to be successful - :param min_score: Minimum _score for matching documents. Documents with a lower - _score are not included in the search results. + :param lenient: If `true`, format-based query failures (such as providing text + to a numeric field) in the query string will be ignored. This parameter can + only be used when the `q` query string parameter is specified. + :param max_concurrent_shard_requests: Defines the number of concurrent shard + requests per node this search executes concurrently. This value should be + used to limit the impact of the search on the cluster in order to limit the + number of concurrent shard requests. + :param min_compatible_shard_node: The minimum version of the node that can handle + the request Any handling node with a lower version will fail the request. + :param min_score: Minimum `_score` for matching documents. Documents with a lower + `_score` are not included in the search results. :param pit: Limits the search to a point in time (PIT). If you provide a PIT, - you cannot specify an in the request path. - :param post_filter: - :param pre_filter_shard_size: A threshold that enforces a pre-filter roundtrip - to prefilter search shards based on query rewriting if the number of shards - the search request expands to exceeds the threshold. This filter roundtrip - can limit the number of shards significantly if for instance a shard can - not match any documents based on its rewrite method ie. if date filters are - mandatory to match but the shard bounds and the query are disjoint. - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param profile: - :param q: Query in the Lucene query string syntax + you cannot specify an `` in the request path. + :param post_filter: Use the `post_filter` parameter to filter search results. + The search hits are filtered after the aggregations are calculated. A post + filter has no impact on the aggregation results. + :param pre_filter_shard_size: Defines a threshold that enforces a pre-filter + roundtrip to prefilter search shards based on query rewriting if the number + of shards the search request expands to exceeds the threshold. This filter + roundtrip can limit the number of shards significantly if for instance a + shard can not match any documents based on its rewrite method (if date filters + are mandatory to match but the shard bounds and the query are disjoint). + When unspecified, the pre-filter phase is executed if any of these conditions + is met: the request targets more than 128 shards; the request targets one + or more read-only index; the primary sort of the query targets an indexed + field. + :param preference: Nodes and shards used for the search. By default, Elasticsearch + selects from eligible nodes and shards using adaptive replica selection, + accounting for allocation awareness. Valid values are: `_only_local` to run + the search only on shards on the local node; `_local` to, if possible, run + the search on shards on the local node, or if not, select shards using the + default method; `_only_nodes:,` to run the search on only + the specified nodes IDs, where, if suitable shards exist on more than one + selected node, use shards on those nodes using the default method, or if + none of the specified nodes are available, select shards from any available + node using the default method; `_prefer_nodes:,` to if + possible, run the search on the specified nodes IDs, or if not, select shards + using the default method; `_shards:,` to run the search only + on the specified shards; `` (any string that does not start + with `_`) to route searches with the same `` to the same shards + in the same order. + :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 q: Query in the Lucene query string syntax using query parameter search. + Query parameter searches do not support the full Elasticsearch Query DSL + but are handy for testing. :param query: Defines the search definition using the Query DSL. - :param rank: Defines the Reciprocal Rank Fusion (RRF) to use - :param request_cache: Specify if request cache should be used for this request - or not, defaults to index level setting - :param rescore: - :param rest_total_hits_as_int: Indicates whether hits.total should be rendered - as an integer or an object in the rest search response - :param routing: A comma-separated list of specific routing values + :param rank: Defines the Reciprocal Rank Fusion (RRF) to use. + :param request_cache: If `true`, the caching of search results is enabled for + requests where `size` is `0`. Defaults to index level settings. + :param rescore: Can be used to improve precision by reordering just the top (for + example 100 - 500) documents returned by the `query` and `post_filter` phases. + :param rest_total_hits_as_int: Indicates whether `hits.total` should be rendered + as an integer or an object in the rest search response. + :param routing: Custom value used to route operations to a specific shard. :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. :param script_fields: Retrieve a script evaluation (based on different fields) for each hit. - :param scroll: Specify how long a consistent view of the index should be maintained - for scrolled search - :param search_after: - :param search_type: Search operation type - :param seq_no_primary_term: If true, returns sequence number and primary term - of the last modification of each hit. See Optimistic concurrency control. + :param scroll: Period to retain the search context for scrolling. See Scroll + search results. By default, this value cannot exceed `1d` (24 hours). You + can change this limit using the `search.max_keep_alive` cluster-level setting. + :param search_after: Used to retrieve the next page of hits using a set of sort + values from the previous page. + :param search_type: How distributed term frequencies are calculated for relevance + scoring. + :param seq_no_primary_term: If `true`, returns sequence number and primary term + of the last modification of each hit. :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the from and size parameters. To page through - more hits, use the search_after parameter. - :param slice: - :param sort: + more than 10,000 hits using the `from` and `size` parameters. To page through + more hits, use the `search_after` parameter. + :param slice: Can be used to split a scrolled search into multiple slices that + can be consumed independently. + :param sort: A comma-separated list of : pairs. :param source: Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response. - :param source_excludes: A list of fields to exclude from the returned _source - field - :param source_includes: A list of fields to extract and return from the _source - field + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. + :param source_includes: A comma-separated list of source fields to include in + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. :param stats: Stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API. :param stored_fields: List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this - field is specified, the _source parameter defaults to false. You can pass - _source: true to return both source fields and stored fields in the search - response. - :param suggest: + field is specified, the `_source` parameter defaults to `false`. You can + pass `_source: true` to return both source fields and stored fields in the + search response. + :param suggest: Defines a suggester that provides similar looking terms based + on a provided text. :param suggest_field: Specifies which field to use for suggestions. - :param suggest_mode: Specify suggest mode - :param suggest_size: How many suggestions to return in response + :param suggest_mode: Specifies the suggest mode. This parameter can only be used + when the `suggest_field` and `suggest_text` query string parameters are specified. + :param suggest_size: Number of suggestions to return. This parameter can only + be used when the `suggest_field` and `suggest_text` query string parameters + are specified. :param suggest_text: The source text for which the suggestions should be returned. + This parameter can only be used when the `suggest_field` and `suggest_text` + query string parameters are specified. :param terminate_after: Maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - Elasticsearch collects documents before sorting. Defaults to 0, which does - not terminate query execution early. + Elasticsearch collects documents before sorting. Use with caution. Elasticsearch + applies this parameter to each shard handling the request. When possible, + let Elasticsearch perform early termination automatically. Avoid specifying + this parameter for requests that target data streams with backing indices + across multiple data tiers. If set to `0` (default), the query does not terminate + early. :param timeout: Specifies the period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout. :param track_scores: If true, calculate and return document scores, even if the scores are not used for sorting. :param track_total_hits: Number of hits matching the query to count accurately. - If true, the exact number of hits is returned at the cost of some performance. - If false, the response does not include the total number of hits matching - the query. Defaults to 10,000 hits. - :param typed_keys: Specify whether aggregation and suggester names should be - prefixed by their respective types in the response + If `true`, the exact number of hits is returned at the cost of some performance. + If `false`, the response does not include the total number of hits matching + the query. + :param typed_keys: If `true`, aggregation and suggester names are be prefixed + by their respective types in the response. :param version: If true, returns document version as part of a hit. """ if index not in SKIP_IN_PATH: diff --git a/elasticsearch/_sync/client/cat.py b/elasticsearch/_sync/client/cat.py index 3d83e09e1..b596cf4e1 100644 --- a/elasticsearch/_sync/client/cat.py +++ b/elasticsearch/_sync/client/cat.py @@ -1266,15 +1266,19 @@ def ml_trained_models( ``_ - :param model_id: The ID of the trained models stats to fetch - :param allow_no_match: Whether to ignore if a wildcard expression matches no - trained models. (This includes `_all` string or when no trained models have - been specified) - :param bytes: The unit in which to display byte values + :param model_id: A unique identifier for the trained model. + :param allow_no_match: Specifies what to do when the request: contains wildcard + expressions and there are no models that match; contains the `_all` string + or no identifiers and there are no matches; contains wildcard expressions + and there are only partial matches. If `true`, the API returns an empty array + when there are no matches and the subset of results when there are partial + matches. If `false`, the API returns a 404 status code when there are no + matches or only partial matches. + :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param from_: skips a number of trained models - :param h: Comma-separated list of column names to display + :param from_: Skips the specified number of transforms. + :param h: A comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. :param local: If `true`, the request computes the list of selected nodes from @@ -1282,8 +1286,9 @@ def ml_trained_models( from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. - :param s: Comma-separated list of column names or column aliases to sort by - :param size: specifies a max number of trained models to get + :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 v: When set to `true` will enable verbose output. """ if model_id not in SKIP_IN_PATH: @@ -1807,8 +1812,10 @@ def segments( ``_ - :param index: A comma-separated list of index names to limit the returned information - :param bytes: The unit in which to display byte values + :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 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. @@ -1887,8 +1894,10 @@ def shards( ``_ - :param index: A comma-separated list of index names to limit the returned information - :param bytes: The unit in which to display byte values + :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 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. @@ -1967,13 +1976,16 @@ def snapshots( ``_ - :param repository: Name of repository from which to fetch the snapshot information + :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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param ignore_unavailable: Set to true to ignore unavailable snapshots + :param ignore_unavailable: If `true`, the response does not include information + from unavailable snapshots. :param local: If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating @@ -2037,7 +2049,7 @@ def tasks( t.Union["t.Literal[-1]", "t.Literal[0]", str] ] = None, node_id: t.Optional[t.Union[t.List[str], t.Tuple[str, ...]]] = None, - parent_task: t.Optional[int] = None, + parent_task_id: t.Optional[str] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]] = None, v: t.Optional[bool] = None, @@ -2048,9 +2060,9 @@ def tasks( ``_ - :param actions: A comma-separated list of actions that should be returned. Leave - empty to return all. - :param detailed: Return detailed task information (default: false) + :param actions: The task action names, which are used to limit the response. + :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 to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -2061,8 +2073,9 @@ def tasks( from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. - :param node_id: - :param parent_task: + :param node_id: Unique node identifiers, which are used to limit the response. + :param parent_task_id: The parent task identifier, which is used to limit the + response. :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. @@ -2092,8 +2105,8 @@ def tasks( __query["master_timeout"] = master_timeout if node_id is not None: __query["node_id"] = node_id - if parent_task is not None: - __query["parent_task"] = parent_task + if parent_task_id is not None: + __query["parent_task_id"] = parent_task_id if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -2131,7 +2144,8 @@ def templates( ``_ - :param name: A pattern that returned template names must match + :param name: The name of the template to return. Accepts wildcard expressions. + If omitted, all templates are returned. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -2211,8 +2225,8 @@ def thread_pool( ``_ - :param thread_pool_patterns: List of thread pool names used to limit the request. - Accepts wildcard expressions. + :param thread_pool_patterns: A comma-separated list of thread pool names used + to limit the request. Accepts wildcard expressions. :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. @@ -2226,7 +2240,7 @@ def thread_pool( :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: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ if thread_pool_patterns not in SKIP_IN_PATH: @@ -2341,14 +2355,19 @@ def transforms( ``_ - :param transform_id: The id of the transform for which to get stats. '_all' or - '*' implies all transforms - :param allow_no_match: Whether to ignore if a wildcard expression matches no - transforms. (This includes `_all` string or when no transforms have been - specified) + :param transform_id: A transform identifier or a wildcard expression. If you + do not specify one of these options, the API returns information for all + transforms. + :param allow_no_match: Specifies what to do when the request: contains wildcard + expressions and there are no transforms that match; contains the `_all` string + or no identifiers and there are no matches; contains wildcard expressions + and there are only partial matches. If `true`, it returns an empty transforms + array when there are no matches and the subset of results when there are + partial matches. If `false`, the request returns a 404 status code when there + are no matches or only partial matches. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param from_: skips a number of transform configs, defaults to 0 + :param from_: Skips the specified number of transforms. :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. @@ -2359,8 +2378,8 @@ def transforms( :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. - :param size: specifies a max number of transforms to get, defaults to 100 - :param time: Unit used to display time values. + :param size: The maximum number of transforms to obtain. + :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ if transform_id not in SKIP_IN_PATH: diff --git a/elasticsearch/_sync/client/cluster.py b/elasticsearch/_sync/client/cluster.py index a245debd6..f3cbcc4e1 100644 --- a/elasticsearch/_sync/client/cluster.py +++ b/elasticsearch/_sync/client/cluster.py @@ -115,8 +115,11 @@ def delete_component_template( :param name: Comma-separated list or wildcard expression of component template names used to limit the request. - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -254,13 +257,16 @@ def get_component_template( ``_ - :param name: The comma separated names of the component templates - :param flat_settings: + :param name: Comma-separated list of component template names used to limit the + request. Wildcard (`*`) expressions are supported. + :param flat_settings: If `true`, returns settings in flat format. :param include_defaults: Return all default configurations for the component template (default: false) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Explicit operation timeout for connection to master node + :param local: If `true`, the request retrieves information from the local node + only. If `false`, information is retrieved from the master node. + :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 not in SKIP_IN_PATH: __path = f"/_component_template/{_quote(name)}" @@ -310,10 +316,14 @@ def get_settings( ``_ - :param flat_settings: Return settings in flat format (default: false) - :param include_defaults: Whether to return all default clusters setting. - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout + :param flat_settings: If `true`, returns settings in flat format. + :param include_defaults: If `true`, returns default cluster settings from the + local node. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ __path = "/_cluster/settings" __query: t.Dict[str, t.Any] = {} @@ -470,6 +480,62 @@ def health( "GET", __path, params=__query, headers=__headers ) + @_rewrite_parameters() + def info( + self, + *, + target: t.Union[ + t.Union[ + "t.Literal['_all', 'http', 'ingest', 'script', 'thread_pool']", str + ], + t.Union[ + t.List[ + t.Union[ + "t.Literal['_all', 'http', 'ingest', 'script', 'thread_pool']", + str, + ] + ], + t.Tuple[ + t.Union[ + "t.Literal['_all', 'http', 'ingest', 'script', 'thread_pool']", + str, + ], + ..., + ], + ], + ], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Returns different information about the cluster. + + ``_ + + :param target: Limits the information returned to the specific target. Supports + a comma-separated list, such as http,ingest. + """ + if target in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'target'") + __path = f"/_info/{_quote(target)}" + __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 + ) + @_rewrite_parameters() def pending_tasks( self, @@ -491,9 +557,11 @@ def pending_tasks( ``_ - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Specify timeout for connection to master + :param local: If `true`, the request retrieves information from the local node + only. If `false`, information is retrieved from the master node. + :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 = "/_cluster/pending_tasks" __query: t.Dict[str, t.Any] = {} @@ -596,7 +664,15 @@ def put_component_template( ``_ - :param name: The name of the template + :param name: Name of the component template to create. Elasticsearch includes + the following built-in component templates: `logs-mappings`; 'logs-settings`; + `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. + Elastic Agent uses these templates to configure backing indices for its data + streams. If you use Elastic Agent and want to overwrite one of these templates, + set the `version` for your replacement template higher than the current version. + If you don’t use Elastic Agent and want to disable all built-in component + and index templates, set `stack.templates.enabled` to `false` using the cluster + update settings API. :param template: The template to be applied which includes mappings, settings, or aliases configuration. :param allow_auto_create: This setting overrides the value of the `action.auto_create_index` @@ -604,13 +680,18 @@ def put_component_template( created using that template even if auto-creation of indices is disabled via `actions.auto_create_index`. If set to `false` then data streams matching the template must always be explicitly created. - :param create: Whether the index template should only be added if new or can - also replace an existing one - :param master_timeout: Specify timeout for connection to master + :param create: If `true`, this request cannot replace or update existing component + templates. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. :param meta: Optional user metadata about the component template. May have any - contents. This map is not automatically generated by Elasticsearch. + contents. This map is not automatically generated by Elasticsearch. This + information is stored in the cluster state, so keeping it short is preferable. + To unset `_meta`, replace the template without specifying this information. :param version: Version number used to manage component templates externally. This number isn't automatically generated or incremented by Elasticsearch. + To unset a version, replace the template without specifying a version. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -940,11 +1021,11 @@ def stats( :param node_id: Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. - :param flat_settings: Return settings in flat format (default: false) + :param flat_settings: If `true`, returns settings in flat format. :param timeout: Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, - timed out nodes are included in the response’s _nodes.failed property. Defaults - to no timeout. + timed out nodes are included in the response’s `_nodes.failed` property. + Defaults to no timeout. """ if node_id not in SKIP_IN_PATH: __path = f"/_cluster/stats/nodes/{_quote(node_id)}" diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index 55b4bd8b5..70a982ec3 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -535,7 +535,11 @@ def create_data_stream( ``_ - :param name: The name of the data stream + :param name: Name of the data stream, which must meet the following criteria: + Lowercase only; Cannot include `\\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, + `#`, `:`, or a space character; Cannot start with `-`, `_`, `+`, or `.ds-`; + Cannot be `.` or `..`; Cannot be longer than 255 bytes. Multi-byte characters + count towards this limit faster. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -589,9 +593,11 @@ def data_streams_stats( ``_ - :param name: A comma-separated list of data stream names; use `_all` or empty - string to perform the operation on all data streams - :param expand_wildcards: + :param name: Comma-separated list of data streams used to limit the request. + Wildcard expressions (`*`) are supported. To target all data streams in a + cluster, omit this parameter or use `*`. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values, such as `open,hidden`. """ if name not in SKIP_IN_PATH: __path = f"/_data_stream/{_quote(name)}/_stats" @@ -847,10 +853,10 @@ def delete_data_stream( ``_ - :param name: A comma-separated list of data streams to delete; use `*` to delete - all data streams - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) + :param name: Comma-separated list of data streams to delete. Wildcard (`*`) expressions + are supported. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values,such as `open,hidden`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -1978,10 +1984,11 @@ def get_data_stream( ``_ - :param name: A comma-separated list of data streams to get; use `*` to get all - data streams - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) + :param name: Comma-separated list of data stream names used to limit the request. + Wildcard (`*`) expressions are supported. If omitted, all data streams are + returned. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values, such as `open,hidden`. :param include_defaults: If true, returns all relevant default configurations for the index template. """ @@ -2279,22 +2286,28 @@ def get_settings( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param name: The name of the settings that should be included - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param flat_settings: Return settings in flat format (default: false) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param include_defaults: Whether to return all default setting for each of the - indices. - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Specify timeout for connection to master + :param 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 name: Comma-separated list or wildcard expression of settings to retrieve. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with foo but no index starts with `bar`. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. + :param flat_settings: If `true`, returns settings in flat format. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param include_defaults: If `true`, return all default settings in the response. + :param local: If `true`, the request retrieves information from the local node + only. If `false`, information is retrieved from the master node. + :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 index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_settings/{_quote(name)}" @@ -2401,7 +2414,7 @@ def migrate_to_data_stream( ``_ - :param name: The name of the alias to migrate + :param name: Name of the index alias to convert to a data stream. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3024,20 +3037,26 @@ def put_settings( ``_ :param settings: - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param flat_settings: Return settings in flat format (default: false) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param preserve_existing: Whether to update existing settings. If set to `true` - existing settings on an index remain unchanged, the default is `false` - :param timeout: Explicit operation timeout + :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 allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. + :param flat_settings: If `true`, returns settings in flat format. + :param ignore_unavailable: If `true`, returns settings in flat format. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param preserve_existing: If `true`, existing index settings remain unchanged. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if settings is None: raise ValueError("Empty value passed for parameter 'settings'") diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index b4f1a527b..6602090a5 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -3217,7 +3217,6 @@ def put_trained_model( self, *, model_id: str, - inference_config: t.Mapping[str, t.Any], compressed_definition: t.Optional[str] = None, defer_definition_decompression: t.Optional[bool] = None, definition: t.Optional[t.Mapping[str, t.Any]] = None, @@ -3227,6 +3226,7 @@ def put_trained_model( t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] ] = None, human: t.Optional[bool] = None, + inference_config: t.Optional[t.Mapping[str, t.Any]] = None, input: t.Optional[t.Mapping[str, t.Any]] = None, metadata: t.Optional[t.Any] = None, model_size_bytes: t.Optional[int] = None, @@ -3242,9 +3242,6 @@ def put_trained_model( ``_ :param model_id: The unique identifier of the trained model. - :param inference_config: The default configuration for inference. This can be - either a regression or classification configuration. It must match the underlying - definition.trained_model's target_type. :param compressed_definition: The compressed (GZipped and Base64 encoded) inference definition of the model. If compressed_definition is specified, then definition cannot be specified. @@ -3254,6 +3251,10 @@ def put_trained_model( :param definition: The inference definition for the model. If definition is specified, then compressed_definition cannot be specified. :param description: A human-readable description of the inference trained model. + :param inference_config: The default configuration for inference. This can be + either a regression or classification configuration. It must match the underlying + definition.trained_model's target_type. For pre-packaged models such as ELSER + the config is not required. :param input: The input field names for the model definition. :param metadata: An object map that contains metadata about the model. :param model_size_bytes: The estimated memory usage in bytes to keep the trained @@ -3264,13 +3265,9 @@ def put_trained_model( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - if inference_config is None: - raise ValueError("Empty value passed for parameter 'inference_config'") __path = f"/_ml/trained_models/{_quote(model_id)}" __body: t.Dict[str, t.Any] = {} __query: t.Dict[str, t.Any] = {} - if inference_config is not None: - __body["inference_config"] = inference_config if compressed_definition is not None: __body["compressed_definition"] = compressed_definition if defer_definition_decompression is not None: @@ -3285,6 +3282,8 @@ def put_trained_model( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if inference_config is not None: + __body["inference_config"] = inference_config if input is not None: __body["input"] = input if metadata is not None: diff --git a/elasticsearch/_sync/client/security.py b/elasticsearch/_sync/client/security.py index 478580bc2..53184b05c 100644 --- a/elasticsearch/_sync/client/security.py +++ b/elasticsearch/_sync/client/security.py @@ -187,7 +187,8 @@ def clear_api_key_cache( ``_ - :param ids: A comma-separated list of IDs of API keys to clear from the cache + :param ids: Comma-separated list of API key IDs to evict from the API key cache. + To evict all API keys, use `*`. Does not support other wildcard patterns. """ if ids in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'ids'") @@ -392,7 +393,7 @@ def create_api_key( expire. :param metadata: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning - with _ are reserved for system usage. + with `_` are reserved for system usage. :param name: Specifies the name for this API key. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to @@ -986,11 +987,18 @@ def get_api_key( ``_ - :param id: API key id of the API key to be retrieved - :param name: API key name of the API key to be retrieved - :param owner: flag to query API keys owned by the currently authenticated user - :param realm_name: realm name of the user who created this API key to be retrieved - :param username: user name of the user who created this API key to be retrieved + :param id: An API key id. This parameter cannot be used with any of `name`, `realm_name` + or `username`. + :param name: An API key name. This parameter cannot be used with any of `id`, + `realm_name` or `username`. It supports prefix search with wildcard. + :param owner: A boolean flag that can be used to query API keys owned by the + currently authenticated user. The `realm_name` or `username` parameters cannot + be specified when this parameter is set to `true` as they are assumed to + be the currently authenticated ones. + :param realm_name: The name of an authentication realm. This parameter cannot + be used with either `id` or `name` or when `owner` flag is set to `true`. + :param username: The username of a user. This parameter cannot be used with either + `id` or `name` or when `owner` flag is set to `true`. :param with_limited_by: Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. @@ -1484,12 +1492,18 @@ def grant_api_key( ``_ - :param api_key: - :param grant_type: - :param access_token: - :param password: - :param run_as: - :param username: + :param api_key: Defines the API key. + :param grant_type: The type of grant. Supported grant types are: `access_token`, + `password`. + :param access_token: The user’s access token. If you specify the `access_token` + grant type, this parameter is required. It is not valid with other grant + types. + :param password: The user’s password. If you specify the `password` grant type, + this parameter is required. It is not valid with other grant types. + :param run_as: The name of the user to be impersonated. + :param username: The user name that identifies the user. If you specify the `password` + grant type, this parameter is required. It is not valid with other grant + types. """ if api_key is None: raise ValueError("Empty value passed for parameter 'api_key'") @@ -1669,11 +1683,18 @@ def invalidate_api_key( ``_ :param id: - :param ids: - :param name: - :param owner: - :param realm_name: - :param username: + :param ids: A list of API key ids. This parameter cannot be used with any of + `name`, `realm_name`, or `username`. + :param name: An API key name. This parameter cannot be used with any of `ids`, + `realm_name` or `username`. + :param owner: Can be used to query API keys owned by the currently authenticated + user. The `realm_name` or `username` parameters cannot be specified when + this parameter is set to `true` as they are assumed to be the currently authenticated + ones. + :param realm_name: The name of an authentication realm. This parameter cannot + be used with either `ids` or `name`, or when `owner` flag is set to `true`. + :param username: The username of a user. This parameter cannot be used with either + `ids` or `name`, or when `owner` flag is set to `true`. """ __path = "/_security/api_key" __query: t.Dict[str, t.Any] = {} @@ -2089,16 +2110,18 @@ def query_api_keys( :param from_: Starting document offset. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more - hits, use the search_after parameter. + hits, use the `search_after` parameter. :param query: A query to filter which API keys to return. The query supports - a subset of query types, including match_all, bool, term, terms, ids, prefix, - wildcard, and range. You can query all public information associated with - an API key - :param search_after: + a subset of query types, including `match_all`, `bool`, `term`, `terms`, + `ids`, `prefix`, `wildcard`, and `range`. You can query all public information + associated with an API key. + :param search_after: Search after definition :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the from and size parameters. To page through - more hits, use the search_after parameter. - :param sort: + more than 10,000 hits using the `from` and `size` parameters. To page through + more hits, use the `search_after` parameter. + :param sort: Other than `id`, all public fields of an API key are eligible for + sorting. In addition, sort can also be applied to the `_doc` field to sort + by index order. :param with_limited_by: Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors.