diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 25f832f5d..d1ff463f1 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -628,6 +628,7 @@ async def bulk( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + include_source_on_error: t.Optional[bool] = None, list_executed_pipelines: t.Optional[bool] = None, pipeline: t.Optional[str] = None, pretty: t.Optional[bool] = None, @@ -735,6 +736,8 @@ async def bulk( :param operations: :param index: The name of the data stream, index, or index alias to perform bulk actions on. + :param include_source_on_error: True or false if to include the document source + in the error message in case of parsing errors. :param list_executed_pipelines: If `true`, the response will include the ingest pipelines that were run for each index or create. :param pipeline: The pipeline identifier to use to preprocess incoming documents. @@ -792,6 +795,8 @@ async def bulk( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if include_source_on_error is not None: + __query["include_source_on_error"] = include_source_on_error if list_executed_pipelines is not None: __query["list_executed_pipelines"] = list_executed_pipelines if pipeline is not None: @@ -984,8 +989,8 @@ async def count(

Count search results. Get the number of documents matching a query.

-

The query can either be provided using a simple query string as a parameter or using the Query DSL defined within the request body. - The latter must be nested in a query key, which is the same as the search API.

+

The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. + The query is optional. When no query is provided, the API uses match_all to count all the documents.

The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices.

The operation is broadcast across all shards. For each shard ID group, a replica is chosen and the search is run against it. @@ -1027,10 +1032,10 @@ async def count( in the result. :param preference: The node or shard the operation should be performed on. By default, it is random. - :param q: The query in Lucene query string syntax. - :param query: Defines the search definition using the Query DSL. The query is - optional, and when not provided, it will use `match_all` to count all the - docs. + :param q: The query in Lucene query string syntax. This parameter cannot be used + with a request body. + :param query: Defines the search query using Query DSL. A request body query + cannot be used with the `q` query string parameter. :param routing: A custom value used to route operations to a specific shard. :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. @@ -1116,6 +1121,7 @@ async def create( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + include_source_on_error: t.Optional[bool] = None, pipeline: t.Optional[str] = None, pretty: t.Optional[bool] = None, refresh: t.Optional[ @@ -1198,6 +1204,8 @@ async def create( :param id: A unique identifier for the document. To automatically generate a document ID, use the `POST //_doc/` request format. :param document: + :param include_source_on_error: True or false if to include the document source + in the error message in case of parsing errors. :param pipeline: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. If a final @@ -1246,6 +1254,8 @@ async def create( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if include_source_on_error is not None: + __query["include_source_on_error"] = include_source_on_error if pipeline is not None: __query["pipeline"] = pipeline if pretty is not None: @@ -1764,14 +1774,16 @@ async def delete_script( Deletes a stored script or search template.

- ``_ + ``_ - :param id: Identifier for the stored script or search template. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param id: The identifier for the stored script or search template. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. It can also be set to `-1` to indicate that the request + should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. It can + also be set to `-1` to indicate that the request should never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -2071,34 +2083,44 @@ async def explain( .. raw:: html

Explain a document match result. - Returns information about why a specific document matches, or doesn’t match, a query.

+ Get information about why a specific document matches, or doesn't match, a query. + It computes a score explanation for a query and a specific document.

``_ - :param index: Index names used to limit the request. Only a single index name - can be provided to this parameter. - :param id: Defines the document ID. + :param index: Index names that are used to limit the request. Only a single index + name can be provided to this parameter. + :param id: The document identifier. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the `q` query string parameter is specified. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: The query in the Lucene query string syntax. :param query: Defines the search definition using the Query DSL. - :param routing: Custom value used to route operations to a specific shard. - :param source: True or false to return the `_source` field or not, or a list + :param routing: A custom value used to route operations to a specific shard. + :param source: `True` or `false` to return the `_source` field or not or a list of fields to return. :param source_excludes: A comma-separated list of source fields to exclude from - the response. + 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. + 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 stored_fields: A comma-separated list of stored fields to return in the response. """ @@ -2202,7 +2224,7 @@ async def field_caps( ``_ - :param index: Comma-separated list of data streams, indices, and aliases used + :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. :param allow_no_indices: If false, the request returns an error if any wildcard @@ -2210,25 +2232,32 @@ async def field_caps( 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 fields: List of fields to retrieve capabilities for. Wildcard (`*`) expressions - are supported. - :param filters: An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. Supports comma-separated + values, such as `open,hidden`. + :param fields: A list of fields to retrieve capabilities for. Wildcard (`*`) + expressions are supported. + :param filters: A comma-separated list of filters to apply to the response. :param ignore_unavailable: If `true`, missing or closed indices are not included in the response. :param include_empty_fields: If false, empty fields are not included in the response. :param include_unmapped: If true, unmapped fields are included in the response. - :param index_filter: Allows to filter indices if the provided query rewrites - to match_none on every shard. - :param runtime_mappings: Defines ad-hoc runtime fields in the request similar + :param index_filter: Filter indices if the provided query rewrites to `match_none` + on every shard. IMPORTANT: The filtering is done on a best-effort basis, + it uses index statistics and mappings to rewrite queries to `match_none` + instead of fully running the request. For instance a range query over a date + field can rewrite to `match_none` if all documents within a shard (including + deleted documents) are outside of the provided range. However, not all queries + can rewrite to `match_none` so this API may return an index even if the provided + filter matches no document. + :param runtime_mappings: Define ad-hoc runtime fields in the request similar to the way it is done in search requests. These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. - :param types: Only return results for fields that have one of the types in the - list + :param types: A comma-separated list of field types to include. Any fields that + do not match one of these types will be excluded from the results. It defaults + to empty, meaning that all field types are returned. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -2461,10 +2490,13 @@ async def get_script( Retrieves a stored script or search template.

- ``_ + ``_ - :param id: Identifier for the stored script or search template. - :param master_timeout: Specify timeout for connection to master + :param id: The identifier for the stored script or search template. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. It can also be set to `-1` to indicate that the request should + never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -2507,7 +2539,7 @@ async def get_script_context(

Get a list of supported script contexts and their methods.

- ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_context" @@ -2546,7 +2578,7 @@ async def get_script_languages(

Get a list of available script types, languages, and contexts.

- ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_language" @@ -2766,6 +2798,7 @@ async def index( human: t.Optional[bool] = None, if_primary_term: t.Optional[int] = None, if_seq_no: t.Optional[int] = None, + include_source_on_error: t.Optional[bool] = None, op_type: t.Optional[t.Union[str, t.Literal["create", "index"]]] = None, pipeline: t.Optional[str] = None, pretty: t.Optional[bool] = None, @@ -2891,6 +2924,8 @@ async def index( term. :param if_seq_no: Only perform the operation if the document has this sequence number. + :param include_source_on_error: True or false if to include the document source + in the error message in case of parsing errors. :param op_type: Set to `create` to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. The behavior is the same as using the `/_create` @@ -2955,6 +2990,8 @@ async def index( __query["if_primary_term"] = if_primary_term if if_seq_no is not None: __query["if_seq_no"] = if_seq_no + if include_source_on_error is not None: + __query["include_source_on_error"] = include_source_on_error if op_type is not None: __query["op_type"] = op_type if pipeline is not None: @@ -3069,30 +3106,37 @@ async def knn_search( This means the results returned are not always the true k closest neighbors.

The kNN search API supports restricting the search using a filter. The search will return the top k documents that also match the filter query.

+

A kNN search response has the exact same structure as a search API response. + However, certain sections have a meaning specific to kNN search:

+
    +
  • The document _score is determined by the similarity between the query and document vector.
  • +
  • The hits.total object contains the total number of nearest neighbor candidates considered, which is num_candidates * num_shards. The hits.total.relation will always be eq, indicating an exact value.
  • +
- ``_ + ``_ :param index: A comma-separated list of index names to search; use `_all` or - to perform the operation on all indices - :param knn: kNN query to execute + to perform the operation on all indices. + :param knn: The kNN query to run. :param docvalue_fields: The request returns doc values for field names matching - these patterns in the hits.fields property of the response. Accepts wildcard - (*) patterns. + these patterns in the `hits.fields` property of the response. It accepts + wildcard (`*`) patterns. :param fields: The request returns values for field names matching these patterns - in the hits.fields property of the response. Accepts wildcard (*) patterns. - :param filter: Query to filter the documents that can match. The kNN search will - return the top `k` documents that also match this filter. The value can be - a single query or a list of queries. If `filter` isn't provided, all documents - are allowed to match. - :param routing: A comma-separated list of specific routing values + in the `hits.fields` property of the response. It accepts wildcard (`*`) + patterns. + :param filter: A query to filter the documents that can match. The kNN search + will return the top `k` documents that also match this filter. The value + can be a single query or a list of queries. If `filter` isn't provided, all + documents are allowed to match. + :param routing: A comma-separated list of specific routing values. :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 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. + These fields are returned in the `hits._source` property of the search response. + :param stored_fields: A list of stored fields to return as part of a hit. If + no fields are specified, no stored fields are included in the response. If + this field is specified, the `_source` parameter defaults to `false`. You + can pass `_source: true` to return both source fields and stored fields in + the search response. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3176,6 +3220,14 @@ async def mget(

Get multiple JSON documents by ID from one or more indices. If you specify an index in the request URI, you only need to specify the document IDs in the request body. To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.

+

Filter source fields

+

By default, the _source field is returned for every document (if stored). + Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. + You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions.

+

Get stored fields

+

Use the stored_fields attribute to specify the set of stored fields you want to retrieve. + Any requested fields that are not stored are ignored. + You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions.

``_ @@ -3446,22 +3498,32 @@ async def msearch_template( .. raw:: html

Run multiple templated searches.

+

Run multiple templated searches with a single request. + If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. + For example:

+
$ cat requests
+          { "index": "my-index" }
+          { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }}
+          { "index": "my-other-index" }
+          { "id": "my-other-search-template", "params": { "query_type": "match_all" }}
+
+          $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo
+          
- ``_ + ``_ :param search_templates: - :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 `*`. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*`. :param ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. - :param max_concurrent_searches: Maximum number of concurrent searches the API - can run. + :param max_concurrent_searches: The maximum number of concurrent searches the + API can run. :param rest_total_hits_as_int: If `true`, the response returns `hits.total` as an integer. If `false`, it returns `hits.total` as an object. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param search_type: The type of the search operation. :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ @@ -3544,34 +3606,38 @@ async def mtermvectors( .. raw:: html

Get multiple term vectors.

-

You can specify existing documents by index and ID or provide artificial documents in the body of the request. +

Get multiple term vectors with a single request. + You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a docs array with all the fetched termvectors. Each element has the structure provided by the termvectors API.

+

Artificial documents

+

You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. + The mapping used is determined by the specified _index.

``_ - :param index: Name of the index that contains the documents. - :param docs: Array of existing or artificial documents. + :param index: The name of the index that contains the documents. + :param docs: An array of existing or artificial documents. :param field_statistics: If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. - :param fields: Comma-separated list or wildcard expressions of fields to include - in the statistics. Used as the default list unless a specific field list - is provided in the `completion_fields` or `fielddata_fields` parameters. - :param ids: Simplified syntax to specify documents by their ID if they're in + :param fields: A comma-separated list or wildcard expressions of fields to include + in the statistics. It is used as the default list unless a specific field + list is provided in the `completion_fields` or `fielddata_fields` parameters. + :param ids: A simplified syntax to specify documents by their ID if they're in the same index. :param offsets: If `true`, the response includes term offsets. :param payloads: If `true`, the response includes term payloads. :param positions: If `true`, the response includes term positions. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param realtime: If true, the request is real-time as opposed to near-real-time. - :param routing: Custom value used to route operations to a specific shard. + :param routing: A custom value used to route operations to a specific shard. :param term_statistics: If true, the response includes term frequency and document frequency. :param version: If `true`, returns the document version as part of a hit. - :param version_type: Specific version type. + :param version_type: The version type. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -3784,20 +3850,21 @@ async def put_script( Creates or updates a stored script or search template.

- ``_ - - :param id: Identifier for the stored script or search template. Must be unique - within the cluster. - :param script: Contains the script or search template, its parameters, and its - language. - :param context: Context in which the script or search template should run. To - prevent errors, the API immediately compiles the script or template in this - context. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + ``_ + + :param id: The identifier for the stored script or search template. It must be + unique within the cluster. + :param script: The script or search template, its parameters, and its language. + :param context: The context in which the script or search template should run. + To prevent errors, the API immediately compiles the script or template in + this context. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. It can also be set to `-1` to indicate that the request + should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. It can + also be set to `-1` to indicate that the request should never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -3877,7 +3944,7 @@ async def rank_eval( :param requests: A set of typical search requests, together with their provided ratings. - :param index: Comma-separated list of data streams, indices, and index aliases + :param index: A comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. To target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`. @@ -4287,13 +4354,13 @@ async def render_search_template( ``_ - :param id: ID of the search template to render. If no `source` is specified, + :param id: The ID of the search template to render. If no `source` is specified, this or the `id` request body parameter is required. :param file: :param params: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. - :param source: An inline search template. Supports the same parameters as the - search API's request body. These parameters also support Mustache variables. + :param source: An inline search template. It supports the same parameters as + the search API's request body. These parameters also support Mustache variables. If no `id` or `` is specified, this parameter is required. """ __path_parts: t.Dict[str, str] @@ -4342,7 +4409,24 @@ async def render_search_template( async def scripts_painless_execute( self, *, - context: t.Optional[str] = None, + context: t.Optional[ + t.Union[ + str, + t.Literal[ + "boolean_field", + "composite_field", + "date_field", + "double_field", + "filter", + "geo_point_field", + "ip_field", + "keyword_field", + "long_field", + "painless_test", + "score", + ], + ] + ] = None, context_setup: t.Optional[t.Mapping[str, t.Any]] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, @@ -4354,15 +4438,22 @@ async def scripts_painless_execute( """ .. raw:: html -

Run a script. - Runs a script and returns a result.

+

Run a script.

+

Runs a script and returns a result. + Use this API to build and test scripts, such as when defining a script for a runtime field. + This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster.

+

The API uses several contexts, which control how scripts are run, what variables are available at runtime, and what the return type is.

+

Each context requires a script, but additional parameters depend on the context you're using for that script.

``_ - :param context: The context that the script should run in. - :param context_setup: Additional parameters for the `context`. - :param script: The Painless script to execute. + :param context: The context that the script should run in. NOTE: Result ordering + in the field contexts is not guaranteed. + :param context_setup: Additional parameters for the `context`. NOTE: This parameter + is required for all contexts except `painless_test`, which is the default + if no value is provided for `context`. + :param script: The Painless script to run. """ __path_parts: t.Dict[str, str] = {} __path = "/_scripts/painless/_execute" @@ -4428,13 +4519,13 @@ async def scroll(

IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.

- ``_ + ``_ - :param scroll_id: Scroll ID of the search. + :param scroll_id: The scroll ID of the search. :param rest_total_hits_as_int: If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. - :param scroll: Period to retain the search context for scrolling. + :param scroll: The period to retain the search context for scrolling. """ if scroll_id is None and body is None: raise ValueError("Empty value passed for parameter 'scroll_id'") @@ -5073,7 +5164,315 @@ async def search_mvt( .. raw:: html

Search a vector tile.

-

Search a vector tile for geospatial values.

+

Search a vector tile for geospatial values. + Before using this API, you should be familiar with the Mapbox vector tile specification. + The API returns results as a binary mapbox vector tile.

+

Internally, Elasticsearch translates a vector tile search API request into a search containing:

+
    +
  • A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box.
  • +
  • A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box.
  • +
  • Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true.
  • +
  • If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label.
  • +
+

For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search

+
GET my-index/_search
+          {
+            "size": 10000,
+            "query": {
+              "geo_bounding_box": {
+                "my-geo-field": {
+                  "top_left": {
+                    "lat": -40.979898069620134,
+                    "lon": -45
+                  },
+                  "bottom_right": {
+                    "lat": -66.51326044311186,
+                    "lon": 0
+                  }
+                }
+              }
+            },
+            "aggregations": {
+              "grid": {
+                "geotile_grid": {
+                  "field": "my-geo-field",
+                  "precision": 11,
+                  "size": 65536,
+                  "bounds": {
+                    "top_left": {
+                      "lat": -40.979898069620134,
+                      "lon": -45
+                    },
+                    "bottom_right": {
+                      "lat": -66.51326044311186,
+                      "lon": 0
+                    }
+                  }
+                }
+              },
+              "bounds": {
+                "geo_bounds": {
+                  "field": "my-geo-field",
+                  "wrap_longitude": false
+                }
+              }
+            }
+          }
+          
+

The API returns results as a binary Mapbox vector tile. + Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers:

+
    +
  • A hits layer containing a feature for each <field> value matching the geo_bounding_box query.
  • +
  • An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data.
  • +
  • A meta layer containing: +
      +
    • A feature containing a bounding box. By default, this is the bounding box of the tile.
    • +
    • Value ranges for any sub-aggregations on the geotile_grid or geohex_grid.
    • +
    • Metadata for the search.
    • +
    +
  • +
+

The API only returns features that can display at its zoom level. + For example, if a polygon feature has no area at its zoom level, the API omits it. + The API returns errors as UTF-8 encoded JSON.

+

IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. + If you specify both parameters, the query parameter takes precedence.

+

Grid precision for geotile

+

For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. + grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. + For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. + The maximum final precision is 29. + The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). + For example, a value of 8 divides the tile into a grid of 256 x 256 cells. + The aggs layer only contains features for cells with matching data.

+

Grid precision for geohex

+

For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision.

+

This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. + The following table maps the H3 resolution for each precision. + For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. + At a precision of 6, hexagonal cells have an H3 resolution of 2. + If <zoom> is 3 and grid_precision is 4, the precision is 7. + At a precision of 7, hexagonal cells have an H3 resolution of 3.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PrecisionUnique tile binsH3 resolutionUnique hex binsRatio
14012230.5
21601227.625
364184213.15625
425618423.2890625
51024258825.744140625
64096258821.436035156
7163843411622.512329102
8655363411620.6280822754
926214442881221.099098206
10104857642881220.2747745514
114194304520168420.4808526039
12167772166141178820.8414913416
13671088646141178820.2103728354
142684354567988251620.3681524172
15107374182486917761220.644266719
16429496729686917761220.1610666797
1717179869184948424328420.2818666889
186871947673610338970298820.4932667053
19274877906944112372792091620.8632167343
201099511627776112372792091620.2158041836
2143980465111041216609544641220.3776573213
221759218604441613116266812488420.6609003122
237036874417766413116266812488420.165225078
2428147497671065614813867687418820.2891438866
251125899906842620155697073811931620.5060018015
264503599627370500155697073811931620.1265004504
2718014398509482000155697073811931620.03162511259
2872057594037927900155697073811931620.007906278149
29288230376151712000155697073811931620.001976569537
+

Hexagonal cells don't align perfectly on a vector tile. + Some cells may intersect more than one vector tile. + To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. + Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density.

``_ @@ -5083,43 +5482,55 @@ async def search_mvt( :param zoom: Zoom level for the vector tile to search :param x: X coordinate for the vector tile to search :param y: Y coordinate for the vector tile to search - :param aggs: Sub-aggregations for the geotile_grid. Supports the following aggregation - types: - avg - cardinality - max - min - sum - :param buffer: Size, in pixels, of a clipping buffer outside the tile. This allows - renderers to avoid outline artifacts from geometries that extend past the - extent of the tile. - :param exact_bounds: If false, the meta layer’s feature is the bounding box of - the tile. If true, the meta layer’s feature is a bounding box resulting from - a geo_bounds aggregation. The aggregation runs on values that intersect - the // tile with wrap_longitude set to false. The resulting bounding - box may be larger than the vector tile. - :param extent: Size, in pixels, of a side of the tile. Vector tiles are square + :param aggs: Sub-aggregations for the geotile_grid. It supports the following + aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats` + - `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank` + - `stats` - `sum` - `value count` The aggregation names can't start with + `_mvt_`. The `_mvt_` prefix is reserved for internal aggregations. + :param buffer: The size, in pixels, of a clipping buffer outside the tile. This + allows renderers to avoid outline artifacts from geometries that extend past + the extent of the tile. + :param exact_bounds: If `false`, the meta layer's feature is the bounding box + of the tile. If `true`, the meta layer's feature is a bounding box resulting + from a `geo_bounds` aggregation. The aggregation runs on values that + intersect the `//` tile with `wrap_longitude` set to `false`. + The resulting bounding box may be larger than the vector tile. + :param extent: The size, in pixels, of a side of the tile. Vector tiles are square with equal sides. - :param fields: Fields to return in the `hits` layer. Supports wildcards (`*`). - This parameter does not support fields with array values. Fields with array - values may return inconsistent results. - :param grid_agg: Aggregation used to create a grid for the `field`. + :param fields: The fields to return in the `hits` layer. It supports wildcards + (`*`). This parameter does not support fields with array values. Fields with + array values may return inconsistent results. + :param grid_agg: The aggregation used to create a grid for the `field`. :param grid_precision: Additional zoom levels available through the aggs layer. - For example, if is 7 and grid_precision is 8, you can zoom in up to - level 15. Accepts 0-8. If 0, results don’t include the aggs layer. + For example, if `` is `7` and `grid_precision` is `8`, you can zoom + in up to level 15. Accepts 0-8. If 0, results don't include the aggs layer. :param grid_type: Determines the geometry type for features in the aggs layer. - In the aggs layer, each feature represents a geotile_grid cell. If 'grid' - each feature is a Polygon of the cells bounding box. If 'point' each feature + In the aggs layer, each feature represents a `geotile_grid` cell. If `grid, + each feature is a polygon of the cells bounding box. If `point`, each feature is a Point that is the centroid of the cell. - :param query: Query DSL used to filter documents for the search. + :param query: The query DSL used to filter documents for the search. :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. - :param size: Maximum number of features to return in the hits layer. Accepts - 0-10000. If 0, results don’t include the hits layer. - :param sort: Sorts features in the hits layer. By default, the API calculates - a bounding box for each feature. It sorts features based on this box’s diagonal + :param size: The maximum number of features to return in the hits layer. Accepts + 0-10000. If 0, results don't include the hits layer. + :param sort: Sort the features in the hits layer. By default, the API calculates + a bounding box for each feature. It sorts features based on this box's diagonal length, from longest to shortest. - :param track_total_hits: Number of hits matching the query to count accurately. + :param track_total_hits: The 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. :param with_labels: If `true`, the hits and aggs layers will contain additional point features representing suggested label positions for the original features. + * `Point` and `MultiPoint` features will have one of the points selected. + * `Polygon` and `MultiPolygon` features will have a single point generated, + either the centroid, if it is within the polygon, or another point within + the polygon selected from the sorted triangle-tree. * `LineString` features + will likewise provide a roughly central point selected from the triangle-tree. + * The aggregation results will provide one central point for each aggregation + bucket. All attributes from the original features will also be copied to + the new label features. In addition, the new features will be distinguishable + using the tag `_mvt_label_position`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5234,13 +5645,15 @@ async def search_shards(

Get the search shards.

Get the indices and shards that a search request would be run against. This information can be useful for working out issues or planning optimizations with routing and shard preferences. - When filtered aliases are used, the filter is returned as part of the indices section.

+ When filtered aliases are used, the filter is returned as part of the indices section.

+

If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias.

``_ - :param index: Returns the indices and shards that a search request would be executed - against. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*` or `_all`. :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 @@ -5254,10 +5667,13 @@ async def search_shards( a missing or closed index. :param local: If `true`, the request retrieves information from the local node only. - :param master_timeout: Period to wait for a connection to the master node. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param routing: Custom value used to route operations to a specific shard. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. IT can also be set to `-1` to indicate that the + request should never timeout. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param routing: A custom value used to route operations to a specific shard. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -5344,10 +5760,10 @@ async def search_template(

Run a search with a search template.

- ``_ + ``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (*). + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). :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 @@ -5355,32 +5771,34 @@ async def search_template( with `foo` but no index starts with `bar`. :param ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. - :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`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. Supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param explain: If `true`, returns detailed information about score calculation - as part of each hit. - :param id: ID of the search template to use. If no source is specified, this - parameter is required. + as part of each hit. If you specify both this and the `explain` query parameter, + the API uses only the query parameter. + :param id: The ID of the search template to use. If no `source` is specified, + this parameter is required. :param ignore_throttled: If `true`, specified concrete, expanded, or aliased indices are not included in the response when throttled. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param params: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param profile: If `true`, the query execution is profiled. - :param rest_total_hits_as_int: If true, hits.total are rendered as an integer - in the response. - :param routing: Custom value used to route operations to a specific shard. + :param rest_total_hits_as_int: If `true`, `hits.total` is rendered as an integer + in the response. If `false`, it is rendered as an object. + :param routing: A custom value used to route operations to a specific shard. :param scroll: Specifies how long a consistent view of the index should be maintained for scrolled search. :param search_type: The type of the search operation. :param source: An inline search template. Supports the same parameters as the - search API's request body. Also supports Mustache variables. If no id is - specified, this parameter is required. + search API's request body. It also supports Mustache variables. If no `id` + is specified, this parameter is required. :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ @@ -5478,30 +5896,35 @@ async def terms_enum(

Get terms in an index.

Discover terms that match a partial string in an index. - This "terms enum" API is designed for low-latency look-ups used in auto-complete scenarios.

-

If the complete property in the response is false, the returned terms set may be incomplete and should be treated as approximate. - This can occur due to a few reasons, such as a request timeout or a node error.

-

NOTE: The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.

+ This API is designed for low-latency look-ups used in auto-complete scenarios.

+
+

info + The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.

+
``_ - :param index: Comma-separated list of data streams, indices, and index aliases - to search. Wildcard (*) expressions are supported. + :param index: A comma-separated list of data streams, indices, and index aliases + to search. Wildcard (`*`) expressions are supported. To search all data streams + or indices, omit this parameter or use `*` or `_all`. :param field: The string to match at the start of indexed terms. If not provided, all terms in the field are considered. - :param case_insensitive: When true the provided search string is matched against + :param case_insensitive: When `true`, the provided search string is matched against index terms without case sensitivity. - :param index_filter: Allows to filter an index shard if the provided query rewrites - to match_none. - :param search_after: - :param size: How many matching terms to return. - :param string: The string after which terms in the index should be returned. - Allows for a form of pagination if the last result from one request is passed - as the search_after parameter for a subsequent request. - :param timeout: The maximum length of time to spend collecting results. Defaults - to "1s" (one second). If the timeout is exceeded the complete flag set to - false in the response and the results may be partial or empty. + :param index_filter: Filter an index shard if the provided query rewrites to + `match_none`. + :param search_after: The string after which terms in the index should be returned. + It allows for a form of pagination if the last result from one request is + passed as the `search_after` parameter for a subsequent request. + :param size: The number of matching terms to return. + :param string: The string to match at the start of indexed terms. If it is not + provided, all terms in the field are considered. > info > The prefix string + cannot be larger than the largest possible keyword value, which is Lucene's + term byte-length limit of 32766. + :param timeout: The maximum length of time to spend collecting results. If the + timeout is exceeded the `complete` flag set to `false` in the response and + the results may be partial or empty. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5584,32 +6007,73 @@ async def termvectors(

Get term vector information.

Get information and statistics about terms in the fields of a particular document.

+

You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. + You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. + For example:

+
GET /my-index-000001/_termvectors/1?fields=message
+          
+

Fields can be specified using wildcards, similar to the multi match query.

+

Term vectors are real-time by default, not near real-time. + This can be changed by setting realtime parameter to false.

+

You can request three types of values: term information, term statistics, and field statistics. + By default, all term information and field statistics are returned for all fields but term statistics are excluded.

+

Term information

+
    +
  • term frequency in the field (always returned)
  • +
  • term positions (positions: true)
  • +
  • start and end offsets (offsets: true)
  • +
  • term payloads (payloads: true), as base64 encoded bytes
  • +
+

If the requested information wasn't stored in the index, it will be computed on the fly if possible. + Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user.

+
+

warn + Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16.

+
+

Behaviour

+

The term and field statistics are not accurate. + Deleted documents are not taken into account. + The information is only retrieved for the shard the requested document resides in. + The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. + By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. + Use routing only to hit a particular shard.

``_ - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. + :param index: The name of the index that contains the document. + :param id: A unique identifier for the document. :param doc: An artificial document (a document not present in the index) for which you want to retrieve term vectors. - :param field_statistics: If `true`, the response includes the document count, - sum of document frequencies, and sum of total term frequencies. - :param fields: Comma-separated list or wildcard expressions of fields to include - in the statistics. Used as the default list unless a specific field list - is provided in the `completion_fields` or `fielddata_fields` parameters. - :param filter: Filter terms based on their tf-idf scores. + :param field_statistics: If `true`, the response includes: * The document count + (how many documents contain this field). * The sum of document frequencies + (the sum of document frequencies for all terms in this field). * The sum + of total term frequencies (the sum of total term frequencies of each term + in this field). + :param fields: A comma-separated list or wildcard expressions of fields to include + in the statistics. It is used as the default list unless a specific field + list is provided in the `completion_fields` or `fielddata_fields` parameters. + :param filter: Filter terms based on their tf-idf scores. This could be useful + in order find out a good characteristic vector of a document. This feature + works in a similar manner to the second phase of the More Like This Query. :param offsets: If `true`, the response includes term offsets. :param payloads: If `true`, the response includes term payloads. - :param per_field_analyzer: Overrides the default per-field analyzer. + :param per_field_analyzer: Override the default per-field analyzer. This is useful + in order to generate term vectors in any fashion, especially when using artificial + documents. When providing an analyzer for a field that already stores term + vectors, the term vectors will be regenerated. :param positions: If `true`, the response includes term positions. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param realtime: If true, the request is real-time as opposed to near-real-time. - :param routing: Custom value used to route operations to a specific shard. - :param term_statistics: If `true`, the response includes term frequency and document - frequency. + :param routing: A custom value that is used to route operations to a specific + shard. + :param term_statistics: If `true`, the response includes: * The total term frequency + (how often a term occurs in all documents). * The document frequency (the + number of documents containing the current term). By default these values + are not returned since term statistics can have a serious performance impact. :param version: If `true`, returns the document version as part of a hit. - :param version_type: Specific version type. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5705,6 +6169,7 @@ async def update( human: t.Optional[bool] = None, if_primary_term: t.Optional[int] = None, if_seq_no: t.Optional[int] = None, + include_source_on_error: t.Optional[bool] = None, lang: t.Optional[str] = None, pretty: t.Optional[bool] = None, refresh: t.Optional[ @@ -5760,6 +6225,8 @@ async def update( term. :param if_seq_no: Only perform the operation if the document has this sequence number. + :param include_source_on_error: True or false if to include the document source + in the error message in case of parsing errors. :param lang: The script language. :param refresh: If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to @@ -5804,6 +6271,8 @@ async def update( __query["if_primary_term"] = if_primary_term if if_seq_no is not None: __query["if_seq_no"] = if_seq_no + if include_source_on_error is not None: + __query["include_source_on_error"] = include_source_on_error if lang is not None: __query["lang"] = lang if pretty is not None: @@ -5915,80 +6384,161 @@ async def update_by_query(

Update documents. Updates documents that match the specified query. If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:

+
    +
  • read
  • +
  • index or write
  • +
+

You can specify the query criteria in the request URI or the request body using the same syntax as the search API.

+

When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. + When the versions match, the document is updated and the version number is incremented. + If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. + You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. + Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query.

+

NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number.

+

While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. + A bulk update request is performed for each batch of matching documents. + Any query or update failures cause the update by query request to fail and the failures are shown in the response. + Any update requests that completed successfully still stick, they are not rolled back.

+

Throttling update requests

+

To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. + This pads each batch with a wait time to throttle the rate. + Set requests_per_second to -1 to turn off throttling.

+

Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. + The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. + By default the batch size is 1000, so if requests_per_second is set to 500:

+
target_time = 1000 / 500 per second = 2 seconds
+          wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds
+          
+

Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. + This is "bursty" instead of "smooth".

+

Slicing

+

Update by query supports sliced scroll to parallelize the update process. + This can improve efficiency and provide a convenient way to break the request down into smaller parts.

+

Setting slices to auto chooses a reasonable number for most data streams and indices. + This setting will use one slice per shard, up to a certain limit. + If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards.

+

Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks:

+
    +
  • You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices.
  • +
  • Fetching the status of the task for the request with slices only contains the status of completed slices.
  • +
  • These sub-requests are individually addressable for things like cancellation and rethrottling.
  • +
  • Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally.
  • +
  • Canceling the request with slices will cancel each sub-request.
  • +
  • Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.
  • +
  • Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated.
  • +
  • Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time.
  • +
+

If you're slicing manually or otherwise tuning automatic slicing, keep in mind that:

+
    +
  • Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.
  • +
  • Update performance scales linearly across available resources with the number of slices.
  • +
+

Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources.

+

Update the document source

+

Update by query supports scripts to update the document source. + As with the update API, you can set ctx.op to change the operation that is performed.

+

Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. + The update by query operation skips updating the document and increments the noop counter.

+

Set ctx.op = "delete" if your script decides that the document should be deleted. + The update by query operation deletes the document and increments the deleted counter.

+

Update by query supports only index, noop, and delete. + Setting ctx.op to anything else is an error. + Setting any other field in ctx is an error. + This API enables you to only modify the source of matching documents; you cannot move them.

``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams or indices, omit this - parameter or use `*` or `_all`. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams or indices, + omit this parameter or use `*` or `_all`. :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 analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. - :param conflicts: What to do if update by query hits version conflicts: `abort` - or `proceed`. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. + :param conflicts: The preferred behavior when update by query hits version conflicts: + `abort` or `proceed`. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. - :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`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param from_: Starting offset (default: 0) :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. :param max_docs: The maximum number of documents to update. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. + :param pipeline: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. - :param query: Specifies the documents to update using the Query DSL. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: A query in the Lucene query string syntax. + :param query: The documents to update using the Query DSL. :param refresh: If `true`, Elasticsearch refreshes affected shards to make the - operation visible to search. + operation visible to search after the request completes. This is different + than the update API's `refresh` parameter, which causes just the shard that + received the request to be refreshed. :param request_cache: If `true`, the request cache is used for this request. + It defaults to the index-level setting. :param requests_per_second: The throttle for this request in sub-requests per second. - :param routing: Custom value used to route operations to a specific shard. + :param routing: A custom value used to route operations to a specific shard. :param script: The script to run to update the document source or metadata when updating. - :param scroll: Period to retain the search context for scrolling. - :param scroll_size: Size of the scroll request that powers the operation. - :param search_timeout: Explicit timeout for each search request. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param scroll: The period to retain the search context for scrolling. + :param scroll_size: The size of the scroll request that powers the operation. + :param search_timeout: An explicit timeout for each search request. By default, + there is no timeout. + :param search_type: The type of the search operation. Available options include + `query_then_fetch` and `dfs_query_then_fetch`. :param slice: Slice the request manually using the provided slice ID and total number of slices. :param slices: The number of slices this task should be divided into. :param sort: A comma-separated list of : pairs. - :param stats: Specific `tag` of the request for logging and statistical purposes. - :param terminate_after: Maximum number of documents to collect for each shard. + :param stats: The specific `tag` of the request for logging and statistical purposes. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - 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. - :param timeout: Period each update request waits for the following operations: - dynamic mapping updates, waiting for active shards. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this parameter to each shard handling the request. + When possible, let Elasticsearch perform early termination automatically. + Avoid specifying this parameter for requests that target data streams with + backing indices across multiple data tiers. + :param timeout: The period each update request waits for the following operations: + dynamic mapping updates, waiting for active shards. By default, it is one + minute. This guarantees Elasticsearch waits for at least the timeout before + failing. The actual wait time could be longer, particularly when multiple + waits occur. :param version: If `true`, returns the document version as part of a hit. :param version_type: Should the document increment the version number (internal) on hit or not (reindex) :param wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + up to the total number of shards in the index (`number_of_replicas+1`). The + `timeout` parameter controls how long each write request waits for unavailable + shards to become available. Both work exactly the way they work in the bulk + API. :param wait_for_completion: If `true`, the request blocks until the operation - is complete. + is complete. If `false`, Elasticsearch performs some preflight checks, launches + the request, and returns a task ID that you can use to cancel or get the + status of the task. Elasticsearch creates a record of this task as a document + at `.tasks/task/${taskId}`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -6118,11 +6668,11 @@ async def update_by_query_rethrottle( Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.

- ``_ + ``_ :param task_id: The ID for the task. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. To turn off throttling, set it to `-1`. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") diff --git a/elasticsearch/_async/client/async_search.py b/elasticsearch/_async/client/async_search.py index ab8421898..e6df0cf25 100644 --- a/elasticsearch/_async/client/async_search.py +++ b/elasticsearch/_async/client/async_search.py @@ -97,8 +97,8 @@ async def get( ``_ :param id: A unique identifier for the async search. - :param keep_alive: Specifies how long the async search should be available in - the cluster. When not specified, the `keep_alive` set with the corresponding + :param keep_alive: The length of time that the async search should be available + in the cluster. When not specified, the `keep_alive` set with the corresponding submit async request will be used. Otherwise, it is possible to override the value and extend the validity of the request. When this period expires, the search, if still running, is cancelled. If the search is completed, its @@ -157,13 +157,17 @@ async def status(

Get the async search status.

Get the status of a previously submitted async search request given its identifier, without retrieving search results. - If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role.

+ If the Elasticsearch security features are enabled, the access to the status of a specific async search is restricted to:

+
    +
  • The user or API key that submitted the original async search request.
  • +
  • Users that have the monitor cluster privilege or greater privileges.
  • +
``_ :param id: A unique identifier for the async search. - :param keep_alive: Specifies how long the async search needs to be available. + :param keep_alive: The length of time that the async search needs to be available. Ongoing async searches and any saved search results are deleted after this period. """ diff --git a/elasticsearch/_async/client/cat.py b/elasticsearch/_async/client/cat.py index 6ffa36b68..2bd625661 100644 --- a/elasticsearch/_async/client/cat.py +++ b/elasticsearch/_async/client/cat.py @@ -2494,7 +2494,7 @@ async def tasks( IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the task management API.

- ``_ + ``_ :param actions: The task action names, which are used to limit the response. :param detailed: If `true`, the response includes detailed information about diff --git a/elasticsearch/_async/client/ccr.py b/elasticsearch/_async/client/ccr.py index aa7b4d085..cfa80673b 100644 --- a/elasticsearch/_async/client/ccr.py +++ b/elasticsearch/_async/client/ccr.py @@ -39,14 +39,17 @@ async def delete_auto_follow_pattern( """ .. raw:: html -

Delete auto-follow patterns. - Delete a collection of cross-cluster replication auto-follow patterns.

+

Delete auto-follow patterns.

+

Delete a collection of cross-cluster replication auto-follow patterns.

``_ - :param name: The name of the auto follow pattern. - :param master_timeout: Period to wait for a connection to the master node. + :param name: The auto-follow pattern collection to delete. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -251,16 +254,18 @@ async def follow_info( """ .. raw:: html -

Get follower information. - Get information about all cross-cluster replication follower indices. +

Get follower information.

+

Get information about all cross-cluster replication follower indices. For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused.

``_ - :param index: A comma-separated list of index patterns; use `_all` to perform - the operation on all indices - :param master_timeout: Period to wait for a connection to the master node. + :param index: A comma-delimited list of follower index patterns. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -301,17 +306,16 @@ async def follow_stats( """ .. raw:: html -

Get follower stats. - Get cross-cluster replication follower stats. +

Get follower stats.

+

Get cross-cluster replication follower stats. The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices.

``_ - :param index: A comma-separated list of index patterns; use `_all` to perform - the operation on all indices - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param index: A comma-delimited list of index patterns. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -437,15 +441,18 @@ async def get_auto_follow_pattern( """ .. raw:: html -

Get auto-follow patterns. - Get cross-cluster replication auto-follow patterns.

+

Get auto-follow patterns.

+

Get cross-cluster replication auto-follow patterns.

``_ - :param name: Specifies the auto-follow pattern collection that you want to retrieve. - If you do not specify a name, the API returns information for all collections. - :param master_timeout: Period to wait for a connection to the master node. + :param name: The auto-follow pattern collection that you want to retrieve. If + you do not specify a name, the API returns information for all collections. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: @@ -489,8 +496,8 @@ async def pause_auto_follow_pattern( """ .. raw:: html -

Pause an auto-follow pattern. - Pause a cross-cluster replication auto-follow pattern. +

Pause an auto-follow pattern.

+

Pause a cross-cluster replication auto-follow pattern. When the API returns, the auto-follow pattern is inactive. New indices that are created on the remote cluster and match the auto-follow patterns are ignored.

You can resume auto-following with the resume auto-follow pattern API. @@ -500,9 +507,11 @@ async def pause_auto_follow_pattern( ``_ - :param name: The name of the auto follow pattern that should pause discovering - new indices to follow. - :param master_timeout: Period to wait for a connection to the master node. + :param name: The name of the auto-follow pattern to pause. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -543,8 +552,8 @@ async def pause_follow( """ .. raw:: html -

Pause a follower. - Pause a cross-cluster replication follower index. +

Pause a follower.

+

Pause a cross-cluster replication follower index. The follower index will not fetch any additional operations from the leader index. You can resume following with the resume follower API. You can pause and resume a follower index to change the configuration of the following task.

@@ -552,9 +561,11 @@ async def pause_follow( ``_ - :param index: The name of the follower index that should pause following its - leader index. - :param master_timeout: Period to wait for a connection to the master node. + :param index: The name of the follower index. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -765,17 +776,19 @@ async def resume_auto_follow_pattern( """ .. raw:: html -

Resume an auto-follow pattern. - Resume a cross-cluster replication auto-follow pattern that was paused. +

Resume an auto-follow pattern.

+

Resume a cross-cluster replication auto-follow pattern that was paused. The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim.

``_ - :param name: The name of the auto follow pattern to resume discovering new indices - to follow. - :param master_timeout: Period to wait for a connection to the master node. + :param name: The name of the auto-follow pattern to resume. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -934,15 +947,18 @@ async def stats( """ .. raw:: html -

Get cross-cluster replication stats. - This API returns stats about auto-following and the same shard-level stats as the get follower stats API.

+

Get cross-cluster replication stats.

+

This API returns stats about auto-following and the same shard-level stats as the get follower stats API.

``_ - :param master_timeout: Period to wait for a connection to the master node. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_ccr/stats" @@ -983,18 +999,23 @@ async def unfollow( """ .. raw:: html -

Unfollow an index. - Convert a cross-cluster replication follower index to a regular index. +

Unfollow an index.

+

Convert a cross-cluster replication follower index to a regular index. The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. The follower index must be paused and closed before you call the unfollow API.

-

NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation.

+
+

info + Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation.

+
``_ - :param index: The name of the follower index that should be turned into a regular - index. - :param master_timeout: Period to wait for a connection to the master node. + :param index: The name of the follower index. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") diff --git a/elasticsearch/_async/client/cluster.py b/elasticsearch/_async/client/cluster.py index e440392a4..ca5656cae 100644 --- a/elasticsearch/_async/client/cluster.py +++ b/elasticsearch/_async/client/cluster.py @@ -920,9 +920,16 @@ async def remote_info( """ .. raw:: html -

Get remote cluster information. - Get all of the configured remote cluster information. - This API returns connection and endpoint information keyed by the configured remote cluster alias.

+

Get remote cluster information.

+

Get information about configured remote clusters. + The API returns connection and endpoint information keyed by the configured remote cluster alias.

+
+

info + This API returns information that reflects current state on the local cluster. + The connected field does not necessarily reflect whether a remote cluster is down or unavailable, only whether there is currently an open connection to it. + Elasticsearch does not spontaneously try to reconnect to a disconnected remote cluster. + To trigger a reconnection, attempt a cross-cluster search, ES|QL cross-cluster search, or try the resolve cluster endpoint.

+
``_ diff --git a/elasticsearch/_async/client/eql.py b/elasticsearch/_async/client/eql.py index 871c37bcc..8985e91ec 100644 --- a/elasticsearch/_async/client/eql.py +++ b/elasticsearch/_async/client/eql.py @@ -43,7 +43,7 @@ async def delete( The API also deletes results for the search.

- ``_ + ``_ :param id: Identifier for the search to delete. A search ID is provided in the EQL search API's response for an async search. A search ID is also provided @@ -251,8 +251,15 @@ async def search( :param index: The name of the index to scope the operation :param query: EQL query you wish to run. :param allow_no_indices: - :param allow_partial_search_results: - :param allow_partial_sequence_results: + :param allow_partial_search_results: Allow query execution also in case of shard + failures. If true, the query will keep running and will return results based + on the available shards. For sequences, the behavior can be further refined + using allow_partial_sequence_results + :param allow_partial_sequence_results: This flag applies only to sequences and + has effect only if allow_partial_search_results=true. If true, the sequence + query will return results based on the available shards, ignoring the others. + If false, the sequence query will return successfully, but will always have + empty results. :param case_sensitive: :param event_category_field: Field containing the event classification, such as process, file, or network. diff --git a/elasticsearch/_async/client/esql.py b/elasticsearch/_async/client/esql.py index bfdda5bbf..6bad89d14 100644 --- a/elasticsearch/_async/client/esql.py +++ b/elasticsearch/_async/client/esql.py @@ -298,6 +298,61 @@ async def async_query_get( path_parts=__path_parts, ) + @_rewrite_parameters() + async def async_query_stop( + self, + *, + id: str, + drop_null_columns: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Stop async ES|QL query.

+

This API interrupts the query execution and returns the results so far. + If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it.

+ + + ``_ + + :param id: The unique identifier of the query. A query ID is provided in the + ES|QL async query API response for a query that does not complete in the + designated time. A query ID is also provided when the request was submitted + with the `keep_on_completion` parameter set to `true`. + :param drop_null_columns: Indicates whether columns that are entirely `null` + will be removed from the `columns` and `values` portion of the results. If + `true`, the response will include an extra section under the name `all_columns` + which has the name of all the columns. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_query/async/{__path_parts["id"]}/stop' + __query: t.Dict[str, t.Any] = {} + if drop_null_columns is not None: + __query["drop_null_columns"] = drop_null_columns + 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] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_stop", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "query", diff --git a/elasticsearch/_async/client/features.py b/elasticsearch/_async/client/features.py index 7615ddddf..8cd9d7b9e 100644 --- a/elasticsearch/_async/client/features.py +++ b/elasticsearch/_async/client/features.py @@ -102,7 +102,7 @@ async def reset_features(

IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes.

- ``_ + ``_ :param master_timeout: Period to wait for a connection to the master node. """ diff --git a/elasticsearch/_async/client/fleet.py b/elasticsearch/_async/client/fleet.py index acdb046de..2cc830efe 100644 --- a/elasticsearch/_async/client/fleet.py +++ b/elasticsearch/_async/client/fleet.py @@ -48,7 +48,9 @@ async def global_checkpoints( """ .. raw:: html -

Returns the current global checkpoints for an index. This API is design for internal use by the fleet server project.

+

Get global checkpoints.

+

Get the current global checkpoints for an index. + This API is designed for internal use by the Fleet server project.

``_ @@ -141,6 +143,8 @@ async def msearch( supports the wait_for_checkpoints parameter.

+ ``_ + :param searches: :param index: A single target to search. If the target is an index alias, it must resolve to a single index. @@ -388,6 +392,8 @@ async def search( after provided checkpoint has been processed and is visible for searches inside of Elasticsearch.

+ ``_ + :param index: A single target to search. If the target is an index alias, it must resolve to a single index. :param aggregations: diff --git a/elasticsearch/_async/client/ilm.py b/elasticsearch/_async/client/ilm.py index 482bb3fdd..d483797d0 100644 --- a/elasticsearch/_async/client/ilm.py +++ b/elasticsearch/_async/client/ilm.py @@ -214,8 +214,8 @@ async def get_status( """ .. raw:: html -

Get the ILM status. - Get the current index lifecycle management status.

+

Get the ILM status.

+

Get the current index lifecycle management status.

``_ diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index 02b315efb..244063cb9 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -57,23 +57,40 @@ async def add_block( """ .. raw:: html -

Add an index block. - Limits the operations allowed on an index by blocking specific operation types.

+

Add an index block.

+

Add an index block to an index. + Index blocks limit the operations allowed on an index by blocking specific operation types.

- ``_ + ``_ - :param index: A comma separated list of indices to add a block to - :param block: The block to add (one of read, write, read_only or metadata) - :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 ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :param index: A comma-separated list or wildcard expression of index names used + to limit the request. By default, you must explicitly name the indices you + are adding blocks to. To allow the adding of blocks to indices with `_all`, + `*`, or other wildcard expressions, change the `action.destructive_requires_name` + setting to `false`. You can update this setting in the `elasticsearch.yml` + file or by using the cluster update settings API. + :param block: The block type to add to the index. + :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: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. It can also be set to `-1` to indicate that the request should + never timeout. + :param timeout: The period to wait for a response from all relevant nodes in + the cluster after updating the cluster metadata. If no response is received + before the timeout expires, the cluster metadata update still applies but + the response will indicate that it was not completely acknowledged. It can + also be set to `-1` to indicate that the request should never timeout. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -710,12 +727,11 @@ async def create_data_stream( """ .. raw:: html -

Create a data stream. - Creates a data stream. - You must have a matching index template with data stream enabled.

+

Create a data stream.

+

You must have a matching index template with data stream enabled.

- ``_ + ``_ :param name: Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include `\\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, @@ -841,11 +857,11 @@ async def data_streams_stats( """ .. raw:: html -

Get data stream stats. - Retrieves statistics for one or more data streams.

+

Get data stream stats.

+

Get statistics for one or more data streams.

- ``_ + ``_ :param name: Comma-separated list of data streams used to limit the request. Wildcard expressions (`*`) are supported. To target all data streams in a @@ -1120,7 +1136,7 @@ async def delete_data_stream( Deletes one or more data streams and their backing indices.

- ``_ + ``_ :param name: Comma-separated list of data streams to delete. Wildcard (`*`) expressions are supported. @@ -1538,11 +1554,11 @@ async def exists_alias( """ .. raw:: html -

Check aliases. - Checks if one or more data stream or index aliases exist.

+

Check aliases.

+

Check if one or more data stream or index aliases exist.

- ``_ + ``_ :param name: Comma-separated list of aliases to check. Supports wildcards (`*`). :param index: Comma-separated list of data streams or indices used to limit the @@ -1612,11 +1628,11 @@ async def exists_index_template( """ .. raw:: html -

Check index templates. - Check whether index templates exist.

+

Check index templates.

+

Check whether index templates exist.

- ``_ + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. @@ -2287,8 +2303,8 @@ async def get_data_lifecycle( """ .. raw:: html -

Get data stream lifecycles. - Retrieves the data stream lifecycle configuration of one or more data streams.

+

Get data stream lifecycles.

+

Get the data stream lifecycle configuration of one or more data streams.

``_ @@ -2396,11 +2412,11 @@ async def get_data_stream( """ .. raw:: html -

Get data streams. - Retrieves information about one or more data streams.

+

Get data streams.

+

Get information about one or more data streams.

- ``_ + ``_ :param name: Comma-separated list of data stream names used to limit the request. Wildcard (`*`) expressions are supported. If omitted, all data streams are @@ -4255,7 +4271,7 @@ async def reload_search_analyzers( async def resolve_cluster( self, *, - name: t.Union[str, t.Sequence[str]], + name: t.Optional[t.Union[str, t.Sequence[str]]] = None, allow_no_indices: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ @@ -4271,19 +4287,20 @@ async def resolve_cluster( ignore_throttled: t.Optional[bool] = None, ignore_unavailable: t.Optional[bool] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html -

Resolve the cluster. - Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - Multiple patterns and remote clusters are supported.

+

Resolve the cluster.

+

Resolve the specified index expressions to return information about each cluster, including the local "querying" cluster, if included. + If no index expression is provided, the API will return information about all the remote clusters that are configured on the querying cluster.

This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search.

You use the same index expression with this endpoint as you would for cross-cluster search. Index and cluster exclusions are also supported with this endpoint.

For each cluster in the index expression, information is returned about:

    -
  • Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope.
  • +
  • Whether the querying ("local") cluster is currently connected to each remote cluster specified in the index expression. Note that this endpoint actively attempts to contact the remote clusters, unlike the remote/info endpoint.
  • Whether each remote cluster is configured with skip_unavailable as true or false.
  • Whether there are any indices, aliases, or data streams on that cluster that match the index expression.
  • Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index).
  • @@ -4291,7 +4308,13 @@ async def resolve_cluster(

For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*.

-

Advantages of using this endpoint before a cross-cluster search

+

Note on backwards compatibility

+

The ability to query without an index expression was added in version 8.18, so when + querying remote clusters older than that, the local cluster will send the index + expression dummy* to those remote clusters. Thus, if an errors occur, you may see a reference + to that index expression even though you didn't request it. If it causes a problem, you can + instead include an index expression like *:* to bypass the issue.

+

Advantages of using this endpoint before a cross-cluster search

You may want to exclude a cluster or index from a search when:

  • A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail.
  • @@ -4299,31 +4322,60 @@ async def resolve_cluster(
  • The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.)
  • A remote cluster is an older version that does not support the feature you want to use in your search.
+

Test availability of remote clusters

+

The remote/info endpoint is commonly used to test whether the "local" cluster (the cluster being queried) is connected to its remote clusters, but it does not necessarily reflect whether the remote cluster is available or not. + The remote cluster may be available, while the local cluster is not currently connected to it.

+

You can use the _resolve/cluster API to attempt to reconnect to remote clusters. + For example with GET _resolve/cluster or GET _resolve/cluster/*:*. + The connected field in the response will indicate whether it was successful. + If a connection was (re-)established, this will also cause the remote/info endpoint to now indicate a connected status.

``_ - :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, - and data streams to resolve. Resources on remote clusters can be specified - using the ``:`` syntax. + :param name: A comma-separated list of names or index patterns for the indices, + aliases, and data streams to resolve. Resources on remote clusters can be + specified using the ``:`` syntax. Index and cluster exclusions + (e.g., `-cluster1:*`) are also supported. If no index expression is specified, + information about all remote clusters configured on the local cluster is + returned without doing any index matching :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. + 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. + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. NOTE: This option is only supported + when specifying an index expression. You will get an error if you specify + index options to the `_resolve/cluster` API endpoint that takes no index + expression. :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`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. - :param ignore_throttled: If true, concrete, expanded or aliased indices are ignored - when frozen. Defaults to false. + NOTE: This option is only supported when specifying an index expression. + You will get an error if you specify index options to the `_resolve/cluster` + API endpoint that takes no index expression. + :param ignore_throttled: If true, concrete, expanded, or aliased indices are + ignored when frozen. NOTE: This option is only supported when specifying + an index expression. You will get an error if you specify index options to + the `_resolve/cluster` API endpoint that takes no index expression. :param ignore_unavailable: If false, the request returns an error if it targets - a missing or closed index. Defaults to false. + a missing or closed index. NOTE: This option is only supported when specifying + an index expression. You will get an error if you specify index options to + the `_resolve/cluster` API endpoint that takes no index expression. + :param timeout: The maximum time to wait for remote clusters to respond. If a + remote cluster does not respond within this timeout period, the API response + will show the cluster as not connected and include an error message that + the request timed out. The default timeout is unset and the query can take + as long as the networking layer is configured to wait for remote clusters + that are not responding (typically 30 seconds). """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for parameter 'name'") - __path_parts: t.Dict[str, str] = {"name": _quote(name)} - __path = f'/_resolve/cluster/{__path_parts["name"]}' + __path_parts: t.Dict[str, str] + if name not in SKIP_IN_PATH: + __path_parts = {"name": _quote(name)} + __path = f'/_resolve/cluster/{__path_parts["name"]}' + else: + __path_parts = {} + __path = "/_resolve/cluster" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -4341,6 +4393,8 @@ async def resolve_cluster( __query["ignore_unavailable"] = ignore_unavailable if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "GET", diff --git a/elasticsearch/_async/client/inference.py b/elasticsearch/_async/client/inference.py index f85857b8b..804e920b6 100644 --- a/elasticsearch/_async/client/inference.py +++ b/elasticsearch/_async/client/inference.py @@ -51,12 +51,12 @@ async def delete( ``_ - :param inference_id: The inference Id + :param inference_id: The inference identifier. :param task_type: The task type - :param dry_run: When true, the endpoint is not deleted, and a list of ingest - processors which reference this endpoint is returned + :param dry_run: When true, the endpoint is not deleted and a list of ingest processors + which reference this endpoint is returned. :param force: When true, the inference endpoint is forcefully deleted even if - it is still being used by ingest processors or semantic text fields + it is still being used by ingest processors or semantic text fields. """ if inference_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'inference_id'") @@ -180,18 +180,29 @@ async def inference( """ .. raw:: html -

Perform inference on the service

+

Perform inference on the service.

+

This API enables you to use machine learning models to perform specific tasks on data that you provide as an input. + It returns a response with the results of the tasks. + The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API.

+
+

info + The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.

+
``_ - :param inference_id: The inference Id - :param input: Inference input. Either a string or an array of strings. - :param task_type: The task type - :param query: Query input, required for rerank task. Not required for other tasks. - :param task_settings: Optional task settings - :param timeout: Specifies the amount of time to wait for the inference request - to complete. + :param inference_id: The unique identifier for the inference endpoint. + :param input: The text on which you want to perform the inference task. It can + be a single string or an array. > info > Inference endpoints for the `completion` + task type currently only support a single string as input. + :param task_type: The type of inference task that the model performs. + :param query: The query input, which is required only for the `rerank` task. + It is not required for other tasks. + :param task_settings: Task settings for the individual inference request. These + settings are specific to the task type you specified and override the task + settings specified when initializing the service. + :param timeout: The amount of time to wait for the inference request to complete. """ if inference_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'inference_id'") diff --git a/elasticsearch/_async/client/ingest.py b/elasticsearch/_async/client/ingest.py index 469be28e6..69792566c 100644 --- a/elasticsearch/_async/client/ingest.py +++ b/elasticsearch/_async/client/ingest.py @@ -40,18 +40,18 @@ async def delete_geoip_database( """ .. raw:: html -

Delete GeoIP database configurations. - Delete one or more IP geolocation database configurations.

+

Delete GeoIP database configurations.

+

Delete one or more IP geolocation database configurations.

- ``_ + ``_ :param id: A comma-separated list of geoip database configurations to delete - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -244,15 +244,15 @@ async def get_geoip_database( """ .. raw:: html -

Get GeoIP database configurations. - Get information about one or more IP geolocation database configurations.

+

Get GeoIP database configurations.

+

Get information about one or more IP geolocation database configurations.

- ``_ + ``_ - :param id: Comma-separated list of database configuration IDs to retrieve. Wildcard - (`*`) expressions are supported. To get all database configurations, omit - this parameter or use `*`. + :param id: A comma-separated list of database configuration IDs to retrieve. + Wildcard (`*`) expressions are supported. To get all database configurations, + omit this parameter or use `*`. """ __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: @@ -350,8 +350,8 @@ async def get_pipeline( """ .. raw:: html -

Get pipelines. - Get information about one or more ingest pipelines. +

Get pipelines.

+

Get information about one or more ingest pipelines. This API returns a local reference of the pipeline.

@@ -455,11 +455,11 @@ async def put_geoip_database( """ .. raw:: html -

Create or update a GeoIP database configuration. - Refer to the create or update IP geolocation database configuration API.

+

Create or update a GeoIP database configuration.

+

Refer to the create or update IP geolocation database configuration API.

- ``_ + ``_ :param id: ID of the database configuration to create or update. :param maxmind: The configuration necessary to identify which IP geolocation @@ -712,17 +712,17 @@ async def simulate( """ .. raw:: html -

Simulate a pipeline. - Run an ingest pipeline against a set of provided documents. +

Simulate a pipeline.

+

Run an ingest pipeline against a set of provided documents. You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request.

``_ :param docs: Sample documents to test in the pipeline. - :param id: Pipeline to test. If you don’t specify a `pipeline` in the request + :param id: The pipeline to test. If you don't specify a `pipeline` in the request body, this parameter is required. - :param pipeline: Pipeline to test. If you don’t specify the `pipeline` request + :param pipeline: The pipeline to test. If you don't specify the `pipeline` request path parameter, this parameter is required. If you specify both this and the request path parameter, the API only uses the request path parameter. :param verbose: If `true`, the response includes output data for each processor diff --git a/elasticsearch/_async/client/license.py b/elasticsearch/_async/client/license.py index cc3827cce..aac236243 100644 --- a/elasticsearch/_async/client/license.py +++ b/elasticsearch/_async/client/license.py @@ -39,16 +39,16 @@ async def delete( """ .. raw:: html -

Delete the license. - When the license expires, your subscription level reverts to Basic.

+

Delete the license.

+

When the license expires, your subscription level reverts to Basic.

If the operator privileges feature is enabled, only operator users can use this API.

``_ - :param master_timeout: Period to wait for a connection to the master node. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param master_timeout: The period to wait for a connection to the master node. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_license" @@ -89,10 +89,13 @@ async def get( """ .. raw:: html -

Get license information. - Get information about your Elastic license including its type, its status, when it was issued, and when it expires.

-

NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. +

Get license information.

+

Get information about your Elastic license including its type, its status, when it was issued, and when it expires.

+
+

info + If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request.

+
``_ @@ -225,8 +228,8 @@ async def post( """ .. raw:: html -

Update the license. - You can update your license at runtime without shutting down your nodes. +

Update the license.

+

You can update your license at runtime without shutting down your nodes. License updates take effect immediately. If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. You must then re-submit the API request with the acknowledge parameter set to true.

@@ -240,9 +243,9 @@ async def post( :param license: :param licenses: A sequence of one or more JSON documents containing the license information. - :param master_timeout: Period to wait for a connection to the master node. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param master_timeout: The period to wait for a connection to the master node. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_license" @@ -297,8 +300,8 @@ async def post_start_basic( """ .. raw:: html -

Start a basic license. - Start an indefinite basic license, which gives access to all the basic features.

+

Start a basic license.

+

Start an indefinite basic license, which gives access to all the basic features.

NOTE: In order to start a basic license, you must not currently have a basic license.

If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. You must then re-submit the API request with the acknowledge parameter set to true.

diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index dfc4ddc32..6c752b15e 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -38,8 +38,8 @@ async def clear_trained_model_deployment_cache( """ .. raw:: html -

Clear trained model deployment cache. - Cache will be cleared on all nodes where the trained model is assigned. +

Clear trained model deployment cache.

+

Cache will be cleared on all nodes where the trained model is assigned. A trained model deployment may have an inference cache enabled. As requests are handled by each allocated node, their responses may be cached on that individual node. Calling this API clears the caches without restarting the deployment.

@@ -93,8 +93,8 @@ async def close_job( """ .. raw:: html -

Close anomaly detection jobs. - A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. +

Close anomaly detection jobs.

+

A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. When a datafeed that has a specified end date stops, it automatically closes its associated job.

@@ -161,8 +161,8 @@ async def delete_calendar( """ .. raw:: html -

Delete a calendar. - Removes all scheduled events from a calendar, then deletes it.

+

Delete a calendar.

+

Remove all scheduled events from a calendar, then delete it.

``_ @@ -415,15 +415,15 @@ async def delete_expired_data( """ .. raw:: html -

Delete expired ML data. - Deletes all job results, model snapshots and forecast data that have exceeded +

Delete expired ML data.

+

Delete all job results, model snapshots and forecast data that have exceeded their retention days period. Machine learning state documents that are not associated with any job are also deleted. You can limit the request to a single or set of anomaly detection jobs by using a job identifier, a group name, a comma-separated list of jobs, or a wildcard expression. You can delete expired data for all anomaly detection - jobs by using _all, by specifying * as the <job_id>, or by omitting the - <job_id>.

+ jobs by using _all, by specifying * as the <job_id>, or by omitting the + <job_id>.

``_ @@ -485,8 +485,8 @@ async def delete_filter( """ .. raw:: html -

Delete a filter. - If an anomaly detection job references the filter, you cannot delete the +

Delete a filter.

+

If an anomaly detection job references the filter, you cannot delete the filter. You must update or delete the job before you can delete the filter.

@@ -533,8 +533,8 @@ async def delete_forecast( """ .. raw:: html -

Delete forecasts from a job. - By default, forecasts are retained for 14 days. You can specify a +

Delete forecasts from a job.

+

By default, forecasts are retained for 14 days. You can specify a different retention period with the expires_in parameter in the forecast jobs API. The delete forecast API enables you to delete one or more forecasts before they expire.

@@ -607,8 +607,8 @@ async def delete_job( """ .. raw:: html -

Delete an anomaly detection job. - All job configuration, model state and results are deleted. +

Delete an anomaly detection job.

+

All job configuration, model state and results are deleted. It is not currently possible to delete multiple jobs using wildcards or a comma separated list. If you delete a job that has a datafeed, the request first tries to delete the datafeed. This behavior is equivalent to calling @@ -670,8 +670,8 @@ async def delete_model_snapshot( """ .. raw:: html -

Delete a model snapshot. - You cannot delete the active model snapshot. To delete that snapshot, first +

Delete a model snapshot.

+

You cannot delete the active model snapshot. To delete that snapshot, first revert to a different one. To identify the active model snapshot, refer to the model_snapshot_id in the results from the get jobs API.

@@ -724,8 +724,8 @@ async def delete_trained_model( """ .. raw:: html -

Delete an unreferenced trained model. - The request deletes a trained inference model that is not referenced by an ingest pipeline.

+

Delete an unreferenced trained model.

+

The request deletes a trained inference model that is not referenced by an ingest pipeline.

``_ @@ -777,8 +777,8 @@ async def delete_trained_model_alias( """ .. raw:: html -

Delete a trained model alias. - This API deletes an existing model alias that refers to a trained model. If +

Delete a trained model alias.

+

This API deletes an existing model alias that refers to a trained model. If the model alias is missing or refers to a model other than the one identified by the model_id, this API returns an error.

@@ -838,13 +838,13 @@ async def estimate_model_memory( """ .. raw:: html -

Estimate job model memory usage. - Makes an estimation of the memory usage for an anomaly detection job model. - It is based on analysis configuration details for the job and cardinality +

Estimate job model memory usage.

+

Make an estimation of the memory usage for an anomaly detection job model. + The estimate is based on analysis configuration details for the job and cardinality estimates for the fields it references.

- ``_ + ``_ :param analysis_config: For a list of the properties that you can specify in the `analysis_config` component of the body of this API. @@ -909,8 +909,8 @@ async def evaluate_data_frame( """ .. raw:: html -

Evaluate data frame analytics. - The API packages together commonly used evaluation metrics for various types +

Evaluate data frame analytics.

+

The API packages together commonly used evaluation metrics for various types of machine learning features. This has been designed for use on indexes created by data frame analytics. Evaluation requires both a ground truth field and an analytics result field to be present.

@@ -990,8 +990,8 @@ async def explain_data_frame_analytics( """ .. raw:: html -

Explain data frame analytics config. - This API provides explanations for a data frame analytics config that either +

Explain data frame analytics config.

+

This API provides explanations for a data frame analytics config that either exists already or one that has not been created yet. The following explanations are provided:

    @@ -2891,8 +2891,8 @@ async def open_job( """ .. raw:: html -

    Open anomaly detection jobs. - An anomaly detection job must be opened to be ready to receive and analyze +

    Open anomaly detection jobs.

    +

    An anomaly detection job must be opened to be ready to receive and analyze data. It can be opened and closed multiple times throughout its lifecycle. When you open a new job, it starts with an empty model. When you open an existing job, the most recent model state is automatically @@ -3082,7 +3082,7 @@ async def preview_data_frame_analytics( .. raw:: html

    Preview features used by data frame analytics. - Previews the extracted features used by a data frame analytics config.

    + Preview the extracted features used by a data frame analytics config.

    ``_ @@ -3821,8 +3821,8 @@ async def put_job( """ .. raw:: html -

    Create an anomaly detection job. - If you include a datafeed_config, you must have read index privileges on the source index. +

    Create an anomaly detection job.

    +

    If you include a datafeed_config, you must have read index privileges on the source index. If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}.

    @@ -5619,7 +5619,7 @@ async def upgrade_job_snapshot( .. raw:: html

    Upgrade a snapshot. - Upgrades an anomaly detection model snapshot to the latest major version. + Upgrade an anomaly detection model snapshot to the latest major version. Over time, older snapshot formats are deprecated and removed. Anomaly detection jobs support only snapshots that are from the current or previous major version. @@ -5782,7 +5782,7 @@ async def validate_detector(

    Validate an anomaly detection job.

    - ``_ + ``_ :param detector: """ diff --git a/elasticsearch/_async/client/monitoring.py b/elasticsearch/_async/client/monitoring.py index d5e5b5252..761e772f4 100644 --- a/elasticsearch/_async/client/monitoring.py +++ b/elasticsearch/_async/client/monitoring.py @@ -48,7 +48,7 @@ async def bulk( This API is used by the monitoring features to send monitoring data.

    - ``_ + ``_ :param interval: Collection interval (e.g., '10s' or '10000ms') of the payload :param operations: diff --git a/elasticsearch/_async/client/nodes.py b/elasticsearch/_async/client/nodes.py index 99d8fb209..ff8c7b321 100644 --- a/elasticsearch/_async/client/nodes.py +++ b/elasticsearch/_async/client/nodes.py @@ -231,8 +231,8 @@ async def info( """ .. raw:: html -

    Get node information. - By default, the API returns all attributes and core settings for cluster nodes.

    +

    Get node information.

    +

    By default, the API returns all attributes and core settings for cluster nodes.

    ``_ @@ -308,7 +308,7 @@ async def reload_secure_settings( Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.

    - ``_ + ``_ :param node_id: The names of particular nodes in the cluster to target. :param secure_settings_password: The password for the Elasticsearch keystore. diff --git a/elasticsearch/_async/client/search_application.py b/elasticsearch/_async/client/search_application.py index 724ccdcff..a517db976 100644 --- a/elasticsearch/_async/client/search_application.py +++ b/elasticsearch/_async/client/search_application.py @@ -45,13 +45,13 @@ async def delete( """ .. raw:: html -

    Delete a search application. - Remove a search application and its associated alias. Indices attached to the search application are not removed.

    +

    Delete a search application.

    +

    Remove a search application and its associated alias. Indices attached to the search application are not removed.

    ``_ - :param name: The name of the search application to delete + :param name: The name of the search application to delete. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -234,7 +234,7 @@ async def list( Get information about search applications.

    - ``_ + ``_ :param from_: Starting offset. :param q: Query in the Lucene query string syntax. diff --git a/elasticsearch/_async/client/transform.py b/elasticsearch/_async/client/transform.py index ae7e846d5..7b134118b 100644 --- a/elasticsearch/_async/client/transform.py +++ b/elasticsearch/_async/client/transform.py @@ -41,8 +41,7 @@ async def delete_transform( """ .. raw:: html -

    Delete a transform. - Deletes a transform.

    +

    Delete a transform.

    ``_ @@ -106,7 +105,7 @@ async def get_transform( .. raw:: html

    Get transforms. - Retrieves configuration information for transforms.

    + Get configuration information for transforms.

    ``_ @@ -178,8 +177,8 @@ async def get_transform_stats( """ .. raw:: html -

    Get transform stats. - Retrieves usage information for transforms.

    +

    Get transform stats.

    +

    Get usage information for transforms.

    ``_ @@ -508,9 +507,8 @@ async def reset_transform( """ .. raw:: html -

    Reset a transform. - Resets a transform. - Before you can reset it, you must stop it; alternatively, use the force query parameter. +

    Reset a transform.

    +

    Before you can reset it, you must stop it; alternatively, use the force query parameter. If the destination index was created by the transform, it is deleted.

    @@ -566,11 +564,11 @@ async def schedule_now_transform( """ .. raw:: html -

    Schedule a transform to start now. - Instantly runs a transform to process data.

    -

    If you _schedule_now a transform, it will process the new data instantly, - without waiting for the configured frequency interval. After _schedule_now API is called, - the transform will be processed again at now + frequency unless _schedule_now API +

    Schedule a transform to start now.

    +

    Instantly run a transform to process data. + If you run this API, the transform will process the new data instantly, + without waiting for the configured frequency interval. After the API is called, + the transform will be processed again at now + frequency unless the API is called again in the meantime.

    @@ -621,8 +619,7 @@ async def start_transform( """ .. raw:: html -

    Start a transform. - Starts a transform.

    +

    Start a transform.

    When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping definitions for the destination index from the source indices and the transform aggregations. If fields in the @@ -879,8 +876,8 @@ async def upgrade_transforms( """ .. raw:: html -

    Upgrade all transforms. - Transforms are compatible across minor versions and between supported major versions. +

    Upgrade all transforms.

    +

    Transforms are compatible across minor versions and between supported major versions. However, over time, the format of transform configuration information may change. This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. It also cleans up the internal data structures that store the transform state and checkpoints. diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 67187220a..705a3914d 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -626,6 +626,7 @@ def bulk( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + include_source_on_error: t.Optional[bool] = None, list_executed_pipelines: t.Optional[bool] = None, pipeline: t.Optional[str] = None, pretty: t.Optional[bool] = None, @@ -733,6 +734,8 @@ def bulk( :param operations: :param index: The name of the data stream, index, or index alias to perform bulk actions on. + :param include_source_on_error: True or false if to include the document source + in the error message in case of parsing errors. :param list_executed_pipelines: If `true`, the response will include the ingest pipelines that were run for each index or create. :param pipeline: The pipeline identifier to use to preprocess incoming documents. @@ -790,6 +793,8 @@ def bulk( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if include_source_on_error is not None: + __query["include_source_on_error"] = include_source_on_error if list_executed_pipelines is not None: __query["list_executed_pipelines"] = list_executed_pipelines if pipeline is not None: @@ -982,8 +987,8 @@ def count(

    Count search results. Get the number of documents matching a query.

    -

    The query can either be provided using a simple query string as a parameter or using the Query DSL defined within the request body. - The latter must be nested in a query key, which is the same as the search API.

    +

    The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. + The query is optional. When no query is provided, the API uses match_all to count all the documents.

    The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices.

    The operation is broadcast across all shards. For each shard ID group, a replica is chosen and the search is run against it. @@ -1025,10 +1030,10 @@ def count( in the result. :param preference: The node or shard the operation should be performed on. By default, it is random. - :param q: The query in Lucene query string syntax. - :param query: Defines the search definition using the Query DSL. The query is - optional, and when not provided, it will use `match_all` to count all the - docs. + :param q: The query in Lucene query string syntax. This parameter cannot be used + with a request body. + :param query: Defines the search query using Query DSL. A request body query + cannot be used with the `q` query string parameter. :param routing: A custom value used to route operations to a specific shard. :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. @@ -1114,6 +1119,7 @@ def create( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + include_source_on_error: t.Optional[bool] = None, pipeline: t.Optional[str] = None, pretty: t.Optional[bool] = None, refresh: t.Optional[ @@ -1196,6 +1202,8 @@ def create( :param id: A unique identifier for the document. To automatically generate a document ID, use the `POST //_doc/` request format. :param document: + :param include_source_on_error: True or false if to include the document source + in the error message in case of parsing errors. :param pipeline: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. If a final @@ -1244,6 +1252,8 @@ def create( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if include_source_on_error is not None: + __query["include_source_on_error"] = include_source_on_error if pipeline is not None: __query["pipeline"] = pipeline if pretty is not None: @@ -1762,14 +1772,16 @@ def delete_script( Deletes a stored script or search template.

    - ``_ + ``_ - :param id: Identifier for the stored script or search template. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param id: The identifier for the stored script or search template. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. It can also be set to `-1` to indicate that the request + should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. It can + also be set to `-1` to indicate that the request should never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -2069,34 +2081,44 @@ def explain( .. raw:: html

    Explain a document match result. - Returns information about why a specific document matches, or doesn’t match, a query.

    + Get information about why a specific document matches, or doesn't match, a query. + It computes a score explanation for a query and a specific document.

    ``_ - :param index: Index names used to limit the request. Only a single index name - can be provided to this parameter. - :param id: Defines the document ID. + :param index: Index names that are used to limit the request. Only a single index + name can be provided to this parameter. + :param id: The document identifier. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the `q` query string parameter is specified. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: The query in the Lucene query string syntax. :param query: Defines the search definition using the Query DSL. - :param routing: Custom value used to route operations to a specific shard. - :param source: True or false to return the `_source` field or not, or a list + :param routing: A custom value used to route operations to a specific shard. + :param source: `True` or `false` to return the `_source` field or not or a list of fields to return. :param source_excludes: A comma-separated list of source fields to exclude from - the response. + 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. + 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 stored_fields: A comma-separated list of stored fields to return in the response. """ @@ -2200,7 +2222,7 @@ def field_caps( ``_ - :param index: Comma-separated list of data streams, indices, and aliases used + :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. :param allow_no_indices: If false, the request returns an error if any wildcard @@ -2208,25 +2230,32 @@ def field_caps( 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 fields: List of fields to retrieve capabilities for. Wildcard (`*`) expressions - are supported. - :param filters: An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. Supports comma-separated + values, such as `open,hidden`. + :param fields: A list of fields to retrieve capabilities for. Wildcard (`*`) + expressions are supported. + :param filters: A comma-separated list of filters to apply to the response. :param ignore_unavailable: If `true`, missing or closed indices are not included in the response. :param include_empty_fields: If false, empty fields are not included in the response. :param include_unmapped: If true, unmapped fields are included in the response. - :param index_filter: Allows to filter indices if the provided query rewrites - to match_none on every shard. - :param runtime_mappings: Defines ad-hoc runtime fields in the request similar + :param index_filter: Filter indices if the provided query rewrites to `match_none` + on every shard. IMPORTANT: The filtering is done on a best-effort basis, + it uses index statistics and mappings to rewrite queries to `match_none` + instead of fully running the request. For instance a range query over a date + field can rewrite to `match_none` if all documents within a shard (including + deleted documents) are outside of the provided range. However, not all queries + can rewrite to `match_none` so this API may return an index even if the provided + filter matches no document. + :param runtime_mappings: Define ad-hoc runtime fields in the request similar to the way it is done in search requests. These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. - :param types: Only return results for fields that have one of the types in the - list + :param types: A comma-separated list of field types to include. Any fields that + do not match one of these types will be excluded from the results. It defaults + to empty, meaning that all field types are returned. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -2459,10 +2488,13 @@ def get_script( Retrieves a stored script or search template.

    - ``_ + ``_ - :param id: Identifier for the stored script or search template. - :param master_timeout: Specify timeout for connection to master + :param id: The identifier for the stored script or search template. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. It can also be set to `-1` to indicate that the request should + never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -2505,7 +2537,7 @@ def get_script_context(

    Get a list of supported script contexts and their methods.

    - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_context" @@ -2544,7 +2576,7 @@ def get_script_languages(

    Get a list of available script types, languages, and contexts.

    - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_language" @@ -2764,6 +2796,7 @@ def index( human: t.Optional[bool] = None, if_primary_term: t.Optional[int] = None, if_seq_no: t.Optional[int] = None, + include_source_on_error: t.Optional[bool] = None, op_type: t.Optional[t.Union[str, t.Literal["create", "index"]]] = None, pipeline: t.Optional[str] = None, pretty: t.Optional[bool] = None, @@ -2889,6 +2922,8 @@ def index( term. :param if_seq_no: Only perform the operation if the document has this sequence number. + :param include_source_on_error: True or false if to include the document source + in the error message in case of parsing errors. :param op_type: Set to `create` to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. The behavior is the same as using the `/_create` @@ -2953,6 +2988,8 @@ def index( __query["if_primary_term"] = if_primary_term if if_seq_no is not None: __query["if_seq_no"] = if_seq_no + if include_source_on_error is not None: + __query["include_source_on_error"] = include_source_on_error if op_type is not None: __query["op_type"] = op_type if pipeline is not None: @@ -3067,30 +3104,37 @@ def knn_search( This means the results returned are not always the true k closest neighbors.

    The kNN search API supports restricting the search using a filter. The search will return the top k documents that also match the filter query.

    +

    A kNN search response has the exact same structure as a search API response. + However, certain sections have a meaning specific to kNN search:

    +
      +
    • The document _score is determined by the similarity between the query and document vector.
    • +
    • The hits.total object contains the total number of nearest neighbor candidates considered, which is num_candidates * num_shards. The hits.total.relation will always be eq, indicating an exact value.
    • +
    - ``_ + ``_ :param index: A comma-separated list of index names to search; use `_all` or - to perform the operation on all indices - :param knn: kNN query to execute + to perform the operation on all indices. + :param knn: The kNN query to run. :param docvalue_fields: The request returns doc values for field names matching - these patterns in the hits.fields property of the response. Accepts wildcard - (*) patterns. + these patterns in the `hits.fields` property of the response. It accepts + wildcard (`*`) patterns. :param fields: The request returns values for field names matching these patterns - in the hits.fields property of the response. Accepts wildcard (*) patterns. - :param filter: Query to filter the documents that can match. The kNN search will - return the top `k` documents that also match this filter. The value can be - a single query or a list of queries. If `filter` isn't provided, all documents - are allowed to match. - :param routing: A comma-separated list of specific routing values + in the `hits.fields` property of the response. It accepts wildcard (`*`) + patterns. + :param filter: A query to filter the documents that can match. The kNN search + will return the top `k` documents that also match this filter. The value + can be a single query or a list of queries. If `filter` isn't provided, all + documents are allowed to match. + :param routing: A comma-separated list of specific routing values. :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 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. + These fields are returned in the `hits._source` property of the search response. + :param stored_fields: A list of stored fields to return as part of a hit. If + no fields are specified, no stored fields are included in the response. If + this field is specified, the `_source` parameter defaults to `false`. You + can pass `_source: true` to return both source fields and stored fields in + the search response. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3174,6 +3218,14 @@ def mget(

    Get multiple JSON documents by ID from one or more indices. If you specify an index in the request URI, you only need to specify the document IDs in the request body. To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.

    +

    Filter source fields

    +

    By default, the _source field is returned for every document (if stored). + Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. + You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions.

    +

    Get stored fields

    +

    Use the stored_fields attribute to specify the set of stored fields you want to retrieve. + Any requested fields that are not stored are ignored. + You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions.

    ``_ @@ -3444,22 +3496,32 @@ def msearch_template( .. raw:: html

    Run multiple templated searches.

    +

    Run multiple templated searches with a single request. + If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. + For example:

    +
    $ cat requests
    +          { "index": "my-index" }
    +          { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }}
    +          { "index": "my-other-index" }
    +          { "id": "my-other-search-template", "params": { "query_type": "match_all" }}
    +
    +          $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo
    +          
    - ``_ + ``_ :param search_templates: - :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 `*`. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*`. :param ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. - :param max_concurrent_searches: Maximum number of concurrent searches the API - can run. + :param max_concurrent_searches: The maximum number of concurrent searches the + API can run. :param rest_total_hits_as_int: If `true`, the response returns `hits.total` as an integer. If `false`, it returns `hits.total` as an object. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param search_type: The type of the search operation. :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ @@ -3542,34 +3604,38 @@ def mtermvectors( .. raw:: html

    Get multiple term vectors.

    -

    You can specify existing documents by index and ID or provide artificial documents in the body of the request. +

    Get multiple term vectors with a single request. + You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a docs array with all the fetched termvectors. Each element has the structure provided by the termvectors API.

    +

    Artificial documents

    +

    You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. + The mapping used is determined by the specified _index.

    ``_ - :param index: Name of the index that contains the documents. - :param docs: Array of existing or artificial documents. + :param index: The name of the index that contains the documents. + :param docs: An array of existing or artificial documents. :param field_statistics: If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. - :param fields: Comma-separated list or wildcard expressions of fields to include - in the statistics. Used as the default list unless a specific field list - is provided in the `completion_fields` or `fielddata_fields` parameters. - :param ids: Simplified syntax to specify documents by their ID if they're in + :param fields: A comma-separated list or wildcard expressions of fields to include + in the statistics. It is used as the default list unless a specific field + list is provided in the `completion_fields` or `fielddata_fields` parameters. + :param ids: A simplified syntax to specify documents by their ID if they're in the same index. :param offsets: If `true`, the response includes term offsets. :param payloads: If `true`, the response includes term payloads. :param positions: If `true`, the response includes term positions. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param realtime: If true, the request is real-time as opposed to near-real-time. - :param routing: Custom value used to route operations to a specific shard. + :param routing: A custom value used to route operations to a specific shard. :param term_statistics: If true, the response includes term frequency and document frequency. :param version: If `true`, returns the document version as part of a hit. - :param version_type: Specific version type. + :param version_type: The version type. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -3782,20 +3848,21 @@ def put_script( Creates or updates a stored script or search template.

    - ``_ - - :param id: Identifier for the stored script or search template. Must be unique - within the cluster. - :param script: Contains the script or search template, its parameters, and its - language. - :param context: Context in which the script or search template should run. To - prevent errors, the API immediately compiles the script or template in this - context. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + ``_ + + :param id: The identifier for the stored script or search template. It must be + unique within the cluster. + :param script: The script or search template, its parameters, and its language. + :param context: The context in which the script or search template should run. + To prevent errors, the API immediately compiles the script or template in + this context. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. It can also be set to `-1` to indicate that the request + should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. It can + also be set to `-1` to indicate that the request should never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -3875,7 +3942,7 @@ def rank_eval( :param requests: A set of typical search requests, together with their provided ratings. - :param index: Comma-separated list of data streams, indices, and index aliases + :param index: A comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. To target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`. @@ -4285,13 +4352,13 @@ def render_search_template( ``_ - :param id: ID of the search template to render. If no `source` is specified, + :param id: The ID of the search template to render. If no `source` is specified, this or the `id` request body parameter is required. :param file: :param params: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. - :param source: An inline search template. Supports the same parameters as the - search API's request body. These parameters also support Mustache variables. + :param source: An inline search template. It supports the same parameters as + the search API's request body. These parameters also support Mustache variables. If no `id` or `` is specified, this parameter is required. """ __path_parts: t.Dict[str, str] @@ -4340,7 +4407,24 @@ def render_search_template( def scripts_painless_execute( self, *, - context: t.Optional[str] = None, + context: t.Optional[ + t.Union[ + str, + t.Literal[ + "boolean_field", + "composite_field", + "date_field", + "double_field", + "filter", + "geo_point_field", + "ip_field", + "keyword_field", + "long_field", + "painless_test", + "score", + ], + ] + ] = None, context_setup: t.Optional[t.Mapping[str, t.Any]] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, @@ -4352,15 +4436,22 @@ def scripts_painless_execute( """ .. raw:: html -

    Run a script. - Runs a script and returns a result.

    +

    Run a script.

    +

    Runs a script and returns a result. + Use this API to build and test scripts, such as when defining a script for a runtime field. + This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster.

    +

    The API uses several contexts, which control how scripts are run, what variables are available at runtime, and what the return type is.

    +

    Each context requires a script, but additional parameters depend on the context you're using for that script.

    ``_ - :param context: The context that the script should run in. - :param context_setup: Additional parameters for the `context`. - :param script: The Painless script to execute. + :param context: The context that the script should run in. NOTE: Result ordering + in the field contexts is not guaranteed. + :param context_setup: Additional parameters for the `context`. NOTE: This parameter + is required for all contexts except `painless_test`, which is the default + if no value is provided for `context`. + :param script: The Painless script to run. """ __path_parts: t.Dict[str, str] = {} __path = "/_scripts/painless/_execute" @@ -4426,13 +4517,13 @@ def scroll(

    IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.

    - ``_ + ``_ - :param scroll_id: Scroll ID of the search. + :param scroll_id: The scroll ID of the search. :param rest_total_hits_as_int: If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. - :param scroll: Period to retain the search context for scrolling. + :param scroll: The period to retain the search context for scrolling. """ if scroll_id is None and body is None: raise ValueError("Empty value passed for parameter 'scroll_id'") @@ -5071,7 +5162,315 @@ def search_mvt( .. raw:: html

    Search a vector tile.

    -

    Search a vector tile for geospatial values.

    +

    Search a vector tile for geospatial values. + Before using this API, you should be familiar with the Mapbox vector tile specification. + The API returns results as a binary mapbox vector tile.

    +

    Internally, Elasticsearch translates a vector tile search API request into a search containing:

    +
      +
    • A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box.
    • +
    • A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box.
    • +
    • Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true.
    • +
    • If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label.
    • +
    +

    For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search

    +
    GET my-index/_search
    +          {
    +            "size": 10000,
    +            "query": {
    +              "geo_bounding_box": {
    +                "my-geo-field": {
    +                  "top_left": {
    +                    "lat": -40.979898069620134,
    +                    "lon": -45
    +                  },
    +                  "bottom_right": {
    +                    "lat": -66.51326044311186,
    +                    "lon": 0
    +                  }
    +                }
    +              }
    +            },
    +            "aggregations": {
    +              "grid": {
    +                "geotile_grid": {
    +                  "field": "my-geo-field",
    +                  "precision": 11,
    +                  "size": 65536,
    +                  "bounds": {
    +                    "top_left": {
    +                      "lat": -40.979898069620134,
    +                      "lon": -45
    +                    },
    +                    "bottom_right": {
    +                      "lat": -66.51326044311186,
    +                      "lon": 0
    +                    }
    +                  }
    +                }
    +              },
    +              "bounds": {
    +                "geo_bounds": {
    +                  "field": "my-geo-field",
    +                  "wrap_longitude": false
    +                }
    +              }
    +            }
    +          }
    +          
    +

    The API returns results as a binary Mapbox vector tile. + Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers:

    +
      +
    • A hits layer containing a feature for each <field> value matching the geo_bounding_box query.
    • +
    • An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data.
    • +
    • A meta layer containing: +
        +
      • A feature containing a bounding box. By default, this is the bounding box of the tile.
      • +
      • Value ranges for any sub-aggregations on the geotile_grid or geohex_grid.
      • +
      • Metadata for the search.
      • +
      +
    • +
    +

    The API only returns features that can display at its zoom level. + For example, if a polygon feature has no area at its zoom level, the API omits it. + The API returns errors as UTF-8 encoded JSON.

    +

    IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. + If you specify both parameters, the query parameter takes precedence.

    +

    Grid precision for geotile

    +

    For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. + grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. + For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. + The maximum final precision is 29. + The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). + For example, a value of 8 divides the tile into a grid of 256 x 256 cells. + The aggs layer only contains features for cells with matching data.

    +

    Grid precision for geohex

    +

    For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision.

    +

    This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. + The following table maps the H3 resolution for each precision. + For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. + At a precision of 6, hexagonal cells have an H3 resolution of 2. + If <zoom> is 3 and grid_precision is 4, the precision is 7. + At a precision of 7, hexagonal cells have an H3 resolution of 3.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PrecisionUnique tile binsH3 resolutionUnique hex binsRatio
    14012230.5
    21601227.625
    364184213.15625
    425618423.2890625
    51024258825.744140625
    64096258821.436035156
    7163843411622.512329102
    8655363411620.6280822754
    926214442881221.099098206
    10104857642881220.2747745514
    114194304520168420.4808526039
    12167772166141178820.8414913416
    13671088646141178820.2103728354
    142684354567988251620.3681524172
    15107374182486917761220.644266719
    16429496729686917761220.1610666797
    1717179869184948424328420.2818666889
    186871947673610338970298820.4932667053
    19274877906944112372792091620.8632167343
    201099511627776112372792091620.2158041836
    2143980465111041216609544641220.3776573213
    221759218604441613116266812488420.6609003122
    237036874417766413116266812488420.165225078
    2428147497671065614813867687418820.2891438866
    251125899906842620155697073811931620.5060018015
    264503599627370500155697073811931620.1265004504
    2718014398509482000155697073811931620.03162511259
    2872057594037927900155697073811931620.007906278149
    29288230376151712000155697073811931620.001976569537
    +

    Hexagonal cells don't align perfectly on a vector tile. + Some cells may intersect more than one vector tile. + To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. + Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density.

    ``_ @@ -5081,43 +5480,55 @@ def search_mvt( :param zoom: Zoom level for the vector tile to search :param x: X coordinate for the vector tile to search :param y: Y coordinate for the vector tile to search - :param aggs: Sub-aggregations for the geotile_grid. Supports the following aggregation - types: - avg - cardinality - max - min - sum - :param buffer: Size, in pixels, of a clipping buffer outside the tile. This allows - renderers to avoid outline artifacts from geometries that extend past the - extent of the tile. - :param exact_bounds: If false, the meta layer’s feature is the bounding box of - the tile. If true, the meta layer’s feature is a bounding box resulting from - a geo_bounds aggregation. The aggregation runs on values that intersect - the // tile with wrap_longitude set to false. The resulting bounding - box may be larger than the vector tile. - :param extent: Size, in pixels, of a side of the tile. Vector tiles are square + :param aggs: Sub-aggregations for the geotile_grid. It supports the following + aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats` + - `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank` + - `stats` - `sum` - `value count` The aggregation names can't start with + `_mvt_`. The `_mvt_` prefix is reserved for internal aggregations. + :param buffer: The size, in pixels, of a clipping buffer outside the tile. This + allows renderers to avoid outline artifacts from geometries that extend past + the extent of the tile. + :param exact_bounds: If `false`, the meta layer's feature is the bounding box + of the tile. If `true`, the meta layer's feature is a bounding box resulting + from a `geo_bounds` aggregation. The aggregation runs on values that + intersect the `//` tile with `wrap_longitude` set to `false`. + The resulting bounding box may be larger than the vector tile. + :param extent: The size, in pixels, of a side of the tile. Vector tiles are square with equal sides. - :param fields: Fields to return in the `hits` layer. Supports wildcards (`*`). - This parameter does not support fields with array values. Fields with array - values may return inconsistent results. - :param grid_agg: Aggregation used to create a grid for the `field`. + :param fields: The fields to return in the `hits` layer. It supports wildcards + (`*`). This parameter does not support fields with array values. Fields with + array values may return inconsistent results. + :param grid_agg: The aggregation used to create a grid for the `field`. :param grid_precision: Additional zoom levels available through the aggs layer. - For example, if is 7 and grid_precision is 8, you can zoom in up to - level 15. Accepts 0-8. If 0, results don’t include the aggs layer. + For example, if `` is `7` and `grid_precision` is `8`, you can zoom + in up to level 15. Accepts 0-8. If 0, results don't include the aggs layer. :param grid_type: Determines the geometry type for features in the aggs layer. - In the aggs layer, each feature represents a geotile_grid cell. If 'grid' - each feature is a Polygon of the cells bounding box. If 'point' each feature + In the aggs layer, each feature represents a `geotile_grid` cell. If `grid, + each feature is a polygon of the cells bounding box. If `point`, each feature is a Point that is the centroid of the cell. - :param query: Query DSL used to filter documents for the search. + :param query: The query DSL used to filter documents for the search. :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. - :param size: Maximum number of features to return in the hits layer. Accepts - 0-10000. If 0, results don’t include the hits layer. - :param sort: Sorts features in the hits layer. By default, the API calculates - a bounding box for each feature. It sorts features based on this box’s diagonal + :param size: The maximum number of features to return in the hits layer. Accepts + 0-10000. If 0, results don't include the hits layer. + :param sort: Sort the features in the hits layer. By default, the API calculates + a bounding box for each feature. It sorts features based on this box's diagonal length, from longest to shortest. - :param track_total_hits: Number of hits matching the query to count accurately. + :param track_total_hits: The 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. :param with_labels: If `true`, the hits and aggs layers will contain additional point features representing suggested label positions for the original features. + * `Point` and `MultiPoint` features will have one of the points selected. + * `Polygon` and `MultiPolygon` features will have a single point generated, + either the centroid, if it is within the polygon, or another point within + the polygon selected from the sorted triangle-tree. * `LineString` features + will likewise provide a roughly central point selected from the triangle-tree. + * The aggregation results will provide one central point for each aggregation + bucket. All attributes from the original features will also be copied to + the new label features. In addition, the new features will be distinguishable + using the tag `_mvt_label_position`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5232,13 +5643,15 @@ def search_shards(

    Get the search shards.

    Get the indices and shards that a search request would be run against. This information can be useful for working out issues or planning optimizations with routing and shard preferences. - When filtered aliases are used, the filter is returned as part of the indices section.

    + When filtered aliases are used, the filter is returned as part of the indices section.

    +

    If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias.

    ``_ - :param index: Returns the indices and shards that a search request would be executed - against. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*` or `_all`. :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 @@ -5252,10 +5665,13 @@ def search_shards( a missing or closed index. :param local: If `true`, the request retrieves information from the local node only. - :param master_timeout: Period to wait for a connection to the master node. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param routing: Custom value used to route operations to a specific shard. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. IT can also be set to `-1` to indicate that the + request should never timeout. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param routing: A custom value used to route operations to a specific shard. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -5342,10 +5758,10 @@ def search_template(

    Run a search with a search template.

    - ``_ + ``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (*). + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). :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 @@ -5353,32 +5769,34 @@ def search_template( with `foo` but no index starts with `bar`. :param ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. - :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`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. Supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param explain: If `true`, returns detailed information about score calculation - as part of each hit. - :param id: ID of the search template to use. If no source is specified, this - parameter is required. + as part of each hit. If you specify both this and the `explain` query parameter, + the API uses only the query parameter. + :param id: The ID of the search template to use. If no `source` is specified, + this parameter is required. :param ignore_throttled: If `true`, specified concrete, expanded, or aliased indices are not included in the response when throttled. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param params: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param profile: If `true`, the query execution is profiled. - :param rest_total_hits_as_int: If true, hits.total are rendered as an integer - in the response. - :param routing: Custom value used to route operations to a specific shard. + :param rest_total_hits_as_int: If `true`, `hits.total` is rendered as an integer + in the response. If `false`, it is rendered as an object. + :param routing: A custom value used to route operations to a specific shard. :param scroll: Specifies how long a consistent view of the index should be maintained for scrolled search. :param search_type: The type of the search operation. :param source: An inline search template. Supports the same parameters as the - search API's request body. Also supports Mustache variables. If no id is - specified, this parameter is required. + search API's request body. It also supports Mustache variables. If no `id` + is specified, this parameter is required. :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ @@ -5476,30 +5894,35 @@ def terms_enum(

    Get terms in an index.

    Discover terms that match a partial string in an index. - This "terms enum" API is designed for low-latency look-ups used in auto-complete scenarios.

    -

    If the complete property in the response is false, the returned terms set may be incomplete and should be treated as approximate. - This can occur due to a few reasons, such as a request timeout or a node error.

    -

    NOTE: The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.

    + This API is designed for low-latency look-ups used in auto-complete scenarios.

    +
    +

    info + The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.

    +
    ``_ - :param index: Comma-separated list of data streams, indices, and index aliases - to search. Wildcard (*) expressions are supported. + :param index: A comma-separated list of data streams, indices, and index aliases + to search. Wildcard (`*`) expressions are supported. To search all data streams + or indices, omit this parameter or use `*` or `_all`. :param field: The string to match at the start of indexed terms. If not provided, all terms in the field are considered. - :param case_insensitive: When true the provided search string is matched against + :param case_insensitive: When `true`, the provided search string is matched against index terms without case sensitivity. - :param index_filter: Allows to filter an index shard if the provided query rewrites - to match_none. - :param search_after: - :param size: How many matching terms to return. - :param string: The string after which terms in the index should be returned. - Allows for a form of pagination if the last result from one request is passed - as the search_after parameter for a subsequent request. - :param timeout: The maximum length of time to spend collecting results. Defaults - to "1s" (one second). If the timeout is exceeded the complete flag set to - false in the response and the results may be partial or empty. + :param index_filter: Filter an index shard if the provided query rewrites to + `match_none`. + :param search_after: The string after which terms in the index should be returned. + It allows for a form of pagination if the last result from one request is + passed as the `search_after` parameter for a subsequent request. + :param size: The number of matching terms to return. + :param string: The string to match at the start of indexed terms. If it is not + provided, all terms in the field are considered. > info > The prefix string + cannot be larger than the largest possible keyword value, which is Lucene's + term byte-length limit of 32766. + :param timeout: The maximum length of time to spend collecting results. If the + timeout is exceeded the `complete` flag set to `false` in the response and + the results may be partial or empty. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5582,32 +6005,73 @@ def termvectors(

    Get term vector information.

    Get information and statistics about terms in the fields of a particular document.

    +

    You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. + You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. + For example:

    +
    GET /my-index-000001/_termvectors/1?fields=message
    +          
    +

    Fields can be specified using wildcards, similar to the multi match query.

    +

    Term vectors are real-time by default, not near real-time. + This can be changed by setting realtime parameter to false.

    +

    You can request three types of values: term information, term statistics, and field statistics. + By default, all term information and field statistics are returned for all fields but term statistics are excluded.

    +

    Term information

    +
      +
    • term frequency in the field (always returned)
    • +
    • term positions (positions: true)
    • +
    • start and end offsets (offsets: true)
    • +
    • term payloads (payloads: true), as base64 encoded bytes
    • +
    +

    If the requested information wasn't stored in the index, it will be computed on the fly if possible. + Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user.

    +
    +

    warn + Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16.

    +
    +

    Behaviour

    +

    The term and field statistics are not accurate. + Deleted documents are not taken into account. + The information is only retrieved for the shard the requested document resides in. + The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. + By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. + Use routing only to hit a particular shard.

    ``_ - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. + :param index: The name of the index that contains the document. + :param id: A unique identifier for the document. :param doc: An artificial document (a document not present in the index) for which you want to retrieve term vectors. - :param field_statistics: If `true`, the response includes the document count, - sum of document frequencies, and sum of total term frequencies. - :param fields: Comma-separated list or wildcard expressions of fields to include - in the statistics. Used as the default list unless a specific field list - is provided in the `completion_fields` or `fielddata_fields` parameters. - :param filter: Filter terms based on their tf-idf scores. + :param field_statistics: If `true`, the response includes: * The document count + (how many documents contain this field). * The sum of document frequencies + (the sum of document frequencies for all terms in this field). * The sum + of total term frequencies (the sum of total term frequencies of each term + in this field). + :param fields: A comma-separated list or wildcard expressions of fields to include + in the statistics. It is used as the default list unless a specific field + list is provided in the `completion_fields` or `fielddata_fields` parameters. + :param filter: Filter terms based on their tf-idf scores. This could be useful + in order find out a good characteristic vector of a document. This feature + works in a similar manner to the second phase of the More Like This Query. :param offsets: If `true`, the response includes term offsets. :param payloads: If `true`, the response includes term payloads. - :param per_field_analyzer: Overrides the default per-field analyzer. + :param per_field_analyzer: Override the default per-field analyzer. This is useful + in order to generate term vectors in any fashion, especially when using artificial + documents. When providing an analyzer for a field that already stores term + vectors, the term vectors will be regenerated. :param positions: If `true`, the response includes term positions. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param realtime: If true, the request is real-time as opposed to near-real-time. - :param routing: Custom value used to route operations to a specific shard. - :param term_statistics: If `true`, the response includes term frequency and document - frequency. + :param routing: A custom value that is used to route operations to a specific + shard. + :param term_statistics: If `true`, the response includes: * The total term frequency + (how often a term occurs in all documents). * The document frequency (the + number of documents containing the current term). By default these values + are not returned since term statistics can have a serious performance impact. :param version: If `true`, returns the document version as part of a hit. - :param version_type: Specific version type. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5703,6 +6167,7 @@ def update( human: t.Optional[bool] = None, if_primary_term: t.Optional[int] = None, if_seq_no: t.Optional[int] = None, + include_source_on_error: t.Optional[bool] = None, lang: t.Optional[str] = None, pretty: t.Optional[bool] = None, refresh: t.Optional[ @@ -5758,6 +6223,8 @@ def update( term. :param if_seq_no: Only perform the operation if the document has this sequence number. + :param include_source_on_error: True or false if to include the document source + in the error message in case of parsing errors. :param lang: The script language. :param refresh: If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to @@ -5802,6 +6269,8 @@ def update( __query["if_primary_term"] = if_primary_term if if_seq_no is not None: __query["if_seq_no"] = if_seq_no + if include_source_on_error is not None: + __query["include_source_on_error"] = include_source_on_error if lang is not None: __query["lang"] = lang if pretty is not None: @@ -5913,80 +6382,161 @@ def update_by_query(

    Update documents. Updates documents that match the specified query. If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes.

    +

    If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:

    +
      +
    • read
    • +
    • index or write
    • +
    +

    You can specify the query criteria in the request URI or the request body using the same syntax as the search API.

    +

    When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. + When the versions match, the document is updated and the version number is incremented. + If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. + You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. + Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query.

    +

    NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number.

    +

    While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. + A bulk update request is performed for each batch of matching documents. + Any query or update failures cause the update by query request to fail and the failures are shown in the response. + Any update requests that completed successfully still stick, they are not rolled back.

    +

    Throttling update requests

    +

    To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. + This pads each batch with a wait time to throttle the rate. + Set requests_per_second to -1 to turn off throttling.

    +

    Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. + The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. + By default the batch size is 1000, so if requests_per_second is set to 500:

    +
    target_time = 1000 / 500 per second = 2 seconds
    +          wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds
    +          
    +

    Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. + This is "bursty" instead of "smooth".

    +

    Slicing

    +

    Update by query supports sliced scroll to parallelize the update process. + This can improve efficiency and provide a convenient way to break the request down into smaller parts.

    +

    Setting slices to auto chooses a reasonable number for most data streams and indices. + This setting will use one slice per shard, up to a certain limit. + If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards.

    +

    Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks:

    +
      +
    • You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices.
    • +
    • Fetching the status of the task for the request with slices only contains the status of completed slices.
    • +
    • These sub-requests are individually addressable for things like cancellation and rethrottling.
    • +
    • Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally.
    • +
    • Canceling the request with slices will cancel each sub-request.
    • +
    • Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.
    • +
    • Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated.
    • +
    • Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time.
    • +
    +

    If you're slicing manually or otherwise tuning automatic slicing, keep in mind that:

    +
      +
    • Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.
    • +
    • Update performance scales linearly across available resources with the number of slices.
    • +
    +

    Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources.

    +

    Update the document source

    +

    Update by query supports scripts to update the document source. + As with the update API, you can set ctx.op to change the operation that is performed.

    +

    Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. + The update by query operation skips updating the document and increments the noop counter.

    +

    Set ctx.op = "delete" if your script decides that the document should be deleted. + The update by query operation deletes the document and increments the deleted counter.

    +

    Update by query supports only index, noop, and delete. + Setting ctx.op to anything else is an error. + Setting any other field in ctx is an error. + This API enables you to only modify the source of matching documents; you cannot move them.

    ``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams or indices, omit this - parameter or use `*` or `_all`. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams or indices, + omit this parameter or use `*` or `_all`. :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 analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. - :param conflicts: What to do if update by query hits version conflicts: `abort` - or `proceed`. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. + :param conflicts: The preferred behavior when update by query hits version conflicts: + `abort` or `proceed`. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. - :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`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param from_: Starting offset (default: 0) :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. :param max_docs: The maximum number of documents to update. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. + :param pipeline: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. - :param query: Specifies the documents to update using the Query DSL. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: A query in the Lucene query string syntax. + :param query: The documents to update using the Query DSL. :param refresh: If `true`, Elasticsearch refreshes affected shards to make the - operation visible to search. + operation visible to search after the request completes. This is different + than the update API's `refresh` parameter, which causes just the shard that + received the request to be refreshed. :param request_cache: If `true`, the request cache is used for this request. + It defaults to the index-level setting. :param requests_per_second: The throttle for this request in sub-requests per second. - :param routing: Custom value used to route operations to a specific shard. + :param routing: A custom value used to route operations to a specific shard. :param script: The script to run to update the document source or metadata when updating. - :param scroll: Period to retain the search context for scrolling. - :param scroll_size: Size of the scroll request that powers the operation. - :param search_timeout: Explicit timeout for each search request. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param scroll: The period to retain the search context for scrolling. + :param scroll_size: The size of the scroll request that powers the operation. + :param search_timeout: An explicit timeout for each search request. By default, + there is no timeout. + :param search_type: The type of the search operation. Available options include + `query_then_fetch` and `dfs_query_then_fetch`. :param slice: Slice the request manually using the provided slice ID and total number of slices. :param slices: The number of slices this task should be divided into. :param sort: A comma-separated list of : pairs. - :param stats: Specific `tag` of the request for logging and statistical purposes. - :param terminate_after: Maximum number of documents to collect for each shard. + :param stats: The specific `tag` of the request for logging and statistical purposes. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - 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. - :param timeout: Period each update request waits for the following operations: - dynamic mapping updates, waiting for active shards. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this parameter to each shard handling the request. + When possible, let Elasticsearch perform early termination automatically. + Avoid specifying this parameter for requests that target data streams with + backing indices across multiple data tiers. + :param timeout: The period each update request waits for the following operations: + dynamic mapping updates, waiting for active shards. By default, it is one + minute. This guarantees Elasticsearch waits for at least the timeout before + failing. The actual wait time could be longer, particularly when multiple + waits occur. :param version: If `true`, returns the document version as part of a hit. :param version_type: Should the document increment the version number (internal) on hit or not (reindex) :param wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + up to the total number of shards in the index (`number_of_replicas+1`). The + `timeout` parameter controls how long each write request waits for unavailable + shards to become available. Both work exactly the way they work in the bulk + API. :param wait_for_completion: If `true`, the request blocks until the operation - is complete. + is complete. If `false`, Elasticsearch performs some preflight checks, launches + the request, and returns a task ID that you can use to cancel or get the + status of the task. Elasticsearch creates a record of this task as a document + at `.tasks/task/${taskId}`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -6116,11 +6666,11 @@ def update_by_query_rethrottle( Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.

    - ``_ + ``_ :param task_id: The ID for the task. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. To turn off throttling, set it to `-1`. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") diff --git a/elasticsearch/_sync/client/async_search.py b/elasticsearch/_sync/client/async_search.py index 30a582b10..756645251 100644 --- a/elasticsearch/_sync/client/async_search.py +++ b/elasticsearch/_sync/client/async_search.py @@ -97,8 +97,8 @@ def get( ``_ :param id: A unique identifier for the async search. - :param keep_alive: Specifies how long the async search should be available in - the cluster. When not specified, the `keep_alive` set with the corresponding + :param keep_alive: The length of time that the async search should be available + in the cluster. When not specified, the `keep_alive` set with the corresponding submit async request will be used. Otherwise, it is possible to override the value and extend the validity of the request. When this period expires, the search, if still running, is cancelled. If the search is completed, its @@ -157,13 +157,17 @@ def status(

    Get the async search status.

    Get the status of a previously submitted async search request given its identifier, without retrieving search results. - If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role.

    + If the Elasticsearch security features are enabled, the access to the status of a specific async search is restricted to:

    +
      +
    • The user or API key that submitted the original async search request.
    • +
    • Users that have the monitor cluster privilege or greater privileges.
    • +
    ``_ :param id: A unique identifier for the async search. - :param keep_alive: Specifies how long the async search needs to be available. + :param keep_alive: The length of time that the async search needs to be available. Ongoing async searches and any saved search results are deleted after this period. """ diff --git a/elasticsearch/_sync/client/cat.py b/elasticsearch/_sync/client/cat.py index cbacf8a67..2ca151d5a 100644 --- a/elasticsearch/_sync/client/cat.py +++ b/elasticsearch/_sync/client/cat.py @@ -2494,7 +2494,7 @@ def tasks( IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the task management API.

    - ``_ + ``_ :param actions: The task action names, which are used to limit the response. :param detailed: If `true`, the response includes detailed information about diff --git a/elasticsearch/_sync/client/ccr.py b/elasticsearch/_sync/client/ccr.py index 5f0ce695f..ab9fe911b 100644 --- a/elasticsearch/_sync/client/ccr.py +++ b/elasticsearch/_sync/client/ccr.py @@ -39,14 +39,17 @@ def delete_auto_follow_pattern( """ .. raw:: html -

    Delete auto-follow patterns. - Delete a collection of cross-cluster replication auto-follow patterns.

    +

    Delete auto-follow patterns.

    +

    Delete a collection of cross-cluster replication auto-follow patterns.

    ``_ - :param name: The name of the auto follow pattern. - :param master_timeout: Period to wait for a connection to the master node. + :param name: The auto-follow pattern collection to delete. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -251,16 +254,18 @@ def follow_info( """ .. raw:: html -

    Get follower information. - Get information about all cross-cluster replication follower indices. +

    Get follower information.

    +

    Get information about all cross-cluster replication follower indices. For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused.

    ``_ - :param index: A comma-separated list of index patterns; use `_all` to perform - the operation on all indices - :param master_timeout: Period to wait for a connection to the master node. + :param index: A comma-delimited list of follower index patterns. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -301,17 +306,16 @@ def follow_stats( """ .. raw:: html -

    Get follower stats. - Get cross-cluster replication follower stats. +

    Get follower stats.

    +

    Get cross-cluster replication follower stats. The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices.

    ``_ - :param index: A comma-separated list of index patterns; use `_all` to perform - the operation on all indices - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param index: A comma-delimited list of index patterns. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -437,15 +441,18 @@ def get_auto_follow_pattern( """ .. raw:: html -

    Get auto-follow patterns. - Get cross-cluster replication auto-follow patterns.

    +

    Get auto-follow patterns.

    +

    Get cross-cluster replication auto-follow patterns.

    ``_ - :param name: Specifies the auto-follow pattern collection that you want to retrieve. - If you do not specify a name, the API returns information for all collections. - :param master_timeout: Period to wait for a connection to the master node. + :param name: The auto-follow pattern collection that you want to retrieve. If + you do not specify a name, the API returns information for all collections. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: @@ -489,8 +496,8 @@ def pause_auto_follow_pattern( """ .. raw:: html -

    Pause an auto-follow pattern. - Pause a cross-cluster replication auto-follow pattern. +

    Pause an auto-follow pattern.

    +

    Pause a cross-cluster replication auto-follow pattern. When the API returns, the auto-follow pattern is inactive. New indices that are created on the remote cluster and match the auto-follow patterns are ignored.

    You can resume auto-following with the resume auto-follow pattern API. @@ -500,9 +507,11 @@ def pause_auto_follow_pattern( ``_ - :param name: The name of the auto follow pattern that should pause discovering - new indices to follow. - :param master_timeout: Period to wait for a connection to the master node. + :param name: The name of the auto-follow pattern to pause. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -543,8 +552,8 @@ def pause_follow( """ .. raw:: html -

    Pause a follower. - Pause a cross-cluster replication follower index. +

    Pause a follower.

    +

    Pause a cross-cluster replication follower index. The follower index will not fetch any additional operations from the leader index. You can resume following with the resume follower API. You can pause and resume a follower index to change the configuration of the following task.

    @@ -552,9 +561,11 @@ def pause_follow( ``_ - :param index: The name of the follower index that should pause following its - leader index. - :param master_timeout: Period to wait for a connection to the master node. + :param index: The name of the follower index. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -765,17 +776,19 @@ def resume_auto_follow_pattern( """ .. raw:: html -

    Resume an auto-follow pattern. - Resume a cross-cluster replication auto-follow pattern that was paused. +

    Resume an auto-follow pattern.

    +

    Resume a cross-cluster replication auto-follow pattern that was paused. The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim.

    ``_ - :param name: The name of the auto follow pattern to resume discovering new indices - to follow. - :param master_timeout: Period to wait for a connection to the master node. + :param name: The name of the auto-follow pattern to resume. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -934,15 +947,18 @@ def stats( """ .. raw:: html -

    Get cross-cluster replication stats. - This API returns stats about auto-following and the same shard-level stats as the get follower stats API.

    +

    Get cross-cluster replication stats.

    +

    This API returns stats about auto-following and the same shard-level stats as the get follower stats API.

    ``_ - :param master_timeout: Period to wait for a connection to the master node. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_ccr/stats" @@ -983,18 +999,23 @@ def unfollow( """ .. raw:: html -

    Unfollow an index. - Convert a cross-cluster replication follower index to a regular index. +

    Unfollow an index.

    +

    Convert a cross-cluster replication follower index to a regular index. The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. The follower index must be paused and closed before you call the unfollow API.

    -

    NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation.

    +
    +

    info + Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation.

    +
    ``_ - :param index: The name of the follower index that should be turned into a regular - index. - :param master_timeout: Period to wait for a connection to the master node. + :param index: The name of the follower index. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. It can also be set to `-1` to indicate that the + request should never timeout. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") diff --git a/elasticsearch/_sync/client/cluster.py b/elasticsearch/_sync/client/cluster.py index 0d7fb74db..1ddb0c01a 100644 --- a/elasticsearch/_sync/client/cluster.py +++ b/elasticsearch/_sync/client/cluster.py @@ -920,9 +920,16 @@ def remote_info( """ .. raw:: html -

    Get remote cluster information. - Get all of the configured remote cluster information. - This API returns connection and endpoint information keyed by the configured remote cluster alias.

    +

    Get remote cluster information.

    +

    Get information about configured remote clusters. + The API returns connection and endpoint information keyed by the configured remote cluster alias.

    +
    +

    info + This API returns information that reflects current state on the local cluster. + The connected field does not necessarily reflect whether a remote cluster is down or unavailable, only whether there is currently an open connection to it. + Elasticsearch does not spontaneously try to reconnect to a disconnected remote cluster. + To trigger a reconnection, attempt a cross-cluster search, ES|QL cross-cluster search, or try the resolve cluster endpoint.

    +
    ``_ diff --git a/elasticsearch/_sync/client/eql.py b/elasticsearch/_sync/client/eql.py index 558e9bad5..7df6bf4b4 100644 --- a/elasticsearch/_sync/client/eql.py +++ b/elasticsearch/_sync/client/eql.py @@ -43,7 +43,7 @@ def delete( The API also deletes results for the search.

    - ``_ + ``_ :param id: Identifier for the search to delete. A search ID is provided in the EQL search API's response for an async search. A search ID is also provided @@ -251,8 +251,15 @@ def search( :param index: The name of the index to scope the operation :param query: EQL query you wish to run. :param allow_no_indices: - :param allow_partial_search_results: - :param allow_partial_sequence_results: + :param allow_partial_search_results: Allow query execution also in case of shard + failures. If true, the query will keep running and will return results based + on the available shards. For sequences, the behavior can be further refined + using allow_partial_sequence_results + :param allow_partial_sequence_results: This flag applies only to sequences and + has effect only if allow_partial_search_results=true. If true, the sequence + query will return results based on the available shards, ignoring the others. + If false, the sequence query will return successfully, but will always have + empty results. :param case_sensitive: :param event_category_field: Field containing the event classification, such as process, file, or network. diff --git a/elasticsearch/_sync/client/esql.py b/elasticsearch/_sync/client/esql.py index 85e129c5f..d747501c0 100644 --- a/elasticsearch/_sync/client/esql.py +++ b/elasticsearch/_sync/client/esql.py @@ -298,6 +298,61 @@ def async_query_get( path_parts=__path_parts, ) + @_rewrite_parameters() + def async_query_stop( + self, + *, + id: str, + drop_null_columns: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

    Stop async ES|QL query.

    +

    This API interrupts the query execution and returns the results so far. + If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it.

    + + + ``_ + + :param id: The unique identifier of the query. A query ID is provided in the + ES|QL async query API response for a query that does not complete in the + designated time. A query ID is also provided when the request was submitted + with the `keep_on_completion` parameter set to `true`. + :param drop_null_columns: Indicates whether columns that are entirely `null` + will be removed from the `columns` and `values` portion of the results. If + `true`, the response will include an extra section under the name `all_columns` + which has the name of all the columns. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_query/async/{__path_parts["id"]}/stop' + __query: t.Dict[str, t.Any] = {} + if drop_null_columns is not None: + __query["drop_null_columns"] = drop_null_columns + 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] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_stop", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "query", diff --git a/elasticsearch/_sync/client/features.py b/elasticsearch/_sync/client/features.py index 66f19522b..70019a24a 100644 --- a/elasticsearch/_sync/client/features.py +++ b/elasticsearch/_sync/client/features.py @@ -102,7 +102,7 @@ def reset_features(

    IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes.

    - ``_ + ``_ :param master_timeout: Period to wait for a connection to the master node. """ diff --git a/elasticsearch/_sync/client/fleet.py b/elasticsearch/_sync/client/fleet.py index f7bce669d..837e7b195 100644 --- a/elasticsearch/_sync/client/fleet.py +++ b/elasticsearch/_sync/client/fleet.py @@ -48,7 +48,9 @@ def global_checkpoints( """ .. raw:: html -

    Returns the current global checkpoints for an index. This API is design for internal use by the fleet server project.

    +

    Get global checkpoints.

    +

    Get the current global checkpoints for an index. + This API is designed for internal use by the Fleet server project.

    ``_ @@ -141,6 +143,8 @@ def msearch( supports the wait_for_checkpoints parameter.

    + ``_ + :param searches: :param index: A single target to search. If the target is an index alias, it must resolve to a single index. @@ -388,6 +392,8 @@ def search( after provided checkpoint has been processed and is visible for searches inside of Elasticsearch.

    + ``_ + :param index: A single target to search. If the target is an index alias, it must resolve to a single index. :param aggregations: diff --git a/elasticsearch/_sync/client/ilm.py b/elasticsearch/_sync/client/ilm.py index f42c24b26..f3dd02684 100644 --- a/elasticsearch/_sync/client/ilm.py +++ b/elasticsearch/_sync/client/ilm.py @@ -214,8 +214,8 @@ def get_status( """ .. raw:: html -

    Get the ILM status. - Get the current index lifecycle management status.

    +

    Get the ILM status.

    +

    Get the current index lifecycle management status.

    ``_ diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index b4774cea3..e0bb98a15 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -57,23 +57,40 @@ def add_block( """ .. raw:: html -

    Add an index block. - Limits the operations allowed on an index by blocking specific operation types.

    +

    Add an index block.

    +

    Add an index block to an index. + Index blocks limit the operations allowed on an index by blocking specific operation types.

    - ``_ + ``_ - :param index: A comma separated list of indices to add a block to - :param block: The block to add (one of read, write, read_only or metadata) - :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 ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :param index: A comma-separated list or wildcard expression of index names used + to limit the request. By default, you must explicitly name the indices you + are adding blocks to. To allow the adding of blocks to indices with `_all`, + `*`, or other wildcard expressions, change the `action.destructive_requires_name` + setting to `false`. You can update this setting in the `elasticsearch.yml` + file or by using the cluster update settings API. + :param block: The block type to add to the index. + :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: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. It can also be set to `-1` to indicate that the request should + never timeout. + :param timeout: The period to wait for a response from all relevant nodes in + the cluster after updating the cluster metadata. If no response is received + before the timeout expires, the cluster metadata update still applies but + the response will indicate that it was not completely acknowledged. It can + also be set to `-1` to indicate that the request should never timeout. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -710,12 +727,11 @@ def create_data_stream( """ .. raw:: html -

    Create a data stream. - Creates a data stream. - You must have a matching index template with data stream enabled.

    +

    Create a data stream.

    +

    You must have a matching index template with data stream enabled.

    - ``_ + ``_ :param name: Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include `\\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, @@ -841,11 +857,11 @@ def data_streams_stats( """ .. raw:: html -

    Get data stream stats. - Retrieves statistics for one or more data streams.

    +

    Get data stream stats.

    +

    Get statistics for one or more data streams.

    - ``_ + ``_ :param name: Comma-separated list of data streams used to limit the request. Wildcard expressions (`*`) are supported. To target all data streams in a @@ -1120,7 +1136,7 @@ def delete_data_stream( Deletes one or more data streams and their backing indices.

    - ``_ + ``_ :param name: Comma-separated list of data streams to delete. Wildcard (`*`) expressions are supported. @@ -1538,11 +1554,11 @@ def exists_alias( """ .. raw:: html -

    Check aliases. - Checks if one or more data stream or index aliases exist.

    +

    Check aliases.

    +

    Check if one or more data stream or index aliases exist.

    - ``_ + ``_ :param name: Comma-separated list of aliases to check. Supports wildcards (`*`). :param index: Comma-separated list of data streams or indices used to limit the @@ -1612,11 +1628,11 @@ def exists_index_template( """ .. raw:: html -

    Check index templates. - Check whether index templates exist.

    +

    Check index templates.

    +

    Check whether index templates exist.

    - ``_ + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. @@ -2287,8 +2303,8 @@ def get_data_lifecycle( """ .. raw:: html -

    Get data stream lifecycles. - Retrieves the data stream lifecycle configuration of one or more data streams.

    +

    Get data stream lifecycles.

    +

    Get the data stream lifecycle configuration of one or more data streams.

    ``_ @@ -2396,11 +2412,11 @@ def get_data_stream( """ .. raw:: html -

    Get data streams. - Retrieves information about one or more data streams.

    +

    Get data streams.

    +

    Get information about one or more data streams.

    - ``_ + ``_ :param name: Comma-separated list of data stream names used to limit the request. Wildcard (`*`) expressions are supported. If omitted, all data streams are @@ -4255,7 +4271,7 @@ def reload_search_analyzers( def resolve_cluster( self, *, - name: t.Union[str, t.Sequence[str]], + name: t.Optional[t.Union[str, t.Sequence[str]]] = None, allow_no_indices: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ @@ -4271,19 +4287,20 @@ def resolve_cluster( ignore_throttled: t.Optional[bool] = None, ignore_unavailable: t.Optional[bool] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ .. raw:: html -

    Resolve the cluster. - Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - Multiple patterns and remote clusters are supported.

    +

    Resolve the cluster.

    +

    Resolve the specified index expressions to return information about each cluster, including the local "querying" cluster, if included. + If no index expression is provided, the API will return information about all the remote clusters that are configured on the querying cluster.

    This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search.

    You use the same index expression with this endpoint as you would for cross-cluster search. Index and cluster exclusions are also supported with this endpoint.

    For each cluster in the index expression, information is returned about:

      -
    • Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope.
    • +
    • Whether the querying ("local") cluster is currently connected to each remote cluster specified in the index expression. Note that this endpoint actively attempts to contact the remote clusters, unlike the remote/info endpoint.
    • Whether each remote cluster is configured with skip_unavailable as true or false.
    • Whether there are any indices, aliases, or data streams on that cluster that match the index expression.
    • Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index).
    • @@ -4291,7 +4308,13 @@ def resolve_cluster(

    For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*.

    -

    Advantages of using this endpoint before a cross-cluster search

    +

    Note on backwards compatibility

    +

    The ability to query without an index expression was added in version 8.18, so when + querying remote clusters older than that, the local cluster will send the index + expression dummy* to those remote clusters. Thus, if an errors occur, you may see a reference + to that index expression even though you didn't request it. If it causes a problem, you can + instead include an index expression like *:* to bypass the issue.

    +

    Advantages of using this endpoint before a cross-cluster search

    You may want to exclude a cluster or index from a search when:

    • A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail.
    • @@ -4299,31 +4322,60 @@ def resolve_cluster(
    • The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.)
    • A remote cluster is an older version that does not support the feature you want to use in your search.
    +

    Test availability of remote clusters

    +

    The remote/info endpoint is commonly used to test whether the "local" cluster (the cluster being queried) is connected to its remote clusters, but it does not necessarily reflect whether the remote cluster is available or not. + The remote cluster may be available, while the local cluster is not currently connected to it.

    +

    You can use the _resolve/cluster API to attempt to reconnect to remote clusters. + For example with GET _resolve/cluster or GET _resolve/cluster/*:*. + The connected field in the response will indicate whether it was successful. + If a connection was (re-)established, this will also cause the remote/info endpoint to now indicate a connected status.

    ``_ - :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, - and data streams to resolve. Resources on remote clusters can be specified - using the ``:`` syntax. + :param name: A comma-separated list of names or index patterns for the indices, + aliases, and data streams to resolve. Resources on remote clusters can be + specified using the ``:`` syntax. Index and cluster exclusions + (e.g., `-cluster1:*`) are also supported. If no index expression is specified, + information about all remote clusters configured on the local cluster is + returned without doing any index matching :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. + 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. + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. NOTE: This option is only supported + when specifying an index expression. You will get an error if you specify + index options to the `_resolve/cluster` API endpoint that takes no index + expression. :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`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. - :param ignore_throttled: If true, concrete, expanded or aliased indices are ignored - when frozen. Defaults to false. + NOTE: This option is only supported when specifying an index expression. + You will get an error if you specify index options to the `_resolve/cluster` + API endpoint that takes no index expression. + :param ignore_throttled: If true, concrete, expanded, or aliased indices are + ignored when frozen. NOTE: This option is only supported when specifying + an index expression. You will get an error if you specify index options to + the `_resolve/cluster` API endpoint that takes no index expression. :param ignore_unavailable: If false, the request returns an error if it targets - a missing or closed index. Defaults to false. + a missing or closed index. NOTE: This option is only supported when specifying + an index expression. You will get an error if you specify index options to + the `_resolve/cluster` API endpoint that takes no index expression. + :param timeout: The maximum time to wait for remote clusters to respond. If a + remote cluster does not respond within this timeout period, the API response + will show the cluster as not connected and include an error message that + the request timed out. The default timeout is unset and the query can take + as long as the networking layer is configured to wait for remote clusters + that are not responding (typically 30 seconds). """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for parameter 'name'") - __path_parts: t.Dict[str, str] = {"name": _quote(name)} - __path = f'/_resolve/cluster/{__path_parts["name"]}' + __path_parts: t.Dict[str, str] + if name not in SKIP_IN_PATH: + __path_parts = {"name": _quote(name)} + __path = f'/_resolve/cluster/{__path_parts["name"]}' + else: + __path_parts = {} + __path = "/_resolve/cluster" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -4341,6 +4393,8 @@ def resolve_cluster( __query["ignore_unavailable"] = ignore_unavailable if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "GET", diff --git a/elasticsearch/_sync/client/inference.py b/elasticsearch/_sync/client/inference.py index 5430e7283..7dc4a8cc2 100644 --- a/elasticsearch/_sync/client/inference.py +++ b/elasticsearch/_sync/client/inference.py @@ -51,12 +51,12 @@ def delete( ``_ - :param inference_id: The inference Id + :param inference_id: The inference identifier. :param task_type: The task type - :param dry_run: When true, the endpoint is not deleted, and a list of ingest - processors which reference this endpoint is returned + :param dry_run: When true, the endpoint is not deleted and a list of ingest processors + which reference this endpoint is returned. :param force: When true, the inference endpoint is forcefully deleted even if - it is still being used by ingest processors or semantic text fields + it is still being used by ingest processors or semantic text fields. """ if inference_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'inference_id'") @@ -180,18 +180,29 @@ def inference( """ .. raw:: html -

    Perform inference on the service

    +

    Perform inference on the service.

    +

    This API enables you to use machine learning models to perform specific tasks on data that you provide as an input. + It returns a response with the results of the tasks. + The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API.

    +
    +

    info + The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.

    +
    ``_ - :param inference_id: The inference Id - :param input: Inference input. Either a string or an array of strings. - :param task_type: The task type - :param query: Query input, required for rerank task. Not required for other tasks. - :param task_settings: Optional task settings - :param timeout: Specifies the amount of time to wait for the inference request - to complete. + :param inference_id: The unique identifier for the inference endpoint. + :param input: The text on which you want to perform the inference task. It can + be a single string or an array. > info > Inference endpoints for the `completion` + task type currently only support a single string as input. + :param task_type: The type of inference task that the model performs. + :param query: The query input, which is required only for the `rerank` task. + It is not required for other tasks. + :param task_settings: Task settings for the individual inference request. These + settings are specific to the task type you specified and override the task + settings specified when initializing the service. + :param timeout: The amount of time to wait for the inference request to complete. """ if inference_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'inference_id'") diff --git a/elasticsearch/_sync/client/ingest.py b/elasticsearch/_sync/client/ingest.py index 0a909bc6b..f4d8c9241 100644 --- a/elasticsearch/_sync/client/ingest.py +++ b/elasticsearch/_sync/client/ingest.py @@ -40,18 +40,18 @@ def delete_geoip_database( """ .. raw:: html -

    Delete GeoIP database configurations. - Delete one or more IP geolocation database configurations.

    +

    Delete GeoIP database configurations.

    +

    Delete one or more IP geolocation database configurations.

    - ``_ + ``_ :param id: A comma-separated list of geoip database configurations to delete - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -244,15 +244,15 @@ def get_geoip_database( """ .. raw:: html -

    Get GeoIP database configurations. - Get information about one or more IP geolocation database configurations.

    +

    Get GeoIP database configurations.

    +

    Get information about one or more IP geolocation database configurations.

    - ``_ + ``_ - :param id: Comma-separated list of database configuration IDs to retrieve. Wildcard - (`*`) expressions are supported. To get all database configurations, omit - this parameter or use `*`. + :param id: A comma-separated list of database configuration IDs to retrieve. + Wildcard (`*`) expressions are supported. To get all database configurations, + omit this parameter or use `*`. """ __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: @@ -350,8 +350,8 @@ def get_pipeline( """ .. raw:: html -

    Get pipelines. - Get information about one or more ingest pipelines. +

    Get pipelines.

    +

    Get information about one or more ingest pipelines. This API returns a local reference of the pipeline.

    @@ -455,11 +455,11 @@ def put_geoip_database( """ .. raw:: html -

    Create or update a GeoIP database configuration. - Refer to the create or update IP geolocation database configuration API.

    +

    Create or update a GeoIP database configuration.

    +

    Refer to the create or update IP geolocation database configuration API.

    - ``_ + ``_ :param id: ID of the database configuration to create or update. :param maxmind: The configuration necessary to identify which IP geolocation @@ -712,17 +712,17 @@ def simulate( """ .. raw:: html -

    Simulate a pipeline. - Run an ingest pipeline against a set of provided documents. +

    Simulate a pipeline.

    +

    Run an ingest pipeline against a set of provided documents. You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request.

    ``_ :param docs: Sample documents to test in the pipeline. - :param id: Pipeline to test. If you don’t specify a `pipeline` in the request + :param id: The pipeline to test. If you don't specify a `pipeline` in the request body, this parameter is required. - :param pipeline: Pipeline to test. If you don’t specify the `pipeline` request + :param pipeline: The pipeline to test. If you don't specify the `pipeline` request path parameter, this parameter is required. If you specify both this and the request path parameter, the API only uses the request path parameter. :param verbose: If `true`, the response includes output data for each processor diff --git a/elasticsearch/_sync/client/license.py b/elasticsearch/_sync/client/license.py index dac9f6b88..842e47354 100644 --- a/elasticsearch/_sync/client/license.py +++ b/elasticsearch/_sync/client/license.py @@ -39,16 +39,16 @@ def delete( """ .. raw:: html -

    Delete the license. - When the license expires, your subscription level reverts to Basic.

    +

    Delete the license.

    +

    When the license expires, your subscription level reverts to Basic.

    If the operator privileges feature is enabled, only operator users can use this API.

    ``_ - :param master_timeout: Period to wait for a connection to the master node. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param master_timeout: The period to wait for a connection to the master node. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_license" @@ -89,10 +89,13 @@ def get( """ .. raw:: html -

    Get license information. - Get information about your Elastic license including its type, its status, when it was issued, and when it expires.

    -

    NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. +

    Get license information.

    +

    Get information about your Elastic license including its type, its status, when it was issued, and when it expires.

    +
    +

    info + If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request.

    +
    ``_ @@ -225,8 +228,8 @@ def post( """ .. raw:: html -

    Update the license. - You can update your license at runtime without shutting down your nodes. +

    Update the license.

    +

    You can update your license at runtime without shutting down your nodes. License updates take effect immediately. If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. You must then re-submit the API request with the acknowledge parameter set to true.

    @@ -240,9 +243,9 @@ def post( :param license: :param licenses: A sequence of one or more JSON documents containing the license information. - :param master_timeout: Period to wait for a connection to the master node. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param master_timeout: The period to wait for a connection to the master node. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_license" @@ -297,8 +300,8 @@ def post_start_basic( """ .. raw:: html -

    Start a basic license. - Start an indefinite basic license, which gives access to all the basic features.

    +

    Start a basic license.

    +

    Start an indefinite basic license, which gives access to all the basic features.

    NOTE: In order to start a basic license, you must not currently have a basic license.

    If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. You must then re-submit the API request with the acknowledge parameter set to true.

    diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index f10b79e2e..e8d1a197b 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -38,8 +38,8 @@ def clear_trained_model_deployment_cache( """ .. raw:: html -

    Clear trained model deployment cache. - Cache will be cleared on all nodes where the trained model is assigned. +

    Clear trained model deployment cache.

    +

    Cache will be cleared on all nodes where the trained model is assigned. A trained model deployment may have an inference cache enabled. As requests are handled by each allocated node, their responses may be cached on that individual node. Calling this API clears the caches without restarting the deployment.

    @@ -93,8 +93,8 @@ def close_job( """ .. raw:: html -

    Close anomaly detection jobs. - A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. +

    Close anomaly detection jobs.

    +

    A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. When a datafeed that has a specified end date stops, it automatically closes its associated job.

    @@ -161,8 +161,8 @@ def delete_calendar( """ .. raw:: html -

    Delete a calendar. - Removes all scheduled events from a calendar, then deletes it.

    +

    Delete a calendar.

    +

    Remove all scheduled events from a calendar, then delete it.

    ``_ @@ -415,15 +415,15 @@ def delete_expired_data( """ .. raw:: html -

    Delete expired ML data. - Deletes all job results, model snapshots and forecast data that have exceeded +

    Delete expired ML data.

    +

    Delete all job results, model snapshots and forecast data that have exceeded their retention days period. Machine learning state documents that are not associated with any job are also deleted. You can limit the request to a single or set of anomaly detection jobs by using a job identifier, a group name, a comma-separated list of jobs, or a wildcard expression. You can delete expired data for all anomaly detection - jobs by using _all, by specifying * as the <job_id>, or by omitting the - <job_id>.

    + jobs by using _all, by specifying * as the <job_id>, or by omitting the + <job_id>.

    ``_ @@ -485,8 +485,8 @@ def delete_filter( """ .. raw:: html -

    Delete a filter. - If an anomaly detection job references the filter, you cannot delete the +

    Delete a filter.

    +

    If an anomaly detection job references the filter, you cannot delete the filter. You must update or delete the job before you can delete the filter.

    @@ -533,8 +533,8 @@ def delete_forecast( """ .. raw:: html -

    Delete forecasts from a job. - By default, forecasts are retained for 14 days. You can specify a +

    Delete forecasts from a job.

    +

    By default, forecasts are retained for 14 days. You can specify a different retention period with the expires_in parameter in the forecast jobs API. The delete forecast API enables you to delete one or more forecasts before they expire.

    @@ -607,8 +607,8 @@ def delete_job( """ .. raw:: html -

    Delete an anomaly detection job. - All job configuration, model state and results are deleted. +

    Delete an anomaly detection job.

    +

    All job configuration, model state and results are deleted. It is not currently possible to delete multiple jobs using wildcards or a comma separated list. If you delete a job that has a datafeed, the request first tries to delete the datafeed. This behavior is equivalent to calling @@ -670,8 +670,8 @@ def delete_model_snapshot( """ .. raw:: html -

    Delete a model snapshot. - You cannot delete the active model snapshot. To delete that snapshot, first +

    Delete a model snapshot.

    +

    You cannot delete the active model snapshot. To delete that snapshot, first revert to a different one. To identify the active model snapshot, refer to the model_snapshot_id in the results from the get jobs API.

    @@ -724,8 +724,8 @@ def delete_trained_model( """ .. raw:: html -

    Delete an unreferenced trained model. - The request deletes a trained inference model that is not referenced by an ingest pipeline.

    +

    Delete an unreferenced trained model.

    +

    The request deletes a trained inference model that is not referenced by an ingest pipeline.

    ``_ @@ -777,8 +777,8 @@ def delete_trained_model_alias( """ .. raw:: html -

    Delete a trained model alias. - This API deletes an existing model alias that refers to a trained model. If +

    Delete a trained model alias.

    +

    This API deletes an existing model alias that refers to a trained model. If the model alias is missing or refers to a model other than the one identified by the model_id, this API returns an error.

    @@ -838,13 +838,13 @@ def estimate_model_memory( """ .. raw:: html -

    Estimate job model memory usage. - Makes an estimation of the memory usage for an anomaly detection job model. - It is based on analysis configuration details for the job and cardinality +

    Estimate job model memory usage.

    +

    Make an estimation of the memory usage for an anomaly detection job model. + The estimate is based on analysis configuration details for the job and cardinality estimates for the fields it references.

    - ``_ + ``_ :param analysis_config: For a list of the properties that you can specify in the `analysis_config` component of the body of this API. @@ -909,8 +909,8 @@ def evaluate_data_frame( """ .. raw:: html -

    Evaluate data frame analytics. - The API packages together commonly used evaluation metrics for various types +

    Evaluate data frame analytics.

    +

    The API packages together commonly used evaluation metrics for various types of machine learning features. This has been designed for use on indexes created by data frame analytics. Evaluation requires both a ground truth field and an analytics result field to be present.

    @@ -990,8 +990,8 @@ def explain_data_frame_analytics( """ .. raw:: html -

    Explain data frame analytics config. - This API provides explanations for a data frame analytics config that either +

    Explain data frame analytics config.

    +

    This API provides explanations for a data frame analytics config that either exists already or one that has not been created yet. The following explanations are provided:

      @@ -2891,8 +2891,8 @@ def open_job( """ .. raw:: html -

      Open anomaly detection jobs. - An anomaly detection job must be opened to be ready to receive and analyze +

      Open anomaly detection jobs.

      +

      An anomaly detection job must be opened to be ready to receive and analyze data. It can be opened and closed multiple times throughout its lifecycle. When you open a new job, it starts with an empty model. When you open an existing job, the most recent model state is automatically @@ -3082,7 +3082,7 @@ def preview_data_frame_analytics( .. raw:: html

      Preview features used by data frame analytics. - Previews the extracted features used by a data frame analytics config.

      + Preview the extracted features used by a data frame analytics config.

      ``_ @@ -3821,8 +3821,8 @@ def put_job( """ .. raw:: html -

      Create an anomaly detection job. - If you include a datafeed_config, you must have read index privileges on the source index. +

      Create an anomaly detection job.

      +

      If you include a datafeed_config, you must have read index privileges on the source index. If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}.

      @@ -5619,7 +5619,7 @@ def upgrade_job_snapshot( .. raw:: html

      Upgrade a snapshot. - Upgrades an anomaly detection model snapshot to the latest major version. + Upgrade an anomaly detection model snapshot to the latest major version. Over time, older snapshot formats are deprecated and removed. Anomaly detection jobs support only snapshots that are from the current or previous major version. @@ -5782,7 +5782,7 @@ def validate_detector(

      Validate an anomaly detection job.

      - ``_ + ``_ :param detector: """ diff --git a/elasticsearch/_sync/client/monitoring.py b/elasticsearch/_sync/client/monitoring.py index eae014b19..033982ad1 100644 --- a/elasticsearch/_sync/client/monitoring.py +++ b/elasticsearch/_sync/client/monitoring.py @@ -48,7 +48,7 @@ def bulk( This API is used by the monitoring features to send monitoring data.

      - ``_ + ``_ :param interval: Collection interval (e.g., '10s' or '10000ms') of the payload :param operations: diff --git a/elasticsearch/_sync/client/nodes.py b/elasticsearch/_sync/client/nodes.py index 61bf40d31..b64f3abf0 100644 --- a/elasticsearch/_sync/client/nodes.py +++ b/elasticsearch/_sync/client/nodes.py @@ -231,8 +231,8 @@ def info( """ .. raw:: html -

      Get node information. - By default, the API returns all attributes and core settings for cluster nodes.

      +

      Get node information.

      +

      By default, the API returns all attributes and core settings for cluster nodes.

      ``_ @@ -308,7 +308,7 @@ def reload_secure_settings( Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.

      - ``_ + ``_ :param node_id: The names of particular nodes in the cluster to target. :param secure_settings_password: The password for the Elasticsearch keystore. diff --git a/elasticsearch/_sync/client/search_application.py b/elasticsearch/_sync/client/search_application.py index 76ef2d456..7309f9ec4 100644 --- a/elasticsearch/_sync/client/search_application.py +++ b/elasticsearch/_sync/client/search_application.py @@ -45,13 +45,13 @@ def delete( """ .. raw:: html -

      Delete a search application. - Remove a search application and its associated alias. Indices attached to the search application are not removed.

      +

      Delete a search application.

      +

      Remove a search application and its associated alias. Indices attached to the search application are not removed.

      ``_ - :param name: The name of the search application to delete + :param name: The name of the search application to delete. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -234,7 +234,7 @@ def list( Get information about search applications.

      - ``_ + ``_ :param from_: Starting offset. :param q: Query in the Lucene query string syntax. diff --git a/elasticsearch/_sync/client/transform.py b/elasticsearch/_sync/client/transform.py index 95427115e..1df9564d1 100644 --- a/elasticsearch/_sync/client/transform.py +++ b/elasticsearch/_sync/client/transform.py @@ -41,8 +41,7 @@ def delete_transform( """ .. raw:: html -

      Delete a transform. - Deletes a transform.

      +

      Delete a transform.

      ``_ @@ -106,7 +105,7 @@ def get_transform( .. raw:: html

      Get transforms. - Retrieves configuration information for transforms.

      + Get configuration information for transforms.

      ``_ @@ -178,8 +177,8 @@ def get_transform_stats( """ .. raw:: html -

      Get transform stats. - Retrieves usage information for transforms.

      +

      Get transform stats.

      +

      Get usage information for transforms.

      ``_ @@ -508,9 +507,8 @@ def reset_transform( """ .. raw:: html -

      Reset a transform. - Resets a transform. - Before you can reset it, you must stop it; alternatively, use the force query parameter. +

      Reset a transform.

      +

      Before you can reset it, you must stop it; alternatively, use the force query parameter. If the destination index was created by the transform, it is deleted.

      @@ -566,11 +564,11 @@ def schedule_now_transform( """ .. raw:: html -

      Schedule a transform to start now. - Instantly runs a transform to process data.

      -

      If you _schedule_now a transform, it will process the new data instantly, - without waiting for the configured frequency interval. After _schedule_now API is called, - the transform will be processed again at now + frequency unless _schedule_now API +

      Schedule a transform to start now.

      +

      Instantly run a transform to process data. + If you run this API, the transform will process the new data instantly, + without waiting for the configured frequency interval. After the API is called, + the transform will be processed again at now + frequency unless the API is called again in the meantime.

      @@ -621,8 +619,7 @@ def start_transform( """ .. raw:: html -

      Start a transform. - Starts a transform.

      +

      Start a transform.

      When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping definitions for the destination index from the source indices and the transform aggregations. If fields in the @@ -879,8 +876,8 @@ def upgrade_transforms( """ .. raw:: html -

      Upgrade all transforms. - Transforms are compatible across minor versions and between supported major versions. +

      Upgrade all transforms.

      +

      Transforms are compatible across minor versions and between supported major versions. However, over time, the format of transform configuration information may change. This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. It also cleans up the internal data structures that store the transform state and checkpoints. diff --git a/elasticsearch/helpers/vectorstore/_sync/vectorstore.py b/elasticsearch/helpers/vectorstore/_sync/vectorstore.py index 3c4a0d51a..6a6a5ee2a 100644 --- a/elasticsearch/helpers/vectorstore/_sync/vectorstore.py +++ b/elasticsearch/helpers/vectorstore/_sync/vectorstore.py @@ -22,7 +22,10 @@ from elasticsearch import Elasticsearch from elasticsearch._version import __versionstr__ as lib_version from elasticsearch.helpers import BulkIndexError, bulk -from elasticsearch.helpers.vectorstore import EmbeddingService, RetrievalStrategy +from elasticsearch.helpers.vectorstore import ( + EmbeddingService, + RetrievalStrategy, +) from elasticsearch.helpers.vectorstore._utils import maximal_marginal_relevance logger = logging.getLogger(__name__)