diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 4947a69ab..694aca757 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -646,83 +646,89 @@ async def bulk( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk index or delete documents. Perform multiple `index`, `create`, `delete`, - and `update` actions in a single request. This reduces overhead and can greatly - increase indexing speed. If the Elasticsearch security features are enabled, - you must have the following index privileges for the target data stream, index, - or index alias: * To use the `create` action, you must have the `create_doc`, - `create`, `index`, or `write` index privilege. Data streams support only the - `create` action. * To use the `index` action, you must have the `create`, `index`, - or `write` index privilege. * To use the `delete` action, you must have the `delete` - or `write` index privilege. * To use the `update` action, you must have the `index` - or `write` index privilege. * To automatically create a data stream or index - with a bulk API request, you must have the `auto_configure`, `create_index`, - or `manage` index privilege. * To make the result of a bulk operation visible - to search using the `refresh` parameter, you must have the `maintenance` or `manage` - index privilege. Automatic data stream creation requires a matching index template - with data stream enabled. The actions are specified in the request body using - a newline delimited JSON (NDJSON) structure: ``` action_and_meta_data\\n optional_source\\n - action_and_meta_data\\n optional_source\\n .... action_and_meta_data\\n optional_source\\n - ``` The `index` and `create` actions expect a source on the next line and have - the same semantics as the `op_type` parameter in the standard index API. A `create` - action fails if a document with the same ID already exists in the target An `index` - action adds or replaces a document as necessary. NOTE: Data streams support only - the `create` action. To update or delete a document in a data stream, you must - target the backing index containing the document. An `update` action expects - that the partial doc, upsert, and script and its options are specified on the - next line. A `delete` action does not expect a source on the next line and has - the same semantics as the standard delete API. NOTE: The final line of data must - end with a newline character (`\\n`). Each newline character may be preceded - by a carriage return (`\\r`). When sending NDJSON data to the `_bulk` endpoint, - use a `Content-Type` header of `application/json` or `application/x-ndjson`. - Because this format uses literal newline characters (`\\n`) as delimiters, make - sure that the JSON actions and sources are not pretty printed. If you provide - a target in the request path, it is used for any actions that don't explicitly - specify an `_index` argument. A note on the format: the idea here is to make - processing as fast as possible. As some of the actions are redirected to other - shards on other nodes, only `action_meta_data` is parsed on the receiving node - side. Client libraries using this protocol should try and strive to do something - similar on the client side, and reduce buffering as much as possible. There is - no "correct" number of actions to perform in a single bulk request. Experiment - with different settings to find the optimal size for your particular workload. - Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by - default so clients must ensure that no request exceeds this size. It is not possible - to index a single document that exceeds the size limit, so you must pre-process - any such documents into smaller pieces before sending them to Elasticsearch. - For instance, split documents into pages or chapters before indexing them, or - store raw binary data in a system outside Elasticsearch and replace the raw data - with a link to the external system in the documents that you send to Elasticsearch. - **Client suppport for bulk requests** Some of the officially supported clients - provide helpers to assist with bulk requests and reindexing: * Go: Check out - `esutil.BulkIndexer` * Perl: Check out `Search::Elasticsearch::Client::5_0::Bulk` - and `Search::Elasticsearch::Client::5_0::Scroll` * Python: Check out `elasticsearch.helpers.*` - * JavaScript: Check out `client.helpers.*` * .NET: Check out `BulkAllObservable` - * PHP: Check out bulk indexing. **Submitting bulk requests with cURL** If you're - providing text file input to `curl`, you must use the `--data-binary` flag instead - of plain `-d`. The latter doesn't preserve newlines. For example: ``` $ cat requests - { "index" : { "_index" : "test", "_id" : "1" } } { "field1" : "value1" } $ curl - -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary - "@requests"; echo {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - ``` **Optimistic concurrency control** Each `index` and `delete` action within - a bulk API call may include the `if_seq_no` and `if_primary_term` parameters - in their respective action and meta data lines. The `if_seq_no` and `if_primary_term` - parameters control how operations are run, based on the last modification to - existing documents. See Optimistic concurrency control for more details. **Versioning** - Each bulk item can include the version value using the `version` field. It automatically - follows the behavior of the index or delete operation based on the `_version` - mapping. It also support the `version_type`. **Routing** Each bulk item can include - the routing value using the `routing` field. It automatically follows the behavior - of the index or delete operation based on the `_routing` mapping. NOTE: Data - streams do not support custom routing unless they were created with the `allow_custom_routing` - setting enabled in the template. **Wait for active shards** When making bulk - calls, you can set the `wait_for_active_shards` parameter to require a minimum - number of shard copies to be active before starting to process the bulk request. - **Refresh** Control when the changes made by this request are visible to search. - NOTE: Only the shards that receive the bulk request will be affected by refresh. - Imagine a `_bulk?refresh=wait_for` request with three documents in it that happen - to be routed to different shards in an index with five shards. The request will - only wait for those three shards to refresh. The other two shards that make up - the index do not participate in the `_bulk` request at all. + .. raw:: html + +

Bulk index or delete documents. + Perform multiple index, create, delete, and update actions in a single request. + This reduces overhead and can greatly increase indexing speed.

+

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

+ +

Automatic data stream creation requires a matching index template with data stream enabled.

+

The actions are specified in the request body using a newline delimited JSON (NDJSON) structure:

+
action_and_meta_data\\n
+          optional_source\\n
+          action_and_meta_data\\n
+          optional_source\\n
+          ....
+          action_and_meta_data\\n
+          optional_source\\n
+          
+

The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. + A create action fails if a document with the same ID already exists in the target + An index action adds or replaces a document as necessary.

+

NOTE: Data streams support only the create action. + To update or delete a document in a data stream, you must target the backing index containing the document.

+

An update action expects that the partial doc, upsert, and script and its options are specified on the next line.

+

A delete action does not expect a source on the next line and has the same semantics as the standard delete API.

+

NOTE: The final line of data must end with a newline character (\\n). + Each newline character may be preceded by a carriage return (\\r). + When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. + Because this format uses literal newline characters (\\n) as delimiters, make sure that the JSON actions and sources are not pretty printed.

+

If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument.

+

A note on the format: the idea here is to make processing as fast as possible. + As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side.

+

Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible.

+

There is no "correct" number of actions to perform in a single bulk request. + Experiment with different settings to find the optimal size for your particular workload. + Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. + It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. + For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch.

+

Client suppport for bulk requests

+

Some of the officially supported clients provide helpers to assist with bulk requests and reindexing:

+ +

Submitting bulk requests with cURL

+

If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. + The latter doesn't preserve newlines. For example:

+
$ cat requests
+          { "index" : { "_index" : "test", "_id" : "1" } }
+          { "field1" : "value1" }
+          $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo
+          {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]}
+          
+

Optimistic concurrency control

+

Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. + The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details.

+

Versioning

+

Each bulk item can include the version value using the version field. + It automatically follows the behavior of the index or delete operation based on the _version mapping. + It also support the version_type.

+

Routing

+

Each bulk item can include the routing value using the routing field. + It automatically follows the behavior of the index or delete operation based on the _routing mapping.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+

Wait for active shards

+

When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request.

+

Refresh

+

Control when the changes made by this request are visible to search.

+

NOTE: Only the shards that receive the bulk request will be affected by refresh. + Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. + The request will only wait for those three shards to refresh. + The other two shards that make up the index do not participate in the _bulk request at all.

+ ``_ @@ -839,8 +845,11 @@ async def clear_scroll( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear a scrolling search. Clear the search context and results for a scrolling - search. + .. raw:: html + +

Clear a scrolling search. + Clear the search context and results for a scrolling search.

+ ``_ @@ -890,11 +899,14 @@ async def close_point_in_time( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Close a point in time. A point in time must be opened explicitly before being - used in search requests. The `keep_alive` parameter tells Elasticsearch how long - it should persist. A point in time is automatically closed when the `keep_alive` - period has elapsed. However, keeping points in time has a cost; close them as - soon as they are no longer required for search requests. + .. raw:: html + +

Close a point in time. + A point in time must be opened explicitly before being used in search requests. + The keep_alive parameter tells Elasticsearch how long it should persist. + A point in time is automatically closed when the keep_alive period has elapsed. + However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.

+ ``_ @@ -968,14 +980,17 @@ async def count( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 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. This means that replicas - increase the scalability of the count. + .. raw:: html + +

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

+

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. + This means that replicas increase the scalability of the count.

+ ``_ @@ -1012,10 +1027,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. @@ -1117,38 +1132,100 @@ async def create( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Index a document. Adds a JSON document to the specified data stream or index - and makes it searchable. If the target is an index and the document already exists, - the request updates the document and increments its version. + .. raw:: html + +

Create a new document in the index.

+

You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs + Using _create guarantees that the document is indexed only if it does not already exist. + It returns a 409 response when a document with a same ID already exists in the index. + To update an existing document, you must use the /<target>/_doc/ API.

+

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

+
    +
  • To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege.
  • +
  • To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

Automatically create data streams and indices

+

If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream.

+

If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.

+

NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.

+

If no mapping exists, the index operation creates a dynamic mapping. + By default, new fields and objects are automatically added to the mapping if needed.

+

Automatic index creation is controlled by the action.auto_create_index setting. + If it is true, any index can be created automatically. + You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. + Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. + When a list is specified, the default behaviour is to disallow.

+

NOTE: The action.auto_create_index setting affects the automatic creation of indices only. + It does not affect the creation of data streams.

+

Routing

+

By default, shard placement — or routing — is controlled by using a hash of the document's ID value. + For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter.

+

When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. + This does come at the (very minimal) cost of an additional document parsing pass. + If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+

** Distributed**

+

The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. + After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.

+

Active shards

+

To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. + If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. + By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). + This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. + To alter this behavior per operation, use the wait_for_active_shards request parameter.

+

Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). + Specifying a negative value or a number greater than the number of shard copies will throw an error.

+

For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). + If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. + This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. + If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. + This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. + However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. + The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.

+

It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. + After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. + The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed.

+ ``_ - :param index: Name of the data stream or index to target. If the target doesn’t + :param index: The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If - the target doesn’t exist and doesn’t match a data stream template, this request + the target doesn't exist and doesn’t match a data stream template, this request creates the index. - :param id: Unique identifier for the document. + :param id: A unique identifier for the document. To automatically generate a + document ID, use the `POST //_doc/` request format. :param document: - :param pipeline: 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 + :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 + pipeline is configured, it will always run regardless of the value of this parameter. :param refresh: If `true`, Elasticsearch refreshes the affected shards to make - this operation visible to search, if `wait_for` then wait for a refresh to - make this operation visible to search, if `false` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period the request waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. + :param routing: A custom value that is used to route operations to a specific + shard. + :param timeout: The period the request waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. Elasticsearch + waits for at least the specified timeout period before failing. The actual + wait time could be longer, particularly when multiple waits occur. This parameter + is useful for situations where the primary shard assigned to perform the + operation might not be available when the operation runs. Some reasons for + this might be that the primary shard is currently recovering from a gateway + or undergoing relocation. By default, the operation will wait on the primary + shard to become available for at least 1 minute before failing and responding + with an error. The actual wait time could be longer, particularly when multiple + waits occur. + :param version: The explicit version number for concurrency control. It must + be a non-negative long number. + :param version_type: The version type. :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`). + before proceeding with the operation. You can set it to `all` or any positive + integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1223,29 +1300,60 @@ async def delete( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a document. Removes a JSON document from the specified index. + .. raw:: html + +

Delete a document.

+

Remove a JSON document from the specified index.

+

NOTE: You cannot send deletion requests directly to a data stream. + To delete a document in a data stream, you must target the backing index containing the document.

+

Optimistic concurrency control

+

Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. + If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409.

+

Versioning

+

Each document indexed is versioned. + When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. + Every write operation run on a document, deletes included, causes its version to be incremented. + The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. + The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting.

+

Routing

+

If routing is used during indexing, the routing value also needs to be specified to delete a document.

+

If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request.

+

For example:

+
DELETE /my-index-000001/_doc/1?routing=shard-1
+          
+

This request deletes the document with ID 1, but it is routed based on the user. + The document is not deleted if the correct routing is not specified.

+

Distributed

+

The delete operation gets hashed into a specific shard ID. + It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.

+ ``_ - :param index: Name of the target index. - :param id: Unique identifier for the document. + :param index: The name of the target index. + :param id: A unique identifier for the document. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param refresh: If `true`, Elasticsearch refreshes the affected shards to make - this operation visible to search, if `wait_for` then wait for a refresh to - make this operation visible to search, if `false` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period to wait for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. - :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`). + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. + :param routing: A custom value used to route operations to a specific shard. + :param timeout: The period to wait for active shards. This parameter is useful + for situations where the primary shard assigned to perform the delete operation + might not be available when the delete operation runs. Some reasons for this + might be that the primary shard is currently recovering from a store or undergoing + relocation. By default, the delete operation will wait on the primary shard + to become available for up to 1 minute before failing and responding with + an error. + :param version: An explicit version number for concurrency control. It must match + the current version of the document for the request to succeed. + :param version_type: The version type. + :param wait_for_active_shards: The minimum number of shard copies that must be + active before proceeding with the operation. You can set it to `all` or any + positive integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1345,72 +1453,148 @@ async def delete_by_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete documents. Deletes documents that match the specified query. + .. raw:: html + +

Delete documents.

+

Deletes documents that match the specified query.

+

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

+
    +
  • read
  • +
  • delete 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 a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. + If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails.

+

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

+

While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. + A bulk delete request is performed for each batch of matching documents. + If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. + If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. + Any delete requests that completed successfully still stick, they are not rolled back.

+

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 delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query.

+

Throttling delete requests

+

To control the rate at which delete by query issues batches of delete 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 disable 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

+

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

+

Setting slices to auto lets Elasticsearch choose the number of slices to use. + 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 the delete by query operation creates 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 earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted.
  • +
  • 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.
  • +
  • Delete performance scales linearly across available resources with the number of slices.
  • +
+

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

+

Cancel a delete by query operation

+

Any delete by query can be canceled using the task cancel API. For example:

+
POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel
+          
+

The task ID can be found by using the get tasks API.

+

Cancellation should happen quickly but might take a few seconds. + The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself.

+ ``_ - :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. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: Analyzer to use for the query string. This parameter can be + used only when the `q` query string parameter is specified. :param conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :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`. :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 delete. - :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 delete 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 delete specified with Query DSL. :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. + delete by query after the request completes. This is different than the delete + API's `refresh` parameter, which causes just the shard that received the + delete request to be refreshed. Unlike the delete API, it does not support + `wait_for`. :param request_cache: If `true`, the request cache is used for this request. 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 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. Defaults to - no timeout. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param routing: A custom value used to route operations to a specific shard. + :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: The explicit timeout for each search request. It defaults + to 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 sort: A comma-separated list of `:` pairs. + :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 deletion request waits for active shards. + :param timeout: The period each deletion request waits for active shards. :param version: If `true`, returns the document version as part of a hit. :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`). + 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`). The + `timeout` value controls how long each write request waits for unavailable + shards to become available. :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 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}`. + When you are done with a task, you should delete the task document so Elasticsearch + can reclaim the space. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1523,16 +1707,18 @@ async def delete_by_query_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Throttle a delete by query operation. Change the number of requests per second - for a particular delete by query operation. 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. + .. raw:: html + +

Throttle a delete by query operation.

+

Change the number of requests per second for a particular delete by query operation. + 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 disable throttling, set it to `-1`. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -1572,16 +1758,22 @@ async def delete_script( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a script or search template. Deletes a stored script or search template. + .. raw:: html - ``_ +

Delete a script or search template. + 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'") @@ -1640,32 +1832,60 @@ async def exists( ] = None, ) -> HeadApiResponse: """ - Check a document. Checks if a specified document exists. + .. raw:: html + +

Check a document.

+

Verify that a document exists. + For example, check to see if a document with the _id 0 exists:

+
HEAD my-index-000001/_doc/0
+          
+

If the document exists, the API returns a status code of 200 - OK. + If the document doesn’t exist, the API returns 404 - Not Found.

+

Versioning support

+

You can use the version parameter to check the document only if its current version is equal to the specified one.

+

Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. + The old version of the document doesn't disappear immediately, although you won't be able to access it. + Elasticsearch cleans up deleted documents in the background as you continue to index more data.

+ ``_ - :param index: Comma-separated list of data streams, indices, and aliases. Supports - wildcards (`*`). - :param id: Identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param index: A comma-separated list of data streams, indices, and aliases. It + supports wildcards (`*`). + :param id: A unique document identifier. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. If it is + set to `_local`, the operation will prefer to be run on a local allocated + shard when possible. If it is set to a custom value, the value is used to + guarantee that the same shards will be used for the same custom value. This + can help with "jumping values" when hitting different shards in different + refresh states. A sample value can be something like the web session ID or + the user name. :param realtime: If `true`, the request is real-time as opposed to near-real-time. - :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. - :param routing: Target the specified primary 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 in - the response. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :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. + 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 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`. :param version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1741,29 +1961,38 @@ async def exists_source( ] = None, ) -> HeadApiResponse: """ - Check for a document source. Checks if a document's `_source` is stored. + .. raw:: html + +

Check for a document source.

+

Check whether a document source exists in an index. + For example:

+
HEAD my-index-000001/_source/1
+          
+

A document's source is not available if it is disabled in the mapping.

+ ``_ - :param index: Comma-separated list of data streams, indices, and aliases. Supports - wildcards (`*`). - :param id: Identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param realtime: If true, the request is real-time as opposed to near-real-time. - :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. - :param routing: Target the specified primary shard. - :param source: `true` or `false` to return the `_source` field or not, or a list - of fields to return. + :param index: A comma-separated list of data streams, indices, and aliases. It + supports wildcards (`*`). + :param id: A unique identifier for the document. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. + :param realtime: If `true`, the request is real-time as opposed to near-real-time. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. :param source_excludes: A comma-separated list of source fields to exclude in the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1841,34 +2070,47 @@ async def explain( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain a document match result. Returns information about why a specific document - matches, or doesn’t match, a query. + .. raw:: html + +

Explain a document match result. + 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. """ @@ -1961,15 +2203,18 @@ async def field_caps( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the field capabilities. Get information about the capabilities of fields - among multiple indices. For data streams, the API returns field capabilities - among the stream’s backing indices. It returns runtime fields like any other - field. For example, a runtime field with a type of keyword is returned the same - as any other field that belongs to the `keyword` family. + .. raw:: html + +

Get the field capabilities.

+

Get information about the capabilities of fields among multiple indices.

+

For data streams, the API returns field capabilities among the stream’s backing indices. + It returns runtime fields like any other field. + For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family.

+ ``_ - :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 @@ -1977,25 +2222,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: @@ -2081,36 +2333,87 @@ async def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a document by its ID. Retrieves the document with the specified ID from an - index. + .. raw:: html + +

Get a document by its ID.

+

Get a document and its source or stored fields from an index.

+

By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). + In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. + To turn off realtime behavior, set the realtime parameter to false.

+

Source filtering

+

By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. + You can turn off _source retrieval by using the _source parameter:

+
GET my-index-000001/_doc/0?_source=false
+          
+

If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. + This can be helpful with large documents where partial retrieval can save on network overhead + Both parameters take a comma separated list of fields or wildcard expressions. + For example:

+
GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities
+          
+

If you only want to specify includes, you can use a shorter notation:

+
GET my-index-000001/_doc/0?_source=*.id
+          
+

Routing

+

If routing is used during indexing, the routing value also needs to be specified to retrieve a document. + For example:

+
GET my-index-000001/_doc/2?routing=user1
+          
+

This request gets the document with ID 2, but it is routed based on the user. + The document is not fetched if the correct routing is not specified.

+

Distributed

+

The GET operation is hashed into a specific shard ID. + It is then redirected to one of the replicas within that shard ID and returns the result. + The replicas are the primary shard and its replicas within that shard ID group. + This means that the more replicas you have, the better your GET scaling will be.

+

Versioning support

+

You can use the version parameter to retrieve the document only if its current version is equal to the specified one.

+

Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. + The old version of the document doesn't disappear immediately, although you won't be able to access it. + Elasticsearch cleans up deleted documents in the background as you continue to index more data.

+ ``_ - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. - :param force_synthetic_source: Should this request force synthetic _source? Use - this to test if the mapping supports synthetic _source and to get a sense - of the worst case performance. Fetches with this enabled will be slower the - enabling synthetic source natively in the index. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param index: The name of the index that contains the document. + :param id: A unique document identifier. + :param force_synthetic_source: Indicates whether the request forces synthetic + `_source`. Use this paramater to test if the mapping supports synthetic `_source` + and to get a sense of the worst case performance. Fetches with this parameter + enabled will be slower than enabling synthetic source natively in the index. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. If it is + set to `_local`, the operation will prefer to be run on a local allocated + shard when possible. If it is set to a custom value, the value is used to + guarantee that the same shards will be used for the same custom value. This + can help with "jumping values" when hitting different shards in different + refresh states. A sample value can be something like the web session ID or + the user name. :param realtime: If `true`, the request is real-time as opposed to near-real-time. - :param refresh: If true, Elasticsearch refreshes the affected shards to make - this operation visible to search. If false, do nothing with refreshes. - :param routing: Target the specified primary 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 in - the response. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :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. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: internal, external, external_gte. + 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 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`. Only leaf fields can be retrieved with the `stored_field` option. + Object fields can't be returned;​if specified, the request fails. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2171,12 +2474,19 @@ async def get_script( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a script or search template. Retrieves a stored script or search template. + .. raw:: html + +

Get a script or search template. + 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'") @@ -2213,9 +2523,13 @@ async def get_script_context( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get script contexts. Get a list of supported script contexts and their methods. + .. raw:: html + +

Get script contexts.

+

Get a list of supported script contexts and their methods.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_context" @@ -2248,9 +2562,13 @@ async def get_script_languages( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get script languages. Get a list of available script types, languages, and contexts. + .. raw:: html - ``_ +

Get script languages.

+

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

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_language" @@ -2303,29 +2621,41 @@ async def get_source( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a document's source. Returns the source of a document. + .. raw:: html + +

Get a document's source.

+

Get the source of a document. + For example:

+
GET my-index-000001/_source/1
+          
+

You can use the source filtering parameters to control which parts of the _source are returned:

+
GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities
+          
+ ``_ - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param realtime: Boolean) If true, the request is real-time as opposed to near-real-time. - :param refresh: If true, Elasticsearch refreshes the affected shards to make - this operation visible to search. If false, do nothing with refreshes. - :param routing: Target the specified primary shard. - :param source: True or false to return the _source field or not, or a list of - fields to return. + :param index: The name of the index that contains the document. + :param id: A unique document identifier. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. + :param realtime: If `true`, the request is real-time as opposed to near-real-time. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. :param source_excludes: A comma-separated list of source fields to exclude in the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param stored_fields: - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: internal, external, external_gte. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2386,26 +2716,22 @@ async def health_report( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the cluster health. Get a report with the health status of an Elasticsearch - cluster. The report contains a list of indicators that compose Elasticsearch - functionality. Each indicator has a health status of: green, unknown, yellow - or red. The indicator will provide an explanation and metadata describing the - reason for its current health status. The cluster’s status is controlled by the - worst indicator status. In the event that an indicator’s status is non-green, - a list of impacts may be present in the indicator result which detail the functionalities - that are negatively affected by the health issue. Each impact carries with it - a severity level, an area of the system that is affected, and a simple description - of the impact on the system. Some health indicators can determine the root cause - of a health problem and prescribe a set of steps that can be performed in order - to improve the health of the system. The root cause and remediation steps are - encapsulated in a diagnosis. A diagnosis contains a cause detailing a root cause - analysis, an action containing a brief description of the steps to take to fix - the problem, the list of affected resources (if applicable), and a detailed step-by-step - troubleshooting guide to fix the diagnosed problem. NOTE: The health indicators - perform root cause analysis of non-green health statuses. This can be computationally - expensive when called frequently. When setting up automated polling of the API - for health status, set verbose to false to disable the more expensive analysis - logic. + .. raw:: html + +

Get the cluster health. + Get a report with the health status of an Elasticsearch cluster. + The report contains a list of indicators that compose Elasticsearch functionality.

+

Each indicator has a health status of: green, unknown, yellow or red. + The indicator will provide an explanation and metadata describing the reason for its current health status.

+

The cluster’s status is controlled by the worst indicator status.

+

In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. + Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system.

+

Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. + The root cause and remediation steps are encapsulated in a diagnosis. + A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem.

+

NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. + When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic.

+ ``_ @@ -2480,44 +2806,148 @@ async def index( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Index a document. Adds a JSON document to the specified data stream or index - and makes it searchable. If the target is an index and the document already exists, - the request updates the document and increments its version. + .. raw:: html + +

Create or update a document in an index.

+

Add a JSON document to the specified data stream or index and make it searchable. + If the target is an index and the document already exists, the request updates the document and increments its version.

+

NOTE: You cannot use this API to send update requests for existing documents in a data stream.

+

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

+
    +
  • To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege.
  • +
  • To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege.
  • +
  • To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

NOTE: Replica shards might not all be started when an indexing operation returns successfully. + By default, only the primary is required. Set wait_for_active_shards to change this default behavior.

+

Automatically create data streams and indices

+

If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream.

+

If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.

+

NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.

+

If no mapping exists, the index operation creates a dynamic mapping. + By default, new fields and objects are automatically added to the mapping if needed.

+

Automatic index creation is controlled by the action.auto_create_index setting. + If it is true, any index can be created automatically. + You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. + Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. + When a list is specified, the default behaviour is to disallow.

+

NOTE: The action.auto_create_index setting affects the automatic creation of indices only. + It does not affect the creation of data streams.

+

Optimistic concurrency control

+

Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. + If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409.

+

Routing

+

By default, shard placement — or routing — is controlled by using a hash of the document's ID value. + For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter.

+

When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. + This does come at the (very minimal) cost of an additional document parsing pass. + If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+
    +
  • ** Distributed**
  • +
+

The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. + After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.

+

Active shards

+

To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. + If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. + By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). + This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. + To alter this behavior per operation, use the wait_for_active_shards request parameter.

+

Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). + Specifying a negative value or a number greater than the number of shard copies will throw an error.

+

For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). + If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. + This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. + If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. + This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. + However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. + The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.

+

It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. + After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. + The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed.

+

No operation (noop) updates

+

When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. + If this isn't acceptable use the _update API with detect_noop set to true. + The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source.

+

There isn't a definitive rule for when noop updates aren't acceptable. + It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates.

+

Versioning

+

Each indexed document is given a version number. + By default, internal versioning is used that starts at 1 and increments with each update, deletes included. + Optionally, the version number can be set to an external value (for example, if maintained in a database). + To enable this functionality, version_type should be set to external. + The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18.

+

NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. + If no version is provided, the operation runs without any version checks.

+

When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. + If true, the document will be indexed and the new version number used. + If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example:

+
PUT my-index-000001/_doc/1?version=2&version_type=external
+          {
+            "user": {
+              "id": "elkbee"
+            }
+          }
+
+          In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
+          If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).
+
+          A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
+          Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.
+          
+ ``_ - :param index: Name of the data stream or index to target. + :param index: The name of the data stream or index to target. If the target doesn't + exist and matches the name or wildcard (`*`) pattern of an index template + with a `data_stream` definition, this request creates the data stream. If + the target doesn't exist and doesn't match a data stream template, this request + creates the index. You can check for existing targets with the resolve index + API. :param document: - :param id: Unique identifier for the document. + :param id: A unique identifier for the document. To automatically generate a + document ID, use the `POST //_doc/` request format and omit this + parameter. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. - :param op_type: Set to create to only index the document if it does not already + :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. Same as using the `/_create` endpoint. - Valid values: `index`, `create`. If document id is specified, it defaults - to `index`. Otherwise, it defaults to `create`. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. + the indexing operation will fail. The behavior is the same as using the `/_create` + endpoint. If a document ID is specified, this paramater defaults to `index`. + Otherwise, it defaults to `create`. If the request targets a data stream, + an `op_type` of `create` is required. + :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 refresh: If `true`, Elasticsearch refreshes the affected shards to make - this operation visible to search, if `wait_for` then wait for a refresh to - make this operation visible to search, if `false` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. :param require_alias: If `true`, the destination must be an index alias. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period the request waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param routing: A custom value that is used to route operations to a specific + shard. + :param timeout: The period the request waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. This + parameter is useful for situations where the primary shard assigned to perform + the operation might not be available when the operation runs. Some reasons + for this might be that the primary shard is currently recovering from a gateway + or undergoing relocation. By default, the operation will wait on the primary + shard to become available for at least 1 minute before failing and responding + with an error. The actual wait time could be longer, particularly when multiple + waits occur. + :param version: An explicit version number for concurrency control. It must be + a non-negative long number. + :param version_type: The version type. :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`). + before proceeding with the operation. You can set it to `all` or any positive + integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2591,7 +3021,11 @@ async def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster info. Get basic build, version, and cluster information. + .. raw:: html + +

Get cluster info. + Get basic build, version, and cluster information.

+ ``_ """ @@ -2648,38 +3082,48 @@ async def knn_search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a knn search. NOTE: The kNN search API has been replaced by the `knn` option - in the search API. Perform a k-nearest neighbor (kNN) search on a dense_vector - field and return the matching documents. Given a query vector, the API finds - the k closest vectors and returns those documents as search hits. Elasticsearch - uses the HNSW algorithm to support efficient kNN search. Like most kNN algorithms, - HNSW is an approximate method that sacrifices result accuracy for improved search - speed. 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. - - ``_ + .. raw:: html + +

Run a knn search.

+

NOTE: The kNN search API has been replaced by the knn option in the search API.

+

Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. + Given a query vector, the API finds the k closest vectors and returns those documents as search hits.

+

Elasticsearch uses the HNSW algorithm to support efficient kNN search. + Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. + 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'") @@ -2757,10 +3201,21 @@ async def mget( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get multiple documents. 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. + .. raw:: html + +

Get multiple documents.

+

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.

+ ``_ @@ -2881,13 +3336,21 @@ async def msearch( typed_keys: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Run multiple searches. The format of the request is similar to the bulk API format - and makes use of the newline delimited JSON (NDJSON) format. The structure is - as follows: ``` header\\n body\\n header\\n body\\n ``` This structure is specifically - optimized to reduce parsing if a specific search ends up redirected to another - node. IMPORTANT: The final line of data must end with a newline character `\\n`. - Each newline character may be preceded by a carriage return `\\r`. When sending - requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`. + .. raw:: html + +

Run multiple searches.

+

The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. + The structure is as follows:

+
header\\n
+          body\\n
+          header\\n
+          body\\n
+          
+

This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.

+

IMPORTANT: The final line of data must end with a newline character \\n. + Each newline character may be preceded by a carriage return \\r. + When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson.

+ ``_ @@ -3019,22 +3482,35 @@ async def msearch_template( typed_keys: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Run multiple templated searches. + .. 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. """ @@ -3114,34 +3590,41 @@ async def mtermvectors( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get multiple term vectors. 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. + .. raw:: html + +

Get multiple term vectors.

+

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: @@ -3230,36 +3713,59 @@ async def open_point_in_time( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Open a point in time. A search request by default runs against the most recent - visible data of the target indices, which is called point in time. Elasticsearch - pit (point in time) is a lightweight view into the state of the data as it existed - when initiated. In some cases, it’s preferred to perform multiple search requests - using the same point in time. For example, if refreshes happen between `search_after` - requests, then the results of those requests might not be consistent as changes - happening between searches are only visible to the more recent point in time. - A point in time must be opened explicitly before being used in search requests. - The `keep_alive` parameter tells Elasticsearch how long it should persist. + .. raw:: html + +

Open a point in time.

+

A search request by default runs against the most recent visible data of the target indices, + which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the + state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple + search requests using the same point in time. For example, if refreshes happen between + search_after requests, then the results of those requests might not be consistent as changes happening + between searches are only visible to the more recent point in time.

+

A point in time must be opened explicitly before being used in search requests.

+

A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time.

+

Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. + If you want to retrieve more hits, use PIT with search_after.

+

IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request.

+

When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. + To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime.

+

Keeping point in time alive

+

The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. + The value does not need to be long enough to process all data — it just needs to be long enough for the next request.

+

Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. + Once the smaller segments are no longer needed they are deleted. + However, open point-in-times prevent the old segments from being deleted since they are still in use.

+

TIP: Keeping older segments alive means that more disk space and file handles are needed. + Ensure that you have configured your nodes to have ample free file handles.

+

Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. + Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. + Note that a point-in-time doesn't prevent its associated indices from being deleted. + You can check how many point-in-times (that is, search contexts) are open with the nodes stats API.

+ ``_ :param index: A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices - :param keep_alive: Extends the time to live of the corresponding point in time. - :param allow_partial_search_results: If `false`, creating a point in time request - when a shard is missing or unavailable will throw an exception. If `true`, - the point in time will contain all the shards that are available at the time - of the request. - :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 keep_alive: Extend the length of time that the point in time persists. + :param allow_partial_search_results: Indicates whether the point in time tolerates + unavailable shards or shard failures when initially creating the PIT. If + `false`, creating a point in time request when a shard is missing or unavailable + will throw an exception. If `true`, the point in time will contain all the + shards that are available at the time of the request. + :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 ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. - :param index_filter: Allows to filter indices if the provided query rewrites - to `match_none` on every shard. - :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 index_filter: Filter indices if the provided query rewrites to `match_none` + on every shard. + :param preference: The node or shard the operation should be performed on. By + default, it is random. + :param routing: A custom value that is used to route operations to a specific + shard. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3325,23 +3831,27 @@ async def put_script( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a script or search template. 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. + .. raw:: html + +

Create or update a script or search template. + Creates or updates a stored script or search template.

+ + + ``_ + + :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'") @@ -3411,14 +3921,17 @@ async def rank_eval( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evaluate ranked search results. Evaluate the quality of ranked search results - over a set of typical search queries. + .. raw:: html + +

Evaluate ranked search results.

+

Evaluate the quality of ranked search results over a set of typical search queries.

+ ``_ :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 `*`. @@ -3506,33 +4019,187 @@ async def reindex( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reindex documents. Copies documents from a source to a destination. The source - can be any existing index, alias, or data stream. The destination must differ - from the source. For example, you cannot reindex a data stream into itself. + .. raw:: html + +

Reindex documents.

+

Copy documents from a source to a destination. + You can copy all documents to the destination index or reindex a subset of the documents. + The source can be any existing index, alias, or data stream. + The destination must differ from the source. + For example, you cannot reindex a data stream into itself.

+

IMPORTANT: Reindex requires _source to be enabled for all documents in the source. + The destination should be configured as wanted before calling the reindex API. + Reindex does not copy the settings from the source or its associated template. + Mappings, shard counts, and replicas, for example, must be configured ahead of time.

+

If the Elasticsearch security features are enabled, you must have the following security privileges:

+
    +
  • The read index privilege for the source data stream, index, or alias.
  • +
  • The write index privilege for the destination data stream, index, or index alias.
  • +
  • To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias.
  • +
  • If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias.
  • +
+

If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. + Automatic data stream creation requires a matching index template with data stream enabled.

+

The dest element can be configured like the index API to control optimistic concurrency control. + Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID.

+

Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source.

+

Setting op_type to create causes the reindex API to create only missing documents in the destination. + All existing documents will cause a version conflict.

+

IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. + A reindex can only add new documents to a destination data stream. + It cannot update existing documents in a destination data stream.

+

By default, version conflicts abort the reindex process. + To continue reindexing if there are conflicts, set the conflicts request body property to proceed. + In this case, the response includes a count of the version conflicts that were encountered. + Note that the handling of other error types is unaffected by the conflicts property. + Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query.

+

NOTE: The reindex API makes no effort to handle ID collisions. + The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. + Instead, make sure that IDs are unique by using a script.

+

Running reindex asynchronously

+

If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task 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_id>.

+

Reindex from multiple sources

+

If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. + That way you can resume the process if there are any errors by removing the partially completed source and starting over. + It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel.

+

For example, you can use a bash script like this:

+
for index in i1 i2 i3 i4 i5; do
+            curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{
+              "source": {
+                "index": "'$index'"
+              },
+              "dest": {
+                "index": "'$index'-reindexed"
+              }
+            }'
+          done
+          
+

** Throttling**

+

Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. + Requests are throttled by padding each batch with a wait time. + To turn off throttling, set requests_per_second to -1.

+

The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. + 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 then wait for a while before starting the next set. + This is "bursty" instead of "smooth".

+

Slicing

+

Reindex supports sliced scroll to parallelize the reindexing process. + This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts.

+

NOTE: Reindexing from remote clusters does not support manual or automatic slicing.

+

You can slice a reindex request manually by providing a slice ID and total number of slices to each request. + You can also let reindex automatically parallelize by using sliced scroll to slice on _id. + The slices parameter specifies the number of slices to use.

+

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

+
    +
  • You can see these requests in the tasks API. 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 previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed.
  • +
  • Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time.
  • +
+

If slicing automatically, setting slices to auto will choose a reasonable number for most indices. + If slicing manually or otherwise tuning automatic slicing, use the following guidelines.

+

Query performance is most efficient when the number of slices is equal to the number of shards in the index. + If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. + Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.

+

Indexing performance scales linearly across available resources with the number of slices.

+

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

+

Modify documents during reindexing

+

Like _update_by_query, reindex operations support a script that modifies the document. + Unlike _update_by_query, the script is allowed to modify the document's metadata.

+

Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. + For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. + Set ctx.op to delete if your script decides that the document must be deleted from the destination. + The deletion will be reported in the deleted counter in the response body. + Setting ctx.op to anything else will return an error, as will setting any other field in ctx.

+

Think of the possibilities! Just be careful; you are able to change:

+
    +
  • _id
  • +
  • _index
  • +
  • _version
  • +
  • _routing
  • +
+

Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. + It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API.

+

Reindex from remote

+

Reindex supports reindexing from a remote Elasticsearch cluster. + The host parameter must contain a scheme, host, port, and optional path. + The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. + Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. + There are a range of settings available to configure the behavior of the HTTPS connection.

+

When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. + Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. + It can be set to a comma delimited list of allowed remote host and port combinations. + Scheme is ignored; only the host and port are used. + For example:

+
reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"]
+          
+

The list of allowed hosts must be configured on any nodes that will coordinate the reindex. + This feature should work with remote clusters of any version of Elasticsearch. + This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version.

+

WARNING: Elasticsearch does not support forward compatibility across major versions. + For example, you cannot reindex from a 7.x cluster into a 6.x cluster.

+

To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification.

+

NOTE: Reindexing from remote clusters does not support manual or automatic slicing.

+

Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. + If the remote index includes very large documents you'll need to use a smaller batch size. + It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. + Both default to 30 seconds.

+

Configuring SSL parameters

+

Reindex from remote supports configurable SSL settings. + These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. + It is not possible to configure SSL in the body of the reindex request.

+ ``_ :param dest: The destination you are copying to. :param source: The source you are copying from. - :param conflicts: Set to proceed to continue reindexing even if there are conflicts. - :param max_docs: The maximum number of documents to reindex. + :param conflicts: Indicates whether to continue reindexing even when there are + conflicts. + :param max_docs: The maximum number of documents to reindex. By default, all + documents are reindexed. If it is a value less then or equal to `scroll_size`, + a scroll will not be used to retrieve the results for the operation. If `conflicts` + is set to `proceed`, the reindex operation could attempt to reindex more + documents from the source than `max_docs` until it has successfully indexed + `max_docs` documents into the target or it has gone through every document + in the source query. :param refresh: If `true`, the request refreshes affected shards to make this operation visible to search. :param requests_per_second: The throttle for this request in sub-requests per - second. Defaults to no throttle. + second. By default, there is no throttle. :param require_alias: If `true`, the destination must be an index alias. :param script: The script to run to update the document source or metadata when reindexing. - :param scroll: Specifies how long a consistent view of the index should be maintained - for scrolled search. + :param scroll: The period of time that a consistent view of the index should + be maintained for scrolled search. :param size: - :param slices: The number of slices this task should be divided into. Defaults - to 1 slice, meaning the task isn’t sliced into subtasks. - :param timeout: Period each indexing waits for automatic index creation, dynamic - mapping updates, and waiting for active shards. + :param slices: The number of slices this task should be divided into. It defaults + to one slice, which means the task isn't sliced into subtasks. Reindex supports + sliced scroll to parallelize the reindexing process. This parallelization + can improve efficiency and provide a convenient way to break the request + down into smaller parts. NOTE: Reindexing from remote clusters does not support + manual or automatic slicing. If set to `auto`, Elasticsearch chooses the + number of slices to use. This setting will use one slice per shard, up to + a certain limit. If there are multiple sources, it will choose the number + of slices based on the index or backing index with the smallest number of + shards. + :param timeout: The period each indexing waits for automatic index creation, + dynamic mapping updates, and waiting for active shards. By default, Elasticsearch + waits for at least one minute before failing. The actual wait time could + be longer, particularly when multiple waits occur. :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`). + before proceeding with the operation. Set it to `all` or any positive integer + up to the total number of shards in the index (`number_of_replicas+1`). The + default value is one, which means it waits for each primary shard to be active. :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ @@ -3604,14 +4271,24 @@ async def reindex_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Throttle a reindex operation. Change the number of requests per second for a - particular reindex operation. + .. raw:: html + +

Throttle a reindex operation.

+

Change the number of requests per second for a particular reindex operation. + For example:

+
POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
+          
+

Rethrottling that speeds up the query takes effect immediately. + Rethrottling that slows down the query will take effect after completing the current batch. + This behavior prevents scroll timeouts.

+ ``_ - :param task_id: Identifier for the task. + :param task_id: The task identifier, which can be found by using the tasks API. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. It can be either `-1` to turn off throttling or any decimal number + like `1.7` or `12` to throttle to that level. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -3656,17 +4333,21 @@ async def render_search_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Render a search template. Render a search template as a search request body. + .. raw:: html + +

Render a search template.

+

Render a search template as a search request body.

+ ``_ - :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] @@ -3725,7 +4406,11 @@ async def scripts_painless_execute( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a script. Runs a script and returns a result. + .. raw:: html + +

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

+ ``_ @@ -3783,30 +4468,27 @@ async def scroll( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a scrolling search. IMPORTANT: The scroll API is no longer recommend for - deep pagination. If you need to preserve the index state while paging through - more than 10,000 hits, use the `search_after` parameter with a point in time - (PIT). The scroll API gets large sets of results from a single scrolling search - request. To get the necessary scroll ID, submit a search API request that includes - an argument for the `scroll` query parameter. The `scroll` parameter indicates - how long Elasticsearch should retain the search context for the request. The - search response returns a scroll ID in the `_scroll_id` response body parameter. - You can then use the scroll ID with the scroll API to retrieve the next batch - of results for the request. If the Elasticsearch security features are enabled, - the access to the results of a specific scroll ID is restricted to the user or - API key that submitted the search. You can also use the scroll API to specify - a new scroll parameter that extends or shortens the retention period for the - search context. 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. + .. raw:: html + +

Run a scrolling search.

+

IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the search_after parameter with a point in time (PIT).

+

The scroll API gets large sets of results from a single scrolling search request. + To get the necessary scroll ID, submit a search API request that includes an argument for the scroll query parameter. + The scroll parameter indicates how long Elasticsearch should retain the search context for the request. + The search response returns a scroll ID in the _scroll_id response body parameter. + You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. + If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search.

+

You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.

+

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: 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'") @@ -3988,15 +4670,29 @@ async def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a search. Get search hits that match the query defined in the request. You - can provide search queries using the `q` query string parameter or the request - body. If both are specified, only the query parameter is used. + .. raw:: html + +

Run a search.

+

Get search hits that match the query defined in the request. + You can provide search queries using the q query string parameter or the request body. + If both are specified, only the query parameter is used.

+

If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. + To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices.

+

Search slicing

+

When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. + By default the splitting is done first on the shards, then locally on each shard. + The local splitting partitions the shard into contiguous ranges based on Lucene document IDs.

+

For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard.

+

IMPORTANT: The same point-in-time ID should be used for all slices. + If different PIT IDs are used, slices can overlap and miss documents. + This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.

+ ``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams and indices, omit this - parameter or use `*` or `_all`. + :param 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 aggregations: Defines the aggregations that are run as part of the search request. :param aggs: Defines the aggregations that are run as part of the search request. @@ -4005,45 +4701,46 @@ async def search( This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. - :param allow_partial_search_results: If true, returns partial results if there - are shard request timeouts or shard failures. If false, returns an error - with no partial results. - :param analyze_wildcard: If true, wildcard and prefix queries are analyzed. This - parameter can only be used when the q query string parameter is specified. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the q query string parameter is specified. + :param allow_partial_search_results: If `true` and there are shard request timeouts + or shard failures, the request returns partial results. If `false`, it returns + an error with no partial results. To override the default behavior, you can + set the `search.default_allow_partial_results` cluster setting to `false`. + :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. + 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 batched_reduce_size: The number of shard results that should be reduced - at once on the coordinating node. This value should be used as a protection - mechanism to reduce the memory overhead per search request if the potential - number of shards in the request can be large. - :param ccs_minimize_roundtrips: If true, network round-trips between the coordinating - node and the remote clusters are minimized when executing cross-cluster search + at once on the coordinating node. If the potential number of shards in the + request can be large, this value should be used as a protection mechanism + to reduce the memory overhead per search request. + :param ccs_minimize_roundtrips: If `true`, network round-trips between the coordinating + node and the remote clusters are minimized when running cross-cluster search (CCS) requests. :param collapse: Collapses search results the values of the specified field. - :param default_operator: The default operator for query string query: AND or - OR. This parameter can only be used when the `q` query string parameter is - specified. - :param df: Field to use as default where no field prefix is given in the query - string. This parameter can only be used when the q query string parameter + :param default_operator: The default operator for the query string query: `AND` + or `OR`. This parameter can be used only when the `q` query string parameter is specified. - :param docvalue_fields: Array of wildcard (`*`) patterns. The request returns - doc values for field names matching these patterns in the `hits.fields` property - of the response. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. - :param explain: If true, returns detailed information about score computation - as part of a hit. + :param df: The field to use as a default when no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param docvalue_fields: An array of wildcard (`*`) field patterns. The request + returns doc values for field names matching these patterns in the `hits.fields` + property of the response. + :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 explain: If `true`, the request returns detailed information about score + computation as part of a hit. :param ext: Configuration of search extensions defined by Elasticsearch plugins. - :param fields: Array of wildcard (`*`) patterns. The request returns values for - field names matching these patterns in the `hits.fields` property of the - response. + :param fields: An array of wildcard (`*`) field patterns. The request returns + values for field names matching these patterns in the `hits.fields` property + of the response. :param force_synthetic_source: Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. - :param from_: Starting document offset. Needs to be non-negative. By default, + :param from_: The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. :param highlight: Specifies the highlighter to use for retrieving highlighted @@ -4052,95 +4749,101 @@ async def search( be ignored when frozen. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. - :param include_named_queries_score: Indicates whether hit.matched_queries should - be rendered as a map that includes the name of the matched query associated - with its score (true) or as an array containing the name of the matched queries - (false) This functionality reruns each named query on every hit in a search - response. Typically, this adds a small overhead to a request. However, using - computationally expensive named queries on a large number of hits may add - significant overhead. - :param indices_boost: Boosts the _score of documents from specified indices. - :param knn: Defines the approximate kNN search to run. + :param include_named_queries_score: If `true`, the response includes the score + contribution from any named queries. This functionality reruns each named + query on every hit in a search response. Typically, this adds a small overhead + to a request. However, using computationally expensive named queries on a + large number of hits may add significant overhead. + :param indices_boost: Boost the `_score` of documents from specified indices. + The boost value is the factor by which scores are multiplied. A boost value + greater than `1.0` increases the score. A boost value between `0` and `1.0` + decreases the score. + :param knn: The approximate kNN search to run. :param lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can - only be used when the `q` query string parameter is specified. - :param max_concurrent_shard_requests: Defines the number of concurrent shard - requests per node this search executes concurrently. This value should be - used to limit the impact of the search on the cluster in order to limit the - number of concurrent shard requests. + be used only when the `q` query string parameter is specified. + :param max_concurrent_shard_requests: The number of concurrent shard requests + per node that the search runs concurrently. This value should be used to + limit the impact of the search on the cluster in order to limit the number + of concurrent shard requests. :param min_compatible_shard_node: The minimum version of the node that can handle - the request Any handling node with a lower version will fail the request. - :param min_score: Minimum `_score` for matching documents. Documents with a lower - `_score` are not included in the search results. - :param pit: Limits the search to a point in time (PIT). If you provide a PIT, + the request. Any handling node with a lower version will fail the request. + :param min_score: The minimum `_score` for matching documents. Documents with + a lower `_score` are not included in the search results. + :param pit: Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an `` in the request path. :param post_filter: Use the `post_filter` parameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results. - :param pre_filter_shard_size: Defines a threshold that enforces a pre-filter - roundtrip to prefilter search shards based on query rewriting if the number - of shards the search request expands to exceeds the threshold. This filter - roundtrip can limit the number of shards significantly if for instance a - shard can not match any documents based on its rewrite method (if date filters - are mandatory to match but the shard bounds and the query are disjoint). - When unspecified, the pre-filter phase is executed if any of these conditions - is met: the request targets more than 128 shards; the request targets one - or more read-only index; the primary sort of the query targets an indexed + :param pre_filter_shard_size: A threshold that enforces a pre-filter roundtrip + to prefilter search shards based on query rewriting if the number of shards + the search request expands to exceeds the threshold. This filter roundtrip + can limit the number of shards significantly if for instance a shard can + not match any documents based on its rewrite method (if date filters are + mandatory to match but the shard bounds and the query are disjoint). When + unspecified, the pre-filter phase is executed if any of these conditions + is met: * The request targets more than 128 shards. * The request targets + one or more read-only index. * The primary sort of the query targets an indexed field. - :param preference: Nodes and shards used for the search. By default, Elasticsearch + :param preference: The nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, - accounting for allocation awareness. Valid values are: `_only_local` to run - the search only on shards on the local node; `_local` to, if possible, run - the search on shards on the local node, or if not, select shards using the - default method; `_only_nodes:,` to run the search on only - the specified nodes IDs, where, if suitable shards exist on more than one - selected node, use shards on those nodes using the default method, or if - none of the specified nodes are available, select shards from any available - node using the default method; `_prefer_nodes:,` to if + accounting for allocation awareness. Valid values are: * `_only_local` to + run the search only on shards on the local node; * `_local` to, if possible, + run the search on shards on the local node, or if not, select shards using + the default method; * `_only_nodes:,` to run the search + on only the specified nodes IDs, where, if suitable shards exist on more + than one selected node, use shards on those nodes using the default method, + or if none of the specified nodes are available, select shards from any available + node using the default method; * `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs, or if not, select shards - using the default method; `_shards:,` to run the search only - on the specified shards; `` (any string that does not start + using the default method; * `_shards:,` to run the search only + on the specified shards; * `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order. :param profile: Set to `true` to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. - :param q: Query in the Lucene query string syntax using query parameter search. - Query parameter searches do not support the full Elasticsearch Query DSL - but are handy for testing. - :param query: Defines the search definition using the Query DSL. - :param rank: Defines the Reciprocal Rank Fusion (RRF) to use. + :param q: A query in the Lucene query string syntax. Query parameter searches + do not support the full Elasticsearch Query DSL but are handy for testing. + IMPORTANT: This parameter overrides the query parameter in the request body. + If both parameters are specified, documents matching the query request body + parameter are not returned. + :param query: The search definition using the Query DSL. + :param rank: The Reciprocal Rank Fusion (RRF) to use. :param request_cache: If `true`, the caching of search results is enabled for - requests where `size` is `0`. Defaults to index level settings. + requests where `size` is `0`. It defaults to index level settings. :param rescore: Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases. :param rest_total_hits_as_int: Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response. :param retriever: A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that - also return top documents such as query and knn. - :param routing: Custom value used to route operations to a specific shard. - :param runtime_mappings: Defines one or more runtime fields in the search request. - These fields take precedence over mapped fields with the same name. + also return top documents such as `query` and `knn`. + :param routing: A custom value that is used to route operations to a specific + shard. + :param runtime_mappings: One or more runtime fields in the search request. These + fields take precedence over mapped fields with the same name. :param script_fields: Retrieve a script evaluation (based on different fields) for each hit. - :param scroll: Period to retain the search context for scrolling. See Scroll - search results. By default, this value cannot exceed `1d` (24 hours). You - can change this limit using the `search.max_keep_alive` cluster-level setting. + :param scroll: The period to retain the search context for scrolling. By default, + this value cannot exceed `1d` (24 hours). You can change this limit by using + the `search.max_keep_alive` cluster-level setting. :param search_after: Used to retrieve the next page of hits using a set of sort values from the previous page. - :param search_type: How distributed term frequencies are calculated for relevance - scoring. - :param seq_no_primary_term: If `true`, returns sequence number and primary term - of the last modification of each hit. - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param slice: Can be used to split a scrolled search into multiple slices that - can be consumed independently. + :param search_type: Indicates how distributed term frequencies are calculated + for relevance scoring. + :param seq_no_primary_term: If `true`, the request returns sequence number and + primary term of the last modification of each hit. + :param size: The number of hits to return, which must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` property. + :param slice: Split a scrolled search into multiple slices that can be consumed + independently. :param sort: A comma-separated list of : pairs. - :param source: Indicates which source fields are returned for matching documents. - These fields are returned in the hits._source property of the search response. + :param source: The source fields that are returned for matching documents. These + fields are returned in the `hits._source` property of the search response. + If the `stored_fields` property is specified, the `_source` property defaults + to `false`. Otherwise, it defaults to `true`. :param source_excludes: A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` @@ -4150,45 +4853,46 @@ async def search( returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. - :param stats: Stats groups to associate with the search. Each group maintains + :param stats: The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the `_source` parameter defaults to `false`. You can - pass `_source: true` to return both source fields and stored fields in the - search response. + :param stored_fields: A comma-separated 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` property defaults to + `false`. You can pass `_source: true` to return both source fields and stored + fields in the search response. :param suggest: Defines a suggester that provides similar looking terms based on a provided text. - :param suggest_field: Specifies which field to use for suggestions. - :param suggest_mode: Specifies the suggest mode. This parameter can only be used - when the `suggest_field` and `suggest_text` query string parameters are specified. - :param suggest_size: Number of suggestions to return. This parameter can only - be used when the `suggest_field` and `suggest_text` query string parameters + :param suggest_field: The field to use for suggestions. + :param suggest_mode: The suggest mode. This parameter can be used only when the + `suggest_field` and `suggest_text` query string parameters are specified. + :param suggest_size: The number of suggestions to return. This parameter can + be used only when the `suggest_field` and `suggest_text` query string parameters are specified. :param suggest_text: The source text for which the suggestions should be returned. - This parameter can only be used when the `suggest_field` and `suggest_text` + This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. - :param terminate_after: Maximum number of documents to collect for each 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. - Elasticsearch collects documents before sorting. Use with caution. Elasticsearch - applies this parameter to each shard handling the request. When possible, - let Elasticsearch perform early termination automatically. Avoid specifying - this parameter for requests that target data streams with backing indices - across multiple data tiers. If set to `0` (default), the query does not terminate - early. - :param timeout: Specifies the period of time to wait for a response from each - shard. If no response is received before the timeout expires, the request - fails and returns an error. Defaults to no timeout. - :param track_scores: If true, calculate and return document scores, even if the - scores are not used for sorting. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this property to each shard handling the request. When + possible, let Elasticsearch perform early termination automatically. Avoid + specifying this property for requests that target data streams with backing + indices across multiple data tiers. If set to `0` (default), the query does + not terminate early. + :param timeout: The period of time to wait for a response from each shard. If + no response is received before the timeout expires, the request fails and + returns an error. Defaults to no timeout. + :param track_scores: If `true`, calculate and return document scores, even if + the scores are not used for sorting. :param track_total_hits: Number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. :param typed_keys: If `true`, aggregation and suggester names are be prefixed by their respective types in the response. - :param version: If true, returns document version as part of a hit. + :param version: If `true`, the request returns the document version as part of + a hit. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -4420,7 +5124,319 @@ async def search_mvt( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> BinaryApiResponse: """ - Search a vector tile. Search a vector tile for geospatial values. + .. raw:: html + +

Search a vector tile.

+

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.

+ ``_ @@ -4429,43 +5445,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'") @@ -4574,15 +5602,20 @@ async def search_shards( routing: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+

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 @@ -4596,9 +5629,9 @@ async def search_shards( a missing or closed index. :param local: If `true`, the request retrieves information from the local node only. - :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 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: @@ -4678,12 +5711,15 @@ async def search_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a search with a search template. + .. raw:: html + +

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 @@ -4691,32 +5727,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. """ @@ -4810,34 +5848,39 @@ async def terms_enum( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

Get terms in an index.

+

Discover terms that match a partial string in an index. + 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'") @@ -4916,33 +5959,77 @@ async def termvectors( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get term vector information. Get information and statistics about terms in the - fields of a particular document. + .. raw:: html + +

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'") @@ -5059,46 +6146,65 @@ async def update( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a document. Updates a document by running a script or passing a partial - document. + .. raw:: html + +

Update a document.

+

Update a document by running a script or passing a partial document.

+

If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias.

+

The script can update, delete, or skip modifying the document. + The API also supports passing a partial document, which is merged into the existing document. + To fully replace an existing document, use the index API. + This operation:

+
    +
  • Gets the document (collocated with the shard) from the index.
  • +
  • Runs the specified script.
  • +
  • Indexes the result.
  • +
+

The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation.

+

The _source field must be enabled to use this API. + In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp).

+ ``_ - :param index: The name of the index - :param id: Document ID - :param detect_noop: Set to false to disable setting 'result' in the response - to 'noop' if no change to the document occurred. - :param doc: A partial update to an existing document. - :param doc_as_upsert: Set to true to use the contents of 'doc' as the value of - 'upsert' + :param index: The name of the target index. By default, the index is created + automatically if it doesn't exist. + :param id: A unique identifier for the document to be updated. + :param detect_noop: If `true`, the `result` in the response is set to `noop` + (no operation) when there are no changes to the document. + :param doc: A partial update to an existing document. If both `doc` and `script` + are specified, `doc` is ignored. + :param doc_as_upsert: If `true`, use the contents of 'doc' as the value of 'upsert'. + NOTE: Using ingest pipelines with `doc_as_upsert` is not supported. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param lang: The script language. :param refresh: If 'true', Elasticsearch refreshes the affected shards to make - this operation visible to search, if 'wait_for' then wait for a refresh to - make this operation visible to search, if 'false' do nothing with refreshes. - :param require_alias: If true, the destination must be an index alias. - :param retry_on_conflict: Specify how many times should the operation be retried + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', it does nothing with refreshes. + :param require_alias: If `true`, the destination must be an index alias. + :param retry_on_conflict: The number of times the operation should be retried when a conflict occurs. - :param routing: Custom value used to route operations to a specific shard. - :param script: Script to execute to update the document. - :param scripted_upsert: Set to true to execute the script whether or not the - document exists. - :param source: Set to false to disable source retrieval. You can also specify - a comma-separated list of the fields you want to retrieve. - :param source_excludes: Specify the source fields you want to exclude. - :param source_includes: Specify the source fields you want to retrieve. - :param timeout: Period to wait for dynamic mapping updates and active shards. - This guarantees Elasticsearch waits for at least the timeout before failing. - The actual wait time could be longer, particularly when multiple waits occur. + :param routing: A custom value used to route operations to a specific shard. + :param script: The script to run to update the document. + :param scripted_upsert: If `true`, run the script whether or not the document + exists. + :param source: If `false`, turn off source retrieval. You can also specify a + comma-separated list of the fields you want to retrieve. + :param source_excludes: The source fields you want to exclude. + :param source_includes: The source fields you want to retrieve. + :param timeout: The period to wait for the following operations: dynamic mapping + updates and waiting for active shards. Elasticsearch waits for at least the + timeout period before failing. The actual wait time could be longer, particularly + when multiple waits occur. :param upsert: If the document does not already exist, the contents of 'upsert' - are inserted as a new document. If the document exists, the 'script' is executed. - :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operations. Set to 'all' or any positive integer - up to the total number of shards in the index (number_of_replicas+1). Defaults - to 1 meaning the primary shard. + are inserted as a new document. If the document exists, the 'script' is run. + :param wait_for_active_shards: The number of copies of each shard 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). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5224,82 +6330,166 @@ async def update_by_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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'") @@ -5422,16 +6612,18 @@ async def update_by_query_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Throttle an update by query operation. Change the number of requests per second - for a particular update by query operation. 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. + .. raw:: html + +

Throttle an update by query operation.

+

Change the number of requests per second for a particular update by query operation. + 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 c2c3f9526..ddd355f3f 100644 --- a/elasticsearch/_async/client/async_search.py +++ b/elasticsearch/_async/client/async_search.py @@ -36,11 +36,13 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an async search. If the asynchronous search is still running, it is cancelled. - Otherwise, the saved search results are deleted. If the Elasticsearch security - features are enabled, the deletion of a specific async search is restricted to: - the authenticated user that submitted the original search request; users that - have the `cancel_task` cluster privilege. + .. raw:: html + +

Delete an async search.

+

If the asynchronous search is still running, it is cancelled. + Otherwise, the saved search results are deleted. + If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege.

+ ``_ @@ -85,10 +87,12 @@ async def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get async search results. Retrieve the results of a previously submitted asynchronous - search request. If the Elasticsearch security features are enabled, access to - the results of a specific async search is restricted to the user or API key that - submitted it. + .. raw:: html + +

Get async search results.

+

Retrieve the results of a previously submitted asynchronous search request. + If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it.

+ ``_ @@ -149,10 +153,12 @@ async def status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -264,6 +270,7 @@ async def submit( ignore_throttled: t.Optional[bool] = None, ignore_unavailable: t.Optional[bool] = None, indices_boost: t.Optional[t.Sequence[t.Mapping[str, float]]] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, keep_on_completion: t.Optional[bool] = None, knn: t.Optional[ t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]] @@ -326,15 +333,14 @@ async def submit( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run an async search. When the primary sort of the results is an indexed field, - shards get sorted based on minimum and maximum value that they hold for that - field. Partial results become available following the sort criteria that was - requested. Warning: Asynchronous search does not support scroll or search requests - that include only the suggest section. By default, Elasticsearch does not allow - you to store an async search response larger than 10Mb and an attempt to do this - results in an error. The maximum allowed size for a stored async search response - can be set by changing the `search.max_async_search_response_size` cluster level - setting. + .. raw:: html + +

Run an async search.

+

When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested.

+

Warning: Asynchronous search does not support scroll or search requests that include only the suggest section.

+

By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. + The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting.

+ ``_ @@ -379,6 +385,9 @@ async def submit( :param ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed) :param indices_boost: Boosts the _score of documents from specified indices. + :param keep_alive: Specifies how long the async search needs to be available. + Ongoing async searches and any saved search results are deleted after this + period. :param keep_on_completion: If `true`, results are stored for later retrieval when the search completes within the `wait_for_completion_timeout`. :param knn: Defines the approximate kNN search to run. @@ -505,6 +514,8 @@ async def submit( __query["ignore_throttled"] = ignore_throttled if ignore_unavailable is not None: __query["ignore_unavailable"] = ignore_unavailable + if keep_alive is not None: + __query["keep_alive"] = keep_alive if keep_on_completion is not None: __query["keep_on_completion"] = keep_on_completion if lenient is not None: diff --git a/elasticsearch/_async/client/autoscaling.py b/elasticsearch/_async/client/autoscaling.py index 82e0e6d8c..9999f82e8 100644 --- a/elasticsearch/_async/client/autoscaling.py +++ b/elasticsearch/_async/client/autoscaling.py @@ -38,9 +38,11 @@ async def delete_autoscaling_policy( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an autoscaling policy. NOTE: This feature is designed for indirect use - by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. - Direct use is not supported. + .. raw:: html + +

Delete an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ ``_ @@ -89,18 +91,18 @@ async def get_autoscaling_capacity( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the autoscaling capacity. NOTE: This feature is designed for indirect use - by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. - Direct use is not supported. This API gets the current autoscaling capacity based - on the configured autoscaling policy. It will return information to size the - cluster appropriately to the current workload. The `required_capacity` is calculated - as the maximum of the `required_capacity` result of all individual deciders that - are enabled for the policy. The operator should verify that the `current_nodes` - match the operator’s knowledge of the cluster to avoid making autoscaling decisions - based on stale or incomplete information. The response contains decider-specific - information you can use to diagnose how and why autoscaling determined a certain - capacity was required. This information is provided for diagnosis only. Do not - use this information to make autoscaling decisions. + .. raw:: html + +

Get the autoscaling capacity.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

This API gets the current autoscaling capacity based on the configured autoscaling policy. + It will return information to size the cluster appropriately to the current workload.

+

The required_capacity is calculated as the maximum of the required_capacity result of all individual deciders that are enabled for the policy.

+

The operator should verify that the current_nodes match the operator’s knowledge of the cluster to avoid making autoscaling decisions based on stale or incomplete information.

+

The response contains decider-specific information you can use to diagnose how and why autoscaling determined a certain capacity was required. + This information is provided for diagnosis only. + Do not use this information to make autoscaling decisions.

+ ``_ @@ -143,9 +145,11 @@ async def get_autoscaling_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an autoscaling policy. NOTE: This feature is designed for indirect use by - Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. - Direct use is not supported. + .. raw:: html + +

Get an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ ``_ @@ -196,9 +200,11 @@ async def put_autoscaling_policy( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an autoscaling policy. NOTE: This feature is designed for indirect - use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on - Kubernetes. Direct use is not supported. + .. raw:: html + +

Create or update an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ ``_ diff --git a/elasticsearch/_async/client/cat.py b/elasticsearch/_async/client/cat.py index c03c3e348..6ffa36b68 100644 --- a/elasticsearch/_async/client/cat.py +++ b/elasticsearch/_async/client/cat.py @@ -57,18 +57,22 @@ async def aliases( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get aliases. Retrieves the cluster’s index aliases, including filter and routing - information. The API does not return data stream aliases. CAT APIs are only intended - for human consumption using the command line or the Kibana console. They are - not intended for use by applications. For application consumption, use the aliases - API. + .. raw:: html + +

Get aliases.

+

Get the cluster's index aliases, including filter and routing information. + This API does not return data stream aliases.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API.

+ ``_ :param name: A comma-separated list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -78,7 +82,10 @@ async def aliases( the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. To indicated that the request should never timeout, + you can set it to `-1`. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -147,13 +154,16 @@ async def allocation( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Provides a snapshot of the number of shards allocated to each data node and their - disk space. IMPORTANT: cat APIs are only intended for human consumption using - the command line or Kibana console. They are not intended for use by applications. + .. raw:: html + +

Get shard allocation information.

+

Get a snapshot of the number of shards allocated to each data node and their disk space.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.

+ ``_ - :param node_id: Comma-separated list of node identifiers or names used to limit + :param node_id: A comma-separated list of node identifiers or names used to limit the returned information. :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set @@ -231,17 +241,19 @@ async def component_templates( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get component templates. Returns information about component templates in a cluster. - Component templates are building blocks for constructing index templates that - specify index mappings, settings, and aliases. 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 get component template - API. + .. raw:: html + +

Get component templates.

+

Get information about component templates in a cluster. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+

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 get component template API.

+ ``_ - :param name: The name of the component template. Accepts wildcard expressions. - If omitted, all component templates are returned. + :param name: The name of the component template. It accepts wildcard expressions. + If it is omitted, all component templates are returned. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -251,7 +263,7 @@ async def component_templates( the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. + :param master_timeout: The period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -313,17 +325,19 @@ async def count( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get a document count. Provides quick access to a document count for a data stream, - an index, or an entire cluster. The document count only includes live documents, - not deleted documents which have not yet been removed by the merge process. 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 count API. + .. raw:: html + +

Get a document count.

+

Get quick access to a document count for a data stream, an index, or an entire cluster. + The document count only includes live documents, not deleted documents which have not yet been removed by the merge process.

+

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 count API.

+ ``_ - :param index: Comma-separated list of data streams, indices, and aliases used - to limit the request. Supports wildcards (`*`). To target all data streams + :param index: A comma-separated list of data streams, indices, and aliases used + to limit the request. It supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -390,10 +404,13 @@ async def fielddata( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the amount of heap memory currently used by the field data cache on every - data node in the cluster. 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 nodes stats API. + .. raw:: html + +

Get field data cache information.

+

Get the amount of heap memory currently used by the field data cache on every data node in the cluster.

+

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 nodes stats API.

+ ``_ @@ -467,17 +484,19 @@ async def health( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the health status of a cluster, similar to the cluster health API. 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 cluster health API. This API is often used to check malfunctioning clusters. - To help you track cluster health alongside log files and alerting systems, the - API returns timestamps in two formats: `HH:MM:SS`, which is human-readable but - includes no date information; `Unix epoch time`, which is machine-sortable and - includes date information. The latter format is useful for cluster recoveries - that take multiple days. You can use the cat health API to verify cluster health - across multiple nodes. You also can use the API to track the recovery of a large - cluster over a longer period of time. + .. raw:: html + +

Get the cluster health status.

+

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 cluster health API. + This API is often used to check malfunctioning clusters. + To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: + HH:MM:SS, which is human-readable but includes no date information; + Unix epoch time, which is machine-sortable and includes date information. + The latter format is useful for cluster recoveries that take multiple days. + You can use the cat health API to verify cluster health across multiple nodes. + You also can use the API to track the recovery of a large cluster over a longer period of time.

+ ``_ @@ -531,7 +550,11 @@ async def health( @_rewrite_parameters() async def help(self) -> TextApiResponse: """ - Get CAT help. Returns help for the CAT APIs. + .. raw:: html + +

Get CAT help.

+

Get help for the CAT APIs.

+ ``_ """ @@ -582,16 +605,23 @@ async def indices( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get index information. Returns high-level information about indices in a cluster, - including backing indices for data streams. Use this request to get the following - information for each index in a cluster: - shard count - document count - deleted - document count - primary store size - total store size of all shards, including - shard replicas These metrics are retrieved directly from Lucene, which Elasticsearch - uses internally to power indexing and search. As a result, all document counts - include hidden nested documents. To get an accurate count of Elasticsearch documents, - use the cat count or count APIs. 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 an index endpoint. + .. raw:: html + +

Get index information.

+

Get high-level information about indices in a cluster, including backing indices for data streams.

+

Use this request to get the following information for each index in a cluster:

+
    +
  • shard count
  • +
  • document count
  • +
  • deleted document count
  • +
  • primary store size
  • +
  • total store size of all shards, including shard replicas
  • +
+

These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents. + To get an accurate count of Elasticsearch documents, use the cat count or count APIs.

+

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 an index endpoint.

+ ``_ @@ -684,10 +714,12 @@ async def master( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the master node, including the ID, bound IP address, - and name. 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 nodes info API. + .. raw:: html + +

Get master node information.

+

Get information about the master node, including the ID, bound IP address, and name.

+

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 nodes info API.

+ ``_ @@ -858,11 +890,14 @@ async def ml_data_frame_analytics( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get data frame analytics jobs. Returns configuration and usage information about - data frame analytics jobs. CAT APIs are only intended for human consumption using - the Kibana console or command line. They are not intended for use by applications. - For application consumption, use the get data frame analytics jobs statistics - API. + .. raw:: html + +

Get data frame analytics jobs.

+

Get configuration and usage information about data frame analytics jobs.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get data frame analytics jobs statistics API.

+ ``_ @@ -1020,12 +1055,17 @@ async def ml_datafeeds( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get datafeeds. Returns configuration and usage information about datafeeds. This - API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features - are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` - cluster privileges to use this API. CAT APIs are only intended for human consumption - using the Kibana console or command line. They are not intended for use by applications. - For application consumption, use the get datafeed statistics API. + .. raw:: html + +

Get datafeeds.

+

Get configuration and usage information about datafeeds. + This API returns a maximum of 10,000 datafeeds. + If the Elasticsearch security features are enabled, you must have monitor_ml, monitor, manage_ml, or manage + cluster privileges to use this API.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get datafeed statistics API.

+ ``_ @@ -1381,13 +1421,17 @@ async def ml_jobs( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get anomaly detection jobs. Returns configuration and usage information for anomaly - detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch - security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, - or `manage` cluster privileges to use this API. CAT APIs are only intended for - human consumption using the Kibana console or command line. They are not intended - for use by applications. For application consumption, use the get anomaly detection - job statistics API. + .. raw:: html + +

Get anomaly detection jobs.

+

Get configuration and usage information for anomaly detection jobs. + This API returns a maximum of 10,000 jobs. + If the Elasticsearch security features are enabled, you must have monitor_ml, + monitor, manage_ml, or manage cluster privileges to use this API.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get anomaly detection job statistics API.

+ ``_ @@ -1565,10 +1609,14 @@ async def ml_trained_models( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get trained models. Returns configuration and usage information about inference - trained models. CAT APIs are only intended for human consumption using the Kibana - console or command line. They are not intended for use by applications. For application - consumption, use the get trained models statistics API. + .. raw:: html + +

Get trained models.

+

Get configuration and usage information about inference trained models.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get trained models statistics API.

+ ``_ @@ -1656,10 +1704,12 @@ async def nodeattrs( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about custom node attributes. 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 - nodes info API. + .. raw:: html + +

Get node attribute information.

+

Get information about custom node attributes. + 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 nodes info API.

+ ``_ @@ -1737,10 +1787,12 @@ async def nodes( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the nodes in a cluster. 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 - nodes info API. + .. raw:: html + +

Get node information.

+

Get information about the nodes in a cluster. + 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 nodes info API.

+ ``_ @@ -1822,10 +1874,12 @@ async def pending_tasks( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns cluster-level changes that have not yet been executed. 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 pending cluster tasks API. + .. raw:: html + +

Get pending task information.

+

Get information about cluster-level changes that have not yet taken effect. + 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 pending cluster tasks API.

+ ``_ @@ -1900,10 +1954,12 @@ async def plugins( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns a list of plugins running on each node of a cluster. 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 nodes info API. + .. raw:: html + +

Get plugin information.

+

Get a list of plugins running on each node of a cluster. + 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 nodes info API.

+ ``_ @@ -1984,14 +2040,14 @@ async def recovery( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about ongoing and completed shard recoveries. Shard recovery - is the process of initializing a shard copy, such as restoring a primary shard - from a snapshot or syncing a replica shard from a primary shard. When a shard - recovery completes, the recovered shard is available for search and indexing. - For data streams, the API returns information about the stream’s backing indices. - 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 index recovery API. + .. raw:: html + +

Get shard recovery information.

+

Get information about ongoing and completed shard recoveries. + Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or syncing a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing. + For data streams, the API returns information about the stream’s backing indices. + 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 index recovery API.

+ ``_ @@ -2074,10 +2130,12 @@ async def repositories( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the snapshot repositories for a cluster. 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 - get snapshot repository API. + .. raw:: html + +

Get snapshot repository information.

+

Get a list of snapshot repositories for a cluster. + 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 get snapshot repository API.

+ ``_ @@ -2152,11 +2210,13 @@ async def segments( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns low-level information about the Lucene segments in index shards. For - data streams, the API returns information about the backing indices. 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 index segments API. + .. raw:: html + +

Get segment information.

+

Get low-level information about the Lucene segments in index shards. + For data streams, the API returns information about the backing indices. + 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 index segments API.

+ ``_ @@ -2244,10 +2304,13 @@ async def shards( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the shards in a cluster. For data streams, the API - returns information about the backing indices. IMPORTANT: cat APIs are only intended - for human consumption using the command line or Kibana console. They are not - intended for use by applications. + .. raw:: html + +

Get shard information.

+

Get information about the shards in a cluster. + For data streams, the API returns information about the backing indices. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.

+ ``_ @@ -2330,11 +2393,13 @@ async def snapshots( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the snapshots stored in one or more repositories. A - snapshot is a backup of an index or running Elasticsearch cluster. 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 get snapshot API. + .. raw:: html + +

Get snapshot information.

+

Get information about the snapshots stored in one or more repositories. + A snapshot is a backup of an index or running Elasticsearch cluster. + 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 get snapshot API.

+ ``_ @@ -2422,10 +2487,12 @@ async def tasks( wait_for_completion: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about tasks currently executing in the cluster. 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. + .. raw:: html + +

Get task information.

+

Get information about tasks currently running in the cluster. + 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.

+ ``_ @@ -2513,11 +2580,13 @@ async def templates( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about index templates in a cluster. You can use index templates - to apply index settings and field mappings to new indices at creation. 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 get index template API. + .. raw:: html + +

Get index template information.

+

Get information about the index templates in a cluster. + You can use index templates to apply index settings and field mappings to new indices at creation. + 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 get index template API.

+ ``_ @@ -2599,11 +2668,13 @@ async def thread_pool( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns thread pool statistics for each node in a cluster. Returned information - includes all built-in thread pools and custom thread pools. 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 nodes info API. + .. raw:: html + +

Get thread pool statistics.

+

Get thread pool statistics for each node in a cluster. + Returned information includes all built-in thread pools and custom thread pools. + 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 nodes info API.

+ ``_ @@ -2853,10 +2924,14 @@ async def transforms( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get transforms. Returns configuration and usage information about transforms. - CAT APIs are only intended for human consumption using the Kibana console or - command line. They are not intended for use by applications. For application - consumption, use the get transform statistics API. + .. raw:: html + +

Get transform information.

+

Get configuration and usage information about transforms.

+

CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get transform statistics API.

+ ``_ diff --git a/elasticsearch/_async/client/ccr.py b/elasticsearch/_async/client/ccr.py index c843f7b8e..9880c32dc 100644 --- a/elasticsearch/_async/client/ccr.py +++ b/elasticsearch/_async/client/ccr.py @@ -36,8 +36,11 @@ async def delete_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete auto-follow patterns. Delete a collection of cross-cluster replication - auto-follow patterns. + .. raw:: html + +

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

+ ``_ @@ -108,10 +111,12 @@ async def follow( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a follower. Create a cross-cluster replication follower index that follows - a specific leader index. When the API returns, the follower index exists and - cross-cluster replication starts replicating operations from the leader index - to the follower index. + .. raw:: html + +

Create a follower. + Create a cross-cluster replication follower index that follows a specific leader index. + When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index.

+ ``_ @@ -202,10 +207,12 @@ async def follow_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -246,9 +253,12 @@ async def follow_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -301,23 +311,19 @@ async def forget_follower( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Forget a follower. Remove the cross-cluster replication follower retention leases - from the leader. A following index takes out retention leases on its leader index. - These leases are used to increase the likelihood that the shards of the leader - index retain the history of operations that the shards of the following index - need to run replication. When a follower index is converted to a regular index - by the unfollow API (either by directly calling the API or by index lifecycle - management tasks), these leases are removed. However, removal of the leases can - fail, for example when the remote cluster containing the leader index is unavailable. - While the leases will eventually expire on their own, their extended existence - can cause the leader index to hold more history than necessary and prevent index - lifecycle management from performing some operations on the leader index. This - API exists to enable manually removing the leases when the unfollow API is unable - to do so. NOTE: This API does not stop replication by a following index. If you - use this API with a follower index that is still actively following, the following - index will add back retention leases on the leader. The only purpose of this - API is to handle the case of failure to remove the following retention leases - after the unfollow API is invoked. + .. raw:: html + +

Forget a follower. + Remove the cross-cluster replication follower retention leases from the leader.

+

A following index takes out retention leases on its leader index. + These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. + When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. + However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. + While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. + This API exists to enable manually removing the leases when the unfollow API is unable to do so.

+

NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. + The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked.

+ ``_ @@ -373,7 +379,11 @@ async def get_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get auto-follow patterns. Get cross-cluster replication auto-follow patterns. + .. raw:: html + +

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

+ ``_ @@ -417,14 +427,16 @@ async def pause_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. When it - resumes, the auto-follow pattern is active again and automatically configures - follower indices for newly created indices on the remote cluster that match its - patterns. Remote indices that were created while the pattern was paused will - also be followed, unless they have been deleted or closed in the interim. + .. raw:: html + +

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. + When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. + Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim.

+ ``_ @@ -465,10 +477,14 @@ async def pause_follow( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -543,14 +559,15 @@ async def put_auto_follow_pattern( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update auto-follow patterns. Create a collection of cross-cluster replication - auto-follow patterns for a remote cluster. Newly created indices on the remote - cluster that match any of the patterns are automatically configured as follower - indices. Indices on the remote cluster that were created before the auto-follow - pattern was created will not be auto-followed even if they match the pattern. - This API can also be used to update auto-follow patterns. NOTE: Follower indices - that were configured automatically before updating an auto-follow pattern will - remain unchanged even if they do not match against the new patterns. + .. raw:: html + +

Create or update auto-follow patterns. + Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. + Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. + Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern.

+

This API can also be used to update auto-follow patterns. + NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns.

+ ``_ @@ -674,11 +691,13 @@ async def resume_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -743,11 +762,14 @@ async def resume_follow( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Resume a follower. Resume a cross-cluster replication follower index that was - paused. The follower index could have been paused with the pause follower API. - Alternatively it could be paused due to replication that cannot be retried due - to failures during following tasks. When this API returns, the follower index - will resume fetching operations from the leader index. + .. raw:: html + +

Resume a follower. + Resume a cross-cluster replication follower index that was paused. + The follower index could have been paused with the pause follower API. + Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. + When this API returns, the follower index will resume fetching operations from the leader index.

+ ``_ @@ -829,8 +851,11 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cross-cluster replication stats. This API returns stats about auto-following - and the same shard-level stats as the get follower stats API. + .. 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.

+ ``_ """ @@ -866,13 +891,14 @@ async def unfollow( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ diff --git a/elasticsearch/_async/client/cluster.py b/elasticsearch/_async/client/cluster.py index 9e0dcb7ca..54ee329af 100644 --- a/elasticsearch/_async/client/cluster.py +++ b/elasticsearch/_async/client/cluster.py @@ -44,13 +44,14 @@ async def allocation_explain( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain the shard allocations. Get explanations for shard allocations in the - cluster. For unassigned shards, it provides an explanation for why the shard - is unassigned. For assigned shards, it provides an explanation for why the shard - is remaining on its current node and has not moved or rebalanced to another node. - This API can be very useful when attempting to diagnose why a shard is unassigned - or why a shard continues to remain on its current node when you might expect - otherwise. + .. raw:: html + +

Explain the shard allocations. + Get explanations for shard allocations in the cluster. + For unassigned shards, it provides an explanation for why the shard is unassigned. + For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. + This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.

+ ``_ @@ -119,8 +120,11 @@ async def delete_component_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete component templates. Component templates are building blocks for constructing - index templates that specify index mappings, settings, and aliases. + .. raw:: html + +

Delete component templates. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+ ``_ @@ -170,8 +174,11 @@ async def delete_voting_config_exclusions( wait_for_removal: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear cluster voting config exclusions. Remove master-eligible nodes from the - voting configuration exclusion list. + .. raw:: html + +

Clear cluster voting config exclusions. + Remove master-eligible nodes from the voting configuration exclusion list.

+ ``_ @@ -218,8 +225,11 @@ async def exists_component_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check component templates. Returns information about whether a particular component - template exists. + .. raw:: html + +

Check component templates. + Returns information about whether a particular component template exists.

+ ``_ @@ -274,7 +284,11 @@ async def get_component_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get component templates. Get information about component templates. + .. raw:: html + +

Get component templates. + Get information about component templates.

+ ``_ @@ -337,8 +351,11 @@ async def get_settings( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster-wide settings. By default, it returns only settings that have been - explicitly defined. + .. raw:: html + +

Get cluster-wide settings. + By default, it returns only settings that have been explicitly defined.

+ ``_ @@ -420,16 +437,17 @@ async def health( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the cluster health status. You can also use the API to get the health status - of only specified data streams and indices. For data streams, the API retrieves - the health status of the stream’s backing indices. The cluster health status - is: green, yellow or red. On the shard level, a red status indicates that the - specific shard is not allocated in the cluster. Yellow means that the primary - shard is allocated but replicas are not. Green means that all shards are allocated. - The index level status is controlled by the worst shard status. One of the main - benefits of the API is the ability to wait until the cluster reaches a certain - high watermark health level. The cluster status is controlled by the worst index - status. + .. raw:: html + +

Get the cluster health status. + You can also use the API to get the health status of only specified data streams and indices. + For data streams, the API retrieves the health status of the stream’s backing indices.

+

The cluster health status is: green, yellow or red. + On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. + The index level status is controlled by the worst shard status.

+

One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. + The cluster status is controlled by the worst index status.

+ ``_ @@ -533,7 +551,11 @@ async def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster info. Returns basic information about the cluster. + .. raw:: html + +

Get cluster info. + Returns basic information about the cluster.

+ ``_ @@ -575,14 +597,14 @@ async def pending_tasks( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the pending cluster tasks. Get information about cluster-level changes (such - as create index, update mapping, allocate or fail shard) that have not yet taken - effect. NOTE: This API returns a list of any pending updates to the cluster state. - These are distinct from the tasks reported by the task management API which include - periodic tasks and tasks initiated by the user, such as node stats, search queries, - or create index requests. However, if a user-initiated task such as a create - index command causes a cluster state update, the activity of this task might - be reported by both task api and pending cluster tasks API. + .. raw:: html + +

Get the pending cluster tasks. + Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect.

+

NOTE: This API returns a list of any pending updates to the cluster state. + These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. + However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.

+ ``_ @@ -630,33 +652,24 @@ async def post_voting_config_exclusions( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update voting configuration exclusions. Update the cluster voting config exclusions - by node IDs or node names. By default, if there are more than three master-eligible - nodes in the cluster and you remove fewer than half of the master-eligible nodes - in the cluster at once, the voting configuration automatically shrinks. If you - want to shrink the voting configuration to contain fewer than three nodes or - to remove half or more of the master-eligible nodes in the cluster at once, use - this API to remove departing nodes from the voting configuration manually. The - API adds an entry for each specified node to the cluster’s voting configuration - exclusions list. It then waits until the cluster has reconfigured its voting - configuration to exclude the specified nodes. Clusters should have no voting - configuration exclusions in normal operation. Once the excluded nodes have stopped, - clear the voting configuration exclusions with `DELETE /_cluster/voting_config_exclusions`. - This API waits for the nodes to be fully removed from the cluster before it returns. - If your cluster has voting configuration exclusions for nodes that you no longer - intend to remove, use `DELETE /_cluster/voting_config_exclusions?wait_for_removal=false` - to clear the voting configuration exclusions without waiting for the nodes to - leave the cluster. A response to `POST /_cluster/voting_config_exclusions` with - an HTTP status code of 200 OK guarantees that the node has been removed from - the voting configuration and will not be reinstated until the voting configuration - exclusions are cleared by calling `DELETE /_cluster/voting_config_exclusions`. - If the call to `POST /_cluster/voting_config_exclusions` fails or returns a response - with an HTTP status code other than 200 OK then the node may not have been removed - from the voting configuration. In that case, you may safely retry the call. NOTE: - Voting exclusions are required only when you remove at least half of the master-eligible - nodes from a cluster in a short time period. They are not required when removing - master-ineligible nodes or when removing fewer than half of the master-eligible - nodes. + .. raw:: html + +

Update voting configuration exclusions. + Update the cluster voting config exclusions by node IDs or node names. + By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. + If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. + The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. + It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes.

+

Clusters should have no voting configuration exclusions in normal operation. + Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. + This API waits for the nodes to be fully removed from the cluster before it returns. + If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster.

+

A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. + If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. + In that case, you may safely retry the call.

+

NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. + They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.

+ ``_ @@ -718,21 +731,23 @@ async def put_component_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a component template. Component templates are building blocks - for constructing index templates that specify index mappings, settings, and aliases. - An index template can be composed of multiple component templates. To use a component - template, specify it in an index template’s `composed_of` list. Component templates - are only applied to new data streams and indices as part of a matching index - template. Settings and mappings specified directly in the index template or the - create index request override any settings or mappings specified in a component - template. Component templates are only used during index creation. For data streams, - this includes data stream creation and the creation of a stream’s backing indices. - Changes to component templates do not affect existing indices, including a stream’s - backing indices. You can use C-style `/* *\\/` block comments in component templates. - You can include comments anywhere in the request body except before the opening - curly bracket. **Applying component templates** You cannot directly apply a component - template to a data stream or index. To be applied, a component template must - be included in an index template's `composed_of` list. + .. raw:: html + +

Create or update a component template. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+

An index template can be composed of multiple component templates. + To use a component template, specify it in an index template’s composed_of list. + Component templates are only applied to new data streams and indices as part of a matching index template.

+

Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.

+

Component templates are only used during index creation. + For data streams, this includes data stream creation and the creation of a stream’s backing indices. + Changes to component templates do not affect existing indices, including a stream’s backing indices.

+

You can use C-style /* *\\/ block comments in component templates. + You can include comments anywhere in the request body except before the opening curly bracket.

+

Applying component templates

+

You cannot directly apply a component template to a data stream or index. + To be applied, a component template must be included in an index template's composed_of list.

+ ``_ @@ -821,26 +836,23 @@ async def put_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the cluster settings. Configure and update dynamic settings on a running - cluster. You can also configure dynamic settings locally on an unstarted or shut - down node in `elasticsearch.yml`. Updates made with this API can be persistent, - which apply across cluster restarts, or transient, which reset after a cluster - restart. You can also reset transient or persistent settings by assigning them - a null value. If you configure the same setting using multiple methods, Elasticsearch - applies the settings in following order of precedence: 1) Transient setting; - 2) Persistent setting; 3) `elasticsearch.yml` setting; 4) Default setting value. - For example, you can apply a transient setting to override a persistent setting - or `elasticsearch.yml` setting. However, a change to an `elasticsearch.yml` setting - will not override a defined transient or persistent setting. TIP: In Elastic - Cloud, use the user settings feature to configure all cluster settings. This - method automatically rejects unsafe settings that could break your cluster. If - you run Elasticsearch on your own hardware, use this API to configure dynamic - cluster settings. Only use `elasticsearch.yml` for static cluster settings and - node settings. The API doesn’t require a restart and ensures a setting’s value - is the same on all nodes. WARNING: Transient cluster settings are no longer recommended. - Use persistent cluster settings instead. If a cluster becomes unstable, transient - settings can clear unexpectedly, resulting in a potentially undesired cluster - configuration. + .. raw:: html + +

Update the cluster settings. + Configure and update dynamic settings on a running cluster. + You can also configure dynamic settings locally on an unstarted or shut down node in elasticsearch.yml.

+

Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart. + You can also reset transient or persistent settings by assigning them a null value.

+

If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) elasticsearch.yml setting; 4) Default setting value. + For example, you can apply a transient setting to override a persistent setting or elasticsearch.yml setting. + However, a change to an elasticsearch.yml setting will not override a defined transient or persistent setting.

+

TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster. + If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings. + Only use elasticsearch.yml for static cluster settings and node settings. + The API doesn’t require a restart and ensures a setting’s value is the same on all nodes.

+

WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead. + If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration.

+ ``_ @@ -894,9 +906,12 @@ async def remote_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. 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.

+ ``_ """ @@ -941,25 +956,19 @@ async def reroute( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reroute the cluster. Manually change the allocation of individual shards in the - cluster. For example, a shard can be moved from one node to another explicitly, - an allocation can be canceled, and an unassigned shard can be explicitly allocated - to a specific node. It is important to note that after processing any reroute - commands Elasticsearch will perform rebalancing as normal (respecting the values - of settings such as `cluster.routing.rebalance.enable`) in order to remain in - a balanced state. For example, if the requested allocation includes moving a - shard from node1 to node2 then this may cause a shard to be moved from node2 - back to node1 to even things out. The cluster can be set to disable allocations - using the `cluster.routing.allocation.enable` setting. If allocations are disabled - then the only allocations that will be performed are explicit ones given using - the reroute command, and consequent allocations due to rebalancing. The cluster - will attempt to allocate a shard a maximum of `index.allocation.max_retries` - times in a row (defaults to `5`), before giving up and leaving the shard unallocated. - This scenario can be caused by structural problems such as having an analyzer - which refers to a stopwords file which doesn’t exist on all nodes. Once the problem - has been corrected, allocation can be manually retried by calling the reroute - API with the `?retry_failed` URI query parameter, which will attempt a single - retry round for these shards. + .. raw:: html + +

Reroute the cluster. + Manually change the allocation of individual shards in the cluster. + For example, a shard can be moved from one node to another explicitly, an allocation can be canceled, and an unassigned shard can be explicitly allocated to a specific node.

+

It is important to note that after processing any reroute commands Elasticsearch will perform rebalancing as normal (respecting the values of settings such as cluster.routing.rebalance.enable) in order to remain in a balanced state. + For example, if the requested allocation includes moving a shard from node1 to node2 then this may cause a shard to be moved from node2 back to node1 to even things out.

+

The cluster can be set to disable allocations using the cluster.routing.allocation.enable setting. + If allocations are disabled then the only allocations that will be performed are explicit ones given using the reroute command, and consequent allocations due to rebalancing.

+

The cluster will attempt to allocate a shard a maximum of index.allocation.max_retries times in a row (defaults to 5), before giving up and leaving the shard unallocated. + This scenario can be caused by structural problems such as having an analyzer which refers to a stopwords file which doesn’t exist on all nodes.

+

Once the problem has been corrected, allocation can be manually retried by calling the reroute API with the ?retry_failed URI query parameter, which will attempt a single retry round for these shards.

+ ``_ @@ -1048,26 +1057,23 @@ async def state( wait_for_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the cluster state. Get comprehensive information about the state of the cluster. - The cluster state is an internal data structure which keeps track of a variety - of information needed by every node, including the identity and attributes of - the other nodes in the cluster; cluster-wide settings; index metadata, including - the mapping and settings for each index; the location and status of every shard - copy in the cluster. The elected master node ensures that every node in the cluster - has a copy of the same cluster state. This API lets you retrieve a representation - of this internal state for debugging or diagnostic purposes. You may need to - consult the Elasticsearch source code to determine the precise meaning of the - response. By default the API will route requests to the elected master node since - this node is the authoritative source of cluster states. You can also retrieve - the cluster state held on the node handling the API request by adding the `?local=true` - query parameter. Elasticsearch may need to expend significant effort to compute - a response to this API in larger clusters, and the response may comprise a very - large quantity of data. If you use this API repeatedly, your cluster may become - unstable. WARNING: The response is a representation of an internal data structure. - Its format is not subject to the same compatibility guarantees as other more - stable APIs and may change from version to version. Do not query this API using - external monitoring tools. Instead, obtain the information you require using - other more stable cluster APIs. + .. raw:: html + +

Get the cluster state. + Get comprehensive information about the state of the cluster.

+

The cluster state is an internal data structure which keeps track of a variety of information needed by every node, including the identity and attributes of the other nodes in the cluster; cluster-wide settings; index metadata, including the mapping and settings for each index; the location and status of every shard copy in the cluster.

+

The elected master node ensures that every node in the cluster has a copy of the same cluster state. + This API lets you retrieve a representation of this internal state for debugging or diagnostic purposes. + You may need to consult the Elasticsearch source code to determine the precise meaning of the response.

+

By default the API will route requests to the elected master node since this node is the authoritative source of cluster states. + You can also retrieve the cluster state held on the node handling the API request by adding the ?local=true query parameter.

+

Elasticsearch may need to expend significant effort to compute a response to this API in larger clusters, and the response may comprise a very large quantity of data. + If you use this API repeatedly, your cluster may become unstable.

+

WARNING: The response is a representation of an internal data structure. + Its format is not subject to the same compatibility guarantees as other more stable APIs and may change from version to version. + Do not query this API using external monitoring tools. + Instead, obtain the information you require using other more stable cluster APIs.

+ ``_ @@ -1151,9 +1157,11 @@ async def stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster statistics. Get basic index metrics (shard numbers, store size, memory - usage) and information about the current nodes that form the cluster (number, - roles, os, jvm versions, memory usage, cpu and installed plugins). + .. raw:: html + +

Get cluster statistics. + Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).

+ ``_ diff --git a/elasticsearch/_async/client/connector.py b/elasticsearch/_async/client/connector.py index e83cbaa53..2f5080821 100644 --- a/elasticsearch/_async/client/connector.py +++ b/elasticsearch/_async/client/connector.py @@ -43,8 +43,11 @@ async def check_in( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Check in a connector. Update the `last_seen` field in the connector and set it - to the current timestamp. + .. raw:: html + +

Check in a connector.

+

Update the last_seen field in the connector and set it to the current timestamp.

+ ``_ @@ -86,10 +89,14 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a connector. Removes a connector and associated sync jobs. This is a destructive - action that is not recoverable. NOTE: This action doesn’t delete any API keys, - ingest pipelines, or data indices associated with the connector. These need to - be removed manually. + .. raw:: html + +

Delete a connector.

+

Removes a connector and associated sync jobs. + This is a destructive action that is not recoverable. + NOTE: This action doesn’t delete any API keys, ingest pipelines, or data indices associated with the connector. + These need to be removed manually.

+ ``_ @@ -134,7 +141,11 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a connector. Get the details about a connector. + .. raw:: html + +

Get a connector.

+

Get the details about a connector.

+ ``_ @@ -229,8 +240,12 @@ async def last_sync( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector last sync stats. Update the fields related to the last sync - of a connector. This action is used for analytics and monitoring. + .. raw:: html + +

Update the connector last sync stats.

+

Update the fields related to the last sync of a connector. + This action is used for analytics and monitoring.

+ ``_ @@ -325,7 +340,11 @@ async def list( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all connectors. Get information about all connectors. + .. raw:: html + +

Get all connectors.

+

Get information about all connectors.

+ ``_ @@ -400,11 +419,13 @@ async def post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a connector. Connectors are Elasticsearch integrations that bring content - from third-party data sources, which can be deployed on Elastic Cloud or hosted - on your own infrastructure. Elastic managed connectors (Native connectors) are - a managed service on Elastic Cloud. Self-managed connectors (Connector clients) - are self-managed on your infrastructure. + .. raw:: html + +

Create a connector.

+

Connectors are Elasticsearch integrations that bring content from third-party data sources, which can be deployed on Elastic Cloud or hosted on your own infrastructure. + Elastic managed connectors (Native connectors) are a managed service on Elastic Cloud. + Self-managed connectors (Connector clients) are self-managed on your infrastructure.

+ ``_ @@ -483,7 +504,10 @@ async def put( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a connector. + .. raw:: html + +

Create or update a connector.

+ ``_ @@ -553,10 +577,12 @@ async def sync_job_cancel( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancel a connector sync job. Cancel a connector sync job, which sets the status - to cancelling and updates `cancellation_requested_at` to the current time. The - connector service is then responsible for setting the status of connector sync - jobs to cancelled. + .. raw:: html + +

Cancel a connector sync job.

+

Cancel a connector sync job, which sets the status to cancelling and updates cancellation_requested_at to the current time. + The connector service is then responsible for setting the status of connector sync jobs to cancelled.

+ ``_ @@ -601,11 +627,13 @@ async def sync_job_check_in( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Check in a connector sync job. Check in a connector sync job and set the `last_seen` - field to the current time before updating it in the internal index. To sync data - using self-managed connectors, you need to deploy the Elastic connector service - on your own infrastructure. This service runs automatically on Elastic Cloud - for Elastic managed connectors. + .. raw:: html + +

Check in a connector sync job. + Check in a connector sync job and set the last_seen field to the current time before updating it in the internal index.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -656,14 +684,16 @@ async def sync_job_claim( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Claim a connector sync job. This action updates the job status to `in_progress` - and sets the `last_seen` and `started_at` timestamps to the current time. Additionally, - it can set the `sync_cursor` property for the sync job. This API is not intended - for direct connector management by users. It supports the implementation of services - that utilize the connector protocol to communicate with Elasticsearch. To sync - data using self-managed connectors, you need to deploy the Elastic connector - service on your own infrastructure. This service runs automatically on Elastic - Cloud for Elastic managed connectors. + .. raw:: html + +

Claim a connector sync job. + This action updates the job status to in_progress and sets the last_seen and started_at timestamps to the current time. + Additionally, it can set the sync_cursor property for the sync job.

+

This API is not intended for direct connector management by users. + It supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -720,8 +750,12 @@ async def sync_job_delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a connector sync job. Remove a connector sync job and its associated data. - This is a destructive action that is not recoverable. + .. raw:: html + +

Delete a connector sync job.

+

Remove a connector sync job and its associated data. + This is a destructive action that is not recoverable.

+ ``_ @@ -769,10 +803,13 @@ async def sync_job_error( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Set a connector sync job error. Set the `error` field for a connector sync job - and set its `status` to `error`. To sync data using self-managed connectors, - you need to deploy the Elastic connector service on your own infrastructure. - This service runs automatically on Elastic Cloud for Elastic managed connectors. + .. raw:: html + +

Set a connector sync job error. + Set the error field for a connector sync job and set its status to error.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -823,7 +860,10 @@ async def sync_job_get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a connector sync job. + .. raw:: html + +

Get a connector sync job.

+ ``_ @@ -892,8 +932,11 @@ async def sync_job_list( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all connector sync jobs. Get information about all stored connector sync - jobs listed by their creation date in ascending order. + .. raw:: html + +

Get all connector sync jobs.

+

Get information about all stored connector sync jobs listed by their creation date in ascending order.

+ ``_ @@ -955,8 +998,11 @@ async def sync_job_post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a connector sync job. Create a connector sync job document in the internal - index and initialize its counters and timestamps with default values. + .. raw:: html + +

Create a connector sync job.

+

Create a connector sync job document in the internal index and initialize its counters and timestamps with default values.

+ ``_ @@ -1024,12 +1070,15 @@ async def sync_job_update_stats( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Set the connector sync job stats. Stats include: `deleted_document_count`, `indexed_document_count`, - `indexed_document_volume`, and `total_document_count`. You can also update `last_seen`. - This API is mainly used by the connector service for updating sync job information. - To sync data using self-managed connectors, you need to deploy the Elastic connector - service on your own infrastructure. This service runs automatically on Elastic - Cloud for Elastic managed connectors. + .. raw:: html + +

Set the connector sync job stats. + Stats include: deleted_document_count, indexed_document_count, indexed_document_volume, and total_document_count. + You can also update last_seen. + This API is mainly used by the connector service for updating sync job information.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -1108,8 +1157,11 @@ async def update_active_filtering( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Activate the connector draft filter. Activates the valid draft filtering for - a connector. + .. raw:: html + +

Activate the connector draft filter.

+

Activates the valid draft filtering for a connector.

+ ``_ @@ -1155,11 +1207,14 @@ async def update_api_key_id( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector API key ID. Update the `api_key_id` and `api_key_secret_id` - fields of a connector. You can specify the ID of the API key used for authorization - and the ID of the connector secret where the API key is stored. The connector - secret ID is required only for Elastic managed (native) connectors. Self-managed - connectors (connector clients) do not use this field. + .. raw:: html + +

Update the connector API key ID.

+

Update the api_key_id and api_key_secret_id fields of a connector. + You can specify the ID of the API key used for authorization and the ID of the connector secret where the API key is stored. + The connector secret ID is required only for Elastic managed (native) connectors. + Self-managed connectors (connector clients) do not use this field.

+ ``_ @@ -1214,8 +1269,11 @@ async def update_configuration( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector configuration. Update the configuration field in the connector - document. + .. raw:: html + +

Update the connector configuration.

+

Update the configuration field in the connector document.

+ ``_ @@ -1269,10 +1327,13 @@ async def update_error( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector error field. Set the error field for the connector. If the - error provided in the request body is non-null, the connector’s status is updated - to error. Otherwise, if the error is reset to null, the connector status is updated - to connected. + .. raw:: html + +

Update the connector error field.

+

Set the error field for the connector. + If the error provided in the request body is non-null, the connector’s status is updated to error. + Otherwise, if the error is reset to null, the connector status is updated to connected.

+ ``_ @@ -1325,14 +1386,22 @@ async def update_features( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector features. Update the connector features in the connector - document. This API can be used to control the following aspects of a connector: - * document-level security * incremental syncs * advanced sync rules * basic sync - rules Normally, the running connector service automatically manages these features. - However, you can use this API to override the default behavior. To sync data - using self-managed connectors, you need to deploy the Elastic connector service - on your own infrastructure. This service runs automatically on Elastic Cloud - for Elastic managed connectors. + .. raw:: html + +

Update the connector features. + Update the connector features in the connector document. + This API can be used to control the following aspects of a connector:

+
    +
  • document-level security
  • +
  • incremental syncs
  • +
  • advanced sync rules
  • +
  • basic sync rules
  • +
+

Normally, the running connector service automatically manages these features. + However, you can use this API to override the default behavior.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -1387,10 +1456,13 @@ async def update_filtering( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector filtering. Update the draft filtering configuration of a - connector and marks the draft validation state as edited. The filtering draft - is activated once validated by the running Elastic connector service. The filtering - property is used to configure sync rules (both basic and advanced) for a connector. + .. raw:: html + +

Update the connector filtering.

+

Update the draft filtering configuration of a connector and marks the draft validation state as edited. + The filtering draft is activated once validated by the running Elastic connector service. + The filtering property is used to configure sync rules (both basic and advanced) for a connector.

+ ``_ @@ -1447,8 +1519,11 @@ async def update_filtering_validation( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector draft filtering validation. Update the draft filtering validation - info for a connector. + .. raw:: html + +

Update the connector draft filtering validation.

+

Update the draft filtering validation info for a connector.

+ ``_ @@ -1501,8 +1576,11 @@ async def update_index_name( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector index name. Update the `index_name` field of a connector, - specifying the index where the data ingested by the connector is stored. + .. raw:: html + +

Update the connector index name.

+

Update the index_name field of a connector, specifying the index where the data ingested by the connector is stored.

+ ``_ @@ -1556,7 +1634,10 @@ async def update_name( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector name and description. + .. raw:: html + +

Update the connector name and description.

+ ``_ @@ -1610,7 +1691,10 @@ async def update_native( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector is_native flag. + .. raw:: html + +

Update the connector is_native flag.

+ ``_ @@ -1663,8 +1747,11 @@ async def update_pipeline( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector pipeline. When you create a new connector, the configuration - of an ingest pipeline is populated with default settings. + .. raw:: html + +

Update the connector pipeline.

+

When you create a new connector, the configuration of an ingest pipeline is populated with default settings.

+ ``_ @@ -1717,7 +1804,10 @@ async def update_scheduling( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector scheduling. + .. raw:: html + +

Update the connector scheduling.

+ ``_ @@ -1770,7 +1860,10 @@ async def update_service_type( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector service type. + .. raw:: html + +

Update the connector service type.

+ ``_ @@ -1830,7 +1923,10 @@ async def update_status( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector status. + .. raw:: html + +

Update the connector status.

+ ``_ diff --git a/elasticsearch/_async/client/dangling_indices.py b/elasticsearch/_async/client/dangling_indices.py index 4f0fe7c82..d7b5d5597 100644 --- a/elasticsearch/_async/client/dangling_indices.py +++ b/elasticsearch/_async/client/dangling_indices.py @@ -39,10 +39,12 @@ async def delete_dangling_index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a dangling index. If Elasticsearch encounters index data that is absent - from the current cluster state, those indices are considered to be dangling. - For example, this can happen if you delete more than `cluster.indices.tombstones.size` - indices while an Elasticsearch node is offline. + .. raw:: html + +

Delete a dangling index. + If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

+ ``_ @@ -98,10 +100,12 @@ async def import_dangling_index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Import a dangling index. If Elasticsearch encounters index data that is absent - from the current cluster state, those indices are considered to be dangling. - For example, this can happen if you delete more than `cluster.indices.tombstones.size` - indices while an Elasticsearch node is offline. + .. raw:: html + +

Import a dangling index.

+

If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

+ ``_ @@ -156,11 +160,13 @@ async def list_dangling_indices( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the dangling indices. If Elasticsearch encounters index data that is absent - from the current cluster state, those indices are considered to be dangling. - For example, this can happen if you delete more than `cluster.indices.tombstones.size` - indices while an Elasticsearch node is offline. Use this API to list dangling - indices, which you can then import or delete. + .. raw:: html + +

Get the dangling indices.

+

If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

+

Use this API to list dangling indices, which you can then import or delete.

+ ``_ """ diff --git a/elasticsearch/_async/client/enrich.py b/elasticsearch/_async/client/enrich.py index d6650b4c7..1eb44df8a 100644 --- a/elasticsearch/_async/client/enrich.py +++ b/elasticsearch/_async/client/enrich.py @@ -36,7 +36,11 @@ async def delete_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an enrich policy. Deletes an existing enrich policy and its enrich index. + .. raw:: html + +

Delete an enrich policy. + Deletes an existing enrich policy and its enrich index.

+ ``_ @@ -77,7 +81,11 @@ async def execute_policy( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Run an enrich policy. Create the enrich index for an existing enrich policy. + .. raw:: html + +

Run an enrich policy. + Create the enrich index for an existing enrich policy.

+ ``_ @@ -121,7 +129,11 @@ async def get_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an enrich policy. Returns information about an enrich policy. + .. raw:: html + +

Get an enrich policy. + Returns information about an enrich policy.

+ ``_ @@ -171,7 +183,11 @@ async def put_policy( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an enrich policy. Creates an enrich policy. + .. raw:: html + +

Create an enrich policy. + Creates an enrich policy.

+ ``_ @@ -224,8 +240,11 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get enrich stats. Returns enrich coordinator statistics and information about - enrich policies that are currently executing. + .. raw:: html + +

Get enrich stats. + Returns enrich coordinator statistics and information about enrich policies that are currently executing.

+ ``_ """ diff --git a/elasticsearch/_async/client/eql.py b/elasticsearch/_async/client/eql.py index dbba23b7a..3908aadd7 100644 --- a/elasticsearch/_async/client/eql.py +++ b/elasticsearch/_async/client/eql.py @@ -36,8 +36,12 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an async EQL search. Delete an async EQL search or a stored synchronous - EQL search. The API also deletes results for the search. + .. raw:: html + +

Delete an async EQL search. + Delete an async EQL search or a stored synchronous EQL search. + The API also deletes results for the search.

+ ``_ @@ -83,8 +87,11 @@ async def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get async EQL search results. Get the current status and available results for - an async EQL search or a stored synchronous EQL search. + .. raw:: html + +

Get async EQL search results. + Get the current status and available results for an async EQL search or a stored synchronous EQL search.

+ ``_ @@ -134,8 +141,11 @@ async def get_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the async EQL status. Get the current status for an async EQL search or a - stored synchronous EQL search without returning results. + .. raw:: html + +

Get the async EQL status. + Get the current status for an async EQL search or a stored synchronous EQL search without returning results.

+ ``_ @@ -223,9 +233,12 @@ async def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get EQL search results. Returns search results for an Event Query Language (EQL) - query. EQL assumes each document in a data stream or index corresponds to an - event. + .. raw:: html + +

Get EQL search results. + Returns search results for an Event Query Language (EQL) query. + EQL assumes each document in a data stream or index corresponds to an event.

+ ``_ diff --git a/elasticsearch/_async/client/esql.py b/elasticsearch/_async/client/esql.py index 1946c2f52..8e375e90c 100644 --- a/elasticsearch/_async/client/esql.py +++ b/elasticsearch/_async/client/esql.py @@ -20,7 +20,7 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import _rewrite_parameters +from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters class EsqlClient(NamespacedClient): @@ -30,6 +30,288 @@ class EsqlClient(NamespacedClient): "query", "columnar", "filter", + "include_ccs_metadata", + "locale", + "params", + "profile", + "tables", + ), + ignore_deprecated_options={"params"}, + ) + async def async_query( + self, + *, + query: t.Optional[str] = None, + columnar: t.Optional[bool] = None, + delimiter: t.Optional[str] = None, + drop_null_columns: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter: t.Optional[t.Mapping[str, t.Any]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + format: t.Optional[ + t.Union[ + str, + t.Literal[ + "arrow", "cbor", "csv", "json", "smile", "tsv", "txt", "yaml" + ], + ] + ] = None, + human: t.Optional[bool] = None, + include_ccs_metadata: t.Optional[bool] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + keep_on_completion: t.Optional[bool] = None, + locale: t.Optional[str] = None, + params: t.Optional[ + t.Sequence[t.Union[None, bool, float, int, str, t.Any]] + ] = None, + pretty: t.Optional[bool] = None, + profile: t.Optional[bool] = None, + tables: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Mapping[str, t.Any]]] + ] = None, + wait_for_completion_timeout: t.Optional[ + t.Union[str, t.Literal[-1], t.Literal[0]] + ] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Run an async ES|QL query. + Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available.

+

The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties.

+ + + ``_ + + :param query: The ES|QL query API accepts an ES|QL query string in the query + parameter, runs it, and returns the results. + :param columnar: By default, ES|QL returns results as rows. For example, FROM + returns each individual document as one row. For the JSON, YAML, CBOR and + smile formats, ES|QL can return the results in a columnar fashion where one + row represents all the values of a certain column in the results. + :param delimiter: The character to use between values within a CSV row. It is + valid only for the CSV format. + :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. + :param filter: Specify a Query DSL query in the filter parameter to filter the + set of documents that an ES|QL query runs on. + :param format: A short version of the Accept header, for example `json` or `yaml`. + :param include_ccs_metadata: When set to `true` and performing a cross-cluster + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. + :param keep_alive: The period for which the query and its results are stored + in the cluster. The default period is five days. When this period expires, + the query and its results are deleted, even if the query is still ongoing. + If the `keep_on_completion` parameter is false, Elasticsearch only stores + async queries that do not complete within the period set by the `wait_for_completion_timeout` + parameter, regardless of this value. + :param keep_on_completion: Indicates whether the query and its results are stored + in the cluster. If false, the query and its results are stored in the cluster + only if the request does not complete during the period set by the `wait_for_completion_timeout` + parameter. + :param locale: + :param params: To avoid any attempts of hacking or code injection, extract the + values in a separate list of parameters. Use question mark placeholders (?) + in the query string for each of the parameters. + :param profile: If provided and `true` the response will include an extra `profile` + object with information on how the query was executed. This information is + for human debugging and its format can change at any time but it can give + some insight into the performance of each part of the query. + :param tables: Tables to use with the LOOKUP operation. The top level key is + the table name and the next level key is the column name. + :param wait_for_completion_timeout: The period to wait for the request to finish. + By default, the request waits for 1 second for the query results. If the + query completes during this period, results are returned Otherwise, a query + ID is returned that can later be used to retrieve the results. + """ + if query is None and body is None: + raise ValueError("Empty value passed for parameter 'query'") + __path_parts: t.Dict[str, str] = {} + __path = "/_query/async" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if delimiter is not None: + __query["delimiter"] = delimiter + 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 format is not None: + __query["format"] = format + if human is not None: + __query["human"] = human + if keep_alive is not None: + __query["keep_alive"] = keep_alive + if keep_on_completion is not None: + __query["keep_on_completion"] = keep_on_completion + if pretty is not None: + __query["pretty"] = pretty + if wait_for_completion_timeout is not None: + __query["wait_for_completion_timeout"] = wait_for_completion_timeout + if not __body: + if query is not None: + __body["query"] = query + if columnar is not None: + __body["columnar"] = columnar + if filter is not None: + __body["filter"] = filter + if include_ccs_metadata is not None: + __body["include_ccs_metadata"] = include_ccs_metadata + if locale is not None: + __body["locale"] = locale + if params is not None: + __body["params"] = params + if profile is not None: + __body["profile"] = profile + if tables is not None: + __body["tables"] = tables + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="esql.async_query", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + async def async_query_delete( + self, + *, + id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Delete an async ES|QL query. + If the query is still running, it is cancelled. + Otherwise, the stored results are deleted.

+

If the Elasticsearch security features are enabled, only the following users can use this API to delete a query:

+
    +
  • The authenticated user that submitted the original query request
  • +
  • Users with the cancel_task cluster privilege
  • +
+ + + ``_ + + :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`. + """ + 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"]}' + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_delete", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + async def async_query_get( + 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, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + wait_for_completion_timeout: t.Optional[ + t.Union[str, t.Literal[-1], t.Literal[0]] + ] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get async ES|QL query results. + Get the current status and available results or stored results for an ES|QL asynchronous query. + If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API.

+ + + ``_ + + :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. + :param keep_alive: The period for which the query and its results are stored + in the cluster. When this period expires, the query and its results are deleted, + even if the query is still ongoing. + :param wait_for_completion_timeout: The period to wait for the request to finish. + By default, the request waits for complete query results. If the request + completes during the period specified in this parameter, complete query results + are returned. Otherwise, the response returns an `is_running` value of `true` + and no results. + """ + 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"]}' + __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 keep_alive is not None: + __query["keep_alive"] = keep_alive + if pretty is not None: + __query["pretty"] = pretty + if wait_for_completion_timeout is not None: + __query["wait_for_completion_timeout"] = wait_for_completion_timeout + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_get", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=( + "query", + "columnar", + "filter", + "include_ccs_metadata", "locale", "params", "profile", @@ -56,6 +338,7 @@ async def query( ] ] = None, human: t.Optional[bool] = None, + include_ccs_metadata: t.Optional[bool] = None, locale: t.Optional[str] = None, params: t.Optional[ t.Sequence[t.Union[None, bool, float, int, str, t.Any]] @@ -68,8 +351,11 @@ async def query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run an ES|QL query. Get search results for an ES|QL (Elasticsearch query language) - query. + .. raw:: html + +

Run an ES|QL query. + Get search results for an ES|QL (Elasticsearch query language) query.

+ ``_ @@ -88,6 +374,10 @@ async def query( :param filter: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. :param format: A short version of the Accept header, e.g. json, yaml. + :param include_ccs_metadata: When set to `true` and performing a cross-cluster + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. :param locale: :param params: To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) @@ -126,6 +416,8 @@ async def query( __body["columnar"] = columnar if filter is not None: __body["filter"] = filter + if include_ccs_metadata is not None: + __body["include_ccs_metadata"] = include_ccs_metadata if locale is not None: __body["locale"] = locale if params is not None: diff --git a/elasticsearch/_async/client/features.py b/elasticsearch/_async/client/features.py index 750fff034..c432e7dfc 100644 --- a/elasticsearch/_async/client/features.py +++ b/elasticsearch/_async/client/features.py @@ -35,17 +35,17 @@ async def get_features( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the features. Get a list of features that can be included in snapshots using - the `feature_states` field when creating a snapshot. You can use this API to - determine which feature states to include when taking a snapshot. By default, - all feature states are included in a snapshot if that snapshot includes the global - state, or none if it does not. A feature state includes one or more system indices - necessary for a given feature to function. In order to ensure data integrity, - all system indices that comprise a feature state are snapshotted and restored - together. The features listed by this API are a combination of built-in features - and features defined by plugins. In order for a feature state to be listed in - this API and recognized as a valid feature state by the create snapshot API, - the plugin that defines that feature must be installed on the master node. + .. raw:: html + +

Get the features. + Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. + You can use this API to determine which feature states to include when taking a snapshot. + By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not.

+

A feature state includes one or more system indices necessary for a given feature to function. + In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together.

+

The features listed by this API are a combination of built-in features and features defined by plugins. + In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node.

+ ``_ """ @@ -81,20 +81,20 @@ async def reset_features( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset the features. Clear all of the state information stored in system indices - by Elasticsearch features, including the security and machine learning indices. - WARNING: Intended for development and testing use only. Do not reset features - on a production cluster. Return a cluster to the same state as a new installation - by resetting the feature state for all Elasticsearch features. This deletes all - state information stored in system indices. The response code is HTTP 200 if - the state is successfully reset for all features. It is HTTP 500 if the reset - operation failed for any feature. Note that select features might provide a way - to reset particular system indices. Using this API resets all features, both - those that are built-in and implemented as plugins. To list the features that - will be affected, use the get features API. 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. + .. raw:: html + +

Reset the features. + Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices.

+

WARNING: Intended for development and testing use only. Do not reset features on a production cluster.

+

Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. + This deletes all state information stored in system indices.

+

The response code is HTTP 200 if the state is successfully reset for all features. + It is HTTP 500 if the reset operation failed for any feature.

+

Note that select features might provide a way to reset particular system indices. + Using this API resets all features, both those that are built-in and implemented as plugins.

+

To list the features that will be affected, use the get features API.

+

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.

+ ``_ """ diff --git a/elasticsearch/_async/client/fleet.py b/elasticsearch/_async/client/fleet.py index ba6637b1d..acdb046de 100644 --- a/elasticsearch/_async/client/fleet.py +++ b/elasticsearch/_async/client/fleet.py @@ -46,8 +46,10 @@ async def global_checkpoints( wait_for_index: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current global checkpoints for an index. This API is design for internal - use by the fleet server project. + .. raw:: html + +

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

+ ``_ @@ -132,10 +134,12 @@ async def msearch( wait_for_checkpoints: t.Optional[t.Sequence[int]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes several [fleet searches](https://www.elastic.co/guide/en/elasticsearch/reference/current/fleet-search.html) - with a single API request. The API follows the same structure as the [multi search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) - API. However, similar to the fleet search API, it supports the wait_for_checkpoints - parameter. + .. raw:: html + +

Executes several fleet searches with a single API request. + The API follows the same structure as the multi search API. However, similar to the fleet search API, it + supports the wait_for_checkpoints parameter.

+ :param searches: :param index: A single target to search. If the target is an index alias, it @@ -378,9 +382,11 @@ async def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The purpose of the fleet search api is to provide a search api where the search - will only be executed after provided checkpoint has been processed and is visible - for searches inside of Elasticsearch. + .. raw:: html + +

The purpose of the fleet search api is to provide a search api where the search will only be executed + 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. diff --git a/elasticsearch/_async/client/graph.py b/elasticsearch/_async/client/graph.py index e713aa26b..5b86970b1 100644 --- a/elasticsearch/_async/client/graph.py +++ b/elasticsearch/_async/client/graph.py @@ -45,14 +45,15 @@ async def explore( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explore graph analytics. Extract and summarize information about the documents - and terms in an Elasticsearch data stream or index. The easiest way to understand - the behavior of this API is to use the Graph UI to explore connections. An initial - request to the `_explore` API contains a seed query that identifies the documents - of interest and specifies the fields that define the vertices and connections - you want to include in the graph. Subsequent requests enable you to spider out - from one more vertices of interest. You can exclude vertices that have already - been returned. + .. raw:: html + +

Explore graph analytics. + Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. + The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. + An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. + Subsequent requests enable you to spider out from one more vertices of interest. + You can exclude vertices that have already been returned.

+ ``_ diff --git a/elasticsearch/_async/client/ilm.py b/elasticsearch/_async/client/ilm.py index cd2a438ad..d43ad52c4 100644 --- a/elasticsearch/_async/client/ilm.py +++ b/elasticsearch/_async/client/ilm.py @@ -38,9 +38,11 @@ async def delete_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a lifecycle policy. You cannot delete policies that are currently in use. - If the policy is being used to manage any indices, the request fails and returns - an error. + .. raw:: html + +

Delete a lifecycle policy. + You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error.

+ ``_ @@ -93,11 +95,13 @@ async def explain_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain the lifecycle state. Get the current lifecycle status for one or more - indices. For data streams, the API retrieves the current lifecycle status for - the stream's backing indices. The response indicates when the index entered each - lifecycle state, provides the definition of the running phase, and information - about any failures. + .. raw:: html + +

Explain the lifecycle state. + Get the current lifecycle status for one or more indices. + For data streams, the API retrieves the current lifecycle status for the stream's backing indices.

+

The response indicates when the index entered each lifecycle state, provides the definition of the running phase, and information about any failures.

+ ``_ @@ -159,7 +163,10 @@ async def get_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get lifecycle policies. + .. raw:: html + +

Get lifecycle policies.

+ ``_ @@ -210,7 +217,11 @@ async def get_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the ILM status. Get the current index lifecycle management status. + .. raw:: html + +

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

+ ``_ """ @@ -251,18 +262,22 @@ async def migrate_to_data_tiers( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Migrate to data tiers routing. Switch the indices, ILM policies, and legacy, - composable, and component templates from using custom node attributes and attribute-based - allocation filters to using data tiers. Optionally, delete one legacy index template. - Using node roles enables ILM to automatically move the indices between data tiers. - Migrating away from custom node attributes routing can be manually performed. - This API provides an automated way of performing three out of the four manual - steps listed in the migration guide: 1. Stop setting the custom hot attribute - on new indices. 1. Remove custom allocation settings from existing ILM policies. - 1. Replace custom allocation settings from existing indices with the corresponding - tier preference. ILM must be stopped before performing the migration. Use the - stop ILM and get ILM status APIs to wait until the reported operation mode is - `STOPPED`. + .. raw:: html + +

Migrate to data tiers routing. + Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. + Optionally, delete one legacy index template. + Using node roles enables ILM to automatically move the indices between data tiers.

+

Migrating away from custom node attributes routing can be manually performed. + This API provides an automated way of performing three out of the four manual steps listed in the migration guide:

+
    +
  1. Stop setting the custom hot attribute on new indices.
  2. +
  3. Remove custom allocation settings from existing ILM policies.
  4. +
  5. Replace custom allocation settings from existing indices with the corresponding tier preference.
  6. +
+

ILM must be stopped before performing the migration. + Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED.

+ ``_ @@ -322,21 +337,20 @@ async def move_to_step( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Move to a lifecycle step. Manually move an index into a specific step in the - lifecycle policy and run that step. WARNING: This operation can result in the - loss of data. Manually moving an index into a specific step runs that step even - if it has already been performed. This is a potentially destructive action and - this should be considered an expert level API. You must specify both the current - step and the step to be executed in the body of the request. The request will - fail if the current step does not match the step currently running for the index - This is to prevent the index from being moved from an unexpected step into the - next step. When specifying the target (`next_step`) to which the index will be - moved, either the name or both the action and name fields are optional. If only - the phase is specified, the index will move to the first step of the first action - in the target phase. If the phase and action are specified, the index will move - to the first step of the specified action in the specified phase. Only actions - specified in the ILM policy are considered valid. An index cannot move to a step - that is not part of its policy. + .. raw:: html + +

Move to a lifecycle step. + Manually move an index into a specific step in the lifecycle policy and run that step.

+

WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API.

+

You must specify both the current step and the step to be executed in the body of the request. + The request will fail if the current step does not match the step currently running for the index + This is to prevent the index from being moved from an unexpected step into the next step.

+

When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. + If only the phase is specified, the index will move to the first step of the first action in the target phase. + If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. + Only actions specified in the ILM policy are considered valid. + An index cannot move to a step that is not part of its policy.

+ ``_ @@ -399,9 +413,12 @@ async def put_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a lifecycle policy. If the specified policy exists, it is replaced - and the policy version is incremented. NOTE: Only the latest version of the policy - is stored, you cannot revert to previous versions. + .. raw:: html + +

Create or update a lifecycle policy. + If the specified policy exists, it is replaced and the policy version is incremented.

+

NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions.

+ ``_ @@ -460,8 +477,12 @@ async def remove_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Remove policies from an index. Remove the assigned lifecycle policies from an - index or a data stream's backing indices. It also stops managing the indices. + .. raw:: html + +

Remove policies from an index. + Remove the assigned lifecycle policies from an index or a data stream's backing indices. + It also stops managing the indices.

+ ``_ @@ -501,10 +522,13 @@ async def retry( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retry a policy. Retry running the lifecycle policy for an index that is in the - ERROR step. The API sets the policy back to the step where the error occurred - and runs the step. Use the explain lifecycle state API to determine whether an - index is in the ERROR step. + .. raw:: html + +

Retry a policy. + Retry running the lifecycle policy for an index that is in the ERROR step. + The API sets the policy back to the step where the error occurred and runs the step. + Use the explain lifecycle state API to determine whether an index is in the ERROR step.

+ ``_ @@ -546,9 +570,13 @@ async def start( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start the ILM plugin. Start the index lifecycle management plugin if it is currently - stopped. ILM is started automatically when the cluster is formed. Restarting - ILM is necessary only when it has been stopped using the stop ILM API. + .. raw:: html + +

Start the ILM plugin. + Start the index lifecycle management plugin if it is currently stopped. + ILM is started automatically when the cluster is formed. + Restarting ILM is necessary only when it has been stopped using the stop ILM API.

+ ``_ @@ -592,12 +620,14 @@ async def stop( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop the ILM plugin. Halt all lifecycle management operations and stop the index - lifecycle management plugin. This is useful when you are performing maintenance - on the cluster and need to prevent ILM from performing any actions on your indices. - The API returns as soon as the stop request has been acknowledged, but the plugin - might continue to run until in-progress operations complete and the plugin can - be safely stopped. Use the get ILM status API to check whether ILM is running. + .. raw:: html + +

Stop the ILM plugin. + Halt all lifecycle management operations and stop the index lifecycle management plugin. + This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices.

+

The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. + Use the get ILM status API to check whether ILM is running.

+ ``_ diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index 4237ff983..7a8a79d4e 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -55,8 +55,11 @@ async def add_block( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Add an index block. Limits the operations allowed on an index by blocking specific - operation types. + .. raw:: html + +

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

+ ``_ @@ -143,12 +146,15 @@ async def analyze( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get tokens from text analysis. The analyze API performs analysis on a text string - and returns the resulting tokens. Generating excessive amount of tokens may cause - a node to run out of memory. The `index.analyze.max_token_count` setting enables - you to limit the number of tokens that can be produced. If more than this limit - of tokens gets generated, an error occurs. The `_analyze` endpoint without a - specified index will always use `10000` as its limit. + .. raw:: html + +

Get tokens from text analysis. + The analyze API performs analysis on a text string and returns the resulting tokens.

+

Generating excessive amount of tokens may cause a node to run out of memory. + The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. + If more than this limit of tokens gets generated, an error occurs. + The _analyze endpoint without a specified index will always use 10000 as its limit.

+ ``_ @@ -249,11 +255,15 @@ async def clear_cache( request: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the cache. Clear the cache of one or more indices. For data streams, the - API clears the caches of the stream's backing indices. By default, the clear - cache API clears all caches. To clear only specific caches, use the `fielddata`, - `query`, or `request` parameters. To clear the cache only of specific fields, - use the `fields` parameter. + .. raw:: html + +

Clear the cache. + Clear the cache of one or more indices. + For data streams, the API clears the caches of the stream's backing indices.

+

By default, the clear cache API clears all caches. + To clear only specific caches, use the fielddata, query, or request parameters. + To clear the cache only of specific fields, use the fields parameter.

+ ``_ @@ -338,44 +348,44 @@ async def clone( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clone an index. Clone an existing index into a new index. Each original primary - shard is cloned into a new primary shard in the new index. IMPORTANT: Elasticsearch - does not apply index templates to the resulting index. The API also does not - copy index metadata from the original index. Index metadata includes aliases, - index lifecycle management phase definitions, and cross-cluster replication (CCR) - follower information. For example, if you clone a CCR follower index, the resulting - clone will not be a follower index. The clone API copies most index settings - from the source index to the resulting index, with the exception of `index.number_of_replicas` - and `index.auto_expand_replicas`. To set the number of replicas in the resulting - index, configure these settings in the clone request. Cloning works as follows: - * First, it creates a new target index with the same definition as the source - index. * Then it hard-links segments from the source index into the target index. - If the file system does not support hard-linking, all segments are copied into - the new index, which is a much more time consuming process. * Finally, it recovers - the target index as though it were a closed index which had just been re-opened. - IMPORTANT: Indices can only be cloned if they meet the following requirements: - * The index must be marked as read-only and have a cluster health status of green. - * The target index must not exist. * The source index must have the same number - of primary shards as the target index. * The node handling the clone process - must have sufficient free disk space to accommodate a second copy of the existing - index. The current write index on a data stream cannot be cloned. In order to - clone the current write index, the data stream must first be rolled over so that - a new write index is created and then the previous write index can be cloned. - NOTE: Mappings cannot be specified in the `_clone` request. The mappings of the - source index will be used for the target index. **Monitor the cloning process** - The cloning process can be monitored with the cat recovery API or the cluster - health API can be used to wait until all primary shards have been allocated by - setting the `wait_for_status` parameter to `yellow`. The `_clone` API returns - as soon as the target index has been added to the cluster state, before any shards - have been allocated. At this point, all shards are in the state unassigned. If, - for any reason, the target index can't be allocated, its primary shard will remain - unassigned until it can be allocated on that node. Once the primary shard is - allocated, it moves to state initializing, and the clone process begins. When - the clone operation completes, the shard will become active. At that point, Elasticsearch - will try to allocate any replicas and may decide to relocate the primary shard - to another node. **Wait for active shards** Because the clone operation creates - a new index to clone the shards to, the wait for active shards setting on index - creation applies to the clone index action as well. + .. raw:: html + +

Clone an index. + Clone an existing index into a new index. + Each original primary shard is cloned into a new primary shard in the new index.

+

IMPORTANT: Elasticsearch does not apply index templates to the resulting index. + The API also does not copy index metadata from the original index. + Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. + For example, if you clone a CCR follower index, the resulting clone will not be a follower index.

+

The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. + To set the number of replicas in the resulting index, configure these settings in the clone request.

+

Cloning works as follows:

+
    +
  • First, it creates a new target index with the same definition as the source index.
  • +
  • Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process.
  • +
  • Finally, it recovers the target index as though it were a closed index which had just been re-opened.
  • +
+

IMPORTANT: Indices can only be cloned if they meet the following requirements:

+
    +
  • The index must be marked as read-only and have a cluster health status of green.
  • +
  • The target index must not exist.
  • +
  • The source index must have the same number of primary shards as the target index.
  • +
  • The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+

The current write index on a data stream cannot be cloned. + In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned.

+

NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index.

+

Monitor the cloning process

+

The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow.

+

The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. + At this point, all shards are in the state unassigned. + If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node.

+

Once the primary shard is allocated, it moves to state initializing, and the clone process begins. + When the clone operation completes, the shard will become active. + At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node.

+

Wait for active shards

+

Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well.

+ ``_ @@ -463,24 +473,23 @@ async def close( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Close an index. A closed index is blocked for read or write operations and does - not allow all operations that opened indices allow. It is not possible to index - documents or to search for documents in a closed index. Closed indices do not - have to maintain internal data structures for indexing or searching documents, - which results in a smaller overhead on the cluster. When opening or closing an - index, the master node is responsible for restarting the index shards to reflect - the new state of the index. The shards will then go through the normal recovery - process. The data of opened and closed indices is automatically replicated by - the cluster to ensure that enough shard copies are safely kept around at all - times. You can open and close multiple indices. An error is thrown if the request - explicitly refers to a missing index. This behaviour can be turned off using - the `ignore_unavailable=true` parameter. By default, you must explicitly name - the indices you are opening or closing. To open or close indices with `_all`, - `*`, or other wildcard expressions, change the` action.destructive_requires_name` - setting to `false`. This setting can also be changed with the cluster update - settings API. Closed indices consume a significant amount of disk-space which - can cause problems in managed environments. Closing indices can be turned off - with the cluster settings API by setting `cluster.indices.close.enable` to `false`. + .. raw:: html + +

Close an index. + A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. + It is not possible to index documents or to search for documents in a closed index. + Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster.

+

When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. + The shards will then go through the normal recovery process. + The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.

+

You can open and close multiple indices. + An error is thrown if the request explicitly refers to a missing index. + This behaviour can be turned off using the ignore_unavailable=true parameter.

+

By default, you must explicitly name the indices you are opening or closing. + To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API.

+

Closed indices consume a significant amount of disk-space which can cause problems in managed environments. + Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false.

+ ``_ @@ -561,26 +570,27 @@ async def create( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an index. You can use the create index API to add a new index to an Elasticsearch - cluster. When creating an index, you can specify the following: * Settings for - the index. * Mappings for fields in the index. * Index aliases **Wait for active - shards** By default, index creation will only return a response to the client - when the primary copies of each shard have been started, or the request times - out. The index creation response will indicate what happened. For example, `acknowledged` - indicates whether the index was successfully created in the cluster, `while shards_acknowledged` - indicates whether the requisite number of shard copies were started for each - shard in the index before timing out. Note that it is still possible for either - `acknowledged` or `shards_acknowledged` to be `false`, but for the index creation - to be successful. These values simply indicate whether the operation completed - before the timeout. If `acknowledged` is false, the request timed out before - the cluster state was updated with the newly created index, but it probably will - be created sometime soon. If `shards_acknowledged` is false, then the request - timed out before the requisite number of shards were started (by default just - the primaries), even if the cluster state was successfully updated to reflect - the newly created index (that is to say, `acknowledged` is `true`). You can change - the default of only waiting for the primary shards to start through the index - setting `index.write.wait_for_active_shards`. Note that changing this setting - will also affect the `wait_for_active_shards` value on all subsequent write operations. + .. raw:: html + +

Create an index. + You can use the create index API to add a new index to an Elasticsearch cluster. + When creating an index, you can specify the following:

+
    +
  • Settings for the index.
  • +
  • Mappings for fields in the index.
  • +
  • Index aliases
  • +
+

Wait for active shards

+

By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. + The index creation response will indicate what happened. + For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. + Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. + These values simply indicate whether the operation completed before the timeout. + If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. + If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true).

+

You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. + Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations.

+ ``_ @@ -653,8 +663,12 @@ async def create_data_stream( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a data stream. Creates a data stream. You must have a matching index template - with data stream enabled. + .. raw:: html + +

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

+ ``_ @@ -715,7 +729,11 @@ async def data_streams_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream stats. Retrieves statistics for one or more data streams. + .. raw:: html + +

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

+ ``_ @@ -776,11 +794,15 @@ async def delete( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete indices. Deleting an index deletes its documents, shards, and metadata. - It does not delete related Kibana components, such as data views, visualizations, - or dashboards. You cannot delete the current write index of a data stream. To - delete the index, you must roll over the data stream so a new write index is - created. You can then use the delete index API to delete the previous write index. + .. raw:: html + +

Delete indices. + Deleting an index deletes its documents, shards, and metadata. + It does not delete related Kibana components, such as data views, visualizations, or dashboards.

+

You cannot delete the current write index of a data stream. + To delete the index, you must roll over the data stream so a new write index is created. + You can then use the delete index API to delete the previous write index.

+ ``_ @@ -850,7 +872,11 @@ async def delete_alias( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an alias. Removes a data stream or index from an alias. + .. raw:: html + +

Delete an alias. + Removes a data stream or index from an alias.

+ ``_ @@ -914,8 +940,11 @@ async def delete_data_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete data stream lifecycles. Removes the data stream lifecycle from a data - stream, rendering it not managed by the data stream lifecycle. + .. raw:: html + +

Delete data stream lifecycles. + Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle.

+ ``_ @@ -975,7 +1004,11 @@ async def delete_data_stream( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete data streams. Deletes one or more data streams and their backing indices. + .. raw:: html + +

Delete data streams. + Deletes one or more data streams and their backing indices.

+ ``_ @@ -1027,10 +1060,13 @@ async def delete_index_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an index template. The provided may contain multiple - template names separated by a comma. If multiple template names are specified - then there is no wildcard support and the provided names should match completely - with existing templates. + .. raw:: html + +

Delete an index template. + The provided may contain multiple template names separated by a comma. If multiple template + names are specified then there is no wildcard support and the provided names should match completely with + existing templates.

+ ``_ @@ -1082,7 +1118,10 @@ async def delete_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a legacy index template. + .. raw:: html + +

Delete a legacy index template.

+ ``_ @@ -1145,16 +1184,16 @@ async def disk_usage( run_expensive_tasks: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Analyze the index disk usage. Analyze the disk usage of each field of an index - or data stream. This API might not support indices created in previous Elasticsearch - versions. The result of a small index can be inaccurate as some parts of an index - might not be analyzed by the API. NOTE: The total size of fields of the analyzed - shards of the index in the response is usually smaller than the index `store_size` - value because some small metadata files are ignored and some parts of data files - might not be scanned by the API. Since stored fields are stored together in a - compressed format, the sizes of stored fields are also estimates and can be inaccurate. - The stored size of the `_id` field is likely underestimated while the `_source` - field is overestimated. + .. raw:: html + +

Analyze the index disk usage. + Analyze the disk usage of each field of an index or data stream. + This API might not support indices created in previous Elasticsearch versions. + The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API.

+

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

+ ``_ @@ -1228,14 +1267,16 @@ async def downsample( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Downsample an index. Aggregate a time series (TSDS) index and store pre-computed - statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each - metric field grouped by a configured time interval. For example, a TSDS index - that contains metrics sampled every 10 seconds can be downsampled to an hourly - index. All documents within an hour interval are summarized and stored as a single - document in the downsample index. NOTE: Only indices in a time series data stream - are supported. Neither field nor document level security can be defined on the - source index. The source index must be read only (`index.blocks.write: true`). + .. raw:: html + +

Downsample an index. + Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. + For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. + All documents within an hour interval are summarized and stored as a single document in the downsample index.

+

NOTE: Only indices in a time series data stream are supported. + Neither field nor document level security can be defined on the source index. + The source index must be read only (index.blocks.write: true).

+ ``_ @@ -1303,7 +1344,11 @@ async def exists( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check indices. Check if one or more indices, index aliases, or data streams exist. + .. raw:: html + +

Check indices. + Check if one or more indices, index aliases, or data streams exist.

+ ``_ @@ -1381,7 +1426,11 @@ async def exists_alias( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check aliases. Checks if one or more data stream or index aliases exist. + .. raw:: html + +

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

+ ``_ @@ -1451,7 +1500,11 @@ async def exists_index_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check index templates. Check whether index templates exist. + .. raw:: html + +

Check index templates. + Check whether index templates exist.

+ ``_ @@ -1500,11 +1553,13 @@ async def exists_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check existence of index templates. Get information about whether index templates - exist. Index templates define settings, mappings, and aliases that can be applied - automatically to new indices. IMPORTANT: This documentation is about legacy index - templates, which are deprecated and will be replaced by the composable templates - introduced in Elasticsearch 7.8. + .. raw:: html + +

Check existence of index templates. + Get information about whether index templates exist. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+ ``_ @@ -1558,10 +1613,11 @@ async def explain_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the status for a data stream lifecycle. Get information about an index or - data stream's current data stream lifecycle status, such as time since index - creation, time since rollover, the lifecycle configuration managing the index, - or any errors encountered during lifecycle execution. + .. raw:: html + +

Get the status for a data stream lifecycle. + Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution.

+ ``_ @@ -1625,13 +1681,15 @@ async def field_usage_stats( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get field usage stats. Get field usage information for each shard and field of - an index. Field usage statistics are automatically captured when queries are - running on a cluster. A shard-level search request that accesses a given field, - even if multiple times during that request, is counted as a single use. The response - body reports the per-shard usage count of the data structures that back the fields - in the index. A given request will increment each count by a maximum value of - 1, even if the request accesses the same field multiple times. + .. raw:: html + +

Get field usage stats. + Get field usage information for each shard and field of an index. + Field usage statistics are automatically captured when queries are running on a cluster. + A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use.

+

The response body reports the per-shard usage count of the data structures that back the fields in the index. + A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times.

+ ``_ @@ -1719,22 +1777,18 @@ async def flush( wait_if_ongoing: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Flush data streams or indices. Flushing a data stream or index is the process - of making sure that any data that is currently only stored in the transaction - log is also permanently stored in the Lucene index. When restarting, Elasticsearch - replays any unflushed operations from the transaction log into the Lucene index - to bring it back into the state that it was in before the restart. Elasticsearch - automatically triggers flushes as needed, using heuristics that trade off the - size of the unflushed transaction log against the cost of performing each flush. - After each operation has been flushed it is permanently stored in the Lucene - index. This may mean that there is no need to maintain an additional copy of - it in the transaction log. The transaction log is made up of multiple files, - called generations, and Elasticsearch will delete any generation files when they - are no longer needed, freeing up disk space. It is also possible to trigger a - flush on one or more indices using the flush API, although it is rare for users - to need to call this API directly. If you call the flush API after indexing some - documents then a successful response indicates that Elasticsearch has flushed - all the documents that were indexed before the flush API was called. + .. raw:: html + +

Flush data streams or indices. + Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. + When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. + Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush.

+

After each operation has been flushed it is permanently stored in the Lucene index. + This may mean that there is no need to maintain an additional copy of it in the transaction log. + The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space.

+

It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. + If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called.

+ ``_ @@ -1817,49 +1871,49 @@ async def forcemerge( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Force a merge. Perform the force merge operation on the shards of one or more - indices. For data streams, the API forces a merge on the shards of the stream's - backing indices. Merging reduces the number of segments in each shard by merging - some of them together and also frees up the space used by deleted documents. - Merging normally happens automatically, but sometimes it is useful to trigger - a merge manually. WARNING: We recommend force merging only a read-only index - (meaning the index is no longer receiving writes). When documents are updated - or deleted, the old version is not immediately removed but instead soft-deleted - and marked with a "tombstone". These soft-deleted documents are automatically - cleaned up during regular segment merges. But force merge can cause very large - (greater than 5 GB) segments to be produced, which are not eligible for regular - merges. So the number of soft-deleted documents can then grow rapidly, resulting - in higher disk usage and worse search performance. If you regularly force merge - an index receiving writes, this can also make snapshots more expensive, since - the new documents can't be backed up incrementally. **Blocks during a force merge** - Calls to this API block until the merge is complete (unless request contains - `wait_for_completion=false`). If the client connection is lost before completion - then the force merge process will continue in the background. Any new requests - to force merge the same indices will also block until the ongoing force merge - is complete. **Running force merge asynchronously** If the request contains `wait_for_completion=false`, - Elasticsearch performs some preflight checks, launches the request, and returns - a task you can use to get the status of the task. However, you can not cancel - this task as the force merge task is not cancelable. Elasticsearch creates a - record of this task as a document at `_tasks/`. When you are done with - a task, you should delete the task document so Elasticsearch can reclaim the - space. **Force merging multiple indices** You can force merge multiple indices - with a single request by targeting: * One or more data streams that contain multiple - backing indices * Multiple indices * One or more aliases * All data streams and - indices in a cluster Each targeted shard is force-merged separately using the - force_merge threadpool. By default each node only has a single `force_merge` - thread which means that the shards on that node are force-merged one at a time. - If you expand the `force_merge` threadpool on a node then it will force merge - its shards in parallel Force merge makes the storage for the shard being merged - temporarily increase, as it may require free space up to triple its size in case - `max_num_segments parameter` is set to `1`, to rewrite all segments into a new - one. **Data streams and time-based indices** Force-merging is useful for managing - a data stream's older backing indices and other time-based indices, particularly - after a rollover. In these cases, each index only receives indexing traffic for - a certain period of time. Once an index receive no more writes, its shards can - be force-merged to a single segment. This can be a good idea because single-segment - shards can sometimes use simpler and more efficient data structures to perform - searches. For example: ``` POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - ``` + .. raw:: html + +

Force a merge. + Perform the force merge operation on the shards of one or more indices. + For data streams, the API forces a merge on the shards of the stream's backing indices.

+

Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. + Merging normally happens automatically, but sometimes it is useful to trigger a merge manually.

+

WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). + When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". + These soft-deleted documents are automatically cleaned up during regular segment merges. + But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. + So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. + If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally.

+

Blocks during a force merge

+

Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). + If the client connection is lost before completion then the force merge process will continue in the background. + Any new requests to force merge the same indices will also block until the ongoing force merge is complete.

+

Running force merge asynchronously

+

If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. + However, you can not cancel this task as the force merge task is not cancelable. + Elasticsearch creates a record of this task as a document at _tasks/<task_id>. + When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.

+

Force merging multiple indices

+

You can force merge multiple indices with a single request by targeting:

+
    +
  • One or more data streams that contain multiple backing indices
  • +
  • Multiple indices
  • +
  • One or more aliases
  • +
  • All data streams and indices in a cluster
  • +
+

Each targeted shard is force-merged separately using the force_merge threadpool. + By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. + If you expand the force_merge threadpool on a node then it will force merge its shards in parallel

+

Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one.

+

Data streams and time-based indices

+

Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. + In these cases, each index only receives indexing traffic for a certain period of time. + Once an index receive no more writes, its shards can be force-merged to a single segment. + This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. + For example:

+
POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1
+          
+ ``_ @@ -1952,8 +2006,12 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index information. Get information about one or more indices. For data streams, - the API returns information about the stream’s backing indices. + .. raw:: html + +

Get index information. + Get information about one or more indices. For data streams, the API returns information about the + stream’s backing indices.

+ ``_ @@ -2042,7 +2100,11 @@ async def get_alias( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get aliases. Retrieves information for one or more data stream or index aliases. + .. raw:: html + +

Get aliases. + Retrieves information for one or more data stream or index aliases.

+ ``_ @@ -2124,8 +2186,11 @@ async def get_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream lifecycles. Retrieves the data stream lifecycle configuration - of one or more data streams. + .. raw:: html + +

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

+ ``_ @@ -2179,8 +2244,11 @@ async def get_data_lifecycle_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream lifecycle stats. Get statistics about the data streams that are - managed by a data stream lifecycle. + .. raw:: html + +

Get data stream lifecycle stats. + Get statistics about the data streams that are managed by a data stream lifecycle.

+ ``_ """ @@ -2227,7 +2295,11 @@ async def get_data_stream( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data streams. Retrieves information about one or more data streams. + .. raw:: html + +

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

+ ``_ @@ -2302,10 +2374,13 @@ async def get_field_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get mapping definitions. Retrieves mapping definitions for one or more fields. - For data streams, the API retrieves field mappings for the stream’s backing indices. - This API is useful if you don't need a complete mapping or if an index mapping - contains a large number of fields. + .. raw:: html + +

Get mapping definitions. + Retrieves mapping definitions for one or more fields. + For data streams, the API retrieves field mappings for the stream’s backing indices.

+

This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields.

+ ``_ @@ -2382,7 +2457,11 @@ async def get_index_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index templates. Get information about one or more index templates. + .. raw:: html + +

Get index templates. + Get information about one or more index templates.

+ ``_ @@ -2455,8 +2534,11 @@ async def get_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get mapping definitions. For data streams, the API retrieves mappings for the - stream’s backing indices. + .. raw:: html + +

Get mapping definitions. + For data streams, the API retrieves mappings for the stream’s backing indices.

+ ``_ @@ -2540,8 +2622,12 @@ async def get_settings( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index settings. Get setting information for one or more indices. For data - streams, it returns setting information for the stream's backing indices. + .. raw:: html + +

Get index settings. + Get setting information for one or more indices. + For data streams, it returns setting information for the stream's backing indices.

+ ``_ @@ -2628,9 +2714,12 @@ async def get_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index templates. Get information about one or more index templates. IMPORTANT: - This documentation is about legacy index templates, which are deprecated and - will be replaced by the composable templates introduced in Elasticsearch 7.8. + .. raw:: html + +

Get index templates. + Get information about one or more index templates.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+ ``_ @@ -2689,14 +2778,20 @@ async def migrate_to_data_stream( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Convert an index alias to a data stream. Converts an index alias to a data stream. - You must have a matching index template that is data stream enabled. The alias - must meet the following criteria: The alias must have a write index; All indices - for the alias must have a `@timestamp` field mapping of a `date` or `date_nanos` - field type; The alias must not have any filters; The alias must not use custom - routing. If successful, the request removes the alias and creates a data stream - with the same name. The indices for the alias become hidden backing indices for - the stream. The write index for the alias becomes the write index for the stream. + .. raw:: html + +

Convert an index alias to a data stream. + Converts an index alias to a data stream. + You must have a matching index template that is data stream enabled. + The alias must meet the following criteria: + The alias must have a write index; + All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; + The alias must not have any filters; + The alias must not use custom routing. + If successful, the request removes the alias and creates a data stream with the same name. + The indices for the alias become hidden backing indices for the stream. + The write index for the alias becomes the write index for the stream.

+ ``_ @@ -2748,8 +2843,11 @@ async def modify_data_stream( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update data streams. Performs one or more data stream modification actions in - a single atomic operation. + .. raw:: html + +

Update data streams. + Performs one or more data stream modification actions in a single atomic operation.

+ ``_ @@ -2809,27 +2907,26 @@ async def open( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Open a closed index. For data streams, the API opens any closed backing indices. - A closed index is blocked for read/write operations and does not allow all operations - that opened indices allow. It is not possible to index documents or to search - for documents in a closed index. This allows closed indices to not have to maintain - internal data structures for indexing or searching documents, resulting in a - smaller overhead on the cluster. When opening or closing an index, the master - is responsible for restarting the index shards to reflect the new state of the - index. The shards will then go through the normal recovery process. The data - of opened or closed indices is automatically replicated by the cluster to ensure - that enough shard copies are safely kept around at all times. You can open and - close multiple indices. An error is thrown if the request explicitly refers to - a missing index. This behavior can be turned off by using the `ignore_unavailable=true` - parameter. By default, you must explicitly name the indices you are opening or - closing. To open or close indices with `_all`, `*`, or other wildcard expressions, - change the `action.destructive_requires_name` setting to `false`. This setting - can also be changed with the cluster update settings API. Closed indices consume - a significant amount of disk-space which can cause problems in managed environments. - Closing indices can be turned off with the cluster settings API by setting `cluster.indices.close.enable` - to `false`. Because opening or closing an index allocates its shards, the `wait_for_active_shards` - setting on index creation applies to the `_open` and `_close` index actions as - well. + .. raw:: html + +

Open a closed index. + For data streams, the API opens any closed backing indices.

+

A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. + It is not possible to index documents or to search for documents in a closed index. + This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster.

+

When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. + The shards will then go through the normal recovery process. + The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.

+

You can open and close multiple indices. + An error is thrown if the request explicitly refers to a missing index. + This behavior can be turned off by using the ignore_unavailable=true parameter.

+

By default, you must explicitly name the indices you are opening or closing. + To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. + This setting can also be changed with the cluster update settings API.

+

Closed indices consume a significant amount of disk-space which can cause problems in managed environments. + Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false.

+

Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well.

+ ``_ @@ -2904,18 +3001,18 @@ async def promote_data_stream( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Promote a data stream. Promote a data stream from a replicated data stream managed - by cross-cluster replication (CCR) to a regular data stream. With CCR auto following, - a data stream from a remote cluster can be replicated to the local cluster. These - data streams can't be rolled over in the local cluster. These replicated data - streams roll over only if the upstream data stream rolls over. In the event that - the remote cluster is no longer available, the data stream in the local cluster - can be promoted to a regular data stream, which allows these data streams to - be rolled over in the local cluster. NOTE: When promoting a data stream, ensure - the local cluster has a data stream enabled index template that matches the data - stream. If this is missing, the data stream will not be able to roll over until - a matching index template is created. This will affect the lifecycle management - of the data stream and interfere with the data stream size and retention. + .. raw:: html + +

Promote a data stream. + Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream.

+

With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. + These data streams can't be rolled over in the local cluster. + These replicated data streams roll over only if the upstream data stream rolls over. + In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster.

+

NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. + If this is missing, the data stream will not be able to roll over until a matching index template is created. + This will affect the lifecycle management of the data stream and interfere with the data stream size and retention.

+ ``_ @@ -2977,7 +3074,11 @@ async def put_alias( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an alias. Adds a data stream or index to an alias. + .. raw:: html + +

Create or update an alias. + Adds a data stream or index to an alias.

+ ``_ @@ -3079,8 +3180,11 @@ async def put_data_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update data stream lifecycles. Update the data stream lifecycle of the specified - data streams. + .. raw:: html + +

Update data stream lifecycles. + Update the data stream lifecycle of the specified data streams.

+ ``_ @@ -3181,34 +3285,30 @@ async def put_index_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an index template. Index templates define settings, mappings, - and aliases that can be applied automatically to new indices. Elasticsearch applies - templates to new indices based on an wildcard pattern that matches the index - name. Index templates are applied during data stream or index creation. For data - streams, these settings and mappings are applied when the stream's backing indices - are created. Settings and mappings specified in a create index API request override - any settings or mappings specified in an index template. Changes to index templates - do not affect existing indices, including the existing backing indices of a data - stream. You can use C-style `/* *\\/` block comments in index templates. You - can include comments anywhere in the request body, except before the opening - curly bracket. **Multiple matching templates** If multiple index templates match - the name of a new index or data stream, the template with the highest priority - is used. Multiple templates with overlapping index patterns at the same priority - are not allowed and an error will be thrown when attempting to create a template - matching an existing index template at identical priorities. **Composing aliases, - mappings, and settings** When multiple component templates are specified in the - `composed_of` field for an index template, they are merged in the order specified, - meaning that later component templates override earlier component templates. - Any mappings, settings, or aliases from the parent index template are merged - in next. Finally, any configuration on the index request itself is merged. Mapping - definitions are merged recursively, which means that later mapping components - can introduce new field mappings and update the mapping configuration. If a field - mapping is already contained in an earlier component, its definition will be - completely overwritten by the later one. This recursive merging strategy applies - not only to field mappings, but also root options like `dynamic_templates` and - `meta`. If an earlier component contains a `dynamic_templates` block, then by - default new `dynamic_templates` entries are appended onto the end. If an entry - already exists with the same key, then it is overwritten by the new definition. + .. raw:: html + +

Create or update an index template. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

+

Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. + Index templates are applied during data stream or index creation. + For data streams, these settings and mappings are applied when the stream's backing indices are created. + Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. + Changes to index templates do not affect existing indices, including the existing backing indices of a data stream.

+

You can use C-style /* *\\/ block comments in index templates. + You can include comments anywhere in the request body, except before the opening curly bracket.

+

Multiple matching templates

+

If multiple index templates match the name of a new index or data stream, the template with the highest priority is used.

+

Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities.

+

Composing aliases, mappings, and settings

+

When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. + Any mappings, settings, or aliases from the parent index template are merged in next. + Finally, any configuration on the index request itself is merged. + Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. + If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. + This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. + If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. + If an entry already exists with the same key, then it is overwritten by the new definition.

+ ``_ @@ -3341,10 +3441,7 @@ async def put_mapping( ] = None, dynamic_date_formats: t.Optional[t.Sequence[str]] = None, dynamic_templates: t.Optional[ - t.Union[ - t.Mapping[str, t.Mapping[str, t.Any]], - t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]], - ] + t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]] ] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ @@ -3372,27 +3469,29 @@ async def put_mapping( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update field mappings. Add new fields to an existing data stream or index. You - can also use this API to change the search settings of existing fields and add - new properties to existing object fields. For data streams, these changes are - applied to all backing indices by default. **Add multi-fields to an existing - field** Multi-fields let you index the same field in different ways. You can - use this API to update the fields mapping parameter and enable multi-fields for - an existing field. WARNING: If an index (or data stream) contains documents when - you add a multi-field, those documents will not have values for the new multi-field. - You can populate the new multi-field with the update by query API. **Change supported - mapping parameters for an existing field** The documentation for each mapping - parameter indicates whether you can update it for an existing field using this - API. For example, you can use the update mapping API to update the `ignore_above` - parameter. **Change the mapping of an existing field** Except for supported mapping - parameters, you can't change the mapping or field type of an existing field. - Changing an existing field could invalidate data that's already indexed. If you - need to change the mapping of a field in a data stream's backing indices, refer - to documentation about modifying data streams. If you need to change the mapping - of a field in other indices, create a new index with the correct mapping and - reindex your data into that index. **Rename a field** Renaming a field would - invalidate data already indexed under the old field name. Instead, add an alias - field to create an alternate field name. + .. raw:: html + +

Update field mappings. + Add new fields to an existing data stream or index. + You can also use this API to change the search settings of existing fields and add new properties to existing object fields. + For data streams, these changes are applied to all backing indices by default.

+

Add multi-fields to an existing field

+

Multi-fields let you index the same field in different ways. + You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. + WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. + You can populate the new multi-field with the update by query API.

+

Change supported mapping parameters for an existing field

+

The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. + For example, you can use the update mapping API to update the ignore_above parameter.

+

Change the mapping of an existing field

+

Except for supported mapping parameters, you can't change the mapping or field type of an existing field. + Changing an existing field could invalidate data that's already indexed.

+

If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. + If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.

+

Rename a field

+

Renaming a field would invalidate data already indexed under the old field name. + Instead, add an alias field to create an alternate field name.

+ ``_ @@ -3521,21 +3620,23 @@ async def put_settings( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update index settings. Changes dynamic index settings in real time. For data - streams, index setting changes are applied to all backing indices by default. - To revert a setting to the default value, use a null value. The list of per-index - settings that can be updated dynamically on live indices can be found in index - module documentation. To preserve existing settings from being updated, set the - `preserve_existing` parameter to `true`. NOTE: You can only define new analyzers - on closed indices. To add an analyzer, you must close the index, define the analyzer, - and reopen the index. You cannot close the write index of a data stream. To update - the analyzer for a data stream's write index and future backing indices, update - the analyzer in the index template used by the stream. Then roll over the data - stream to apply the new analyzer to the stream's write index and future backing - indices. This affects searches and any new data added to the stream after the - rollover. However, it does not affect the data stream's backing indices or their - existing data. To change the analyzer for existing backing indices, you must - create a new data stream and reindex your data into it. + .. raw:: html + +

Update index settings. + Changes dynamic index settings in real time. + For data streams, index setting changes are applied to all backing indices by default.

+

To revert a setting to the default value, use a null value. + The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. + To preserve existing settings from being updated, set the preserve_existing parameter to true.

+

NOTE: You can only define new analyzers on closed indices. + To add an analyzer, you must close the index, define the analyzer, and reopen the index. + You cannot close the write index of a data stream. + To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. + Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. + This affects searches and any new data added to the stream after the rollover. + However, it does not affect the data stream's backing indices or their existing data. + To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it.

+ ``_ @@ -3639,24 +3740,24 @@ async def put_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an index template. Index templates define settings, mappings, - and aliases that can be applied automatically to new indices. Elasticsearch applies - templates to new indices based on an index pattern that matches the index name. - IMPORTANT: This documentation is about legacy index templates, which are deprecated - and will be replaced by the composable templates introduced in Elasticsearch - 7.8. Composable templates always take precedence over legacy templates. If no - composable template matches a new index, matching legacy templates are applied - according to their order. Index templates are only applied during index creation. - Changes to index templates do not affect existing indices. Settings and mappings - specified in create index API requests override any settings or mappings specified - in an index template. You can use C-style `/* *\\/` block comments in index templates. - You can include comments anywhere in the request body, except before the opening - curly bracket. **Indices matching multiple templates** Multiple index templates - can potentially match an index, in this case, both the settings and mappings - are merged into the final configuration of the index. The order of the merging - can be controlled using the order parameter, with lower order being applied first, - and higher orders overriding them. NOTE: Multiple matching templates with the - same order value will result in a non-deterministic merging order. + .. raw:: html + +

Create or update an index template. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices. + Elasticsearch applies templates to new indices based on an index pattern that matches the index name.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+

Composable templates always take precedence over legacy templates. + If no composable template matches a new index, matching legacy templates are applied according to their order.

+

Index templates are only applied during index creation. + Changes to index templates do not affect existing indices. + Settings and mappings specified in create index API requests override any settings or mappings specified in an index template.

+

You can use C-style /* *\\/ block comments in index templates. + You can include comments anywhere in the request body, except before the opening curly bracket.

+

Indices matching multiple templates

+

Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. + The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. + NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order.

+ ``_ @@ -3737,27 +3838,28 @@ async def recovery( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index recovery information. Get information about ongoing and completed shard - recoveries for one or more indices. For data streams, the API returns information - for the stream's backing indices. All recoveries, whether ongoing or complete, - are kept in the cluster state and may be reported on at any time. Shard recovery - is the process of initializing a shard copy, such as restoring a primary shard - from a snapshot or creating a replica shard from a primary shard. When a shard - recovery completes, the recovered shard is available for search and indexing. - Recovery automatically occurs during the following processes: * When creating - an index for the first time. * When a node rejoins the cluster and starts up - any missing primary shard copies using the data that it holds in its data path. - * Creation of new replica shard copies from the primary. * Relocation of a shard - copy to a different node in the same cluster. * A snapshot restore operation. - * A clone, shrink, or split operation. You can determine the cause of a shard - recovery using the recovery or cat recovery APIs. The index recovery API reports - information about completed recoveries only for shard copies that currently exist - in the cluster. It only reports the last recovery for each shard copy and does - not report historical information about earlier recoveries, nor does it report - information about the recoveries of shard copies that no longer exist. This means - that if a shard copy completes a recovery and then Elasticsearch relocates it - onto a different node then the information about the original recovery will not - be shown in the recovery API. + .. raw:: html + +

Get index recovery information. + Get information about ongoing and completed shard recoveries for one or more indices. + For data streams, the API returns information for the stream's backing indices.

+

All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time.

+

Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. + When a shard recovery completes, the recovered shard is available for search and indexing.

+

Recovery automatically occurs during the following processes:

+
    +
  • When creating an index for the first time.
  • +
  • When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path.
  • +
  • Creation of new replica shard copies from the primary.
  • +
  • Relocation of a shard copy to a different node in the same cluster.
  • +
  • A snapshot restore operation.
  • +
  • A clone, shrink, or split operation.
  • +
+

You can determine the cause of a shard recovery using the recovery or cat recovery APIs.

+

The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. + It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. + This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API.

+ ``_ @@ -3819,19 +3921,19 @@ async def refresh( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Refresh an index. A refresh makes recent operations performed on one or more - indices available for search. For data streams, the API runs the refresh operation - on the stream’s backing indices. By default, Elasticsearch periodically refreshes - indices every second, but only on indices that have received one search request - or more in the last 30 seconds. You can change this default interval with the - `index.refresh_interval` setting. Refresh requests are synchronous and do not - return a response until the refresh operation completes. Refreshes are resource-intensive. - To ensure good cluster performance, it's recommended to wait for Elasticsearch's - periodic refresh rather than performing an explicit refresh when possible. If - your application workflow indexes documents and then runs a search to retrieve - the indexed document, it's recommended to use the index API's `refresh=wait_for` - query parameter option. This option ensures the indexing operation waits for - a periodic refresh before running the search. + .. raw:: html + +

Refresh an index. + A refresh makes recent operations performed on one or more indices available for search. + For data streams, the API runs the refresh operation on the stream’s backing indices.

+

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

+

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

+

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

+

If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. + This option ensures the indexing operation waits for a periodic refresh before running the search.

+ ``_ @@ -3901,21 +4003,20 @@ async def reload_search_analyzers( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reload search analyzers. Reload an index's search analyzers and their resources. - For data streams, the API reloads search analyzers and resources for the stream's - backing indices. IMPORTANT: After reloading the search analyzers you should clear - the request cache to make sure it doesn't contain responses derived from the - previous versions of the analyzer. You can use the reload search analyzers API - to pick up changes to synonym files used in the `synonym_graph` or `synonym` - token filter of a search analyzer. To be eligible, the token filter must have - an `updateable` flag of `true` and only be used in search analyzers. NOTE: This - API does not perform a reload for each shard of an index. Instead, it performs - a reload for each node containing index shards. As a result, the total shard - count returned by the API can differ from the number of index shards. Because - reloading affects every node with an index shard, it is important to update the - synonym file on every data node in the cluster--including nodes that don't contain - a shard replica--before using this API. This ensures the synonym file is updated - everywhere in the cluster in case shards are relocated in the future. + .. raw:: html + +

Reload search analyzers. + Reload an index's search analyzers and their resources. + For data streams, the API reloads search analyzers and resources for the stream's backing indices.

+

IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer.

+

You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. + To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers.

+

NOTE: This API does not perform a reload for each shard of an index. + Instead, it performs a reload for each node containing index shards. + As a result, the total shard count returned by the API can differ from the number of index shards. + Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. + This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future.

+ ``_ @@ -3979,38 +4080,33 @@ async def resolve_cluster( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. 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 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). * Cluster version information, including the Elasticsearch server version. - 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** 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. * A cluster has no matching - indices, aliases or data streams for the index expression (or your user does - not have permissions to search them). For example, suppose your index expression - is `logs*,remote1:logs*` and the remote1 cluster has no indices, aliases or data - streams that match `logs*`. In that case, that cluster will return no results - from that cluster if you include it in a cross-cluster search. * 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. + .. 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.

+

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 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).
  • +
  • Cluster version information, including the Elasticsearch server version.
  • +
+

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

+

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.
  • +
  • A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search.
  • +
  • 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.
  • +
+ ``_ @@ -4083,8 +4179,12 @@ async def resolve_index( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resolve indices. Resolve the names and/or index patterns for indices, aliases, - and data streams. Multiple patterns and remote clusters are supported. + .. raw:: html + +

Resolve indices. + Resolve the names and/or index patterns for indices, aliases, and data streams. + Multiple patterns and remote clusters are supported.

+ ``_ @@ -4157,33 +4257,35 @@ async def rollover( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Roll over to a new index. TIP: It is recommended to use the index lifecycle rollover - action to automate rollovers. The rollover API creates a new index for a data - stream or index alias. The API behavior depends on the rollover target. **Roll - over a data stream** If you roll over a data stream, the API creates a new write - index for the stream. The stream's previous write index becomes a regular backing - index. A rollover also increments the data stream's generation. **Roll over an - index alias with a write index** TIP: Prior to Elasticsearch 7.9, you'd typically - use an index alias with a write index to manage time series data. Data streams - replace this functionality, require less maintenance, and automatically integrate - with data tiers. If an index alias points to multiple indices, one of the indices - must be a write index. The rollover API creates a new write index for the alias - with `is_write_index` set to `true`. The API also `sets is_write_index` to `false` - for the previous write index. **Roll over an index alias with one index** If - you roll over an index alias that points to only one index, the API creates a - new index for the alias and removes the original index from the alias. NOTE: - A rollover creates a new index and is subject to the `wait_for_active_shards` - setting. **Increment index names for an alias** When you roll over an index alias, - you can specify a name for the new index. If you don't specify a name and the - current index ends with `-` and a number, such as `my-index-000001` or `my-index-3`, - the new index name increments that number. For example, if you roll over an alias - with a current index of `my-index-000001`, the rollover creates a new index named - `my-index-000002`. This number is always six characters and zero-padded, regardless - of the previous index's name. If you use an index alias for time series data, - you can use date math in the index name to track the rollover date. For example, - you can create an alias that points to an index named ``. - If you create the index on May 6, 2099, the index's name is `my-index-2099.05.06-000001`. - If you roll over the alias on May 7, 2099, the new index's name is `my-index-2099.05.07-000002`. + .. raw:: html + +

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

+

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

+

Roll over a data stream

+

If you roll over a data stream, the API creates a new write index for the stream. + The stream's previous write index becomes a regular backing index. + A rollover also increments the data stream's generation.

+

Roll over an index alias with a write index

+

TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. + Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers.

+

If an index alias points to multiple indices, one of the indices must be a write index. + The rollover API creates a new write index for the alias with is_write_index set to true. + The API also sets is_write_index to false for the previous write index.

+

Roll over an index alias with one index

+

If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias.

+

NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting.

+

Increment index names for an alias

+

When you roll over an index alias, you can specify a name for the new index. + If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. + For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. + This number is always six characters and zero-padded, regardless of the previous index's name.

+

If you use an index alias for time series data, you can use date math in the index name to track the rollover date. + For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. + If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. + If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002.

+ ``_ @@ -4288,9 +4390,12 @@ async def segments( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index segments. Get low-level information about the Lucene segments in index - shards. For data streams, the API returns information about the stream's backing - indices. + .. raw:: html + +

Get index segments. + Get low-level information about the Lucene segments in index shards. + For data streams, the API returns information about the stream's backing indices.

+ ``_ @@ -4369,14 +4474,20 @@ async def shard_stores( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index shard stores. Get store information about replica shards in one or - more indices. For data streams, the API retrieves store information for the stream's - backing indices. The index shard stores API returns the following information: - * The node on which each replica shard exists. * The allocation ID for each replica - shard. * A unique ID for each replica shard. * Any errors encountered while opening - the shard index or from an earlier failure. By default, the API returns store - information only for primary shards that are unassigned or have one or more unassigned - replica shards. + .. raw:: html + +

Get index shard stores. + Get store information about replica shards in one or more indices. + For data streams, the API retrieves store information for the stream's backing indices.

+

The index shard stores API returns the following information:

+
    +
  • The node on which each replica shard exists.
  • +
  • The allocation ID for each replica shard.
  • +
  • A unique ID for each replica shard.
  • +
  • Any errors encountered while opening the shard index or from an earlier failure.
  • +
+

By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards.

+ ``_ @@ -4447,39 +4558,38 @@ async def shrink( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Shrink an index. Shrink an index into a new index with fewer primary shards. - Before you can shrink an index: * The index must be read-only. * A copy of every - shard in the index must reside on the same node. * The index must have a green - health status. To make shard allocation easier, we recommend you also remove - the index's replica shards. You can later re-add replica shards as part of the - shrink operation. The requested number of primary shards in the target index - must be a factor of the number of shards in the source index. For example an - index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an - index with 15 primary shards can be shrunk into 5, 3 or 1. If the number of shards - in the index is a prime number it can only be shrunk into a single primary shard - Before shrinking, a (primary or replica) copy of every shard in the index must - be present on the same node. The current write index on a data stream cannot - be shrunk. In order to shrink the current write index, the data stream must first - be rolled over so that a new write index is created and then the previous write - index can be shrunk. A shrink operation: * Creates a new target index with the - same definition as the source index, but with a smaller number of primary shards. - * Hard-links segments from the source index into the target index. If the file - system does not support hard-linking, then all segments are copied into the new - index, which is a much more time consuming process. Also if using multiple data - paths, shards on different data paths require a full copy of segment files if - they are not on the same disk since hardlinks do not work across disks. * Recovers - the target index as though it were a closed index which had just been re-opened. - Recovers shards to the `.routing.allocation.initial_recovery._id` index setting. - IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - * The target index must not exist. * The source index must have more primary - shards than the target index. * The number of primary shards in the target index - must be a factor of the number of primary shards in the source index. The source - index must have more primary shards than the target index. * The index must not - contain more than 2,147,483,519 documents in total across all shards that will - be shrunk into a single shard on the target index as this is the maximum number - of docs that can fit into a single shard. * The node handling the shrink process - must have sufficient free disk space to accommodate a second copy of the existing - index. + .. raw:: html + +

Shrink an index. + Shrink an index into a new index with fewer primary shards.

+

Before you can shrink an index:

+
    +
  • The index must be read-only.
  • +
  • A copy of every shard in the index must reside on the same node.
  • +
  • The index must have a green health status.
  • +
+

To make shard allocation easier, we recommend you also remove the index's replica shards. + You can later re-add replica shards as part of the shrink operation.

+

The requested number of primary shards in the target index must be a factor of the number of shards in the source index. + For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. + If the number of shards in the index is a prime number it can only be shrunk into a single primary shard + Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node.

+

The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk.

+

A shrink operation:

+
    +
  • Creates a new target index with the same definition as the source index, but with a smaller number of primary shards.
  • +
  • Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks.
  • +
  • Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting.
  • +
+

IMPORTANT: Indices can only be shrunk if they satisfy the following requirements:

+
    +
  • The target index must not exist.
  • +
  • The source index must have more primary shards than the target index.
  • +
  • The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index.
  • +
  • The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard.
  • +
  • The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+ ``_ @@ -4554,8 +4664,11 @@ async def simulate_index_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate an index. Get the index configuration that would be applied to the specified - index from an existing index template. + .. raw:: html + +

Simulate an index. + Get the index configuration that would be applied to the specified index from an existing index template.

+ ``_ @@ -4632,8 +4745,11 @@ async def simulate_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate an index template. Get the index configuration that would be applied - by a particular index template. + .. raw:: html + +

Simulate an index template. + Get the index configuration that would be applied by a particular index template.

+ ``_ @@ -4764,31 +4880,44 @@ async def split( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Split an index. Split an index into a new index with more primary shards. * Before - you can split an index: * The index must be read-only. * The cluster health status - must be green. You can do make an index read-only with the following request - using the add index block API: ``` PUT /my_source_index/_block/write ``` The - current write index on a data stream cannot be split. In order to split the current - write index, the data stream must first be rolled over so that a new write index - is created and then the previous write index can be split. The number of times - the index can be split (and the number of shards that each original shard can - be split into) is determined by the `index.number_of_routing_shards` setting. - The number of routing shards specifies the hashing space that is used internally - to distribute documents across shards with consistent hashing. For instance, - a 5 shard index with `number_of_routing_shards` set to 30 (5 x 2 x 3) could be - split by a factor of 2 or 3. A split operation: * Creates a new target index - with the same definition as the source index, but with a larger number of primary - shards. * Hard-links segments from the source index into the target index. If - the file system doesn't support hard-linking, all segments are copied into the - new index, which is a much more time consuming process. * Hashes all documents - again, after low level files are created, to delete documents that belong to - a different shard. * Recovers the target index as though it were a closed index - which had just been re-opened. IMPORTANT: Indices can only be split if they satisfy - the following requirements: * The target index must not exist. * The source index - must have fewer primary shards than the target index. * The number of primary - shards in the target index must be a multiple of the number of primary shards - in the source index. * The node handling the split process must have sufficient - free disk space to accommodate a second copy of the existing index. + .. raw:: html + +

Split an index. + Split an index into a new index with more primary shards.

+
    +
  • +

    Before you can split an index:

    +
  • +
  • +

    The index must be read-only.

    +
  • +
  • +

    The cluster health status must be green.

    +
  • +
+

You can do make an index read-only with the following request using the add index block API:

+
PUT /my_source_index/_block/write
+          
+

The current write index on a data stream cannot be split. + In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split.

+

The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. + The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. + For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3.

+

A split operation:

+
    +
  • Creates a new target index with the same definition as the source index, but with a larger number of primary shards.
  • +
  • Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process.
  • +
  • Hashes all documents again, after low level files are created, to delete documents that belong to a different shard.
  • +
  • Recovers the target index as though it were a closed index which had just been re-opened.
  • +
+

IMPORTANT: Indices can only be split if they satisfy the following requirements:

+
    +
  • The target index must not exist.
  • +
  • The source index must have fewer primary shards than the target index.
  • +
  • The number of primary shards in the target index must be a multiple of the number of primary shards in the source index.
  • +
  • The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+ ``_ @@ -4880,14 +5009,17 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index statistics. For data streams, the API retrieves statistics for the - stream's backing indices. By default, the returned statistics are index-level - with `primaries` and `total` aggregations. `primaries` are the values for only - the primary shards. `total` are the accumulated values for both primary and replica - shards. To get shard-level statistics, set the `level` parameter to `shards`. - NOTE: When moving to another node, the shard-level statistics for a shard are - cleared. Although the shard is no longer part of the node, that node retains - any node-level statistics to which the shard contributed. + .. raw:: html + +

Get index statistics. + For data streams, the API retrieves statistics for the stream's backing indices.

+

By default, the returned statistics are index-level with primaries and total aggregations. + primaries are the values for only the primary shards. + total are the accumulated values for both primary and replica shards.

+

To get shard-level statistics, set the level parameter to shards.

+

NOTE: When moving to another node, the shard-level statistics for a shard are cleared. + Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed.

+ ``_ @@ -4990,8 +5122,11 @@ async def unfreeze( wait_for_active_shards: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Unfreeze an index. When a frozen index is unfrozen, the index goes through the - normal recovery process and becomes writeable again. + .. raw:: html + +

Unfreeze an index. + When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.

+ ``_ @@ -5065,7 +5200,11 @@ async def update_aliases( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an alias. Adds a data stream or index to an alias. + .. raw:: html + +

Create or update an alias. + Adds a data stream or index to an alias.

+ ``_ @@ -5140,7 +5279,11 @@ async def validate_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Validate a query. Validates a query without running it. + .. raw:: html + +

Validate a query. + Validates a query without running it.

+ ``_ diff --git a/elasticsearch/_async/client/inference.py b/elasticsearch/_async/client/inference.py index 0b124e281..f85857b8b 100644 --- a/elasticsearch/_async/client/inference.py +++ b/elasticsearch/_async/client/inference.py @@ -44,7 +44,10 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an inference endpoint + .. raw:: html + +

Delete an inference endpoint

+ ``_ @@ -109,7 +112,10 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an inference endpoint + .. raw:: html + +

Get an inference endpoint

+ ``_ @@ -172,7 +178,10 @@ async def inference( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Perform inference on the service + .. raw:: html + +

Perform inference on the service

+ ``_ @@ -255,21 +264,18 @@ async def put( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an inference endpoint. When you create an inference endpoint, the associated - machine learning model is automatically deployed if it is not already running. - After creating the endpoint, wait for the model deployment to complete before - using it. To verify the deployment status, use the get trained model statistics - API. Look for `"state": "fully_allocated"` in the response and ensure that the - `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating - multiple endpoints for the same model unless required, as each endpoint consumes - significant resources. IMPORTANT: The inference APIs enable you to use certain - services, such as built-in machine learning models (ELSER, E5), models uploaded - through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, 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. + .. raw:: html + +

Create an inference endpoint. + When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. + After creating the endpoint, wait for the model deployment to complete before using it. + To verify the deployment status, use the get trained model statistics API. + Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". + Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.

+

IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, 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.

+ ``_ @@ -339,16 +345,14 @@ async def update( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an inference endpoint. Modify `task_settings`, secrets (within `service_settings`), - or `num_allocations` for an inference endpoint, depending on the specific endpoint - service and `task_type`. IMPORTANT: 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. + .. raw:: html + +

Update an inference endpoint.

+

Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type.

+

IMPORTANT: 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.

+ ``_ diff --git a/elasticsearch/_async/client/ingest.py b/elasticsearch/_async/client/ingest.py index d2ec37976..be1369846 100644 --- a/elasticsearch/_async/client/ingest.py +++ b/elasticsearch/_async/client/ingest.py @@ -38,8 +38,11 @@ async def delete_geoip_database( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete GeoIP database configurations. Delete one or more IP geolocation database - configurations. + .. raw:: html + +

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

+ ``_ @@ -90,7 +93,10 @@ async def delete_ip_location_database( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete IP geolocation database configurations. + .. raw:: html + +

Delete IP geolocation database configurations.

+ ``_ @@ -143,7 +149,11 @@ async def delete_pipeline( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete pipelines. Delete one or more ingest pipelines. + .. raw:: html + +

Delete pipelines. + Delete one or more ingest pipelines.

+ ``_ @@ -192,8 +202,11 @@ async def geo_ip_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get GeoIP statistics. Get download statistics for GeoIP2 databases that are used - with the GeoIP processor. + .. raw:: html + +

Get GeoIP statistics. + Get download statistics for GeoIP2 databases that are used with the GeoIP processor.

+ ``_ """ @@ -230,8 +243,11 @@ async def get_geoip_database( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get GeoIP database configurations. Get information about one or more IP geolocation - database configurations. + .. raw:: html + +

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

+ ``_ @@ -282,7 +298,10 @@ async def get_ip_location_database( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get IP geolocation database configurations. + .. raw:: html + +

Get IP geolocation database configurations.

+ ``_ @@ -335,8 +354,12 @@ async def get_pipeline( summary: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get pipelines. Get information about one or more ingest pipelines. This API returns - a local reference of the pipeline. + .. raw:: html + +

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

+ ``_ @@ -387,10 +410,13 @@ async def processor_grok( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a grok processor. Extract structured fields out of a single text field within - a document. You must choose which field to extract matched fields from, as well - as the grok pattern you expect will match. A grok pattern is like a regular expression - that supports aliased expressions that can be reused. + .. raw:: html + +

Run a grok processor. + Extract structured fields out of a single text field within a document. + You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. + A grok pattern is like a regular expression that supports aliased expressions that can be reused.

+ ``_ """ @@ -433,8 +459,11 @@ async def put_geoip_database( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a GeoIP database configuration. Refer to the create or update - IP geolocation database configuration API. + .. raw:: html + +

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

+ ``_ @@ -506,7 +535,10 @@ async def put_ip_location_database( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an IP geolocation database configuration. + .. raw:: html + +

Create or update an IP geolocation database configuration.

+ ``_ @@ -588,7 +620,11 @@ async def put_pipeline( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a pipeline. Changes made using this API take effect immediately. + .. raw:: html + +

Create or update a pipeline. + Changes made using this API take effect immediately.

+ ``_ @@ -680,9 +716,12 @@ async def simulate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ diff --git a/elasticsearch/_async/client/license.py b/elasticsearch/_async/client/license.py index 48b79050e..1dba3a6d0 100644 --- a/elasticsearch/_async/client/license.py +++ b/elasticsearch/_async/client/license.py @@ -35,9 +35,12 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ """ @@ -74,11 +77,13 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. If you receive an unexpected 404 response after cluster - startup, wait a short period and retry the request. + .. 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. + If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request.

+ ``_ @@ -124,7 +129,10 @@ async def get_basic_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the basic license status. + .. raw:: html + +

Get the basic license status.

+ ``_ """ @@ -159,7 +167,10 @@ async def get_trial_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the trial status. + .. raw:: html + +

Get the trial status.

+ ``_ """ @@ -200,14 +211,16 @@ async def post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. NOTE: If Elasticsearch security features - are enabled and you are installing a gold or higher license, you must enable - TLS on the transport networking layer before you install the license. If the - operator privileges feature is enabled, only operator users can use this API. + .. raw:: html + +

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.

+

NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. + If the operator privileges feature is enabled, only operator users can use this API.

+ ``_ @@ -261,13 +274,15 @@ async def post_start_basic( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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`. To check the status of your basic license, use the get - basic license API. + .. raw:: html + +

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.

+

To check the status of your basic license, use the get basic license API.

+ ``_ @@ -309,12 +324,14 @@ async def post_start_trial( type_query_string: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a trial. Start a 30-day trial, which gives access to all subscription features. - NOTE: You are allowed to start a trial only if your cluster has not already activated - a trial for the current major product version. For example, if you have already - activated a trial for v8.0, you cannot start a new trial until v9.0. You can, - however, request an extended trial at https://www.elastic.co/trialextension. - To check the status of your trial, use the get trial status API. + .. raw:: html + +

Start a trial. + Start a 30-day trial, which gives access to all subscription features.

+

NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. + For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension.

+

To check the status of your trial, use the get trial status API.

+ ``_ diff --git a/elasticsearch/_async/client/logstash.py b/elasticsearch/_async/client/logstash.py index 308588e32..9e8e6c639 100644 --- a/elasticsearch/_async/client/logstash.py +++ b/elasticsearch/_async/client/logstash.py @@ -36,9 +36,12 @@ async def delete_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a Logstash pipeline. Delete a pipeline that is used for Logstash Central - Management. If the request succeeds, you receive an empty response with an appropriate - status code. + .. raw:: html + +

Delete a Logstash pipeline. + Delete a pipeline that is used for Logstash Central Management. + If the request succeeds, you receive an empty response with an appropriate status code.

+ ``_ @@ -78,7 +81,11 @@ async def get_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get Logstash pipelines. Get pipelines that are used for Logstash Central Management. + .. raw:: html + +

Get Logstash pipelines. + Get pipelines that are used for Logstash Central Management.

+ ``_ @@ -125,8 +132,12 @@ async def put_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a Logstash pipeline. Create a pipeline that is used for Logstash - Central Management. If the specified pipeline exists, it is replaced. + .. raw:: html + +

Create or update a Logstash pipeline.

+

Create a pipeline that is used for Logstash Central Management. + If the specified pipeline exists, it is replaced.

+ ``_ diff --git a/elasticsearch/_async/client/migration.py b/elasticsearch/_async/client/migration.py index 4bf4cead0..6cbc5283e 100644 --- a/elasticsearch/_async/client/migration.py +++ b/elasticsearch/_async/client/migration.py @@ -36,10 +36,13 @@ async def deprecations( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get deprecation information. Get information about different cluster, node, and - index level settings that use deprecated features that will be removed or changed - in the next major version. TIP: This APIs is designed for indirect use by the - Upgrade Assistant. You are strongly recommended to use the Upgrade Assistant. + .. raw:: html + +

Get deprecation information. + Get information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version.

+

TIP: This APIs is designed for indirect use by the Upgrade Assistant. + You are strongly recommended to use the Upgrade Assistant.

+ ``_ @@ -82,11 +85,14 @@ async def get_feature_upgrade_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get feature migration information. Version upgrades sometimes require changes - to how features store configuration information and data in system indices. Check - which features need to be migrated and the status of any migrations that are - in progress. TIP: This API is designed for indirect use by the Upgrade Assistant. - You are strongly recommended to use the Upgrade Assistant. + .. raw:: html + +

Get feature migration information. + Version upgrades sometimes require changes to how features store configuration information and data in system indices. + Check which features need to be migrated and the status of any migrations that are in progress.

+

TIP: This API is designed for indirect use by the Upgrade Assistant. + You are strongly recommended to use the Upgrade Assistant.

+ ``_ """ @@ -121,11 +127,14 @@ async def post_feature_upgrade( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Start the feature migration. Version upgrades sometimes require changes to how - features store configuration information and data in system indices. This API - starts the automatic migration process. Some functionality might be temporarily - unavailable during the migration process. TIP: The API is designed for indirect - use by the Upgrade Assistant. We strongly recommend you use the Upgrade Assistant. + .. raw:: html + +

Start the feature migration. + Version upgrades sometimes require changes to how features store configuration information and data in system indices. + This API starts the automatic migration process.

+

Some functionality might be temporarily unavailable during the migration process.

+

TIP: The API is designed for indirect use by the Upgrade Assistant. We strongly recommend you use the Upgrade Assistant.

+ ``_ """ diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index b8e73ae50..783ddf22b 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -36,11 +36,14 @@ async def clear_trained_model_deployment_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -88,19 +91,14 @@ async def close_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. 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. + 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 +159,11 @@ async def delete_calendar( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a calendar. Removes all scheduled events from a calendar, then deletes - it. + .. raw:: html + +

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

+ ``_ @@ -203,7 +204,10 @@ async def delete_calendar_event( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete events from a calendar. + .. raw:: html + +

Delete events from a calendar.

+ ``_ @@ -251,7 +255,10 @@ async def delete_calendar_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete anomaly jobs from a calendar. + .. raw:: html + +

Delete anomaly jobs from a calendar.

+ ``_ @@ -300,7 +307,10 @@ async def delete_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a data frame analytics job. + .. raw:: html + +

Delete a data frame analytics job.

+ ``_ @@ -348,7 +358,10 @@ async def delete_datafeed( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a datafeed. + .. raw:: html + +

Delete a datafeed.

+ ``_ @@ -400,13 +413,18 @@ async def delete_expired_data( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete expired ML data. Deletes 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 , or by omitting the . + .. raw:: html + +

Delete expired ML data. + Deletes 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>.

+ ``_ @@ -465,9 +483,12 @@ async def delete_filter( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -510,10 +531,14 @@ async def delete_forecast( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -580,12 +605,16 @@ async def delete_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 the - delete datafeed API with the same timeout and force parameters as the delete - job request. + .. raw:: html + +

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 + the delete datafeed API with the same timeout and force parameters as the + delete job request.

+ ``_ @@ -639,9 +668,13 @@ async def delete_model_snapshot( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -688,8 +721,11 @@ async def delete_trained_model( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an unreferenced trained model. The request deletes a trained inference - model that is not referenced by an ingest pipeline. + .. raw:: html + +

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

+ ``_ @@ -734,9 +770,13 @@ async def delete_trained_model_alias( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -791,9 +831,13 @@ async def estimate_model_memory( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 estimates for the fields it references. + .. 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 + estimates for the fields it references.

+ ``_ @@ -858,10 +902,14 @@ async def evaluate_data_frame( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -935,13 +983,18 @@ async def explain_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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: * which fields are included or - not in the analysis and why, * how much memory is estimated to be required. The - estimate can be used when deciding the appropriate value for model_memory_limit - setting later on. If you have object fields or fields that are excluded via source - filtering, they are not included in the explanation. + .. raw:: html + +

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:

+
    +
  • which fields are included or not in the analysis and why,
  • +
  • how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. + If you have object fields or fields that are excluded via source filtering, they are not included in the explanation.
  • +
+ ``_ @@ -1041,14 +1094,18 @@ async def flush_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Force buffered data to be processed. The flush jobs API is only applicable when - sending data for analysis using the post data API. Depending on the content of - the buffer, then it might additionally calculate new results. Both flush and - close operations are similar, however the flush is more efficient if you are - expecting to send more data for analysis. When flushing, the job remains open - and is available to continue analyzing data. A close operation additionally prunes - and persists the model state to disk and the job must be opened again before - analyzing further data. + .. raw:: html + +

Force buffered data to be processed. + The flush jobs API is only applicable when sending data for analysis using + the post data API. Depending on the content of the buffer, then it might + additionally calculate new results. Both flush and close operations are + similar, however the flush is more efficient if you are expecting to send + more data for analysis. When flushing, the job remains open and is available + to continue analyzing data. A close operation additionally prunes and + persists the model state to disk and the job must be opened again before + analyzing further data.

+ ``_ @@ -1116,10 +1173,14 @@ async def forecast( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Predict future behavior of a time series. Forecasts are not supported for jobs - that perform population analysis; an error occurs if you try to create a forecast - for a job that has an `over_field_name` in its configuration. Forcasts predict - future behavior based on historical data. + .. raw:: html + +

Predict future behavior of a time series.

+

Forecasts are not supported for jobs that perform population analysis; an + error occurs if you try to create a forecast for a job that has an + over_field_name in its configuration. Forcasts predict future behavior + based on historical data.

+ ``_ @@ -1201,8 +1262,11 @@ async def get_buckets( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for buckets. The API presents a chronological - view of the records, grouped by bucket. + .. raw:: html + +

Get anomaly detection job results for buckets. + The API presents a chronological view of the records, grouped by bucket.

+ ``_ @@ -1297,7 +1361,10 @@ async def get_calendar_events( start: t.Optional[t.Union[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get info about events in calendars. + .. raw:: html + +

Get info about events in calendars.

+ ``_ @@ -1363,7 +1430,10 @@ async def get_calendars( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get calendar configuration info. + .. raw:: html + +

Get calendar configuration info.

+ ``_ @@ -1436,7 +1506,10 @@ async def get_categories( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for categories. + .. raw:: html + +

Get anomaly detection job results for categories.

+ ``_ @@ -1518,9 +1591,13 @@ async def get_data_frame_analytics( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data frame analytics job configuration info. You can get information for - multiple data frame analytics jobs in a single API request by using a comma-separated - list of data frame analytics jobs or a wildcard expression. + .. raw:: html + +

Get data frame analytics job configuration info. + You can get information for multiple data frame analytics jobs in a single + API request by using a comma-separated list of data frame analytics jobs or a + wildcard expression.

+ ``_ @@ -1592,7 +1669,10 @@ async def get_data_frame_analytics_stats( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data frame analytics jobs usage info. + .. raw:: html + +

Get data frame analytics jobs usage info.

+ ``_ @@ -1657,12 +1737,16 @@ async def get_datafeed_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get datafeeds usage info. You can get statistics for multiple datafeeds in a - single API request by using a comma-separated list of datafeeds or a wildcard - expression. You can get statistics for all datafeeds by using `_all`, by specifying - `*` as the ``, or by omitting the ``. If the datafeed is stopped, - the only information you receive is the `datafeed_id` and the `state`. This API - returns a maximum of 10,000 datafeeds. + .. raw:: html + +

Get datafeeds usage info. + You can get statistics for multiple datafeeds in a single API request by + using a comma-separated list of datafeeds or a wildcard expression. You can + get statistics for all datafeeds by using _all, by specifying * as the + <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the + only information you receive is the datafeed_id and the state. + This API returns a maximum of 10,000 datafeeds.

+ ``_ @@ -1718,11 +1802,15 @@ async def get_datafeeds( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get datafeeds configuration info. You can get information for multiple datafeeds - in a single API request by using a comma-separated list of datafeeds or a wildcard - expression. You can get information for all datafeeds by using `_all`, by specifying - `*` as the ``, or by omitting the ``. This API returns a maximum - of 10,000 datafeeds. + .. raw:: html + +

Get datafeeds configuration info. + You can get information for multiple datafeeds in a single API request by + using a comma-separated list of datafeeds or a wildcard expression. You can + get information for all datafeeds by using _all, by specifying * as the + <feed_id>, or by omitting the <feed_id>. + This API returns a maximum of 10,000 datafeeds.

+ ``_ @@ -1785,7 +1873,11 @@ async def get_filters( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get filters. You can get a single filter or all filters. + .. raw:: html + +

Get filters. + You can get a single filter or all filters.

+ ``_ @@ -1847,9 +1939,13 @@ async def get_influencers( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for influencers. Influencers are the entities - that have contributed to, or are to blame for, the anomalies. Influencer results - are available only if an `influencer_field_name` is specified in the job configuration. + .. raw:: html + +

Get anomaly detection job results for influencers. + Influencers are the entities that have contributed to, or are to blame for, + the anomalies. Influencer results are available only if an + influencer_field_name is specified in the job configuration.

+ ``_ @@ -1930,7 +2026,10 @@ async def get_job_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection jobs usage info. + .. raw:: html + +

Get anomaly detection jobs usage info.

+ ``_ @@ -1987,11 +2086,14 @@ async def get_jobs( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection jobs configuration info. You can get information for multiple - anomaly detection jobs in a single API request by using a group name, a comma-separated - list of jobs, or a wildcard expression. You can get information for all anomaly - detection jobs by using `_all`, by specifying `*` as the ``, or by omitting - the ``. + .. raw:: html + +

Get anomaly detection jobs configuration info. + You can get information for multiple anomaly detection jobs in a single API + request by using a group name, a comma-separated list of jobs, or a wildcard + expression. You can get information for all anomaly detection jobs by using + _all, by specifying * as the <job_id>, or by omitting the <job_id>.

+ ``_ @@ -2052,9 +2154,12 @@ async def get_memory_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get machine learning memory usage info. Get information about how machine learning - jobs and trained models are using memory, on each node, both within the JVM heap, - and natively, outside of the JVM. + .. raw:: html + +

Get machine learning memory usage info. + Get information about how machine learning jobs and trained models are using memory, + on each node, both within the JVM heap, and natively, outside of the JVM.

+ ``_ @@ -2109,7 +2214,10 @@ async def get_model_snapshot_upgrade_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job model snapshot upgrade usage info. + .. raw:: html + +

Get anomaly detection job model snapshot upgrade usage info.

+ ``_ @@ -2180,7 +2288,10 @@ async def get_model_snapshots( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get model snapshots info. + .. raw:: html + +

Get model snapshots info.

+ ``_ @@ -2281,19 +2392,26 @@ async def get_overall_buckets( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get overall bucket results. Retrievs overall bucket results that summarize the - bucket results of multiple anomaly detection jobs. The `overall_score` is calculated - by combining the scores of all the buckets within the overall bucket span. First, - the maximum `anomaly_score` per anomaly detection job in the overall bucket is - calculated. Then the `top_n` of those scores are averaged to result in the `overall_score`. - This means that you can fine-tune the `overall_score` so that it is more or less - sensitive to the number of jobs that detect an anomaly at the same time. For - example, if you set `top_n` to `1`, the `overall_score` is the maximum bucket - score in the overall bucket. Alternatively, if you set `top_n` to the number - of jobs, the `overall_score` is high only when all jobs detect anomalies in that - overall bucket. If you set the `bucket_span` parameter (to a value greater than - its default), the `overall_score` is the maximum `overall_score` of the overall - buckets that have a span equal to the jobs' largest bucket span. + .. raw:: html + +

Get overall bucket results.

+

Retrievs overall bucket results that summarize the bucket results of + multiple anomaly detection jobs.

+

The overall_score is calculated by combining the scores of all the + buckets within the overall bucket span. First, the maximum + anomaly_score per anomaly detection job in the overall bucket is + calculated. Then the top_n of those scores are averaged to result in + the overall_score. This means that you can fine-tune the + overall_score so that it is more or less sensitive to the number of + jobs that detect an anomaly at the same time. For example, if you set + top_n to 1, the overall_score is the maximum bucket score in the + overall bucket. Alternatively, if you set top_n to the number of jobs, + the overall_score is high only when all jobs detect anomalies in that + overall bucket. If you set the bucket_span parameter (to a value + greater than its default), the overall_score is the maximum + overall_score of the overall buckets that have a span equal to the + jobs' largest bucket span.

+ ``_ @@ -2390,15 +2508,20 @@ async def get_records( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly records for an anomaly detection job. Records contain the detailed - analytical results. They describe the anomalous activity that has been identified - in the input data based on the detector configuration. There can be many anomaly - records depending on the characteristics and size of the input data. In practice, - there are often too many to be able to manually process them. The machine learning - features therefore perform a sophisticated aggregation of the anomaly records - into buckets. The number of record results depends on the number of anomalies - found in each bucket, which relates to the number of time series being modeled - and the number of detectors. + .. raw:: html + +

Get anomaly records for an anomaly detection job. + Records contain the detailed analytical results. They describe the anomalous + activity that has been identified in the input data based on the detector + configuration. + There can be many anomaly records depending on the characteristics and size + of the input data. In practice, there are often too many to be able to + manually process them. The machine learning features therefore perform a + sophisticated aggregation of the anomaly records into buckets. + The number of record results depends on the number of anomalies found in each + bucket, which relates to the number of time series being modeled and the + number of detectors.

+ ``_ @@ -2494,7 +2617,10 @@ async def get_trained_models( tags: t.Optional[t.Union[str, t.Sequence[str]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get trained model configuration info. + .. raw:: html + +

Get trained model configuration info.

+ ``_ @@ -2580,9 +2706,12 @@ async def get_trained_models_stats( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get trained models usage info. You can get usage information for multiple trained - models in a single API request by using a comma-separated list of model IDs or - a wildcard expression. + .. raw:: html + +

Get trained models usage info. + You can get usage information for multiple trained + models in a single API request by using a comma-separated list of model IDs or a wildcard expression.

+ ``_ @@ -2645,7 +2774,10 @@ async def infer_trained_model( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evaluate a trained model. + .. raw:: html + +

Evaluate a trained model.

+ ``_ @@ -2702,12 +2834,17 @@ async def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get machine learning information. Get defaults and limits used by machine learning. - This endpoint is designed to be used by a user interface that needs to fully - understand machine learning configurations where some options are not specified, - meaning that the defaults should be used. This endpoint may be used to find out - what those defaults are. It also provides information about the maximum size - of machine learning jobs that could run in the current cluster configuration. + .. raw:: html + +

Get machine learning information. + Get defaults and limits used by machine learning. + This endpoint is designed to be used by a user interface that needs to fully + understand machine learning configurations where some options are not + specified, meaning that the defaults should be used. This endpoint may be + used to find out what those defaults are. It also provides information about + the maximum size of machine learning jobs that could run in the current + cluster configuration.

+ ``_ """ @@ -2747,12 +2884,16 @@ async def open_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 loaded. The - job is ready to resume its analysis from where it left off, once new data is - received. + .. raw:: html + +

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 + loaded. The job is ready to resume its analysis from where it left off, once + new data is received.

+ ``_ @@ -2806,7 +2947,10 @@ async def post_calendar_events( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Add scheduled events to the calendar. + .. raw:: html + +

Add scheduled events to the calendar.

+ ``_ @@ -2862,9 +3006,12 @@ async def post_data( reset_start: t.Optional[t.Union[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Send data to an anomaly detection job for analysis. IMPORTANT: For each job, - data can be accepted from only a single connection at a time. It is not currently - possible to post data to multiple jobs using wildcards or a comma-separated list. + .. raw:: html + +

Send data to an anomaly detection job for analysis.

+

IMPORTANT: For each job, data can be accepted from only a single connection at a time. + It is not currently possible to post data to multiple jobs using wildcards or a comma-separated list.

+ ``_ @@ -2927,8 +3074,11 @@ async def preview_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview features used by data frame analytics. Previews the extracted features - used by a data frame analytics config. + .. raw:: html + +

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

+ ``_ @@ -2990,15 +3140,18 @@ async def preview_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview a datafeed. This API returns the first "page" of search results from - a datafeed. You can preview an existing datafeed or provide configuration details - for a datafeed and anomaly detection job in the API. The preview shows the structure - of the data that will be passed to the anomaly detection engine. IMPORTANT: When - Elasticsearch security features are enabled, the preview uses the credentials - of the user that called the API. However, when the datafeed starts it uses the - roles of the last user that created or updated the datafeed. To get a preview - that accurately reflects the behavior of the datafeed, use the appropriate credentials. - You can also use secondary authorization headers to supply the credentials. + .. raw:: html + +

Preview a datafeed. + This API returns the first "page" of search results from a datafeed. + You can preview an existing datafeed or provide configuration details for a datafeed + and anomaly detection job in the API. The preview shows the structure of the data + that will be passed to the anomaly detection engine. + IMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that + called the API. However, when the datafeed starts it uses the roles of the last user that created or updated the + datafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials. + You can also use secondary authorization headers to supply the credentials.

+ ``_ @@ -3074,7 +3227,10 @@ async def put_calendar( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a calendar. + .. raw:: html + +

Create a calendar.

+ ``_ @@ -3128,7 +3284,10 @@ async def put_calendar_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Add anomaly detection job to calendar. + .. raw:: html + +

Add anomaly detection job to calendar.

+ ``_ @@ -3203,13 +3362,15 @@ async def put_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a data frame analytics job. This API creates a data frame analytics job - that performs an analysis on the source indices and stores the outcome in a destination - index. By default, the query used in the source configuration is `{"match_all": - {}}`. If the destination index does not exist, it is created automatically when - you start the job. If you supply only a subset of the regression or classification - parameters, hyperparameter optimization occurs. It determines a value for each - of the undefined parameters. + .. raw:: html + +

Create a data frame analytics job. + This API creates a data frame analytics job that performs an analysis on the + source indices and stores the outcome in a destination index. + By default, the query used in the source configuration is {"match_all": {}}.

+

If the destination index does not exist, it is created automatically when you start the job.

+

If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters.

+ ``_ @@ -3382,18 +3543,19 @@ async def put_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a datafeed. Datafeeds retrieve data from Elasticsearch for analysis by - an anomaly detection job. You can associate only one datafeed with each anomaly - detection job. The datafeed contains a query that runs at a defined interval - (`frequency`). If you are concerned about delayed data, you can add a delay (`query_delay') - at each interval. By default, the datafeed uses the following query: `{"match_all": - {"boost": 1}}`. When Elasticsearch security features are enabled, your datafeed - remembers which roles the user who created it had at the time of creation and - runs the query using those same roles. If you provide secondary authorization - headers, those credentials are used instead. You must use Kibana, this API, or - the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - directly to the `.ml-config` index. Do not give users `write` privileges on the - `.ml-config` index. + .. raw:: html + +

Create a datafeed. + Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. + You can associate only one datafeed with each anomaly detection job. + The datafeed contains a query that runs at a defined interval (frequency). + If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`.

+

When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had + at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, + those credentials are used instead. + You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed + directly to the .ml-config index. Do not give users write privileges on the .ml-config index.

+ ``_ @@ -3550,9 +3712,12 @@ async def put_filter( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a filter. A filter contains a list of strings. It can be used by one or - more anomaly detection jobs. Specifically, filters are referenced in the `custom_rules` - property of detector configuration objects. + .. raw:: html + +

Create a filter. + A filter contains a list of strings. It can be used by one or more anomaly detection jobs. + Specifically, filters are referenced in the custom_rules property of detector configuration objects.

+ ``_ @@ -3649,9 +3814,12 @@ async def put_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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}}`. + .. raw:: html + +

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}}.

+ ``_ @@ -3855,8 +4023,11 @@ async def put_trained_model( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a trained model. Enable you to supply a trained model that is not created - by data frame analytics. + .. raw:: html + +

Create a trained model. + Enable you to supply a trained model that is not created by data frame analytics.

+ ``_ @@ -3958,19 +4129,26 @@ async def put_trained_model_alias( reassign: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a trained model alias. A trained model alias is a logical name - used to reference a single trained model. You can use aliases instead of trained - model identifiers to make it easier to reference your models. For example, you - can use aliases in inference aggregations and processors. An alias must be unique - and refer to only a single trained model. However, you can have multiple aliases - for each trained model. If you use this API to update an alias such that it references - a different trained model ID and the model uses a different type of data frame - analytics, an error occurs. For example, this situation occurs if you have a - trained model for regression analysis and a trained model for classification - analysis; you cannot reassign an alias from one type of trained model to another. - If you use this API to update an alias and there are very few input fields in - common between the old and new trained models for the model alias, the API returns - a warning. + .. raw:: html + +

Create or update a trained model alias. + A trained model alias is a logical name used to reference a single trained + model. + You can use aliases instead of trained model identifiers to make it easier to + reference your models. For example, you can use aliases in inference + aggregations and processors. + An alias must be unique and refer to only a single trained model. However, + you can have multiple aliases for each trained model. + If you use this API to update an alias such that it references a different + trained model ID and the model uses a different type of data frame analytics, + an error occurs. For example, this situation occurs if you have a trained + model for regression analysis and a trained model for classification + analysis; you cannot reassign an alias from one type of trained model to + another. + If you use this API to update an alias and there are very few input fields in + common between the old and new trained models for the model alias, the API + returns a warning.

+ ``_ @@ -4028,7 +4206,10 @@ async def put_trained_model_definition_part( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create part of a trained model definition. + .. raw:: html + +

Create part of a trained model definition.

+ ``_ @@ -4105,9 +4286,12 @@ async def put_trained_model_vocabulary( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a trained model vocabulary. This API is supported only for natural language - processing (NLP) models. The vocabulary is stored in the index as described in - `inference_config.*.vocabulary` of the trained model definition. + .. raw:: html + +

Create a trained model vocabulary. + This API is supported only for natural language processing (NLP) models. + The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition.

+ ``_ @@ -4163,9 +4347,14 @@ async def reset_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset an anomaly detection job. All model state and results are deleted. The - job is ready to start over as if it had just been created. It is not currently - possible to reset multiple jobs using wildcards or a comma separated list. + .. raw:: html + +

Reset an anomaly detection job. + All model state and results are deleted. The job is ready to start over as if + it had just been created. + It is not currently possible to reset multiple jobs using wildcards or a + comma separated list.

+ ``_ @@ -4219,13 +4408,17 @@ async def revert_model_snapshot( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Revert to a snapshot. The machine learning features react quickly to anomalous - input, learning new behaviors in data. Highly anomalous input increases the variance - in the models whilst the system learns whether this is a new step-change in behavior - or a one-off event. In the case where this anomalous input is known to be a one-off, - then it might be appropriate to reset the model state to a time before this event. - For example, you might consider reverting to a saved snapshot after Black Friday - or a critical system failure. + .. raw:: html + +

Revert to a snapshot. + The machine learning features react quickly to anomalous input, learning new + behaviors in data. Highly anomalous input increases the variance in the + models whilst the system learns whether this is a new step-change in behavior + or a one-off event. In the case where this anomalous input is known to be a + one-off, then it might be appropriate to reset the model state to a time + before this event. For example, you might consider reverting to a saved + snapshot after Black Friday or a critical system failure.

+ ``_ @@ -4285,17 +4478,22 @@ async def set_upgrade_mode( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Set upgrade_mode for ML indices. Sets a cluster wide upgrade_mode setting that - prepares machine learning indices for an upgrade. When upgrading your cluster, - in some circumstances you must restart your nodes and reindex your machine learning - indices. In those circumstances, there must be no machine learning jobs running. - You can close the machine learning jobs, do the upgrade, then open all the jobs - again. Alternatively, you can use this API to temporarily halt tasks associated - with the jobs and datafeeds and prevent new jobs from opening. You can also use - this API during upgrades that do not require you to reindex your machine learning - indices, though stopping jobs is not a requirement in that case. You can see - the current value for the upgrade_mode setting by using the get machine learning - info API. + .. raw:: html + +

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

+ ``_ @@ -4341,16 +4539,21 @@ async def start_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a data frame analytics job. A data frame analytics job can be started and - stopped multiple times throughout its lifecycle. If the destination index does - not exist, it is created automatically the first time you start the data frame - analytics job. The `index.number_of_shards` and `index.number_of_replicas` settings - for the destination index are copied from the source index. If there are multiple - source indices, the destination index copies the highest setting values. The - mappings for the destination index are also copied from the source indices. If - there are any mapping conflicts, the job fails to start. If the destination index - exists, it is used as is. You can therefore set up the destination index in advance - with custom settings and mappings. + .. raw:: html + +

Start a data frame analytics job. + A data frame analytics job can be started and stopped multiple times + throughout its lifecycle. + If the destination index does not exist, it is created automatically the + first time you start the data frame analytics job. The + index.number_of_shards and index.number_of_replicas settings for the + destination index are copied from the source index. If there are multiple + source indices, the destination index copies the highest setting values. The + mappings for the destination index are also copied from the source indices. + If there are any mapping conflicts, the job fails to start. + If the destination index exists, it is used as is. You can therefore set up + the destination index in advance with custom settings and mappings.

+ ``_ @@ -4402,17 +4605,18 @@ async def start_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start datafeeds. A datafeed must be started in order to retrieve data from Elasticsearch. - A datafeed can be started and stopped multiple times throughout its lifecycle. - Before you can start a datafeed, the anomaly detection job must be open. Otherwise, - an error occurs. If you restart a stopped datafeed, it continues processing input - data from the next millisecond after it was stopped. If new data was indexed - for that exact millisecond between stopping and starting, it will be ignored. - When Elasticsearch security features are enabled, your datafeed remembers which - roles the last user to create or update it had at the time of creation or update - and runs the query using those same roles. If you provided secondary authorization - headers when you created or updated the datafeed, those credentials are used - instead. + .. raw:: html + +

Start datafeeds.

+

A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped + multiple times throughout its lifecycle.

+

Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs.

+

If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. + If new data was indexed for that exact millisecond between stopping and starting, it will be ignored.

+

When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or + update it had at the time of creation or update and runs the query using those same roles. If you provided secondary + authorization headers when you created or updated the datafeed, those credentials are used instead.

+ ``_ @@ -4481,8 +4685,11 @@ async def start_trained_model_deployment( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a trained model deployment. It allocates the model to every machine learning - node. + .. raw:: html + +

Start a trained model deployment. + It allocates the model to every machine learning node.

+ ``_ @@ -4565,8 +4772,12 @@ async def stop_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop data frame analytics jobs. A data frame analytics job can be started and - stopped multiple times throughout its lifecycle. + .. raw:: html + +

Stop data frame analytics jobs. + A data frame analytics job can be started and stopped multiple times + throughout its lifecycle.

+ ``_ @@ -4631,8 +4842,12 @@ async def stop_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop datafeeds. A datafeed that is stopped ceases to retrieve data from Elasticsearch. - A datafeed can be started and stopped multiple times throughout its lifecycle. + .. raw:: html + +

Stop datafeeds. + A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped + multiple times throughout its lifecycle.

+ ``_ @@ -4694,7 +4909,10 @@ async def stop_trained_model_deployment( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop a trained model deployment. + .. raw:: html + +

Stop a trained model deployment.

+ ``_ @@ -4759,7 +4977,10 @@ async def update_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a data frame analytics job. + .. raw:: html + +

Update a data frame analytics job.

+ ``_ @@ -4867,11 +5088,14 @@ async def update_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a datafeed. You must stop and start the datafeed for the changes to be - applied. When Elasticsearch security features are enabled, your datafeed remembers - which roles the user who updated it had at the time of the update and runs the - query using those same roles. If you provide secondary authorization headers, - those credentials are used instead. + .. raw:: html + +

Update a datafeed. + You must stop and start the datafeed for the changes to be applied. + When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at + the time of the update and runs the query using those same roles. If you provide secondary authorization headers, + those credentials are used instead.

+ ``_ @@ -5034,8 +5258,11 @@ async def update_filter( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a filter. Updates the description of a filter, adds items, or removes - items from the list. + .. raw:: html + +

Update a filter. + Updates the description of a filter, adds items, or removes items from the list.

+ ``_ @@ -5125,8 +5352,11 @@ async def update_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an anomaly detection job. Updates certain properties of an anomaly detection - job. + .. raw:: html + +

Update an anomaly detection job. + Updates certain properties of an anomaly detection job.

+ ``_ @@ -5254,7 +5484,11 @@ async def update_model_snapshot( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a snapshot. Updates certain properties of a snapshot. + .. raw:: html + +

Update a snapshot. + Updates certain properties of a snapshot.

+ ``_ @@ -5315,7 +5549,10 @@ async def update_trained_model_deployment( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a trained model deployment. + .. raw:: html + +

Update a trained model deployment.

+ ``_ @@ -5374,14 +5611,19 @@ async def upgrade_job_snapshot( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Upgrade a snapshot. Upgrades 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. This API provides a means to upgrade a snapshot to the current - major version. This aids in preparing the cluster for an upgrade to the next - major version. Only one snapshot per anomaly detection job can be upgraded at - a time and the upgraded snapshot cannot be the current snapshot of the anomaly - detection job. + .. raw:: html + +

Upgrade a snapshot. + Upgrades 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. + This API provides a means to upgrade a snapshot to the current major version. + This aids in preparing the cluster for an upgrade to the next major version. + Only one snapshot per anomaly detection job can be upgraded at a time and the + upgraded snapshot cannot be the current snapshot of the anomaly detection + job.

+ ``_ @@ -5457,7 +5699,10 @@ async def validate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Validate an anomaly detection job. + .. raw:: html + +

Validate an anomaly detection job.

+ ``_ @@ -5527,7 +5772,10 @@ async def validate_detector( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Validate an anomaly detection job. + .. raw:: html + +

Validate an anomaly detection job.

+ ``_ diff --git a/elasticsearch/_async/client/monitoring.py b/elasticsearch/_async/client/monitoring.py index 2439d73d7..d5e5b5252 100644 --- a/elasticsearch/_async/client/monitoring.py +++ b/elasticsearch/_async/client/monitoring.py @@ -42,8 +42,11 @@ async def bulk( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Send monitoring data. This API is used by the monitoring features to send monitoring - data. + .. raw:: html + +

Send monitoring data. + This API is used by the monitoring features to send monitoring data.

+ ``_ diff --git a/elasticsearch/_async/client/nodes.py b/elasticsearch/_async/client/nodes.py index 99c0d62f7..49a3086c7 100644 --- a/elasticsearch/_async/client/nodes.py +++ b/elasticsearch/_async/client/nodes.py @@ -44,8 +44,11 @@ async def clear_repositories_metering_archive( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the archived repositories metering. Clear the archived repositories metering - information in the cluster. + .. raw:: html + +

Clear the archived repositories metering. + Clear the archived repositories metering information in the cluster.

+ ``_ @@ -94,11 +97,13 @@ async def get_repositories_metering_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster repositories metering. Get repositories metering information for - a cluster. This API exposes monotonically non-decreasing counters and it is expected - that clients would durably store the information needed to compute aggregations - over a period of time. Additionally, the information exposed by this API is volatile, - meaning that it will not be present after node restarts. + .. raw:: html + +

Get cluster repositories metering. + Get repositories metering information for a cluster. + This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. + Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts.

+ ``_ @@ -151,9 +156,12 @@ async def hot_threads( ] = None, ) -> TextApiResponse: """ - Get the hot threads for nodes. Get a breakdown of the hot threads on each selected - node in the cluster. The output is plain text with a breakdown of the top hot - threads for each node. + .. raw:: html + +

Get the hot threads for nodes. + Get a breakdown of the hot threads on each selected node in the cluster. + The output is plain text with a breakdown of the top hot threads for each node.

+ ``_ @@ -228,8 +236,11 @@ async def info( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get node information. By default, the API returns all attributes and core settings - for cluster nodes. + .. raw:: html + +

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

+ ``_ @@ -298,18 +309,16 @@ async def reload_secure_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reload the keystore on nodes in the cluster. Secure settings are stored in an - on-disk keystore. Certain of these settings are reloadable. That is, you can - change them on disk and reload them without restarting any nodes in the cluster. - When you have updated reloadable secure settings in your keystore, you can use - this API to reload those settings on each node. When the Elasticsearch keystore - is password protected and not simply obfuscated, you must provide the password - for the keystore when you reload the secure settings. Reloading the settings - for the whole cluster assumes that the keystores for all nodes are protected - with the same password; this method is allowed only when inter-node communications - are encrypted. Alternatively, you can reload the secure settings on each node - by locally accessing the API and passing the node-specific Elasticsearch keystore - password. + .. raw:: html + +

Reload the keystore on nodes in the cluster.

+

Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. + That is, you can change them on disk and reload them without restarting any nodes in the cluster. + When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node.

+

When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. + Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. + Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.

+ ``_ @@ -380,8 +389,12 @@ async def stats( types: t.Optional[t.Sequence[str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get node statistics. Get statistics for nodes in a cluster. By default, all stats - are returned. You can limit the returned information by using metrics. + .. raw:: html + +

Get node statistics. + Get statistics for nodes in a cluster. + By default, all stats are returned. You can limit the returned information by using metrics.

+ ``_ @@ -498,7 +511,10 @@ async def usage( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get feature usage information. + .. raw:: html + +

Get feature usage information.

+ ``_ diff --git a/elasticsearch/_async/client/query_rules.py b/elasticsearch/_async/client/query_rules.py index 3380840c5..9e7f38b4b 100644 --- a/elasticsearch/_async/client/query_rules.py +++ b/elasticsearch/_async/client/query_rules.py @@ -37,9 +37,12 @@ async def delete_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a query rule. Delete a query rule within a query ruleset. This is a destructive - action that is only recoverable by re-adding the same rule with the create or - update query rule API. + .. raw:: html + +

Delete a query rule. + Delete a query rule within a query ruleset. + This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API.

+ ``_ @@ -87,8 +90,12 @@ async def delete_ruleset( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a query ruleset. Remove a query ruleset and its associated data. This - is a destructive action that is not recoverable. + .. raw:: html + +

Delete a query ruleset. + Remove a query ruleset and its associated data. + This is a destructive action that is not recoverable.

+ ``_ @@ -129,7 +136,11 @@ async def get_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a query rule. Get details about a query rule within a query ruleset. + .. raw:: html + +

Get a query rule. + Get details about a query rule within a query ruleset.

+ ``_ @@ -177,7 +188,11 @@ async def get_ruleset( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a query ruleset. Get details about a query ruleset. + .. raw:: html + +

Get a query ruleset. + Get details about a query ruleset.

+ ``_ @@ -220,7 +235,11 @@ async def list_rulesets( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all query rulesets. Get summarized information about the query rulesets. + .. raw:: html + +

Get all query rulesets. + Get summarized information about the query rulesets.

+ ``_ @@ -273,13 +292,15 @@ async def put_rule( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a query rule. Create or update a query rule within a query ruleset. - IMPORTANT: Due to limitations within pinned queries, you can only pin documents - using ids or docs, but cannot use both in single rule. It is advised to use one - or the other in query rulesets, to avoid errors. Additionally, pinned queries - have a maximum limit of 100 pinned hits. If multiple matching rules pin more - than 100 documents, only the first 100 documents are pinned in the order they - are specified in the ruleset. + .. raw:: html + +

Create or update a query rule. + Create or update a query rule within a query ruleset.

+

IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. + It is advised to use one or the other in query rulesets, to avoid errors. + Additionally, pinned queries have a maximum limit of 100 pinned hits. + If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.

+ ``_ @@ -357,14 +378,16 @@ async def put_ruleset( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a query ruleset. There is a limit of 100 rules per ruleset. - This limit can be increased by using the `xpack.applications.rules.max_rules_per_ruleset` - cluster setting. IMPORTANT: Due to limitations within pinned queries, you can - only select documents using `ids` or `docs`, but cannot use both in single rule. - It is advised to use one or the other in query rulesets, to avoid errors. Additionally, - pinned queries have a maximum limit of 100 pinned hits. If multiple matching - rules pin more than 100 documents, only the first 100 documents are pinned in - the order they are specified in the ruleset. + .. raw:: html + +

Create or update a query ruleset. + There is a limit of 100 rules per ruleset. + This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting.

+

IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. + It is advised to use one or the other in query rulesets, to avoid errors. + Additionally, pinned queries have a maximum limit of 100 pinned hits. + If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.

+ ``_ @@ -417,8 +440,11 @@ async def test( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Test a query ruleset. Evaluate match criteria against a query ruleset to identify - the rules that would match that criteria. + .. raw:: html + +

Test a query ruleset. + Evaluate match criteria against a query ruleset to identify the rules that would match that criteria.

+ ``_ diff --git a/elasticsearch/_async/client/rollup.py b/elasticsearch/_async/client/rollup.py index fcf4dda78..94dc52ae3 100644 --- a/elasticsearch/_async/client/rollup.py +++ b/elasticsearch/_async/client/rollup.py @@ -43,20 +43,29 @@ async def delete_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a rollup job. A job must be stopped before it can be deleted. If you attempt - to delete a started job, an error occurs. Similarly, if you attempt to delete - a nonexistent job, an exception occurs. IMPORTANT: When you delete a job, you - remove only the process that is actively monitoring and rolling up data. The - API does not delete any previously rolled up data. This is by design; a user - may wish to roll up a static data set. Because the data set is static, after - it has been fully rolled up there is no need to keep the indexing rollup job - around (as there will be no new data). Thus the job can be deleted, leaving behind - the rolled up data for analysis. If you wish to also remove the rollup data and - the rollup index contains the data for only a single job, you can delete the - whole rollup index. If the rollup index stores data from several jobs, you must - issue a delete-by-query that targets the rollup job's identifier in the rollup - index. For example: ``` POST my_rollup_index/_delete_by_query { "query": { "term": - { "_rollup.id": "the_rollup_job_id" } } } ``` + .. raw:: html + +

Delete a rollup job.

+

A job must be stopped before it can be deleted. + If you attempt to delete a started job, an error occurs. + Similarly, if you attempt to delete a nonexistent job, an exception occurs.

+

IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. + The API does not delete any previously rolled up data. + This is by design; a user may wish to roll up a static data set. + Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). + Thus the job can be deleted, leaving behind the rolled up data for analysis. + If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. + If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example:

+
POST my_rollup_index/_delete_by_query
+          {
+            "query": {
+              "term": {
+                "_rollup.id": "the_rollup_job_id"
+              }
+            }
+          }
+          
+ ``_ @@ -97,11 +106,14 @@ async def get_jobs( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get rollup job information. Get the configuration, stats, and status of rollup - jobs. NOTE: This API returns only active (both `STARTED` and `STOPPED`) jobs. - If a job was created, ran for a while, then was deleted, the API does not return - any details about it. For details about a historical rollup job, the rollup capabilities - API may be more useful. + .. raw:: html + +

Get rollup job information. + Get the configuration, stats, and status of rollup jobs.

+

NOTE: This API returns only active (both STARTED and STOPPED) jobs. + If a job was created, ran for a while, then was deleted, the API does not return any details about it. + For details about a historical rollup job, the rollup capabilities API may be more useful.

+ ``_ @@ -146,15 +158,18 @@ async def get_rollup_caps( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the rollup job capabilities. Get the capabilities of any rollup jobs that - have been configured for a specific index or index pattern. This API is useful - because a rollup job is often configured to rollup only a subset of fields from - the source index. Furthermore, only certain aggregations can be configured for - various fields, leading to a limited subset of functionality depending on that - configuration. This API enables you to inspect an index and determine: 1. Does - this index have associated rollup data somewhere in the cluster? 2. If yes to - the first question, what fields were rolled up, what aggregations can be performed, - and where does the data live? + .. raw:: html + +

Get the rollup job capabilities. + Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern.

+

This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. + Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. + This API enables you to inspect an index and determine:

+
    +
  1. Does this index have associated rollup data somewhere in the cluster?
  2. +
  3. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live?
  4. +
+ ``_ @@ -199,12 +214,16 @@ async def get_rollup_index_caps( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the rollup index capabilities. Get the rollup capabilities of all jobs inside - of a rollup index. A single rollup index may store the data for multiple rollup - jobs and may have a variety of capabilities depending on those jobs. This API - enables you to determine: * What jobs are stored in an index (or indices specified - via a pattern)? * What target indices were rolled up, what fields were used in - those rollups, and what aggregations can be performed on each job? + .. raw:: html + +

Get the rollup index capabilities. + Get the rollup capabilities of all jobs inside of a rollup index. + A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine:

+
    +
  • What jobs are stored in an index (or indices specified via a pattern)?
  • +
  • What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job?
  • +
+ ``_ @@ -267,16 +286,14 @@ async def put_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a rollup job. WARNING: From 8.15.0, calling this API in a cluster with - no rollup usage will fail with a message about the deprecation and planned removal - of rollup features. A cluster needs to contain either a rollup job or a rollup - index in order for this API to be allowed to run. The rollup job configuration - contains all the details about how the job should run, when it indexes documents, - and what future queries will be able to run against the rollup index. There are - three main sections to the job configuration: the logistical details about the - job (for example, the cron schedule), the fields that are used for grouping, - and what metrics to collect for each group. Jobs are created in a `STOPPED` state. - You can start them with the start rollup jobs API. + .. raw:: html + +

Create a rollup job.

+

WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run.

+

The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index.

+

There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group.

+

Jobs are created in a STOPPED state. You can start them with the start rollup jobs API.

+ ``_ @@ -393,25 +410,38 @@ async def rollup_search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Search rolled-up data. The rollup search endpoint is needed because, internally, - rolled-up documents utilize a different document structure than the original - data. It rewrites standard Query DSL into a format that matches the rollup documents - then takes the response and rewrites it back to what a client would expect given - the original query. The request body supports a subset of features from the regular - search API. The following functionality is not available: `size`: Because rollups - work on pre-aggregated data, no search hits can be returned and so size must - be set to zero or omitted entirely. `highlighter`, `suggestors`, `post_filter`, - `profile`, `explain`: These are similarly disallowed. **Searching both historical - rollup and non-rollup data** The rollup search API has the capability to search - across both "live" non-rollup data and the aggregated rollup data. This is done - by simply adding the live indices to the URI. For example: ``` GET sensor-1,sensor_rollup/_rollup_search - { "size": 0, "aggregations": { "max_temperature": { "max": { "field": "temperature" - } } } } ``` The rollup search endpoint does two things when the search runs: - * The original request is sent to the non-rollup index unaltered. * A rewritten - version of the original request is sent to the rollup index. When the two responses - are received, the endpoint rewrites the rollup response and merges the two together. - During the merging process, if there is any overlap in buckets between the two - responses, the buckets from the non-rollup index are used. + .. raw:: html + +

Search rolled-up data. + The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. + It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query.

+

The request body supports a subset of features from the regular search API. + The following functionality is not available:

+

size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. + highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed.

+

Searching both historical rollup and non-rollup data

+

The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. + This is done by simply adding the live indices to the URI. For example:

+
GET sensor-1,sensor_rollup/_rollup_search
+          {
+            "size": 0,
+            "aggregations": {
+               "max_temperature": {
+                "max": {
+                  "field": "temperature"
+                }
+              }
+            }
+          }
+          
+

The rollup search endpoint does two things when the search runs:

+
    +
  • The original request is sent to the non-rollup index unaltered.
  • +
  • A rewritten version of the original request is sent to the rollup index.
  • +
+

When the two responses are received, the endpoint rewrites the rollup response and merges the two together. + During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used.

+ ``_ @@ -484,8 +514,12 @@ async def start_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Start rollup jobs. If you try to start a job that does not exist, an exception - occurs. If you try to start a job that is already started, nothing happens. + .. raw:: html + +

Start rollup jobs. + If you try to start a job that does not exist, an exception occurs. + If you try to start a job that is already started, nothing happens.

+ ``_ @@ -528,14 +562,18 @@ async def stop_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop rollup jobs. If you try to stop a job that does not exist, an exception - occurs. If you try to stop a job that is already stopped, nothing happens. Since - only a stopped job can be deleted, it can be useful to block the API until the - indexer has fully stopped. This is accomplished with the `wait_for_completion` - query parameter, and optionally a timeout. For example: ``` POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - ``` The parameter blocks the API call from returning until either the job has - moved to STOPPED or the specified time has elapsed. If the specified time elapses - without the job moving to STOPPED, a timeout exception occurs. + .. raw:: html + +

Stop rollup jobs. + If you try to stop a job that does not exist, an exception occurs. + If you try to stop a job that is already stopped, nothing happens.

+

Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. + This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example:

+
POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s
+          
+

The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. + If the specified time elapses without the job moving to STOPPED, a timeout exception occurs.

+ ``_ diff --git a/elasticsearch/_async/client/search_application.py b/elasticsearch/_async/client/search_application.py index 72e1ca23e..724ccdcff 100644 --- a/elasticsearch/_async/client/search_application.py +++ b/elasticsearch/_async/client/search_application.py @@ -43,8 +43,11 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a search application. Remove a search application and its associated alias. - Indices attached to the search application are not removed. + .. raw:: html + +

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

+ ``_ @@ -85,8 +88,11 @@ async def delete_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a behavioral analytics collection. The associated data stream is also - deleted. + .. raw:: html + +

Delete a behavioral analytics collection. + The associated data stream is also deleted.

+ ``_ @@ -127,7 +133,10 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get search application details. + .. raw:: html + +

Get search application details.

+ ``_ @@ -168,7 +177,10 @@ async def get_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get behavioral analytics collections. + .. raw:: html + +

Get behavioral analytics collections.

+ ``_ @@ -216,7 +228,11 @@ async def list( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get search applications. Get information about search applications. + .. raw:: html + +

Get search applications. + Get information about search applications.

+ ``_ @@ -269,7 +285,10 @@ async def post_behavioral_analytics_event( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a behavioral analytics collection event. + .. raw:: html + +

Create a behavioral analytics collection event.

+ ``_ @@ -333,7 +352,10 @@ async def put( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a search application. + .. raw:: html + +

Create or update a search application.

+ ``_ @@ -387,7 +409,10 @@ async def put_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a behavioral analytics collection. + .. raw:: html + +

Create a behavioral analytics collection.

+ ``_ @@ -433,13 +458,14 @@ async def render_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Render a search application query. Generate an Elasticsearch query using the - specified query parameters and the search template associated with the search - application or a default template if none is specified. If a parameter used in - the search template is not specified in `params`, the parameter's default value - will be used. The API returns the specific Elasticsearch query that would be - generated and run by calling the search application search API. You must have - `read` privileges on the backing alias of the search application. + .. raw:: html + +

Render a search application query. + Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. + If a parameter used in the search template is not specified in params, the parameter's default value will be used. + The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.

+

You must have read privileges on the backing alias of the search application.

+ ``_ @@ -498,10 +524,12 @@ async def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a search application search. Generate and run an Elasticsearch query that - uses the specified query parameteter and the search template associated with - the search application or default template. Unspecified template parameters are - assigned their default values if applicable. + .. raw:: html + +

Run a search application search. + Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. + Unspecified template parameters are assigned their default values if applicable.

+ ``_ diff --git a/elasticsearch/_async/client/searchable_snapshots.py b/elasticsearch/_async/client/searchable_snapshots.py index ac3975751..6d9ef50cc 100644 --- a/elasticsearch/_async/client/searchable_snapshots.py +++ b/elasticsearch/_async/client/searchable_snapshots.py @@ -44,8 +44,11 @@ async def cache_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cache statistics. Get statistics about the shared cache for partially mounted - indices. + .. raw:: html + +

Get cache statistics. + Get statistics about the shared cache for partially mounted indices.

+ ``_ @@ -102,8 +105,11 @@ async def clear_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the cache. Clear indices and data streams from the shared cache for partially - mounted indices. + .. raw:: html + +

Clear the cache. + Clear indices and data streams from the shared cache for partially mounted indices.

+ ``_ @@ -176,9 +182,13 @@ async def mount( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Mount a snapshot. Mount a snapshot as a searchable snapshot index. Do not use - this API for snapshots managed by index lifecycle management (ILM). Manually - mounting ILM-managed snapshots can interfere with ILM processes. + .. raw:: html + +

Mount a snapshot. + Mount a snapshot as a searchable snapshot index. + Do not use this API for snapshots managed by index lifecycle management (ILM). + Manually mounting ILM-managed snapshots can interfere with ILM processes.

+ ``_ @@ -263,7 +273,10 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get searchable snapshot statistics. + .. raw:: html + +

Get searchable snapshot statistics.

+ ``_ diff --git a/elasticsearch/_async/client/security.py b/elasticsearch/_async/client/security.py index 57fafd1b2..2fb66dddb 100644 --- a/elasticsearch/_async/client/security.py +++ b/elasticsearch/_async/client/security.py @@ -44,21 +44,19 @@ async def activate_user_profile( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Activate a user profile. Create or update a user profile on behalf of another - user. NOTE: The user profile feature is designed only for use by Kibana and Elastic's - Observability, Enterprise Search, and Elastic Security solutions. Individual - users and external applications should not call this API directly. The calling - application must have either an `access_token` or a combination of `username` - and `password` for the user that the profile document is intended for. Elastic - reserves the right to change or remove this feature in future releases without - prior notice. This API creates or updates a profile document for end users with - information that is extracted from the user's authentication object including - `username`, `full_name,` `roles`, and the authentication realm. For example, - in the JWT `access_token` case, the profile user's `username` is extracted from - the JWT token claim pointed to by the `claims.principal` setting of the JWT realm - that authenticated the token. When updating a profile document, the API enables - the document if it was disabled. Any updates do not change existing content for - either the `labels` or `data` fields. + .. raw:: html + +

Activate a user profile.

+

Create or update a user profile on behalf of another user.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. + For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token.

+

When updating a profile document, the API enables the document if it was disabled. + Any updates do not change existing content for either the labels or data fields.

+ ``_ @@ -117,12 +115,14 @@ async def authenticate( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Authenticate a user. Authenticates a user and returns information about the authenticated - user. Include the user information in a [basic auth header](https://en.wikipedia.org/wiki/Basic_access_authentication). - A successful call returns a JSON structure that shows user information such as - their username, the roles that are assigned to the user, any assigned metadata, - and information about the realms that authenticated and authorized the user. - If the user cannot be authenticated, this API returns a 401 status code. + .. raw:: html + +

Authenticate a user.

+

Authenticates a user and returns information about the authenticated user. + Include the user information in a basic auth header. + A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + If the user cannot be authenticated, this API returns a 401 status code.

+ ``_ """ @@ -164,9 +164,12 @@ async def bulk_delete_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk delete roles. The role management APIs are generally the preferred way to - manage roles, rather than using file-based role management. The bulk delete roles - API cannot delete roles that are defined in roles files. + .. raw:: html + +

Bulk delete roles.

+

The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The bulk delete roles API cannot delete roles that are defined in roles files.

+ ``_ @@ -222,9 +225,12 @@ async def bulk_put_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk create or update roles. The role management APIs are generally the preferred - way to manage roles, rather than using file-based role management. The bulk create - or update roles API cannot update roles that are defined in roles files. + .. raw:: html + +

Bulk create or update roles.

+

The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The bulk create or update roles API cannot update roles that are defined in roles files.

+ ``_ @@ -280,23 +286,19 @@ async def bulk_update_api_keys( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk update API keys. Update the attributes for multiple API keys. IMPORTANT: - It is not possible to use an API key as the authentication credential for this - API. To update API keys, the owner user's credentials are required. This API - is similar to the update API key API but enables you to apply the same update - to multiple API keys in one API call. This operation can greatly improve performance - over making individual updates. It is not possible to update expired or invalidated - API keys. This API supports updates to API key access scope, metadata and expiration. - The access scope of each API key is derived from the `role_descriptors` you specify - in the request and a snapshot of the owner user's permissions at the time of - the request. The snapshot of the owner's permissions is updated automatically - on every call. IMPORTANT: If you don't specify `role_descriptors` in the request, - a call to this API might still change an API key's access scope. This change - can occur if the owner user's permissions have changed since the API key was - created or last modified. A successful request returns a JSON structure that - contains the IDs of all updated API keys, the IDs of API keys that already had - the requested changes and did not require an update, and error details for any - failed update. + .. raw:: html + +

Bulk update API keys. + Update the attributes for multiple API keys.

+

IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required.

+

This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates.

+

It is not possible to update expired or invalidated API keys.

+

This API supports updates to API key access scope, metadata and expiration. + The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. + The snapshot of the owner's permissions is updated automatically on every call.

+

IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified.

+

A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update.

+ ``_ @@ -370,8 +372,11 @@ async def change_password( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Change passwords. Change the passwords of users in the native realm and built-in - users. + .. raw:: html + +

Change passwords.

+

Change the passwords of users in the native realm and built-in users.

+ ``_ @@ -433,8 +438,12 @@ async def clear_api_key_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the API key cache. Evict a subset of all entries from the API key cache. - The cache is also automatically cleared on state changes of the security index. + .. raw:: html + +

Clear the API key cache.

+

Evict a subset of all entries from the API key cache. + The cache is also automatically cleared on state changes of the security index.

+ ``_ @@ -475,13 +484,17 @@ async def clear_cached_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the privileges cache. Evict privileges from the native application privilege - cache. The cache is also automatically cleared for applications that have their - privileges updated. + .. raw:: html + +

Clear the privileges cache.

+

Evict privileges from the native application privilege cache. + The cache is also automatically cleared for applications that have their privileges updated.

+ ``_ - :param application: A comma-separated list of application names + :param application: A comma-separated list of applications. To clear all applications, + use an asterism (`*`). It does not support other wildcard patterns. """ if application in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'application'") @@ -518,13 +531,23 @@ async def clear_cached_realms( usernames: t.Optional[t.Sequence[str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the user cache. Evict users from the user cache. You can completely clear - the cache or evict specific users. + .. raw:: html + +

Clear the user cache.

+

Evict users from the user cache. + You can completely clear the cache or evict specific users.

+

User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. + There are realm settings that you can use to configure the user cache. + For more information, refer to the documentation about controlling the user cache.

+ ``_ - :param realms: Comma-separated list of realms to clear - :param usernames: Comma-separated list of usernames to clear from the cache + :param realms: A comma-separated list of realms. To clear all realms, use an + asterisk (`*`). It does not support other wildcard patterns. + :param usernames: A comma-separated list of the users to clear from the cache. + If you do not specify this parameter, the API evicts all users from the user + cache. """ if realms in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'realms'") @@ -562,11 +585,17 @@ async def clear_cached_roles( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the roles cache. Evict roles from the native role cache. + .. raw:: html + +

Clear the roles cache.

+

Evict roles from the native role cache.

+ ``_ - :param name: Role name + :param name: A comma-separated list of roles to evict from the role cache. To + evict all roles, use an asterisk (`*`). It does not support other wildcard + patterns. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -604,14 +633,23 @@ async def clear_cached_service_tokens( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear service account token caches. Evict a subset of all entries from the service - account token caches. + .. raw:: html + +

Clear service account token caches.

+

Evict a subset of all entries from the service account token caches. + Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. + This API clears matching entries from both caches.

+

The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. + The cache for tokens backed by the service_tokens file is cleared automatically on file changes.

+ ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: A comma-separated list of service token names + :param namespace: The namespace, which is a top-level grouping of service accounts. + :param service: The name of the service, which must be unique within its namespace. + :param name: A comma-separated list of token names to evict from the service + account token caches. Use a wildcard (`*`) to evict all tokens that belong + to a service account. It does not support other wildcard patterns. """ if namespace in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'namespace'") @@ -664,31 +702,43 @@ async def create_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an API key. Create an API key for access without requiring basic authentication. - A successful request returns a JSON structure that contains the API key, its - unique id, and its name. If applicable, it also returns expiration information - for the API key in milliseconds. NOTE: By default, API keys never expire. You - can specify expiration information when you create the API keys. + .. raw:: html + +

Create an API key.

+

Create an API key for access without requiring basic authentication.

+

IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. + If you specify privileges, the API returns an error.

+

A successful request returns a JSON structure that contains the API key, its unique id, and its name. + If applicable, it also returns expiration information for the API key in milliseconds.

+

NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys.

+

The API keys are created by the Elasticsearch API key service, which is automatically enabled. + To configure or turn off the API key service, refer to API key service setting documentation.

+ ``_ - :param expiration: Expiration time for the API key. By default, API keys never - expire. + :param expiration: The expiration time for the API key. By default, API keys + never expire. :param metadata: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. - :param name: Specifies the name for this API key. + :param name: A name for the API key. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - :param role_descriptors: An array of role descriptors for this API key. This - parameter is optional. When it is not specified or is an empty array, then - the API key will have a point in time snapshot of permissions of the authenticated - user. If you supply role descriptors then the resultant permissions would - be an intersection of API keys permissions and authenticated user’s permissions - thereby limiting the access scope for API keys. The structure of role descriptor - is the same as the request for create role API. For more details, see create - or update roles API. + :param role_descriptors: An array of role descriptors for this API key. When + it is not specified or it is an empty array, the API key will have a point + in time snapshot of permissions of the authenticated user. If you supply + role descriptors, the resultant permissions are an intersection of API keys + permissions and the authenticated user's permissions thereby limiting the + access scope for API keys. The structure of role descriptor is the same as + the request for the create role API. For more details, refer to the create + or update roles API. NOTE: Due to the way in which this permission intersection + is calculated, it is not possible to create an API key that is a child of + another API key, unless the derived key is created without any privileges. + In this case, you must explicitly specify a role descriptor with no privileges. + The derived API key can be used for authentication; it will not have authority + to call Elasticsearch APIs. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" @@ -741,21 +791,19 @@ async def create_cross_cluster_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a cross-cluster API key. Create an API key of the `cross_cluster` type - for the API key based remote cluster access. A `cross_cluster` API key cannot - be used to authenticate through the REST interface. IMPORTANT: To authenticate - this request you must use a credential that is not an API key. Even if you use - an API key that has the required privilege, the API returns an error. Cross-cluster - API keys are created by the Elasticsearch API key service, which is automatically - enabled. NOTE: Unlike REST API keys, a cross-cluster API key does not capture - permissions of the authenticated user. The API key’s effective permission is - exactly as specified with the `access` property. A successful request returns - a JSON structure that contains the API key, its unique ID, and its name. If applicable, - it also returns expiration information for the API key in milliseconds. By default, - API keys never expire. You can specify expiration information when you create - the API keys. Cross-cluster API keys can only be updated with the update cross-cluster - API key API. Attempting to update them with the update REST API key API or the - bulk update REST API keys API will result in an error. + .. raw:: html + +

Create a cross-cluster API key.

+

Create an API key of the cross_cluster type for the API key based remote cluster access. + A cross_cluster API key cannot be used to authenticate through the REST interface.

+

IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error.

+

Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled.

+

NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property.

+

A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds.

+

By default, API keys never expire. You can specify expiration information when you create the API keys.

+

Cross-cluster API keys can only be updated with the update cross-cluster API key API. + Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error.

+ ``_ @@ -824,14 +872,26 @@ async def create_service_token( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a service account token. Create a service accounts token for access without - requiring basic authentication. + .. raw:: html + +

Create a service account token.

+

Create a service accounts token for access without requiring basic authentication.

+

NOTE: Service account tokens never expire. + You must actively delete them if they are no longer needed.

+ ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: An identifier for the token name + :param namespace: The name of the namespace, which is a top-level grouping of + service accounts. + :param service: The name of the service. + :param name: The name for the service account token. If omitted, a random name + will be generated. Token names must be at least one and no more than 256 + characters. They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes + (`-`), and underscores (`_`), but cannot begin with an underscore. NOTE: + Token names must be unique in the context of the associated service account. + They must also be globally unique with their fully qualified names, which + are comprised of the service account principal and token name, such as `//`. :param refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -894,20 +954,17 @@ async def delegate_pki( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delegate PKI authentication. This API implements the exchange of an X509Certificate - chain for an Elasticsearch access token. The certificate chain is validated, - according to RFC 5280, by sequentially considering the trust configuration of - every installed PKI realm that has `delegation.enabled` set to `true`. A successfully - trusted client certificate is also subject to the validation of the subject distinguished - name according to thw `username_pattern` of the respective realm. This API is - called by smart and trusted proxies, such as Kibana, which terminate the user's - TLS session but still want to authenticate the user by using a PKI realm—-​as - if the user connected directly to Elasticsearch. IMPORTANT: The association between - the subject public key in the target certificate and the corresponding private - key is not validated. This is part of the TLS authentication process and it is - delegated to the proxy that calls this API. The proxy is trusted to have performed - the TLS authentication and this API translates that authentication into an Elasticsearch - access token. + .. raw:: html + +

Delegate PKI authentication.

+

This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. + The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. + A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm.

+

This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch.

+

IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. + This is part of the TLS authentication process and it is delegated to the proxy that calls this API. + The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token.

+ ``_ @@ -963,12 +1020,21 @@ async def delete_privileges( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete application privileges. + .. raw:: html + +

Delete application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_security cluster privilege (or a greater privilege such as all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
+ ``_ - :param application: Application name - :param name: Privilege name + :param application: The name of the application. Application privileges are always + associated with exactly one application. + :param name: The name of the privilege. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1019,11 +1085,17 @@ async def delete_role( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete roles. Delete roles in the native realm. + .. raw:: html + +

Delete roles.

+

Delete roles in the native realm. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The delete roles API cannot remove roles that are defined in roles files.

+ ``_ - :param name: Role name + :param name: The name of the role. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1067,11 +1139,19 @@ async def delete_role_mapping( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete role mappings. + .. raw:: html + +

Delete role mappings.

+

Role mappings define which roles are assigned to each user. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. + The delete role mappings API cannot remove role mappings that are defined in role mapping files.

+ ``_ - :param name: Role-mapping name + :param name: The distinct name that identifies the role mapping. The name is + used solely as an identifier to facilitate interaction via the API; it does + not affect the behavior of the mapping in any way. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1117,14 +1197,17 @@ async def delete_service_token( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete service account tokens. Delete service account tokens for a service in - a specified namespace. + .. raw:: html + +

Delete service account tokens.

+

Delete service account tokens for a service in a specified namespace.

+ ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: An identifier for the token name + :param namespace: The namespace, which is a top-level grouping of service accounts. + :param service: The service name. + :param name: The name of the service account token. :param refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1176,11 +1259,15 @@ async def delete_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete users. Delete users from the native realm. + .. raw:: html + +

Delete users.

+

Delete users from the native realm.

+ ``_ - :param username: username + :param username: An identifier for the user. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1224,11 +1311,17 @@ async def disable_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Disable users. Disable users in the native realm. + .. raw:: html + +

Disable users.

+

Disable users in the native realm. + By default, when you create users, they are enabled. + You can use this API to revoke a user's access to Elasticsearch.

+ ``_ - :param username: The username of the user to disable + :param username: An identifier for the user. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1272,15 +1365,16 @@ async def disable_user_profile( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Disable a user profile. Disable user profiles so that they are not visible in - user profile searches. NOTE: The user profile feature is designed only for use - by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security - solutions. Individual users and external applications should not call this API - directly. Elastic reserves the right to change or remove this feature in future - releases without prior notice. When you activate a user profile, its automatically - enabled and visible in user profile searches. You can use the disable user profile - API to disable a user profile so it’s not visible in these searches. To re-enable - a disabled user profile, use the enable user profile API . + .. raw:: html + +

Disable a user profile.

+

Disable user profiles so that they are not visible in user profile searches.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. + To re-enable a disabled user profile, use the enable user profile API .

+ ``_ @@ -1328,11 +1422,16 @@ async def enable_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Enable users. Enable users in the native realm. + .. raw:: html + +

Enable users.

+

Enable users in the native realm. + By default, when you create users, they are enabled.

+ ``_ - :param username: The username of the user to enable + :param username: An identifier for the user. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1376,14 +1475,16 @@ async def enable_user_profile( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Enable a user profile. Enable user profiles to make them visible in user profile - searches. NOTE: The user profile feature is designed only for use by Kibana and - Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual - users and external applications should not call this API directly. Elastic reserves - the right to change or remove this feature in future releases without prior notice. - When you activate a user profile, it's automatically enabled and visible in user - profile searches. If you later disable the user profile, you can use the enable - user profile API to make the profile visible in these searches again. + .. raw:: html + +

Enable a user profile.

+

Enable user profiles to make them visible in user profile searches.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

When you activate a user profile, it's automatically enabled and visible in user profile searches. + If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again.

+ ``_ @@ -1427,8 +1528,13 @@ async def enroll_kibana( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Enroll Kibana. Enable a Kibana instance to configure itself for communication - with a secured Elasticsearch cluster. + .. raw:: html + +

Enroll Kibana.

+

Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster.

+

NOTE: This API is currently intended for internal use only by Kibana. + Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled.

+ ``_ """ @@ -1463,8 +1569,13 @@ async def enroll_node( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Enroll a node. Enroll a new node to allow it to join an existing cluster with - security features enabled. + .. raw:: html + +

Enroll a node.

+

Enroll a new node to allow it to join an existing cluster with security features enabled.

+

The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. + The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster.

+ ``_ """ @@ -1507,11 +1618,13 @@ async def get_api_key( with_profile_uid: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get API key information. Retrieves information for one or more API keys. NOTE: - If you have only the `manage_own_api_key` privilege, this API returns only the - API keys that you own. If you have `read_security`, `manage_api_key` or greater - privileges (including `manage_security`), this API returns all API keys regardless - of ownership. + .. raw:: html + +

Get API key information.

+

Retrieves information for one or more API keys. + NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership.

+ ``_ @@ -1585,8 +1698,11 @@ async def get_builtin_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get builtin privileges. Get the list of cluster privileges and index privileges - that are available in this version of Elasticsearch. + .. raw:: html + +

Get builtin privileges.

+

Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch.

+ ``_ """ @@ -1623,12 +1739,23 @@ async def get_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get application privileges. + .. raw:: html + +

Get application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The read_security cluster privilege (or a greater privilege such as manage_security or all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
+ ``_ - :param application: Application name - :param name: Privilege name + :param application: The name of the application. Application privileges are always + associated with exactly one application. If you do not specify this parameter, + the API returns information about all privileges for all applications. + :param name: The name of the privilege. If you do not specify this parameter, + the API returns information about all privileges for the requested application. """ __path_parts: t.Dict[str, str] if application not in SKIP_IN_PATH and name not in SKIP_IN_PATH: @@ -1670,9 +1797,13 @@ async def get_role( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get roles. Get roles in the native realm. The role management APIs are generally - the preferred way to manage roles, rather than using file-based role management. - The get roles API cannot retrieve roles that are defined in roles files. + .. raw:: html + +

Get roles.

+

Get roles in the native realm. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The get roles API cannot retrieve roles that are defined in roles files.

+ ``_ @@ -1717,10 +1848,13 @@ async def get_role_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get role mappings. Role mappings define which roles are assigned to each user. - The role mapping APIs are generally the preferred way to manage role mappings - rather than using role mapping files. The get role mappings API cannot retrieve - role mappings that are defined in role mapping files. + .. raw:: html + +

Get role mappings.

+

Role mappings define which roles are assigned to each user. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. + The get role mappings API cannot retrieve role mappings that are defined in role mapping files.

+ ``_ @@ -1768,15 +1902,19 @@ async def get_service_accounts( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get service accounts. Get a list of service accounts that match the provided - path parameters. + .. raw:: html + +

Get service accounts.

+

Get a list of service accounts that match the provided path parameters.

+

NOTE: Currently, only the elastic/fleet-server service account is available.

+ ``_ - :param namespace: Name of the namespace. Omit this parameter to retrieve information - about all service accounts. If you omit this parameter, you must also omit - the `service` parameter. - :param service: Name of the service name. Omit this parameter to retrieve information + :param namespace: The name of the namespace. Omit this parameter to retrieve + information about all service accounts. If you omit this parameter, you must + also omit the `service` parameter. + :param service: The service name. Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. """ __path_parts: t.Dict[str, str] @@ -1820,12 +1958,19 @@ async def get_service_credentials( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get service account credentials. + .. raw:: html + +

Get service account credentials.

+

To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security).

+

The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster.

+

NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. + Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens.

+ ``_ - :param namespace: Name of the namespace. - :param service: Name of the service name. + :param namespace: The name of the namespace. + :param service: The service name. """ if namespace in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'namespace'") @@ -1866,8 +2011,17 @@ async def get_settings( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get security index settings. Get the user-configurable settings for the security - internal index (`.security` and associated indices). + .. raw:: html + +

Get security index settings.

+

Get the user-configurable settings for the security internal index (.security and associated indices). + Only a subset of the index settings — those that are user-configurable—will be shown. + This includes:

+
    +
  • index.auto_expand_replicas
  • +
  • index.number_of_replicas
  • +
+ ``_ @@ -1931,16 +2085,39 @@ async def get_token( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a token. Create a bearer token for access without requiring basic authentication. + .. raw:: html + +

Get a token.

+

Create a bearer token for access without requiring basic authentication. + The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. + Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. + When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface.

+

The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body.

+

A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available.

+

The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. + That time period is defined by the xpack.security.authc.token.timeout setting. + If you want to invalidate a token immediately, you can do so by using the invalidate token API.

+ ``_ - :param grant_type: - :param kerberos_ticket: - :param password: - :param refresh_token: - :param scope: - :param username: + :param grant_type: The type of grant. Supported grant types are: `password`, + `_kerberos`, `client_credentials`, and `refresh_token`. + :param kerberos_ticket: The base64 encoded kerberos ticket. If you specify the + `_kerberos` grant type, this parameter is required. This parameter is not + valid with any other supported grant type. + :param password: The user's password. If you specify the `password` grant type, + this parameter is required. This parameter is not valid with any other supported + grant type. + :param refresh_token: The string that was returned when you created the token, + which enables you to extend its life. If you specify the `refresh_token` + grant type, this parameter is required. This parameter is not valid with + any other supported grant type. + :param scope: The scope of the token. Currently tokens are only issued for a + scope of FULL regardless of the value sent with the request. + :param username: The username that identifies the user. If you specify the `password` + grant type, this parameter is required. This parameter is not valid with + any other supported grant type. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" @@ -1990,15 +2167,19 @@ async def get_user( with_profile_uid: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get users. Get information about users in the native realm and built-in users. + .. raw:: html + +

Get users.

+

Get information about users in the native realm and built-in users.

+ ``_ :param username: An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users. - :param with_profile_uid: If true will return the User Profile ID for a user, - if any. + :param with_profile_uid: Determines whether to retrieve the user profile UID, + if it exists, for the users. """ __path_parts: t.Dict[str, str] if username not in SKIP_IN_PATH: @@ -2041,7 +2222,14 @@ async def get_user_privileges( username: t.Optional[t.Union[None, str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get user privileges. + .. raw:: html + +

Get user privileges.

+

Get the security privileges for the logged in user. + All users can use this API, but only to determine their own privileges. + To check the privileges of other users, you must use the run as feature. + To check whether a user has a specific list of privileges, use the has privileges API.

+ ``_ @@ -2091,11 +2279,14 @@ async def get_user_profile( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a user profile. Get a user's profile using the unique profile ID. NOTE: The - user profile feature is designed only for use by Kibana and Elastic's Observability, - Enterprise Search, and Elastic Security solutions. Individual users and external - applications should not call this API directly. Elastic reserves the right to - change or remove this feature in future releases without prior notice. + .. raw:: html + +

Get a user profile.

+

Get a user's profile using the unique profile ID.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ ``_ @@ -2159,31 +2350,37 @@ async def grant_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Grant an API key. Create an API key on behalf of another user. This API is similar - to the create API keys API, however it creates the API key for a user that is - different than the user that runs the API. The caller must have authentication - credentials (either an access token, or a username and password) for the user - on whose behalf the API key will be created. It is not possible to use this API - to create an API key without that user’s credentials. The user, for whom the - authentication credentials is provided, can optionally "run as" (impersonate) - another user. In this case, the API key will be created on behalf of the impersonated - user. This API is intended be used by applications that need to create and manage - API keys for end users, but cannot guarantee that those users have permission - to create API keys on their own behalf. A successful grant API key API call returns - a JSON structure that contains the API key, its unique id, and its name. If applicable, - it also returns expiration information for the API key in milliseconds. By default, - API keys never expire. You can specify expiration information when you create - the API keys. + .. raw:: html + +

Grant an API key.

+

Create an API key on behalf of another user. + This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. + The caller must have authentication credentials for the user on whose behalf the API key will be created. + It is not possible to use this API to create an API key without that user's credentials. + The supported user authentication credential types are:

+
    +
  • username and password
  • +
  • Elasticsearch access tokens
  • +
  • JWTs
  • +
+

The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + In this case, the API key will be created on behalf of the impersonated user.

+

This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + The API keys are created by the Elasticsearch API key service, which is automatically enabled.

+

A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + If applicable, it also returns expiration information for the API key in milliseconds.

+

By default, API keys never expire. You can specify expiration information when you create the API keys.

+ ``_ - :param api_key: Defines the API key. + :param api_key: The API key. :param grant_type: The type of grant. Supported grant types are: `access_token`, `password`. - :param access_token: The user’s access token. If you specify the `access_token` + :param access_token: The user's access token. If you specify the `access_token` grant type, this parameter is required. It is not valid with other grant types. - :param password: The user’s password. If you specify the `password` grant type, + :param password: The user's password. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. :param run_as: The name of the user to be impersonated. :param username: The user name that identifies the user. If you specify the `password` @@ -2314,8 +2511,13 @@ async def has_privileges( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Check user privileges. Determine whether the specified user has a specified list - of privileges. + .. raw:: html + +

Check user privileges.

+

Determine whether the specified user has a specified list of privileges. + All users can use this API, but only to determine their own privileges. + To check the privileges of other users, you must use the run as feature.

+ ``_ @@ -2374,12 +2576,13 @@ async def has_privileges_user_profile( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Check user profile privileges. Determine whether the users associated with the - specified user profile IDs have all the requested privileges. NOTE: The user - profile feature is designed only for use by Kibana and Elastic's Observability, - Enterprise Search, and Elastic Security solutions. Individual users and external - applications should not call this API directly. Elastic reserves the right to - change or remove this feature in future releases without prior notice. + .. raw:: html + +

Check user profile privileges.

+

Determine whether the users associated with the specified user profile IDs have all the requested privileges.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ ``_ @@ -2438,17 +2641,22 @@ async def invalidate_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidate API keys. This API invalidates API keys created by the create API - key or grant API key APIs. Invalidated API keys fail authentication, but they - can still be viewed using the get API key information and query API key information - APIs, for at least the configured retention period, until they are automatically - deleted. The `manage_api_key` privilege allows deleting any API keys. The `manage_own_api_key` - only allows deleting API keys that are owned by the user. In addition, with the - `manage_own_api_key` privilege, an invalidation request must be issued in one - of the three formats: - Set the parameter `owner=true`. - Or, set both `username` - and `realm_name` to match the user’s identity. - Or, if the request is issued - by an API key, that is to say an API key invalidates itself, specify its ID in - the `ids` field. + .. raw:: html + +

Invalidate API keys.

+

This API invalidates API keys created by the create API key or grant API key APIs. + Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted.

+

To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. + The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. + The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. + The manage_own_api_key only allows deleting REST API keys that are owned by the user. + In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats:

+
    +
  • Set the parameter owner=true.
  • +
  • Or, set both username and realm_name to match the user's identity.
  • +
  • Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field.
  • +
+ ``_ @@ -2457,14 +2665,15 @@ async def invalidate_api_key( `name`, `realm_name`, or `username`. :param name: An API key name. This parameter cannot be used with any of `ids`, `realm_name` or `username`. - :param owner: Can be used to query API keys owned by the currently authenticated - user. The `realm_name` or `username` parameters cannot be specified when - this parameter is set to `true` as they are assumed to be the currently authenticated - ones. + :param owner: Query API keys owned by the currently authenticated user. The `realm_name` + or `username` parameters cannot be specified when this parameter is set to + `true` as they are assumed to be the currently authenticated ones. NOTE: + At least one of `ids`, `name`, `username`, and `realm_name` must be specified + if `owner` is `false`. :param realm_name: The name of an authentication realm. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. :param username: The username of a user. This parameter cannot be used with either - `ids` or `name`, or when `owner` flag is set to `true`. + `ids` or `name` or when `owner` flag is set to `true`. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" @@ -2519,19 +2728,30 @@ async def invalidate_token( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidate a token. The access tokens returned by the get token API have a finite - period of time for which they are valid. After that time period, they can no - longer be used. The time period is defined by the `xpack.security.authc.token.timeout` - setting. The refresh tokens returned by the get token API are only valid for - 24 hours. They can also be used exactly once. If you want to invalidate one or - more access or refresh tokens immediately, use this invalidate token API. + .. raw:: html + +

Invalidate a token.

+

The access tokens returned by the get token API have a finite period of time for which they are valid. + After that time period, they can no longer be used. + The time period is defined by the xpack.security.authc.token.timeout setting.

+

The refresh tokens returned by the get token API are only valid for 24 hours. + They can also be used exactly once. + If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API.

+

NOTE: While all parameters are optional, at least one of them is required. + More specifically, either one of token or refresh_token parameters is required. + If none of these two are specified, then realm_name and/or username need to be specified.

+ ``_ - :param realm_name: - :param refresh_token: - :param token: - :param username: + :param realm_name: The name of an authentication realm. This parameter cannot + be used with either `refresh_token` or `token`. + :param refresh_token: A refresh token. This parameter cannot be used if any of + `refresh_token`, `realm_name`, or `username` are used. + :param token: An access token. This parameter cannot be used if any of `refresh_token`, + `realm_name`, or `username` are used. + :param username: The username of a user. This parameter cannot be used with either + `refresh_token` or `token`. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" @@ -2582,12 +2802,13 @@ async def oidc_authenticate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Authenticate OpenID Connect. Exchange an OpenID Connect authentication response - message for an Elasticsearch internal access token and refresh token that can - be subsequently used for authentication. Elasticsearch exposes all the necessary - OpenID Connect related functionality with the OpenID Connect APIs. These APIs - are used internally by Kibana in order to provide OpenID Connect based authentication, - but can also be used by other, custom web applications or other clients. + .. raw:: html + +

Authenticate OpenID Connect.

+

Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ ``_ @@ -2660,15 +2881,14 @@ async def oidc_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Logout of OpenID Connect. Invalidate an access token and a refresh token that - were generated as a response to the `/_security/oidc/authenticate` API. If the - OpenID Connect authentication realm in Elasticsearch is accordingly configured, - the response to this call will contain a URI pointing to the end session endpoint - of the OpenID Connect Provider in order to perform single logout. Elasticsearch - exposes all the necessary OpenID Connect related functionality with the OpenID - Connect APIs. These APIs are used internally by Kibana in order to provide OpenID - Connect based authentication, but can also be used by other, custom web applications - or other clients. + .. raw:: html + +

Logout of OpenID Connect.

+

Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API.

+

If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ ``_ @@ -2723,15 +2943,14 @@ async def oidc_prepare_authentication( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Prepare OpenID connect authentication. Create an oAuth 2.0 authentication request - as a URL string based on the configuration of the OpenID Connect authentication - realm in Elasticsearch. The response of this API is a URL pointing to the Authorization - Endpoint of the configured OpenID Connect Provider, which can be used to redirect - the browser of the user in order to continue the authentication process. Elasticsearch - exposes all the necessary OpenID Connect related functionality with the OpenID - Connect APIs. These APIs are used internally by Kibana in order to provide OpenID - Connect based authentication, but can also be used by other, custom web applications - or other clients. + .. raw:: html + +

Prepare OpenID connect authentication.

+

Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch.

+

The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ ``_ @@ -2808,7 +3027,26 @@ async def put_privileges( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update application privileges. + .. raw:: html + +

Create or update application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_security cluster privilege (or a greater privilege such as all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
+

Application names are formed from a prefix, with an optional suffix that conform to the following rules:

+
    +
  • The prefix must begin with a lowercase ASCII letter.
  • +
  • The prefix must contain only ASCII letters or digits.
  • +
  • The prefix must be at least 3 characters long.
  • +
  • If the suffix exists, it must begin with either a dash - or _.
  • +
  • The suffix cannot contain any of the following characters: \\, /, *, ?, ", <, >, |, ,, *.
  • +
  • No part of the name can contain whitespace.
  • +
+

Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and ..

+

Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :.

+ ``_ @@ -2954,10 +3192,13 @@ async def put_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update roles. The role management APIs are generally the preferred - way to manage roles in the native realm, rather than using file-based role management. - The create or update roles API cannot update roles that are defined in roles - files. File-based role management is not available in Elastic Serverless. + .. raw:: html + +

Create or update roles.

+

The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. + The create or update roles API cannot update roles that are defined in roles files. + File-based role management is not available in Elastic Serverless.

+ ``_ @@ -2976,7 +3217,10 @@ async def put_role( this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. :param remote_cluster: A list of remote cluster permissions entries. - :param remote_indices: A list of remote indices permissions entries. + :param remote_indices: A list of remote indices permissions entries. NOTE: Remote + indices are effective for remote clusters configured with the API key based + model. They have no effect for remote clusters configured with the certificate + based model. :param run_as: A list of users that the owners of this role can impersonate. *Note*: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will @@ -3066,26 +3310,48 @@ async def put_role_mapping( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update role mappings. Role mappings define which roles are assigned - to each user. Each mapping has rules that identify users and a list of roles - that are granted to those users. The role mapping APIs are generally the preferred - way to manage role mappings rather than using role mapping files. The create - or update role mappings API cannot update role mappings that are defined in role - mapping files. This API does not create roles. Rather, it maps users to existing - roles. Roles can be created by using the create or update roles API or roles - files. + .. raw:: html + +

Create or update role mappings.

+

Role mappings define which roles are assigned to each user. + Each mapping has rules that identify users and a list of roles that are granted to those users. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files.

+

NOTE: This API does not create roles. Rather, it maps users to existing roles. + Roles can be created by using the create or update roles API or roles files.

+

Role templates

+

The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. + For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. + The roles field is used for this purpose.

+

For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. + The role_templates field is used for this purpose.

+

NOTE: To use role templates successfully, the relevant scripting feature must be enabled. + Otherwise, all attempts to create a role mapping with role templates fail.

+

All of the user fields that are available in the role mapping rules are also available in the role templates. + Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated.

+

By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. + If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names.

+ ``_ - :param name: Role-mapping name - :param enabled: - :param metadata: + :param name: The distinct name that identifies the role mapping. The name is + used solely as an identifier to facilitate interaction via the API; it does + not affect the behavior of the mapping in any way. + :param enabled: Mappings that have `enabled` set to `false` are ignored when + role mapping is performed. + :param metadata: Additional metadata that helps define which roles are assigned + to each user. Within the metadata object, keys beginning with `_` are reserved + for system usage. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - :param role_templates: - :param roles: - :param rules: + :param role_templates: A list of Mustache templates that will be evaluated to + determine the roles names that should granted to the users that match the + role mapping rules. Exactly one of `roles` or `role_templates` must be specified. + :param roles: A list of role names that are granted to the users that match the + role mapping rules. Exactly one of `roles` or `role_templates` must be specified. + :param rules: The rules that determine which users should be matched by the mapping. + A rule is a logical condition that is expressed by using a JSON DSL. :param run_as: """ if name in SKIP_IN_PATH: @@ -3160,23 +3426,41 @@ async def put_user( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update users. A password is required for adding a new user but is optional - when updating an existing user. To change a user’s password without updating - any other fields, use the change password API. + .. raw:: html + +

Create or update users.

+

Add and update users in the native realm. + A password is required for adding a new user but is optional when updating an existing user. + To change a user's password without updating any other fields, use the change password API.

+ ``_ - :param username: The username of the User - :param email: - :param enabled: - :param full_name: - :param metadata: - :param password: - :param password_hash: - :param refresh: If `true` (the default) then refresh the affected shards to make - this operation visible to search, if `wait_for` then wait for a refresh to - make this operation visible to search, if `false` then do nothing with refreshes. - :param roles: + :param username: An identifier for the user. NOTE: Usernames must be at least + 1 and no more than 507 characters. They can contain alphanumeric characters + (a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic + Latin (ASCII) block. Leading or trailing whitespace is not allowed. + :param email: The email of the user. + :param enabled: Specifies whether the user is enabled. + :param full_name: The full name of the user. + :param metadata: Arbitrary metadata that you want to associate with the user. + :param password: The user's password. Passwords must be at least 6 characters + long. When adding a user, one of `password` or `password_hash` is required. + When updating an existing user, the password is optional, so that other fields + on the user (such as their roles) may be updated without modifying the user's + password + :param password_hash: A hash of the user's password. This must be produced using + the same hashing algorithm as has been configured for password storage. For + more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm` + setting in the user cache and password hash algorithm documentation. Using + this parameter allows the client to pre-hash the password for performance + and/or confidentiality reasons. The `password` parameter and the `password_hash` + parameter cannot be used in the same request. + :param refresh: Valid values are `true`, `false`, and `wait_for`. These values + have the same meaning as in the index API, but the default value for this + API is true. + :param roles: A set of roles the user has. The roles determine the user's access + permissions. To create a user without any roles, specify an empty list (`[]`). """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") @@ -3259,8 +3543,15 @@ async def query_api_keys( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Find API keys with a query. Get a paginated list of API keys and their information. - You can optionally filter the results with a query. + .. raw:: html + +

Find API keys with a query.

+

Get a paginated list of API keys and their information. + You can optionally filter the results with a query.

+

To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. + If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership.

+ ``_ @@ -3276,30 +3567,39 @@ async def query_api_keys( `terms`, `range`, `date_range`, `missing`, `cardinality`, `value_count`, `composite`, `filter`, and `filters`. Additionally, aggregations only run over the same subset of fields that query works with. - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which API keys to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following public information associated with an API key: `id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`, - `username`, `realm`, and `metadata`. - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: Other than `id`, all public fields of an API key are eligible for - sorting. In addition, sort can also be applied to the `_doc` field to sort - by index order. + `username`, `realm`, and `metadata`. NOTE: The queryable string values associated + with API keys are internally mapped as keywords. Consequently, if no `analyzer` + parameter is specified for a `match` query, then the provided match query + string is interpreted as a single keyword value. Such a match query is hence + equivalent to a `term` query. + :param search_after: The search after definition. + :param size: The number of hits to return. It must not be negative. The `size` + parameter can be set to `0`, in which case no API key matches are returned, + only the aggregation results. By default, you cannot page through more than + 10,000 hits using the `from` and `size` parameters. To page through more + hits, use the `search_after` parameter. + :param sort: The sort definition. Other than `id`, all public fields of an API + key are eligible for sorting. In addition, sort can also be applied to the + `_doc` field to sort by index order. :param typed_keys: Determines whether aggregation names are prefixed by their respective types in the response. :param with_limited_by: Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection - of its assigned role descriptors and the owner user's role descriptors. - :param with_profile_uid: Determines whether to also retrieve the profile uid, - for the API key owner principal, if it exists. + of its assigned role descriptors and the owner user's role descriptors (effectively + limited by it). An API key cannot retrieve any API key’s limited-by role + descriptors (including itself) unless it has `manage_api_key` or higher privileges. + :param with_profile_uid: Determines whether to also retrieve the profile UID + for the API key owner principal. If it exists, the profile UID is returned + under the `profile_uid` response field for each API key. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/api_key" @@ -3386,26 +3686,34 @@ async def query_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Find roles with a query. Get roles in a paginated manner. You can optionally - filter the results with a query. + .. raw:: html + +

Find roles with a query.

+

Get roles in a paginated manner. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. + You can optionally filter the results with a query. + Also, the results can be paginated and sorted.

+ ``_ - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which roles to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with roles: `name`, `description`, - `metadata`, `applications.application`, `applications.privileges`, `applications.resources`. - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: All public fields of a role are eligible for sorting. In addition, - sort can also be applied to the `_doc` field to sort by index order. + `metadata`, `applications.application`, `applications.privileges`, and `applications.resources`. + :param search_after: The search after definition. + :param size: The number of hits to return. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param sort: The sort definition. You can sort on `username`, `roles`, or `enabled`. + In addition, sort can also be applied to the `_doc` field to sort by index + order. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/role" @@ -3472,28 +3780,35 @@ async def query_user( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Find users with a query. Get information for users in a paginated manner. You - can optionally filter the results with a query. + .. raw:: html + +

Find users with a query.

+

Get information for users in a paginated manner. + You can optionally filter the results with a query.

+

NOTE: As opposed to the get user API, built-in users are excluded from the result. + This API is only for native users.

+ ``_ - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which users to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with user: `username`, - `roles`, `enabled` - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: Fields eligible for sorting are: username, roles, enabled In addition, - sort can also be applied to the `_doc` field to sort by index order. - :param with_profile_uid: If true will return the User Profile ID for the users - in the query result, if any. + `roles`, `enabled`, `full_name`, and `email`. + :param search_after: The search after definition + :param size: The number of hits to return. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param sort: The sort definition. Fields eligible for sorting are: `username`, + `roles`, `enabled`. In addition, sort can also be applied to the `_doc` field + to sort by index order. + :param with_profile_uid: Determines whether to retrieve the user profile UID, + if it exists, for the users. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/user" @@ -3551,19 +3866,21 @@ async def saml_authenticate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Authenticate SAML. Submit a SAML response message to Elasticsearch for consumption. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. The SAML message that is submitted can be: * A response - to a SAML authentication request that was previously created using the SAML prepare - authentication API. * An unsolicited SAML message in the case of an IdP-initiated - single sign-on (SSO) flow. In either case, the SAML message needs to be a base64 - encoded XML document with a root element of ``. After successful validation, - Elasticsearch responds with an Elasticsearch internal access token and refresh - token that can be subsequently used for authentication. This API endpoint essentially - exchanges SAML responses that indicate successful authentication in the IdP for - Elasticsearch access and refresh tokens, which can be used for authentication - against Elasticsearch. + .. raw:: html + +

Authenticate SAML.

+

Submit a SAML response message to Elasticsearch for consumption.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The SAML message that is submitted can be:

+
    +
  • A response to a SAML authentication request that was previously created using the SAML prepare authentication API.
  • +
  • An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow.
  • +
+

In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>.

+

After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. + This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch.

+ ``_ @@ -3625,16 +3942,18 @@ async def saml_complete_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Logout of SAML completely. Verifies the logout response sent from the SAML IdP. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. The SAML IdP may send a logout response back to the SP - after handling the SP-initiated SAML Single Logout. This API verifies the response - by ensuring the content is relevant and validating its signature. An empty response - is returned if the verification process is successful. The response can be sent - by the IdP with either the HTTP-Redirect or the HTTP-Post binding. The caller - of this API must prepare the request accordingly so that this API can handle - either of them. + .. raw:: html + +

Logout of SAML completely.

+

Verifies the logout response sent from the SAML IdP.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. + This API verifies the response by ensuring the content is relevant and validating its signature. + An empty response is returned if the verification process is successful. + The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. + The caller of this API must prepare the request accordingly so that this API can handle either of them.

+ ``_ @@ -3700,15 +4019,17 @@ async def saml_invalidate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidate SAML. Submit a SAML LogoutRequest message to Elasticsearch for consumption. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. The logout request comes from the SAML IdP during an IdP - initiated Single Logout. The custom web application can use this API to have - Elasticsearch process the `LogoutRequest`. After successful validation of the - request, Elasticsearch invalidates the access token and refresh token that corresponds - to that specific SAML principal and provides a URL that contains a SAML LogoutResponse - message. Thus the user can be redirected back to their IdP. + .. raw:: html + +

Invalidate SAML.

+

Submit a SAML LogoutRequest message to Elasticsearch for consumption.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The logout request comes from the SAML IdP during an IdP initiated Single Logout. + The custom web application can use this API to have Elasticsearch process the LogoutRequest. + After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. + Thus the user can be redirected back to their IdP.

+ ``_ @@ -3775,14 +4096,15 @@ async def saml_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Logout of SAML. Submits a request to invalidate an access token and refresh token. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. This API invalidates the tokens that were generated for - a user by the SAML authenticate API. If the SAML realm in Elasticsearch is configured - accordingly and the SAML IdP supports this, the Elasticsearch response contains - a URL to redirect the user to the IdP that contains a SAML logout request (starting - an SP-initiated SAML Single Logout). + .. raw:: html + +

Logout of SAML.

+

Submits a request to invalidate an access token and refresh token.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

This API invalidates the tokens that were generated for a user by the SAML authenticate API. + If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout).

+ ``_ @@ -3839,20 +4161,20 @@ async def saml_prepare_authentication( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Prepare SAML authentication. Create a SAML authentication request (``) - as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. This API returns a URL pointing to the SAML Identity Provider. - You can use the URL to redirect the browser of the user in order to continue - the authentication process. The URL includes a single parameter named `SAMLRequest`, - which contains a SAML Authentication request that is deflated and Base64 encoded. - If the configuration dictates that SAML authentication requests should be signed, - the URL has two extra parameters named `SigAlg` and `Signature`. These parameters - contain the algorithm used for the signature and the signature value itself. - It also returns a random string that uniquely identifies this SAML Authentication - request. The caller of this API needs to store this identifier as it needs to - be used in a following step of the authentication process. + .. raw:: html + +

Prepare SAML authentication.

+

Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

This API returns a URL pointing to the SAML Identity Provider. + You can use the URL to redirect the browser of the user in order to continue the authentication process. + The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. + If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. + These parameters contain the algorithm used for the signature and the signature value itself. + It also returns a random string that uniquely identifies this SAML Authentication request. + The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process.

+ ``_ @@ -3907,11 +4229,13 @@ async def saml_service_provider_metadata( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create SAML service provider metadata. Generate SAML metadata for a SAML 2.0 - Service Provider. The SAML 2.0 specification provides a mechanism for Service - Providers to describe their capabilities and configuration using a metadata file. - This API generates Service Provider metadata based on the configuration of a - SAML realm in Elasticsearch. + .. raw:: html + +

Create SAML service provider metadata.

+

Generate SAML metadata for a SAML 2.0 Service Provider.

+

The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. + This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch.

+ ``_ @@ -3957,12 +4281,14 @@ async def suggest_user_profiles( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Suggest a user profile. Get suggestions for user profiles that match specified - search criteria. NOTE: The user profile feature is designed only for use by Kibana - and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - Individual users and external applications should not call this API directly. - Elastic reserves the right to change or remove this feature in future releases - without prior notice. + .. raw:: html + +

Suggest a user profile.

+

Get suggestions for user profiles that match specified search criteria.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ ``_ @@ -4033,38 +4359,43 @@ async def update_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an API key. Updates attributes of an existing API key. Users can only - update API keys that they created or that were granted to them. Use this API - to update API keys created by the create API Key or grant API Key APIs. If you - need to apply the same update to many API keys, you can use bulk update API Keys - to reduce overhead. It’s not possible to update expired API keys, or API keys - that have been invalidated by invalidate API Key. This API supports updates to - an API key’s access scope and metadata. The access scope of an API key is derived - from the `role_descriptors` you specify in the request, and a snapshot of the - owner user’s permissions at the time of the request. The snapshot of the owner’s - permissions is updated automatically on every call. If you don’t specify `role_descriptors` - in the request, a call to this API might still change the API key’s access scope. - This change can occur if the owner user’s permissions have changed since the - API key was created or last modified. To update another user’s API key, use the - `run_as` feature to submit a request on behalf of another user. IMPORTANT: It’s - not possible to use an API key as the authentication credential for this API. - To update an API key, the owner user’s credentials are required. + .. raw:: html + +

Update an API key.

+

Update attributes of an existing API key. + This API supports updates to an API key's access scope, expiration, and metadata.

+

To use this API, you must have at least the manage_own_api_key cluster privilege. + Users can only update API keys that they created or that were granted to them. + To update another user’s API key, use the run_as feature to submit a request on behalf of another user.

+

IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required.

+

Use this API to update API keys created by the create API key or grant API Key APIs. + If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. + It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API.

+

The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. + The snapshot of the owner's permissions is updated automatically on every call.

+

IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. + This change can occur if the owner user's permissions have changed since the API key was created or last modified.

+ ``_ :param id: The ID of the API key to update. - :param expiration: Expiration time for the API key. + :param expiration: The expiration time for the API key. By default, API keys + never expire. This property can be omitted to leave the expiration unchanged. :param metadata: Arbitrary metadata that you want to associate with the API key. - It supports nested data structure. Within the metadata object, keys beginning - with _ are reserved for system usage. - :param role_descriptors: An array of role descriptors for this API key. This - parameter is optional. When it is not specified or is an empty array, then - the API key will have a point in time snapshot of permissions of the authenticated - user. If you supply role descriptors then the resultant permissions would - be an intersection of API keys permissions and authenticated user’s permissions - thereby limiting the access scope for API keys. The structure of role descriptor - is the same as the request for create role API. For more details, see create - or update roles API. + It supports a nested data structure. Within the metadata object, keys beginning + with `_` are reserved for system usage. When specified, this value fully + replaces the metadata previously associated with the API key. + :param role_descriptors: The role descriptors to assign to this API key. The + API key's effective permissions are an intersection of its assigned privileges + and the point in time snapshot of permissions of the owner user. You can + assign new privileges by specifying them in this parameter. To remove assigned + privileges, you can supply an empty `role_descriptors` parameter, that is + to say, an empty object `{}`. If an API key has no assigned privileges, it + inherits the owner user's full permissions. The snapshot of the owner's permissions + is always updated, whether you supply the `role_descriptors` parameter or + not. The structure of a role descriptor is the same as the request for the + create API keys API. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -4119,19 +4450,20 @@ async def update_cross_cluster_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a cross-cluster API key. Update the attributes of an existing cross-cluster - API key, which is used for API key based remote cluster access. To use this API, - you must have at least the `manage_security` cluster privilege. Users can only - update API keys that they created. To update another user's API key, use the - `run_as` feature to submit a request on behalf of another user. IMPORTANT: It's - not possible to use an API key as the authentication credential for this API. - To update an API key, the owner user's credentials are required. It's not possible - to update expired API keys, or API keys that have been invalidated by the invalidate - API key API. This API supports updates to an API key's access scope, metadata, - and expiration. The owner user's information, such as the `username` and `realm`, - is also updated automatically on every call. NOTE: This API cannot update REST - API keys, which should be updated by either the update API key or bulk update - API keys API. + .. raw:: html + +

Update a cross-cluster API key.

+

Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access.

+

To use this API, you must have at least the manage_security cluster privilege. + Users can only update API keys that they created. + To update another user's API key, use the run_as feature to submit a request on behalf of another user.

+

IMPORTANT: It's not possible to use an API key as the authentication credential for this API. + To update an API key, the owner user's credentials are required.

+

It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API.

+

This API supports updates to an API key's access scope, metadata, and expiration. + The owner user's information, such as the username and realm, is also updated automatically on every call.

+

NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API.

+ ``_ @@ -4203,12 +4535,14 @@ async def update_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update security index settings. Update the user-configurable settings for the - security internal index (`.security` and associated indices). Only a subset of - settings are allowed to be modified, for example `index.auto_expand_replicas` - and `index.number_of_replicas`. If a specific index is not in use on the system - and settings are provided for it, the request will be rejected. This API does - not yet support configuring the settings for indices before they are in use. + .. raw:: html + +

Update security index settings.

+

Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas.

+

NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates.

+

If a specific index is not in use on the system and settings are provided for it, the request will be rejected. + This API does not yet support configuring the settings for indices before they are in use.

+ ``_ @@ -4277,19 +4611,23 @@ async def update_user_profile_data( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update user profile data. Update specific data for the user profile that is associated - with a unique ID. NOTE: The user profile feature is designed only for use by - Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - Individual users and external applications should not call this API directly. - Elastic reserves the right to change or remove this feature in future releases - without prior notice. To use this API, you must have one of the following privileges: - * The `manage_user_profile` cluster privilege. * The `update_profile_data` global - privilege for the namespaces that are referenced in the request. This API updates - the `labels` and `data` fields of an existing user profile document with JSON - objects. New keys and their values are added to the profile document and conflicting - keys are replaced by data that's included in the request. For both labels and - data, content is namespaced by the top-level fields. The `update_profile_data` - global privilege grants privileges for updating only the allowed namespaces. + .. raw:: html + +

Update user profile data.

+

Update specific data for the user profile that is associated with a unique ID.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_user_profile cluster privilege.
  • +
  • The update_profile_data global privilege for the namespaces that are referenced in the request.
  • +
+

This API updates the labels and data fields of an existing user profile document with JSON objects. + New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request.

+

For both labels and data, content is namespaced by the top-level fields. + The update_profile_data global privilege grants privileges for updating only the allowed namespaces.

+ ``_ diff --git a/elasticsearch/_async/client/shutdown.py b/elasticsearch/_async/client/shutdown.py index d62605917..54e2beed1 100644 --- a/elasticsearch/_async/client/shutdown.py +++ b/elasticsearch/_async/client/shutdown.py @@ -42,13 +42,16 @@ async def delete_node( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancel node shutdown preparations. Remove a node from the shutdown list so it - can resume normal operations. You must explicitly clear the shutdown request - when a node rejoins the cluster or when a node has permanently left the cluster. - Shutdown requests are never removed automatically by Elasticsearch. NOTE: This - feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, - and Elastic Cloud on Kubernetes. Direct use is not supported. If the operator - privileges feature is enabled, you must be an operator to use this API. + .. raw:: html + +

Cancel node shutdown preparations. + Remove a node from the shutdown list so it can resume normal operations. + You must explicitly clear the shutdown request when a node rejoins the cluster or when a node has permanently left the cluster. + Shutdown requests are never removed automatically by Elasticsearch.

+

NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. + Direct use is not supported.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+ ``_ @@ -103,13 +106,14 @@ async def get_node( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the shutdown status. Get information about nodes that are ready to be shut - down, have shut down preparations still in progress, or have stalled. The API - returns status information for each part of the shut down process. NOTE: This - feature is designed for indirect use by Elasticsearch Service, Elastic Cloud - Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. If - the operator privileges feature is enabled, you must be an operator to use this - API. + .. raw:: html + +

Get the shutdown status.

+

Get information about nodes that are ready to be shut down, have shut down preparations still in progress, or have stalled. + The API returns status information for each part of the shut down process.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+ ``_ @@ -176,18 +180,19 @@ async def put_node( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Prepare a node to be shut down. NOTE: This feature is designed for indirect use - by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. - Direct use is not supported. If you specify a node that is offline, it will be - prepared for shut down when it rejoins the cluster. If the operator privileges - feature is enabled, you must be an operator to use this API. The API migrates - ongoing tasks and index shards to other nodes as needed to prepare a node to - be restarted or shut down and removed from the cluster. This ensures that Elasticsearch - can be stopped safely with minimal disruption to the cluster. You must specify - the type of shutdown: `restart`, `remove`, or `replace`. If a node is already - being prepared for shutdown, you can use this API to change the shutdown type. - IMPORTANT: This API does NOT terminate the Elasticsearch process. Monitor the - node shutdown status to determine when it is safe to stop Elasticsearch. + .. raw:: html + +

Prepare a node to be shut down.

+

NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

If you specify a node that is offline, it will be prepared for shut down when it rejoins the cluster.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+

The API migrates ongoing tasks and index shards to other nodes as needed to prepare a node to be restarted or shut down and removed from the cluster. + This ensures that Elasticsearch can be stopped safely with minimal disruption to the cluster.

+

You must specify the type of shutdown: restart, remove, or replace. + If a node is already being prepared for shutdown, you can use this API to change the shutdown type.

+

IMPORTANT: This API does NOT terminate the Elasticsearch process. + Monitor the node shutdown status to determine when it is safe to stop Elasticsearch.

+ ``_ diff --git a/elasticsearch/_async/client/simulate.py b/elasticsearch/_async/client/simulate.py index 6c40ff3c7..73f71429f 100644 --- a/elasticsearch/_async/client/simulate.py +++ b/elasticsearch/_async/client/simulate.py @@ -64,28 +64,22 @@ async def ingest( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate data ingestion. Run ingest pipelines against a set of provided documents, - optionally with substitute pipeline definitions, to simulate ingesting data into - an index. This API is meant to be used for troubleshooting or pipeline development, - as it does not actually index any data into Elasticsearch. The API runs the default - and final pipeline for that index against a set of documents provided in the - body of the request. If a pipeline contains a reroute processor, it follows that - reroute processor to the new index, running that index's pipelines as well the - same way that a non-simulated ingest would. No data is indexed into Elasticsearch. - Instead, the transformed document is returned, along with the list of pipelines - that have been run and the name of the index where the document would have been - indexed if this were not a simulation. The transformed document is validated - against the mappings that would apply to this index, and any validation error - is reported in the result. This API differs from the simulate pipeline API in - that you specify a single pipeline for that API, and it runs only that one pipeline. - The simulate pipeline API is more useful for developing a single pipeline, while - the simulate ingest API is more useful for troubleshooting the interaction of - the various pipelines that get applied when ingesting into an index. By default, - the pipeline definitions that are currently in the system are used. However, - you can supply substitute pipeline definitions in the body of the request. These - will be used in place of the pipeline definitions that are already in the system. - This can be used to replace existing pipeline definitions or to create new ones. - The pipeline substitutions are used only within this request. + .. raw:: html + +

Simulate data ingestion. + Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index.

+

This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch.

+

The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. + If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. + No data is indexed into Elasticsearch. + Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. + The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result.

+

This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. + The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index.

+

By default, the pipeline definitions that are currently in the system are used. + However, you can supply substitute pipeline definitions in the body of the request. + These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request.

+ ``_ diff --git a/elasticsearch/_async/client/slm.py b/elasticsearch/_async/client/slm.py index 1870a9de5..62ef2aa53 100644 --- a/elasticsearch/_async/client/slm.py +++ b/elasticsearch/_async/client/slm.py @@ -38,9 +38,12 @@ async def delete_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a policy. Delete a snapshot lifecycle policy definition. This operation - prevents any future snapshots from being taken but does not cancel in-progress - snapshots or remove previously-taken snapshots. + .. raw:: html + +

Delete a policy. + Delete a snapshot lifecycle policy definition. + This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots.

+ ``_ @@ -91,10 +94,12 @@ async def execute_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a policy. Immediately create a snapshot according to the snapshot lifecycle - policy without waiting for the scheduled time. The snapshot policy is normally - applied according to its schedule, but you might want to manually run a policy - before performing an upgrade or other maintenance. + .. raw:: html + +

Run a policy. + Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. + The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance.

+ ``_ @@ -144,9 +149,12 @@ async def execute_retention( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a retention policy. Manually apply the retention policy to force immediate - removal of snapshots that are expired according to the snapshot lifecycle policy - retention rules. The retention policy is normally applied according to its schedule. + .. raw:: html + +

Run a retention policy. + Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. + The retention policy is normally applied according to its schedule.

+ ``_ @@ -194,8 +202,11 @@ async def get_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get policy information. Get snapshot lifecycle policy definitions and information - about the latest snapshot attempts. + .. raw:: html + +

Get policy information. + Get snapshot lifecycle policy definitions and information about the latest snapshot attempts.

+ ``_ @@ -248,8 +259,11 @@ async def get_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get snapshot lifecycle management statistics. Get global and policy-level statistics - about actions taken by snapshot lifecycle management. + .. raw:: html + +

Get snapshot lifecycle management statistics. + Get global and policy-level statistics about actions taken by snapshot lifecycle management.

+ ``_ @@ -296,7 +310,10 @@ async def get_status( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the snapshot lifecycle management status. + .. raw:: html + +

Get the snapshot lifecycle management status.

+ ``_ @@ -354,9 +371,13 @@ async def put_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a policy. Create or update a snapshot lifecycle policy. If the - policy already exists, this request increments the policy version. Only the latest - version of a policy is stored. + .. raw:: html + +

Create or update a policy. + Create or update a snapshot lifecycle policy. + If the policy already exists, this request increments the policy version. + Only the latest version of a policy is stored.

+ ``_ @@ -437,9 +458,12 @@ async def start( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start snapshot lifecycle management. Snapshot lifecycle management (SLM) starts - automatically when a cluster is formed. Manually starting SLM is necessary only - if it has been stopped using the stop SLM API. + .. raw:: html + +

Start snapshot lifecycle management. + Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. + Manually starting SLM is necessary only if it has been stopped using the stop SLM API.

+ ``_ @@ -488,15 +512,16 @@ async def stop( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop snapshot lifecycle management. Stop all snapshot lifecycle management (SLM) - operations and the SLM plugin. This API is useful when you are performing maintenance - on a cluster and need to prevent SLM from performing any actions on your data - streams or indices. Stopping SLM does not stop any snapshots that are in progress. - You can manually trigger snapshots with the run snapshot lifecycle policy API - even if SLM is stopped. The API returns a response as soon as the request is - acknowledged, but the plugin might continue to run until in-progress operations - complete and it can be safely stopped. Use the get snapshot lifecycle management - status API to see if SLM is running. + .. raw:: html + +

Stop snapshot lifecycle management. + Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. + This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. + Stopping SLM does not stop any snapshots that are in progress. + You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped.

+

The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. + Use the get snapshot lifecycle management status API to see if SLM is running.

+ ``_ diff --git a/elasticsearch/_async/client/snapshot.py b/elasticsearch/_async/client/snapshot.py index d644eabcf..df8d6920c 100644 --- a/elasticsearch/_async/client/snapshot.py +++ b/elasticsearch/_async/client/snapshot.py @@ -44,8 +44,11 @@ async def cleanup_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clean up the snapshot repository. Trigger the review of the contents of a snapshot - repository and delete any stale data not referenced by existing snapshots. + .. raw:: html + +

Clean up the snapshot repository. + Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots.

+ ``_ @@ -99,8 +102,11 @@ async def clone( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clone a snapshot. Clone part of all of a snapshot into another snapshot in the - same repository. + .. raw:: html + +

Clone a snapshot. + Clone part of all of a snapshot into another snapshot in the same repository.

+ ``_ @@ -183,7 +189,11 @@ async def create( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a snapshot. Take a snapshot of a cluster or of data streams and indices. + .. raw:: html + +

Create a snapshot. + Take a snapshot of a cluster or of data streams and indices.

+ ``_ @@ -287,11 +297,13 @@ async def create_repository( verify: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a snapshot repository. IMPORTANT: If you are migrating searchable - snapshots, the repository name must be identical in the source and destination - clusters. To register a snapshot repository, the cluster's global metadata must - be writeable. Ensure there are no cluster blocks (for example, `cluster.blocks.read_only` - and `clsuter.blocks.read_only_allow_delete` settings) that prevent write access. + .. raw:: html + +

Create or update a snapshot repository. + IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. + To register a snapshot repository, the cluster's global metadata must be writeable. + Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access.

+ ``_ @@ -351,7 +363,10 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete snapshots. + .. raw:: html + +

Delete snapshots.

+ ``_ @@ -402,9 +417,12 @@ async def delete_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete snapshot repositories. When a repository is unregistered, Elasticsearch - removes only the reference to the location where the repository is storing the - snapshots. The snapshots themselves are left untouched and in place. + .. raw:: html + +

Delete snapshot repositories. + When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. + The snapshots themselves are left untouched and in place.

+ ``_ @@ -478,7 +496,10 @@ async def get( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get snapshot information. + .. raw:: html + +

Get snapshot information.

+ ``_ @@ -590,7 +611,10 @@ async def get_repository( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get snapshot repository information. + .. raw:: html + +

Get snapshot repository information.

+ ``_ @@ -652,120 +676,83 @@ async def repository_analyze( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Analyze a snapshot repository. Analyze the performance characteristics and any - incorrect behaviour found in a repository. The response exposes implementation - details of the analysis which may change from version to version. The response - body format is therefore not considered stable and may be different in newer - versions. There are a large number of third-party storage systems available, - not all of which are suitable for use as a snapshot repository by Elasticsearch. - Some storage systems behave incorrectly, or perform poorly, especially when accessed - concurrently by multiple clients as the nodes of an Elasticsearch cluster do. - This API performs a collection of read and write operations on your repository - which are designed to detect incorrect behaviour and to measure the performance - characteristics of your storage system. The default values for the parameters - are deliberately low to reduce the impact of running an analysis inadvertently - and to provide a sensible starting point for your investigations. Run your first - analysis with the default parameter values to check for simple problems. If successful, - run a sequence of increasingly large analyses until you encounter a failure or - you reach a `blob_count` of at least `2000`, a `max_blob_size` of at least `2gb`, - a `max_total_data_size` of at least `1tb`, and a `register_operation_count` of - at least `100`. Always specify a generous timeout, possibly `1h` or longer, to - allow time for each analysis to run to completion. Perform the analyses using - a multi-node cluster of a similar size to your production cluster so that it - can detect any problems that only arise when the repository is accessed by many - nodes at once. If the analysis fails, Elasticsearch detected that your repository - behaved unexpectedly. This usually means you are using a third-party storage - system with an incorrect or incompatible implementation of the API it claims - to support. If so, this storage system is not suitable for use as a snapshot - repository. You will need to work with the supplier of your storage system to - address the incompatibilities that Elasticsearch detects. If the analysis is - successful, the API returns details of the testing process, optionally including - how long each operation took. You can use this information to determine the performance - of your storage system. If any operation fails or returns an incorrect result, - the API returns an error. If the API returns an error, it may not have removed - all the data it wrote to the repository. The error will indicate the location - of any leftover data and this path is also recorded in the Elasticsearch logs. - You should verify that this location has been cleaned up correctly. If there - is still leftover data at the specified location, you should manually remove - it. If the connection from your client to Elasticsearch is closed while the client - is waiting for the result of the analysis, the test is cancelled. Some clients - are configured to close their connection if no response is received within a - certain timeout. An analysis takes a long time to complete so you might need - to relax any such client-side timeouts. On cancellation the analysis attempts - to clean up the data it was writing, but it may not be able to remove it all. - The path to the leftover data is recorded in the Elasticsearch logs. You should - verify that this location has been cleaned up correctly. If there is still leftover - data at the specified location, you should manually remove it. If the analysis - is successful then it detected no incorrect behaviour, but this does not mean - that correct behaviour is guaranteed. The analysis attempts to detect common - bugs but it does not offer 100% coverage. Additionally, it does not test the - following: * Your repository must perform durable writes. Once a blob has been - written it must remain in place until it is deleted, even after a power loss - or similar disaster. * Your repository must not suffer from silent data corruption. - Once a blob has been written, its contents must remain unchanged until it is - deliberately modified or deleted. * Your repository must behave correctly even - if connectivity from the cluster is disrupted. Reads and writes may fail in this - case, but they must not return incorrect results. IMPORTANT: An analysis writes - a substantial amount of data to your repository and then reads it back again. - This consumes bandwidth on the network between the cluster and the repository, - and storage space and I/O bandwidth on the repository itself. You must ensure - this load does not affect other users of these systems. Analyses respect the - repository settings `max_snapshot_bytes_per_sec` and `max_restore_bytes_per_sec` - if available and the cluster setting `indices.recovery.max_bytes_per_sec` which - you can use to limit the bandwidth they consume. NOTE: This API is intended for - exploratory use by humans. You should expect the request parameters and the response - format to vary in future versions. NOTE: Different versions of Elasticsearch - may perform different checks for repository compatibility, with newer versions - typically being stricter than older ones. A storage system that passes repository - analysis with one version of Elasticsearch may fail with a different version. - This indicates it behaves incorrectly in ways that the former version did not - detect. You must work with the supplier of your storage system to address the - incompatibilities detected by the repository analysis API in any version of Elasticsearch. - NOTE: This API may not work correctly in a mixed-version cluster. *Implementation - details* NOTE: This section of documentation describes how the repository analysis - API works in this version of Elasticsearch, but you should expect the implementation - to vary between versions. The request parameters and response format depend on - details of the implementation so may also be different in newer versions. The - analysis comprises a number of blob-level tasks, as set by the `blob_count` parameter - and a number of compare-and-exchange operations on linearizable registers, as - set by the `register_operation_count` parameter. These tasks are distributed - over the data and master-eligible nodes in the cluster for execution. For most - blob-level tasks, the executing node first writes a blob to the repository and - then instructs some of the other nodes in the cluster to attempt to read the - data it just wrote. The size of the blob is chosen randomly, according to the - `max_blob_size` and `max_total_data_size` parameters. If any of these reads fails - then the repository does not implement the necessary read-after-write semantics - that Elasticsearch requires. For some blob-level tasks, the executing node will - instruct some of its peers to attempt to read the data before the writing process - completes. These reads are permitted to fail, but must not return partial data. - If any read returns partial data then the repository does not implement the necessary - atomicity semantics that Elasticsearch requires. For some blob-level tasks, the - executing node will overwrite the blob while its peers are reading it. In this - case the data read may come from either the original or the overwritten blob, - but the read operation must not return partial data or a mix of data from the - two blobs. If any of these reads returns partial data or a mix of the two blobs - then the repository does not implement the necessary atomicity semantics that - Elasticsearch requires for overwrites. The executing node will use a variety - of different methods to write the blob. For instance, where applicable, it will - use both single-part and multi-part uploads. Similarly, the reading nodes will - use a variety of different methods to read the data back again. For instance - they may read the entire blob from start to end or may read only a subset of - the data. For some blob-level tasks, the executing node will cancel the write - before it is complete. In this case, it still instructs some of the other nodes - in the cluster to attempt to read the blob but all of these reads must fail to - find the blob. Linearizable registers are special blobs that Elasticsearch manipulates - using an atomic compare-and-exchange operation. This operation ensures correct - and strongly-consistent behavior even when the blob is accessed by multiple nodes - at the same time. The detailed implementation of the compare-and-exchange operation - on linearizable registers varies by repository type. Repository analysis verifies - that that uncontended compare-and-exchange operations on a linearizable register - blob always succeed. Repository analysis also verifies that contended operations - either succeed or report the contention but do not return incorrect results. - If an operation fails due to contention, Elasticsearch retries the operation - until it succeeds. Most of the compare-and-exchange operations performed by repository - analysis atomically increment a counter which is represented as an 8-byte blob. - Some operations also verify the behavior on small blobs with sizes other than - 8 bytes. + .. raw:: html + +

Analyze a snapshot repository. + Analyze the performance characteristics and any incorrect behaviour found in a repository.

+

The response exposes implementation details of the analysis which may change from version to version. + The response body format is therefore not considered stable and may be different in newer versions.

+

There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. + Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system.

+

The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. + Run your first analysis with the default parameter values to check for simple problems. + If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. + Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. + Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once.

+

If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. + This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. + If so, this storage system is not suitable for use as a snapshot repository. + You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects.

+

If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. + You can use this information to determine the performance of your storage system. + If any operation fails or returns an incorrect result, the API returns an error. + If the API returns an error, it may not have removed all the data it wrote to the repository. + The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. + You should verify that this location has been cleaned up correctly. + If there is still leftover data at the specified location, you should manually remove it.

+

If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. + Some clients are configured to close their connection if no response is received within a certain timeout. + An analysis takes a long time to complete so you might need to relax any such client-side timeouts. + On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. + The path to the leftover data is recorded in the Elasticsearch logs. + You should verify that this location has been cleaned up correctly. + If there is still leftover data at the specified location, you should manually remove it.

+

If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. + The analysis attempts to detect common bugs but it does not offer 100% coverage. + Additionally, it does not test the following:

+
    +
  • Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster.
  • +
  • Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted.
  • +
  • Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results.
  • +
+

IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. + This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. + You must ensure this load does not affect other users of these systems. + Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume.

+

NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.

+

NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. + A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. + This indicates it behaves incorrectly in ways that the former version did not detect. + You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch.

+

NOTE: This API may not work correctly in a mixed-version cluster.

+

Implementation details

+

NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions.

+

The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. + These tasks are distributed over the data and master-eligible nodes in the cluster for execution.

+

For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. + The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. + If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires.

+

For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. + These reads are permitted to fail, but must not return partial data. + If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires.

+

For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. + In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. + If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites.

+

The executing node will use a variety of different methods to write the blob. + For instance, where applicable, it will use both single-part and multi-part uploads. + Similarly, the reading nodes will use a variety of different methods to read the data back again. + For instance they may read the entire blob from start to end or may read only a subset of the data.

+

For some blob-level tasks, the executing node will cancel the write before it is complete. + In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob.

+

Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. + This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. + The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. + Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. + Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. + If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. + Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. + Some operations also verify the behavior on small blobs with sizes other than 8 bytes.

+ ``_ @@ -868,40 +855,31 @@ async def repository_verify_integrity( verify_blob_contents: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Verify the repository integrity. Verify the integrity of the contents of a snapshot - repository. This API enables you to perform a comprehensive check of the contents - of a repository, looking for any anomalies in its data or metadata which might - prevent you from restoring snapshots from the repository or which might cause - future snapshot create or delete operations to fail. If you suspect the integrity - of the contents of one of your snapshot repositories, cease all write activity - to this repository immediately, set its `read_only` option to `true`, and use - this API to verify its integrity. Until you do so: * It may not be possible to - restore some snapshots from this repository. * Searchable snapshots may report - errors when searched or may have unassigned shards. * Taking snapshots into this - repository may fail or may appear to succeed but have created a snapshot which - cannot be restored. * Deleting snapshots from this repository may fail or may - appear to succeed but leave the underlying data on disk. * Continuing to write - to the repository while it is in an invalid state may causing additional damage - to its contents. If the API finds any problems with the integrity of the contents - of your repository, Elasticsearch will not be able to repair the damage. The - only way to bring the repository back into a fully working state after its contents - have been damaged is by restoring its contents from a repository backup which - was taken before the damage occurred. You must also identify what caused the - damage and take action to prevent it from happening again. If you cannot restore - a repository backup, register a new repository and use this for all future snapshot - operations. In some cases it may be possible to recover some of the contents - of a damaged repository, either by restoring as many of its snapshots as needed - and taking new snapshots of the restored data, or by using the reindex API to - copy data from any searchable snapshots mounted from the damaged repository. - Avoid all operations which write to the repository while the verify repository - integrity API is running. If something changes the repository contents while - an integrity verification is running then Elasticsearch may incorrectly report - having detected some anomalies in its contents due to the concurrent writes. - It may also incorrectly fail to report some anomalies that the concurrent writes - prevented it from detecting. NOTE: This API is intended for exploratory use by - humans. You should expect the request parameters and the response format to vary - in future versions. NOTE: This API may not work correctly in a mixed-version - cluster. + .. raw:: html + +

Verify the repository integrity. + Verify the integrity of the contents of a snapshot repository.

+

This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail.

+

If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. + Until you do so:

+
    +
  • It may not be possible to restore some snapshots from this repository.
  • +
  • Searchable snapshots may report errors when searched or may have unassigned shards.
  • +
  • Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored.
  • +
  • Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk.
  • +
  • Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents.
  • +
+

If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. + The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. + You must also identify what caused the damage and take action to prevent it from happening again.

+

If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. + In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository.

+

Avoid all operations which write to the repository while the verify repository integrity API is running. + If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. + It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting.

+

NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.

+

NOTE: This API may not work correctly in a mixed-version cluster.

+ ``_ @@ -998,20 +976,20 @@ async def restore( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Restore a snapshot. Restore a snapshot of a cluster or data streams and indices. - You can restore a snapshot only to a running cluster with an elected master node. - The snapshot repository must be registered and available to the cluster. The - snapshot and cluster versions must be compatible. To restore a snapshot, the - cluster's global metadata must be writable. Ensure there are't any cluster blocks - that prevent writes. The restore operation ignores index blocks. Before you restore - a data stream, ensure the cluster contains a matching index template with data - streams enabled. To check, use the index management feature in Kibana or the - get index template API: ``` GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - ``` If no such template exists, you can create one or restore a cluster state - that contains one. Without a matching index template, a data stream can't roll - over or create backing indices. If your snapshot contains data from App Search - or Workplace Search, you must restore the Enterprise Search encryption key before - you restore the snapshot. + .. raw:: html + +

Restore a snapshot. + Restore a snapshot of a cluster or data streams and indices.

+

You can restore a snapshot only to a running cluster with an elected master node. + The snapshot repository must be registered and available to the cluster. + The snapshot and cluster versions must be compatible.

+

To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks.

+

Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API:

+
GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream
+          
+

If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices.

+

If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot.

+ ``_ @@ -1104,18 +1082,18 @@ async def status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the snapshot status. Get a detailed description of the current state for - each shard participating in the snapshot. Note that this API should be used only - to obtain detailed shard-level information for ongoing snapshots. If this detail - is not needed or you want to obtain information about one or more existing snapshots, - use the get snapshot API. WARNING: Using the API to return the status of any - snapshots other than currently running snapshots can be expensive. The API requires - a read from the repository for each shard in each snapshot. For example, if you - have 100 snapshots with 1,000 shards each, an API request that includes all snapshots - will require 100,000 reads (100 snapshots x 1,000 shards). Depending on the latency - of your storage, such requests can take an extremely long time to return results. - These requests can also tax machine resources and, when using cloud storage, - incur high processing costs. + .. raw:: html + +

Get the snapshot status. + Get a detailed description of the current state for each shard participating in the snapshot. + Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. + If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API.

+

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

+

Depending on the latency of your storage, such requests can take an extremely long time to return results. + These requests can also tax machine resources and, when using cloud storage, incur high processing costs.

+ ``_ @@ -1174,8 +1152,11 @@ async def verify_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Verify a snapshot repository. Check for common misconfigurations in a snapshot - repository. + .. raw:: html + +

Verify a snapshot repository. + Check for common misconfigurations in a snapshot repository.

+ ``_ diff --git a/elasticsearch/_async/client/sql.py b/elasticsearch/_async/client/sql.py index 2a93a5837..39ac7c5b9 100644 --- a/elasticsearch/_async/client/sql.py +++ b/elasticsearch/_async/client/sql.py @@ -39,7 +39,10 @@ async def clear_cursor( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear an SQL search cursor. + .. raw:: html + +

Clear an SQL search cursor.

+ ``_ @@ -84,11 +87,17 @@ async def delete_async( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an async SQL search. Delete an async SQL search or a stored synchronous - SQL search. If the search is still running, the API cancels it. If the Elasticsearch - security features are enabled, only the following users can use this API to delete - a search: * Users with the `cancel_task` cluster privilege. * The user who first - submitted the search. + .. raw:: html + +

Delete an async SQL search. + Delete an async SQL search or a stored synchronous SQL search. + If the search is still running, the API cancels it.

+

If the Elasticsearch security features are enabled, only the following users can use this API to delete a search:

+
    +
  • Users with the cancel_task cluster privilege.
  • +
  • The user who first submitted the search.
  • +
+ ``_ @@ -134,10 +143,12 @@ async def get_async( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get async SQL search results. Get the current status and available results for - an async SQL search or stored synchronous SQL search. If the Elasticsearch security - features are enabled, only the user who first submitted the SQL search can retrieve - the search using this API. + .. raw:: html + +

Get async SQL search results. + Get the current status and available results for an async SQL search or stored synchronous SQL search.

+

If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API.

+ ``_ @@ -195,8 +206,11 @@ async def get_async_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the async SQL search status. Get the current status of an async SQL search - or a stored synchronous SQL search. + .. raw:: html + +

Get the async SQL search status. + Get the current status of an async SQL search or a stored synchronous SQL search.

+ ``_ @@ -281,7 +295,11 @@ async def query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get SQL search results. Run an SQL request. + .. raw:: html + +

Get SQL search results. + Run an SQL request.

+ ``_ @@ -402,9 +420,12 @@ async def translate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Translate SQL into Elasticsearch queries. Translate an SQL search into a search - API request containing Query DSL. It accepts the same request body parameters - as the SQL search API, excluding `cursor`. + .. raw:: html + +

Translate SQL into Elasticsearch queries. + Translate an SQL search into a search API request containing Query DSL. + It accepts the same request body parameters as the SQL search API, excluding cursor.

+ ``_ diff --git a/elasticsearch/_async/client/ssl.py b/elasticsearch/_async/client/ssl.py index 6ab683691..9fc313614 100644 --- a/elasticsearch/_async/client/ssl.py +++ b/elasticsearch/_async/client/ssl.py @@ -35,23 +35,22 @@ async def certificates( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get SSL certificates. Get information about the X.509 certificates that are used - to encrypt communications in the cluster. The API returns a list that includes - certificates from all TLS contexts including: - Settings for transport and HTTP - interfaces - TLS settings that are used within authentication realms - TLS settings - for remote monitoring exporters The list includes certificates that are used - for configuring trust, such as those configured in the `xpack.security.transport.ssl.truststore` - and `xpack.security.transport.ssl.certificate_authorities` settings. It also - includes certificates that are used for configuring server identity, such as - `xpack.security.http.ssl.keystore` and `xpack.security.http.ssl.certificate settings`. - The list does not include certificates that are sourced from the default SSL - context of the Java Runtime Environment (JRE), even if those certificates are - in use within Elasticsearch. NOTE: When a PKCS#11 token is configured as the - truststore of the JRE, the API returns all the certificates that are included - in the PKCS#11 token irrespective of whether these are used in the Elasticsearch - TLS configuration. If Elasticsearch is configured to use a keystore or truststore, - the API output includes all certificates in that store, even though some of the - certificates might not be in active use within the cluster. + .. raw:: html + +

Get SSL certificates.

+

Get information about the X.509 certificates that are used to encrypt communications in the cluster. + The API returns a list that includes certificates from all TLS contexts including:

+
    +
  • Settings for transport and HTTP interfaces
  • +
  • TLS settings that are used within authentication realms
  • +
  • TLS settings for remote monitoring exporters
  • +
+

The list includes certificates that are used for configuring trust, such as those configured in the xpack.security.transport.ssl.truststore and xpack.security.transport.ssl.certificate_authorities settings. + It also includes certificates that are used for configuring server identity, such as xpack.security.http.ssl.keystore and xpack.security.http.ssl.certificate settings.

+

The list does not include certificates that are sourced from the default SSL context of the Java Runtime Environment (JRE), even if those certificates are in use within Elasticsearch.

+

NOTE: When a PKCS#11 token is configured as the truststore of the JRE, the API returns all the certificates that are included in the PKCS#11 token irrespective of whether these are used in the Elasticsearch TLS configuration.

+

If Elasticsearch is configured to use a keystore or truststore, the API output includes all certificates in that store, even though some of the certificates might not be in active use within the cluster.

+ ``_ """ diff --git a/elasticsearch/_async/client/synonyms.py b/elasticsearch/_async/client/synonyms.py index e6fe303fc..21cbd8084 100644 --- a/elasticsearch/_async/client/synonyms.py +++ b/elasticsearch/_async/client/synonyms.py @@ -36,21 +36,22 @@ async def delete_synonym( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a synonym set. You can only delete a synonyms set that is not in use by - any index analyzer. Synonyms sets can be used in synonym graph token filters - and synonym token filters. These synonym filters can be used as part of search - analyzers. Analyzers need to be loaded when an index is restored (such as when - a node starts, or the index becomes open). Even if the analyzer is not used on - any field mapping, it still needs to be loaded on the index recovery phase. If - any analyzers cannot be loaded, the index becomes unavailable and the cluster - status becomes red or yellow as index shards are not available. To prevent that, - synonyms sets that are used in analyzers can't be deleted. A delete request in - this case will return a 400 response code. To remove a synonyms set, you must - first remove all indices that contain analyzers using it. You can migrate an - index by creating a new index that does not contain the token filter with the - synonyms set, and use the reindex API in order to copy over the index data. Once - finished, you can delete the index. When the synonyms set is not used in analyzers, - you will be able to delete it. + .. raw:: html + +

Delete a synonym set.

+

You can only delete a synonyms set that is not in use by any index analyzer.

+

Synonyms sets can be used in synonym graph token filters and synonym token filters. + These synonym filters can be used as part of search analyzers.

+

Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). + Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase.

+

If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. + To prevent that, synonyms sets that are used in analyzers can't be deleted. + A delete request in this case will return a 400 response code.

+

To remove a synonyms set, you must first remove all indices that contain analyzers using it. + You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. + Once finished, you can delete the index. + When the synonyms set is not used in analyzers, you will be able to delete it.

+ ``_ @@ -91,7 +92,11 @@ async def delete_synonym_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a synonym rule. Delete a synonym rule from a synonym set. + .. raw:: html + +

Delete a synonym rule. + Delete a synonym rule from a synonym set.

+ ``_ @@ -141,7 +146,10 @@ async def get_synonym( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a synonym set. + .. raw:: html + +

Get a synonym set.

+ ``_ @@ -188,7 +196,11 @@ async def get_synonym_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a synonym rule. Get a synonym rule from a synonym set. + .. raw:: html + +

Get a synonym rule. + Get a synonym rule from a synonym set.

+ ``_ @@ -237,7 +249,11 @@ async def get_synonyms_sets( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all synonym sets. Get a summary of all defined synonym sets. + .. raw:: html + +

Get all synonym sets. + Get a summary of all defined synonym sets.

+ ``_ @@ -286,12 +302,14 @@ async def put_synonym( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a synonym set. Synonyms sets are limited to a maximum of 10,000 - synonym rules per set. If you need to manage more synonym rules, you can create - multiple synonym sets. When an existing synonyms set is updated, the search analyzers - that use the synonyms set are reloaded automatically for all indices. This is - equivalent to invoking the reload search analyzers API for all indices that use - the synonyms set. + .. raw:: html + +

Create or update a synonym set. + Synonyms sets are limited to a maximum of 10,000 synonym rules per set. + If you need to manage more synonym rules, you can create multiple synonym sets.

+

When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. + This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set.

+ ``_ @@ -344,10 +362,13 @@ async def put_synonym_rule( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a synonym rule. Create or update a synonym rule in a synonym - set. If any of the synonym rules included is invalid, the API returns an error. - When you update a synonym rule, all analyzers using the synonyms set will be - reloaded automatically to reflect the new rule. + .. raw:: html + +

Create or update a synonym rule. + Create or update a synonym rule in a synonym set.

+

If any of the synonym rules included is invalid, the API returns an error.

+

When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule.

+ ``_ diff --git a/elasticsearch/_async/client/tasks.py b/elasticsearch/_async/client/tasks.py index fa589affb..c3ad38970 100644 --- a/elasticsearch/_async/client/tasks.py +++ b/elasticsearch/_async/client/tasks.py @@ -47,19 +47,18 @@ async def cancel( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancel a task. WARNING: The task management API is new and should still be considered - a beta feature. The API may change in ways that are not backwards compatible. - A task may continue to run for some time after it has been cancelled because - it may not be able to safely stop its current activity straight away. It is also - possible that Elasticsearch must complete its work on other tasks before it can - process the cancellation. The get task information API will continue to list - these cancelled tasks until they complete. The cancelled flag in the response - indicates that the cancellation command has been processed and the task will - stop as soon as possible. To troubleshoot why a cancelled task does not complete - promptly, use the get task information API with the `?detailed` parameter to - identify the other tasks the system is running. You can also use the node hot - threads API to obtain detailed information about the work the system is doing - instead of completing the cancelled task. + .. raw:: html + +

Cancel a task.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. + It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. + The get task information API will continue to list these cancelled tasks until they complete. + The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible.

+

To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. + You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task.

+ ``_ @@ -120,11 +119,14 @@ async def get( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get task information. Get information about a task currently running in the cluster. - WARNING: The task management API is new and should still be considered a beta - feature. The API may change in ways that are not backwards compatible. If the - task identifier is not found, a 404 response code indicates that there are no - resources that match the request. + .. raw:: html + +

Get task information. + Get information about a task currently running in the cluster.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

If the task identifier is not found, a 404 response code indicates that there are no resources that match the request.

+ ``_ @@ -182,27 +184,60 @@ async def list( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all tasks. Get information about the tasks currently running on one or more - nodes in the cluster. WARNING: The task management API is new and should still - be considered a beta feature. The API may change in ways that are not backwards - compatible. **Identifying running tasks** The `X-Opaque-Id header`, when provided - on the HTTP request header, is going to be returned as a header in the response - as well as in the headers field for in the task information. This enables you - to track certain calls or associate certain tasks with the client that started - them. For example: ``` curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - ``` The API returns the following result: ``` HTTP/1.1 200 OK X-Opaque-Id: 123456 - content-type: application/json; charset=UTF-8 content-length: 831 { "tasks" : - { "u5lcZHqcQhu-rUoFaqDphA:45" : { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 45, - "type" : "transport", "action" : "cluster:monitor/tasks/lists", "start_time_in_millis" - : 1513823752749, "running_time_in_nanos" : 293139, "cancellable" : false, "headers" - : { "X-Opaque-Id" : "123456" }, "children" : [ { "node" : "u5lcZHqcQhu-rUoFaqDphA", - "id" : 46, "type" : "direct", "action" : "cluster:monitor/tasks/lists[n]", "start_time_in_millis" - : 1513823752750, "running_time_in_nanos" : 92133, "cancellable" : false, "parent_task_id" - : "u5lcZHqcQhu-rUoFaqDphA:45", "headers" : { "X-Opaque-Id" : "123456" } } ] } - } } ``` In this example, `X-Opaque-Id: 123456` is the ID as a part of the response - header. The `X-Opaque-Id` in the task `headers` is the ID for the task that was - initiated by the REST request. The `X-Opaque-Id` in the children `headers` is - the child task of the task that was initiated by the REST request. + .. raw:: html + +

Get all tasks. + Get information about the tasks currently running on one or more nodes in the cluster.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

Identifying running tasks

+

The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. + This enables you to track certain calls or associate certain tasks with the client that started them. + For example:

+
curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents"
+          
+

The API returns the following result:

+
HTTP/1.1 200 OK
+          X-Opaque-Id: 123456
+          content-type: application/json; charset=UTF-8
+          content-length: 831
+
+          {
+            "tasks" : {
+              "u5lcZHqcQhu-rUoFaqDphA:45" : {
+                "node" : "u5lcZHqcQhu-rUoFaqDphA",
+                "id" : 45,
+                "type" : "transport",
+                "action" : "cluster:monitor/tasks/lists",
+                "start_time_in_millis" : 1513823752749,
+                "running_time_in_nanos" : 293139,
+                "cancellable" : false,
+                "headers" : {
+                  "X-Opaque-Id" : "123456"
+                },
+                "children" : [
+                  {
+                    "node" : "u5lcZHqcQhu-rUoFaqDphA",
+                    "id" : 46,
+                    "type" : "direct",
+                    "action" : "cluster:monitor/tasks/lists[n]",
+                    "start_time_in_millis" : 1513823752750,
+                    "running_time_in_nanos" : 92133,
+                    "cancellable" : false,
+                    "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45",
+                    "headers" : {
+                      "X-Opaque-Id" : "123456"
+                    }
+                  }
+                ]
+              }
+            }
+           }
+          
+

In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. + The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. + The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request.

+ ``_ diff --git a/elasticsearch/_async/client/text_structure.py b/elasticsearch/_async/client/text_structure.py index f06f0940a..e5d7b1e12 100644 --- a/elasticsearch/_async/client/text_structure.py +++ b/elasticsearch/_async/client/text_structure.py @@ -53,22 +53,24 @@ async def find_field_structure( timestamp_format: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Find the structure of a text field. Find the structure of a text field in an - Elasticsearch index. This API provides a starting point for extracting further - information from log messages already ingested into Elasticsearch. For example, - if you have ingested data into a very simple index that has just `@timestamp` - and message fields, you can use this API to see what common structure exists - in the message field. The response from the API contains: * Sample messages. - * Statistics that reveal the most common values for all fields detected within - the text and basic numeric statistics for numeric fields. * Information about - the structure of the text, which is useful when you write ingest configurations - to index it or similarly formatted text. * Appropriate mappings for an Elasticsearch - index, which you could use to ingest the text. All this information can be calculated - by the structure finder with no guidance. However, you can optionally override - some of the decisions about the text structure by specifying one or more query - parameters. If the structure finder produces unexpected results, specify the - `explain` query parameter and an explanation will appear in the response. It - helps determine why the returned structure was chosen. + .. raw:: html + +

Find the structure of a text field. + Find the structure of a text field in an Elasticsearch index.

+

This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. + For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field.

+

The response from the API contains:

+
    +
  • Sample messages.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.
  • +
  • Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+

If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. + It helps determine why the returned structure was chosen.

+ ``_ @@ -237,23 +239,25 @@ async def find_message_structure( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Find the structure of text messages. Find the structure of a list of text messages. - The messages must contain data that is suitable to be ingested into Elasticsearch. - This API provides a starting point for ingesting data into Elasticsearch in a - format that is suitable for subsequent use with other Elastic Stack functionality. - Use this API rather than the find text structure API if your input text has already - been split up into separate messages by some other process. The response from - the API contains: * Sample messages. * Statistics that reveal the most common - values for all fields detected within the text and basic numeric statistics for - numeric fields. * Information about the structure of the text, which is useful - when you write ingest configurations to index it or similarly formatted text. - Appropriate mappings for an Elasticsearch index, which you could use to ingest - the text. All this information can be calculated by the structure finder with - no guidance. However, you can optionally override some of the decisions about - the text structure by specifying one or more query parameters. If the structure - finder produces unexpected results, specify the `explain` query parameter and - an explanation will appear in the response. It helps determine why the returned - structure was chosen. + .. raw:: html + +

Find the structure of text messages. + Find the structure of a list of text messages. + The messages must contain data that is suitable to be ingested into Elasticsearch.

+

This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. + Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.

+

The response from the API contains:

+
    +
  • Sample messages.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. + Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+

If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. + It helps determine why the returned structure was chosen.

+ ``_ @@ -410,22 +414,24 @@ async def find_structure( timestamp_format: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Find the structure of a text file. The text file must contain data that is suitable - to be ingested into Elasticsearch. This API provides a starting point for ingesting - data into Elasticsearch in a format that is suitable for subsequent use with - other Elastic Stack functionality. Unlike other Elasticsearch endpoints, the - data that is posted to this endpoint does not need to be UTF-8 encoded and in - JSON format. It must, however, be text; binary text formats are not currently - supported. The size is limited to the Elasticsearch HTTP receive buffer size, - which defaults to 100 Mb. The response from the API contains: * A couple of messages - from the beginning of the text. * Statistics that reveal the most common values - for all fields detected within the text and basic numeric statistics for numeric - fields. * Information about the structure of the text, which is useful when you - write ingest configurations to index it or similarly formatted text. * Appropriate - mappings for an Elasticsearch index, which you could use to ingest the text. - All this information can be calculated by the structure finder with no guidance. - However, you can optionally override some of the decisions about the text structure - by specifying one or more query parameters. + .. raw:: html + +

Find the structure of a text file. + The text file must contain data that is suitable to be ingested into Elasticsearch.

+

This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. + Unlike other Elasticsearch endpoints, the data that is posted to this endpoint does not need to be UTF-8 encoded and in JSON format. + It must, however, be text; binary text formats are not currently supported. + The size is limited to the Elasticsearch HTTP receive buffer size, which defaults to 100 Mb.

+

The response from the API contains:

+
    +
  • A couple of messages from the beginning of the text.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.
  • +
  • Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+ ``_ @@ -607,9 +613,12 @@ async def test_grok_pattern( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Test a Grok pattern. Test a Grok pattern on one or more lines of text. The API - indicates whether the lines match the pattern together with the offsets and lengths - of the matched substrings. + .. raw:: html + +

Test a Grok pattern. + Test a Grok pattern on one or more lines of text. + The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings.

+ ``_ diff --git a/elasticsearch/_async/client/transform.py b/elasticsearch/_async/client/transform.py index 52d4c886f..010f6de9a 100644 --- a/elasticsearch/_async/client/transform.py +++ b/elasticsearch/_async/client/transform.py @@ -39,7 +39,11 @@ async def delete_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a transform. Deletes a transform. + .. raw:: html + +

Delete a transform. + Deletes a transform.

+ ``_ @@ -99,7 +103,11 @@ async def get_transform( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get transforms. Retrieves configuration information for transforms. + .. raw:: html + +

Get transforms. + Retrieves configuration information for transforms.

+ ``_ @@ -168,7 +176,11 @@ async def get_transform_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get transform stats. Retrieves usage information for transforms. + .. raw:: html + +

Get transform stats. + Retrieves usage information for transforms.

+ ``_ @@ -249,12 +261,14 @@ async def preview_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview a transform. Generates a preview of the results that you will get when - you create a transform with the same configuration. It returns a maximum of 100 - results. The calculations are based on all the current data in the source index. - It also generates a list of mappings and settings for the destination index. - These values are determined based on the field types of the source index and - the transform aggregations. + .. raw:: html + +

Preview a transform. + Generates a preview of the results that you will get when you create a transform with the same configuration.

+

It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also + generates a list of mappings and settings for the destination index. These values are determined based on the field + types of the source index and the transform aggregations.

+ ``_ @@ -371,27 +385,27 @@ async def put_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a transform. Creates a transform. A transform copies data from source - indices, transforms it, and persists it into an entity-centric destination index. - You can also think of the destination index as a two-dimensional tabular data - structure (known as a data frame). The ID for each document in the data frame - is generated from a hash of the entity, so there is a unique row per entity. - You must choose either the latest or pivot method for your transform; you cannot - use both in a single transform. If you choose to use the pivot method for your - transform, the entities are defined by the set of `group_by` fields in the pivot - object. If you choose to use the latest method, the entities are defined by the - `unique_key` field values in the latest object. You must have `create_index`, - `index`, and `read` privileges on the destination index and `read` and `view_index_metadata` - privileges on the source indices. When Elasticsearch security features are enabled, - the transform remembers which roles the user that created it had at the time - of creation and uses those same roles. If those roles do not have the required - privileges on the source and destination indices, the transform fails when it - attempts unauthorized operations. NOTE: You must use Kibana or this API to create - a transform. Do not add a transform directly into any `.transform-internal*` - indices using the Elasticsearch index API. If Elasticsearch security features - are enabled, do not give users any privileges on `.transform-internal*` indices. - If you used transforms prior to 7.5, also do not give users any privileges on - `.data-frame-internal*` indices. + .. raw:: html + +

Create a transform. + Creates a transform.

+

A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as + a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a + unique row per entity.

+

You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If + you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in + the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values + in the latest object.

+

You must have create_index, index, and read privileges on the destination index and read and + view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the + transform remembers which roles the user that created it had at the time of creation and uses those same roles. If + those roles do not have the required privileges on the source and destination indices, the transform fails when it + attempts unauthorized operations.

+

NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any + .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do + not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not + give users any privileges on .data-frame-internal* indices.

+ ``_ @@ -491,9 +505,13 @@ async def reset_transform( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset a transform. Resets 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. + .. raw:: html + +

Reset a transform. + Resets 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.

+ ``_ @@ -541,11 +559,15 @@ async def schedule_now_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 is called again in the meantime. + .. 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 + is called again in the meantime.

+ ``_ @@ -592,24 +614,24 @@ async def start_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a transform. Starts 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 destination index are - derived from scripts (as in the case of `scripted_metric` or `bucket_script` - aggregations), the transform uses dynamic mappings unless an index template exists. - If it is a latest transform, it does not deduce mapping definitions; it uses - dynamic mappings. To use explicit mappings, create the destination index before - you start the transform. Alternatively, you can create an index template, though - it does not affect the deduced mappings in a pivot transform. When the transform - starts, a series of validations occur to ensure its success. If you deferred - validation when you created the transform, they occur when you start the transform—​with - the exception of privilege checks. When Elasticsearch security features are enabled, - the transform remembers which roles the user that created it had at the time - of creation and uses those same roles. If those roles do not have the required - privileges on the source and destination indices, the transform fails when it - attempts unauthorized operations. + .. raw:: html + +

Start a transform. + Starts 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 + destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), + the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce + mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you + start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings + in a pivot transform.

+

When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you + created the transform, they occur when you start the transform—​with the exception of privilege checks. When + Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the + time of creation and uses those same roles. If those roles do not have the required privileges on the source and + destination indices, the transform fails when it attempts unauthorized operations.

+ ``_ @@ -663,7 +685,11 @@ async def stop_transform( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop transforms. Stops one or more transforms. + .. raw:: html + +

Stop transforms. + Stops one or more transforms.

+ ``_ @@ -756,14 +782,16 @@ async def update_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a transform. Updates certain properties of a transform. All updated properties - except `description` do not take effect until after the transform starts the - next checkpoint, thus there is data consistency in each checkpoint. To use this - API, you must have `read` and `view_index_metadata` privileges for the source - indices. You must also have `index` and `read` privileges for the destination - index. When Elasticsearch security features are enabled, the transform remembers - which roles the user who updated it had at the time of update and runs with those - privileges. + .. raw:: html + +

Update a transform. + Updates certain properties of a transform.

+

All updated properties except description do not take effect until after the transform starts the next checkpoint, + thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata + privileges for the source indices. You must also have index and read privileges for the destination index. When + Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the + time of update and runs with those privileges.

+ ``_ @@ -844,20 +872,21 @@ async def upgrade_transforms( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. The upgrade does - not affect the source and destination indices. The upgrade also does not affect - the roles that transforms use when Elasticsearch security features are enabled; - the role used to read source data and write to the destination index remains - unchanged. If a transform upgrade step fails, the upgrade stops and an error - is returned about the underlying issue. Resolve the issue then re-run the process - again. A summary is returned when the upgrade is finished. To ensure continuous - transforms remain running during a major version upgrade of the cluster – for - example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading - the cluster. You may want to perform a recent cluster backup prior to the upgrade. + .. raw:: html + +

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. + The upgrade does not affect the source and destination indices. + The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged.

+

If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. + Resolve the issue then re-run the process again. + A summary is returned when the upgrade is finished.

+

To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. + You may want to perform a recent cluster backup prior to the upgrade.

+ ``_ diff --git a/elasticsearch/_async/client/watcher.py b/elasticsearch/_async/client/watcher.py index 26be17552..83615b26b 100644 --- a/elasticsearch/_async/client/watcher.py +++ b/elasticsearch/_async/client/watcher.py @@ -37,14 +37,16 @@ async def ack_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Acknowledge a watch. Acknowledging a watch enables you to manually throttle the - execution of the watch's actions. The acknowledgement state of an action is stored - in the `status.actions..ack.state` structure. IMPORTANT: If the specified - watch is currently being executed, this API will return an error The reason for - this behavior is to prevent overwriting the watch status from a watch execution. - Acknowledging an action throttles further executions of that action until its - `ack.state` is reset to `awaits_successful_execution`. This happens when the - condition of the watch is not met (the condition evaluates to false). + .. raw:: html + +

Acknowledge a watch. + Acknowledging a watch enables you to manually throttle the execution of the watch's actions.

+

The acknowledgement state of an action is stored in the status.actions.<id>.ack.state structure.

+

IMPORTANT: If the specified watch is currently being executed, this API will return an error + The reason for this behavior is to prevent overwriting the watch status from a watch execution.

+

Acknowledging an action throttles further executions of that action until its ack.state is reset to awaits_successful_execution. + This happens when the condition of the watch is not met (the condition evaluates to false).

+ ``_ @@ -96,7 +98,11 @@ async def activate_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Activate a watch. A watch can be either active or inactive. + .. raw:: html + +

Activate a watch. + A watch can be either active or inactive.

+ ``_ @@ -136,7 +142,11 @@ async def deactivate_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deactivate a watch. A watch can be either active or inactive. + .. raw:: html + +

Deactivate a watch. + A watch can be either active or inactive.

+ ``_ @@ -176,13 +186,15 @@ async def delete_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a watch. When the watch is removed, the document representing the watch - in the `.watches` index is gone and it will never be run again. Deleting a watch - does not delete any watch execution records related to this watch from the watch - history. IMPORTANT: Deleting a watch must be done by using only this API. Do - not delete the watch directly from the `.watches` index using the Elasticsearch - delete document API When Elasticsearch security features are enabled, make sure - no write privileges are granted to anyone for the `.watches` index. + .. raw:: html + +

Delete a watch. + When the watch is removed, the document representing the watch in the .watches index is gone and it will never be run again.

+

Deleting a watch does not delete any watch execution records related to this watch from the watch history.

+

IMPORTANT: Deleting a watch must be done by using only this API. + Do not delete the watch directly from the .watches index using the Elasticsearch delete document API + When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the .watches index.

+ ``_ @@ -251,21 +263,19 @@ async def execute_watch( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a watch. This API can be used to force execution of the watch outside of - its triggering logic or to simulate the watch execution for debugging purposes. - For testing and debugging purposes, you also have fine-grained control on how - the watch runs. You can run the watch without running all of its actions or alternatively - by simulating them. You can also force execution by ignoring the watch condition - and control whether a watch record would be written to the watch history after - it runs. You can use the run watch API to run watches that are not yet registered - by specifying the watch definition inline. This serves as great tool for testing - and debugging your watches prior to adding them to Watcher. When Elasticsearch - security features are enabled on your cluster, watches are run with the privileges - of the user that stored the watches. If your user is allowed to read index `a`, - but not index `b`, then the exact same set of rules will apply during execution - of a watch. When using the run watch API, the authorization data of the user - that called the API will be used as a base, instead of the information who stored - the watch. + .. raw:: html + +

Run a watch. + This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.

+

For testing and debugging purposes, you also have fine-grained control on how the watch runs. + You can run the watch without running all of its actions or alternatively by simulating them. + You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.

+

You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline. + This serves as great tool for testing and debugging your watches prior to adding them to Watcher.

+

When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches. + If your user is allowed to read index a, but not index b, then the exact same set of rules will apply during execution of a watch.

+

When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.

+ ``_ @@ -348,9 +358,12 @@ async def get_settings( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get Watcher index settings. Get settings for the Watcher internal index (`.watches`). - Only a subset of settings are shown, for example `index.auto_expand_replicas` - and `index.number_of_replicas`. + .. raw:: html + +

Get Watcher index settings. + Get settings for the Watcher internal index (.watches). + Only a subset of settings are shown, for example index.auto_expand_replicas and index.number_of_replicas.

+ ``_ @@ -392,7 +405,10 @@ async def get_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a watch. + .. raw:: html + +

Get a watch.

+ ``_ @@ -456,17 +472,18 @@ async def put_watch( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a watch. When a watch is registered, a new document that represents - the watch is added to the `.watches` index and its trigger is immediately registered - with the relevant trigger engine. Typically for the `schedule` trigger, the scheduler - is the trigger engine. IMPORTANT: You must use Kibana or this API to create a - watch. Do not add a watch directly to the `.watches` index by using the Elasticsearch - index API. If Elasticsearch security features are enabled, do not give users - write privileges on the `.watches` index. When you add a watch you can also define - its initial active state by setting the *active* parameter. When Elasticsearch - security features are enabled, your watch can index or search only on indices - for which the user that stored the watch has privileges. If the user is able - to read index `a`, but not index `b`, the same will apply when the watch runs. + .. raw:: html + +

Create or update a watch. + When a watch is registered, a new document that represents the watch is added to the .watches index and its trigger is immediately registered with the relevant trigger engine. + Typically for the schedule trigger, the scheduler is the trigger engine.

+

IMPORTANT: You must use Kibana or this API to create a watch. + Do not add a watch directly to the .watches index by using the Elasticsearch index API. + If Elasticsearch security features are enabled, do not give users write privileges on the .watches index.

+

When you add a watch you can also define its initial active state by setting the active parameter.

+

When Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges. + If the user is able to read index a, but not index b, the same will apply when the watch runs.

+ ``_ @@ -574,9 +591,12 @@ async def query_watches( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Query watches. Get all registered watches in a paginated manner and optionally - filter watches by a query. Note that only the `_id` and `metadata.*` fields are - queryable or sortable. + .. raw:: html + +

Query watches. + Get all registered watches in a paginated manner and optionally filter watches by a query.

+

Note that only the _id and metadata.* fields are queryable or sortable.

+ ``_ @@ -646,7 +666,11 @@ async def start( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Start the watch service. Start the Watcher service if it is not already running. + .. raw:: html + +

Start the watch service. + Start the Watcher service if it is not already running.

+ ``_ """ @@ -703,8 +727,12 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get Watcher statistics. This API always returns basic metrics. You retrieve more - metrics by using the metric parameter. + .. raw:: html + +

Get Watcher statistics. + This API always returns basic metrics. + You retrieve more metrics by using the metric parameter.

+ ``_ @@ -751,7 +779,11 @@ async def stop( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop the watch service. Stop the Watcher service if it is running. + .. raw:: html + +

Stop the watch service. + Stop the Watcher service if it is running.

+ ``_ @@ -803,9 +835,13 @@ async def update_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update Watcher index settings. Update settings for the Watcher internal index - (`.watches`). Only a subset of settings can be modified. This includes `index.auto_expand_replicas` - and `index.number_of_replicas`. + .. raw:: html + +

Update Watcher index settings. + Update settings for the Watcher internal index (.watches). + Only a subset of settings can be modified. + This includes index.auto_expand_replicas and index.number_of_replicas.

+ ``_ diff --git a/elasticsearch/_async/client/xpack.py b/elasticsearch/_async/client/xpack.py index 090aca019..36e87da61 100644 --- a/elasticsearch/_async/client/xpack.py +++ b/elasticsearch/_async/client/xpack.py @@ -43,10 +43,16 @@ async def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get information. The information provided by the API includes: * Build information - including the build number and timestamp. * License information about the currently - installed license. * Feature information for the features that are currently - enabled and available under the current license. + .. raw:: html + +

Get information. + The information provided by the API includes:

+
    +
  • Build information including the build number and timestamp.
  • +
  • License information about the currently installed license.
  • +
  • Feature information for the features that are currently enabled and available under the current license.
  • +
+ ``_ @@ -90,9 +96,12 @@ async def usage( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get usage information. Get information about the features that are currently - enabled and available under the current license. The API also provides some usage - statistics. + .. raw:: html + +

Get usage information. + Get information about the features that are currently enabled and available under the current license. + The API also provides some usage statistics.

+ ``_ diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 347643eb3..20fd44322 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -644,83 +644,89 @@ def bulk( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk index or delete documents. Perform multiple `index`, `create`, `delete`, - and `update` actions in a single request. This reduces overhead and can greatly - increase indexing speed. If the Elasticsearch security features are enabled, - you must have the following index privileges for the target data stream, index, - or index alias: * To use the `create` action, you must have the `create_doc`, - `create`, `index`, or `write` index privilege. Data streams support only the - `create` action. * To use the `index` action, you must have the `create`, `index`, - or `write` index privilege. * To use the `delete` action, you must have the `delete` - or `write` index privilege. * To use the `update` action, you must have the `index` - or `write` index privilege. * To automatically create a data stream or index - with a bulk API request, you must have the `auto_configure`, `create_index`, - or `manage` index privilege. * To make the result of a bulk operation visible - to search using the `refresh` parameter, you must have the `maintenance` or `manage` - index privilege. Automatic data stream creation requires a matching index template - with data stream enabled. The actions are specified in the request body using - a newline delimited JSON (NDJSON) structure: ``` action_and_meta_data\\n optional_source\\n - action_and_meta_data\\n optional_source\\n .... action_and_meta_data\\n optional_source\\n - ``` The `index` and `create` actions expect a source on the next line and have - the same semantics as the `op_type` parameter in the standard index API. A `create` - action fails if a document with the same ID already exists in the target An `index` - action adds or replaces a document as necessary. NOTE: Data streams support only - the `create` action. To update or delete a document in a data stream, you must - target the backing index containing the document. An `update` action expects - that the partial doc, upsert, and script and its options are specified on the - next line. A `delete` action does not expect a source on the next line and has - the same semantics as the standard delete API. NOTE: The final line of data must - end with a newline character (`\\n`). Each newline character may be preceded - by a carriage return (`\\r`). When sending NDJSON data to the `_bulk` endpoint, - use a `Content-Type` header of `application/json` or `application/x-ndjson`. - Because this format uses literal newline characters (`\\n`) as delimiters, make - sure that the JSON actions and sources are not pretty printed. If you provide - a target in the request path, it is used for any actions that don't explicitly - specify an `_index` argument. A note on the format: the idea here is to make - processing as fast as possible. As some of the actions are redirected to other - shards on other nodes, only `action_meta_data` is parsed on the receiving node - side. Client libraries using this protocol should try and strive to do something - similar on the client side, and reduce buffering as much as possible. There is - no "correct" number of actions to perform in a single bulk request. Experiment - with different settings to find the optimal size for your particular workload. - Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by - default so clients must ensure that no request exceeds this size. It is not possible - to index a single document that exceeds the size limit, so you must pre-process - any such documents into smaller pieces before sending them to Elasticsearch. - For instance, split documents into pages or chapters before indexing them, or - store raw binary data in a system outside Elasticsearch and replace the raw data - with a link to the external system in the documents that you send to Elasticsearch. - **Client suppport for bulk requests** Some of the officially supported clients - provide helpers to assist with bulk requests and reindexing: * Go: Check out - `esutil.BulkIndexer` * Perl: Check out `Search::Elasticsearch::Client::5_0::Bulk` - and `Search::Elasticsearch::Client::5_0::Scroll` * Python: Check out `elasticsearch.helpers.*` - * JavaScript: Check out `client.helpers.*` * .NET: Check out `BulkAllObservable` - * PHP: Check out bulk indexing. **Submitting bulk requests with cURL** If you're - providing text file input to `curl`, you must use the `--data-binary` flag instead - of plain `-d`. The latter doesn't preserve newlines. For example: ``` $ cat requests - { "index" : { "_index" : "test", "_id" : "1" } } { "field1" : "value1" } $ curl - -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary - "@requests"; echo {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - ``` **Optimistic concurrency control** Each `index` and `delete` action within - a bulk API call may include the `if_seq_no` and `if_primary_term` parameters - in their respective action and meta data lines. The `if_seq_no` and `if_primary_term` - parameters control how operations are run, based on the last modification to - existing documents. See Optimistic concurrency control for more details. **Versioning** - Each bulk item can include the version value using the `version` field. It automatically - follows the behavior of the index or delete operation based on the `_version` - mapping. It also support the `version_type`. **Routing** Each bulk item can include - the routing value using the `routing` field. It automatically follows the behavior - of the index or delete operation based on the `_routing` mapping. NOTE: Data - streams do not support custom routing unless they were created with the `allow_custom_routing` - setting enabled in the template. **Wait for active shards** When making bulk - calls, you can set the `wait_for_active_shards` parameter to require a minimum - number of shard copies to be active before starting to process the bulk request. - **Refresh** Control when the changes made by this request are visible to search. - NOTE: Only the shards that receive the bulk request will be affected by refresh. - Imagine a `_bulk?refresh=wait_for` request with three documents in it that happen - to be routed to different shards in an index with five shards. The request will - only wait for those three shards to refresh. The other two shards that make up - the index do not participate in the `_bulk` request at all. + .. raw:: html + +

Bulk index or delete documents. + Perform multiple index, create, delete, and update actions in a single request. + This reduces overhead and can greatly increase indexing speed.

+

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

+
    +
  • To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action.
  • +
  • To use the index action, you must have the create, index, or write index privilege.
  • +
  • To use the delete action, you must have the delete or write index privilege.
  • +
  • To use the update action, you must have the index or write index privilege.
  • +
  • To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
  • To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

The actions are specified in the request body using a newline delimited JSON (NDJSON) structure:

+
action_and_meta_data\\n
+          optional_source\\n
+          action_and_meta_data\\n
+          optional_source\\n
+          ....
+          action_and_meta_data\\n
+          optional_source\\n
+          
+

The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. + A create action fails if a document with the same ID already exists in the target + An index action adds or replaces a document as necessary.

+

NOTE: Data streams support only the create action. + To update or delete a document in a data stream, you must target the backing index containing the document.

+

An update action expects that the partial doc, upsert, and script and its options are specified on the next line.

+

A delete action does not expect a source on the next line and has the same semantics as the standard delete API.

+

NOTE: The final line of data must end with a newline character (\\n). + Each newline character may be preceded by a carriage return (\\r). + When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. + Because this format uses literal newline characters (\\n) as delimiters, make sure that the JSON actions and sources are not pretty printed.

+

If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument.

+

A note on the format: the idea here is to make processing as fast as possible. + As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side.

+

Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible.

+

There is no "correct" number of actions to perform in a single bulk request. + Experiment with different settings to find the optimal size for your particular workload. + Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. + It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. + For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch.

+

Client suppport for bulk requests

+

Some of the officially supported clients provide helpers to assist with bulk requests and reindexing:

+
    +
  • Go: Check out esutil.BulkIndexer
  • +
  • Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll
  • +
  • Python: Check out elasticsearch.helpers.*
  • +
  • JavaScript: Check out client.helpers.*
  • +
  • .NET: Check out BulkAllObservable
  • +
  • PHP: Check out bulk indexing.
  • +
+

Submitting bulk requests with cURL

+

If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. + The latter doesn't preserve newlines. For example:

+
$ cat requests
+          { "index" : { "_index" : "test", "_id" : "1" } }
+          { "field1" : "value1" }
+          $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo
+          {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]}
+          
+

Optimistic concurrency control

+

Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. + The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details.

+

Versioning

+

Each bulk item can include the version value using the version field. + It automatically follows the behavior of the index or delete operation based on the _version mapping. + It also support the version_type.

+

Routing

+

Each bulk item can include the routing value using the routing field. + It automatically follows the behavior of the index or delete operation based on the _routing mapping.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+

Wait for active shards

+

When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request.

+

Refresh

+

Control when the changes made by this request are visible to search.

+

NOTE: Only the shards that receive the bulk request will be affected by refresh. + Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. + The request will only wait for those three shards to refresh. + The other two shards that make up the index do not participate in the _bulk request at all.

+ ``_ @@ -837,8 +843,11 @@ def clear_scroll( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear a scrolling search. Clear the search context and results for a scrolling - search. + .. raw:: html + +

Clear a scrolling search. + Clear the search context and results for a scrolling search.

+ ``_ @@ -888,11 +897,14 @@ def close_point_in_time( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Close a point in time. A point in time must be opened explicitly before being - used in search requests. The `keep_alive` parameter tells Elasticsearch how long - it should persist. A point in time is automatically closed when the `keep_alive` - period has elapsed. However, keeping points in time has a cost; close them as - soon as they are no longer required for search requests. + .. raw:: html + +

Close a point in time. + A point in time must be opened explicitly before being used in search requests. + The keep_alive parameter tells Elasticsearch how long it should persist. + A point in time is automatically closed when the keep_alive period has elapsed. + However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.

+ ``_ @@ -966,14 +978,17 @@ def count( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 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. This means that replicas - increase the scalability of the count. + .. raw:: html + +

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

+

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. + This means that replicas increase the scalability of the count.

+ ``_ @@ -1010,10 +1025,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. @@ -1115,38 +1130,100 @@ def create( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Index a document. Adds a JSON document to the specified data stream or index - and makes it searchable. If the target is an index and the document already exists, - the request updates the document and increments its version. + .. raw:: html + +

Create a new document in the index.

+

You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs + Using _create guarantees that the document is indexed only if it does not already exist. + It returns a 409 response when a document with a same ID already exists in the index. + To update an existing document, you must use the /<target>/_doc/ API.

+

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

+
    +
  • To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege.
  • +
  • To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

Automatically create data streams and indices

+

If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream.

+

If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.

+

NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.

+

If no mapping exists, the index operation creates a dynamic mapping. + By default, new fields and objects are automatically added to the mapping if needed.

+

Automatic index creation is controlled by the action.auto_create_index setting. + If it is true, any index can be created automatically. + You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. + Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. + When a list is specified, the default behaviour is to disallow.

+

NOTE: The action.auto_create_index setting affects the automatic creation of indices only. + It does not affect the creation of data streams.

+

Routing

+

By default, shard placement — or routing — is controlled by using a hash of the document's ID value. + For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter.

+

When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. + This does come at the (very minimal) cost of an additional document parsing pass. + If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+

** Distributed**

+

The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. + After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.

+

Active shards

+

To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. + If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. + By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). + This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. + To alter this behavior per operation, use the wait_for_active_shards request parameter.

+

Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). + Specifying a negative value or a number greater than the number of shard copies will throw an error.

+

For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). + If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. + This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. + If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. + This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. + However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. + The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.

+

It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. + After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. + The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed.

+ ``_ - :param index: Name of the data stream or index to target. If the target doesn’t + :param index: The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If - the target doesn’t exist and doesn’t match a data stream template, this request + the target doesn't exist and doesn’t match a data stream template, this request creates the index. - :param id: Unique identifier for the document. + :param id: A unique identifier for the document. To automatically generate a + document ID, use the `POST //_doc/` request format. :param document: - :param pipeline: 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 + :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 + pipeline is configured, it will always run regardless of the value of this parameter. :param refresh: If `true`, Elasticsearch refreshes the affected shards to make - this operation visible to search, if `wait_for` then wait for a refresh to - make this operation visible to search, if `false` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period the request waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. + :param routing: A custom value that is used to route operations to a specific + shard. + :param timeout: The period the request waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. Elasticsearch + waits for at least the specified timeout period before failing. The actual + wait time could be longer, particularly when multiple waits occur. This parameter + is useful for situations where the primary shard assigned to perform the + operation might not be available when the operation runs. Some reasons for + this might be that the primary shard is currently recovering from a gateway + or undergoing relocation. By default, the operation will wait on the primary + shard to become available for at least 1 minute before failing and responding + with an error. The actual wait time could be longer, particularly when multiple + waits occur. + :param version: The explicit version number for concurrency control. It must + be a non-negative long number. + :param version_type: The version type. :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`). + before proceeding with the operation. You can set it to `all` or any positive + integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1221,29 +1298,60 @@ def delete( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a document. Removes a JSON document from the specified index. + .. raw:: html + +

Delete a document.

+

Remove a JSON document from the specified index.

+

NOTE: You cannot send deletion requests directly to a data stream. + To delete a document in a data stream, you must target the backing index containing the document.

+

Optimistic concurrency control

+

Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. + If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409.

+

Versioning

+

Each document indexed is versioned. + When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. + Every write operation run on a document, deletes included, causes its version to be incremented. + The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. + The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting.

+

Routing

+

If routing is used during indexing, the routing value also needs to be specified to delete a document.

+

If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request.

+

For example:

+
DELETE /my-index-000001/_doc/1?routing=shard-1
+          
+

This request deletes the document with ID 1, but it is routed based on the user. + The document is not deleted if the correct routing is not specified.

+

Distributed

+

The delete operation gets hashed into a specific shard ID. + It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.

+ ``_ - :param index: Name of the target index. - :param id: Unique identifier for the document. + :param index: The name of the target index. + :param id: A unique identifier for the document. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param refresh: If `true`, Elasticsearch refreshes the affected shards to make - this operation visible to search, if `wait_for` then wait for a refresh to - make this operation visible to search, if `false` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period to wait for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. - :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`). + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. + :param routing: A custom value used to route operations to a specific shard. + :param timeout: The period to wait for active shards. This parameter is useful + for situations where the primary shard assigned to perform the delete operation + might not be available when the delete operation runs. Some reasons for this + might be that the primary shard is currently recovering from a store or undergoing + relocation. By default, the delete operation will wait on the primary shard + to become available for up to 1 minute before failing and responding with + an error. + :param version: An explicit version number for concurrency control. It must match + the current version of the document for the request to succeed. + :param version_type: The version type. + :param wait_for_active_shards: The minimum number of shard copies that must be + active before proceeding with the operation. You can set it to `all` or any + positive integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1343,72 +1451,148 @@ def delete_by_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete documents. Deletes documents that match the specified query. + .. raw:: html + +

Delete documents.

+

Deletes documents that match the specified query.

+

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

+
    +
  • read
  • +
  • delete 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 a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. + If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails.

+

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

+

While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. + A bulk delete request is performed for each batch of matching documents. + If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. + If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. + Any delete requests that completed successfully still stick, they are not rolled back.

+

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 delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query.

+

Throttling delete requests

+

To control the rate at which delete by query issues batches of delete 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 disable 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

+

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

+

Setting slices to auto lets Elasticsearch choose the number of slices to use. + 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 the delete by query operation creates 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 earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted.
  • +
  • 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.
  • +
  • Delete performance scales linearly across available resources with the number of slices.
  • +
+

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

+

Cancel a delete by query operation

+

Any delete by query can be canceled using the task cancel API. For example:

+
POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel
+          
+

The task ID can be found by using the get tasks API.

+

Cancellation should happen quickly but might take a few seconds. + The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself.

+ ``_ - :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. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: Analyzer to use for the query string. This parameter can be + used only when the `q` query string parameter is specified. :param conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :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`. :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 delete. - :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 delete 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 delete specified with Query DSL. :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. + delete by query after the request completes. This is different than the delete + API's `refresh` parameter, which causes just the shard that received the + delete request to be refreshed. Unlike the delete API, it does not support + `wait_for`. :param request_cache: If `true`, the request cache is used for this request. 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 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. Defaults to - no timeout. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param routing: A custom value used to route operations to a specific shard. + :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: The explicit timeout for each search request. It defaults + to 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 sort: A comma-separated list of `:` pairs. + :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 deletion request waits for active shards. + :param timeout: The period each deletion request waits for active shards. :param version: If `true`, returns the document version as part of a hit. :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`). + 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`). The + `timeout` value controls how long each write request waits for unavailable + shards to become available. :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 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}`. + When you are done with a task, you should delete the task document so Elasticsearch + can reclaim the space. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1521,16 +1705,18 @@ def delete_by_query_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Throttle a delete by query operation. Change the number of requests per second - for a particular delete by query operation. 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. + .. raw:: html + +

Throttle a delete by query operation.

+

Change the number of requests per second for a particular delete by query operation. + 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 disable throttling, set it to `-1`. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -1570,16 +1756,22 @@ def delete_script( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a script or search template. Deletes a stored script or search template. + .. raw:: html - ``_ +

Delete a script or search template. + 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'") @@ -1638,32 +1830,60 @@ def exists( ] = None, ) -> HeadApiResponse: """ - Check a document. Checks if a specified document exists. + .. raw:: html + +

Check a document.

+

Verify that a document exists. + For example, check to see if a document with the _id 0 exists:

+
HEAD my-index-000001/_doc/0
+          
+

If the document exists, the API returns a status code of 200 - OK. + If the document doesn’t exist, the API returns 404 - Not Found.

+

Versioning support

+

You can use the version parameter to check the document only if its current version is equal to the specified one.

+

Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. + The old version of the document doesn't disappear immediately, although you won't be able to access it. + Elasticsearch cleans up deleted documents in the background as you continue to index more data.

+ ``_ - :param index: Comma-separated list of data streams, indices, and aliases. Supports - wildcards (`*`). - :param id: Identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param index: A comma-separated list of data streams, indices, and aliases. It + supports wildcards (`*`). + :param id: A unique document identifier. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. If it is + set to `_local`, the operation will prefer to be run on a local allocated + shard when possible. If it is set to a custom value, the value is used to + guarantee that the same shards will be used for the same custom value. This + can help with "jumping values" when hitting different shards in different + refresh states. A sample value can be something like the web session ID or + the user name. :param realtime: If `true`, the request is real-time as opposed to near-real-time. - :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. - :param routing: Target the specified primary 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 in - the response. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :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. + 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 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`. :param version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1739,29 +1959,38 @@ def exists_source( ] = None, ) -> HeadApiResponse: """ - Check for a document source. Checks if a document's `_source` is stored. + .. raw:: html + +

Check for a document source.

+

Check whether a document source exists in an index. + For example:

+
HEAD my-index-000001/_source/1
+          
+

A document's source is not available if it is disabled in the mapping.

+ ``_ - :param index: Comma-separated list of data streams, indices, and aliases. Supports - wildcards (`*`). - :param id: Identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param realtime: If true, the request is real-time as opposed to near-real-time. - :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. - :param routing: Target the specified primary shard. - :param source: `true` or `false` to return the `_source` field or not, or a list - of fields to return. + :param index: A comma-separated list of data streams, indices, and aliases. It + supports wildcards (`*`). + :param id: A unique identifier for the document. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. + :param realtime: If `true`, the request is real-time as opposed to near-real-time. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. :param source_excludes: A comma-separated list of source fields to exclude in the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1839,34 +2068,47 @@ def explain( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain a document match result. Returns information about why a specific document - matches, or doesn’t match, a query. + .. raw:: html + +

Explain a document match result. + 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. """ @@ -1959,15 +2201,18 @@ def field_caps( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the field capabilities. Get information about the capabilities of fields - among multiple indices. For data streams, the API returns field capabilities - among the stream’s backing indices. It returns runtime fields like any other - field. For example, a runtime field with a type of keyword is returned the same - as any other field that belongs to the `keyword` family. + .. raw:: html + +

Get the field capabilities.

+

Get information about the capabilities of fields among multiple indices.

+

For data streams, the API returns field capabilities among the stream’s backing indices. + It returns runtime fields like any other field. + For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family.

+ ``_ - :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 @@ -1975,25 +2220,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: @@ -2079,36 +2331,87 @@ def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a document by its ID. Retrieves the document with the specified ID from an - index. + .. raw:: html + +

Get a document by its ID.

+

Get a document and its source or stored fields from an index.

+

By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). + In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. + To turn off realtime behavior, set the realtime parameter to false.

+

Source filtering

+

By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. + You can turn off _source retrieval by using the _source parameter:

+
GET my-index-000001/_doc/0?_source=false
+          
+

If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. + This can be helpful with large documents where partial retrieval can save on network overhead + Both parameters take a comma separated list of fields or wildcard expressions. + For example:

+
GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities
+          
+

If you only want to specify includes, you can use a shorter notation:

+
GET my-index-000001/_doc/0?_source=*.id
+          
+

Routing

+

If routing is used during indexing, the routing value also needs to be specified to retrieve a document. + For example:

+
GET my-index-000001/_doc/2?routing=user1
+          
+

This request gets the document with ID 2, but it is routed based on the user. + The document is not fetched if the correct routing is not specified.

+

Distributed

+

The GET operation is hashed into a specific shard ID. + It is then redirected to one of the replicas within that shard ID and returns the result. + The replicas are the primary shard and its replicas within that shard ID group. + This means that the more replicas you have, the better your GET scaling will be.

+

Versioning support

+

You can use the version parameter to retrieve the document only if its current version is equal to the specified one.

+

Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. + The old version of the document doesn't disappear immediately, although you won't be able to access it. + Elasticsearch cleans up deleted documents in the background as you continue to index more data.

+ ``_ - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. - :param force_synthetic_source: Should this request force synthetic _source? Use - this to test if the mapping supports synthetic _source and to get a sense - of the worst case performance. Fetches with this enabled will be slower the - enabling synthetic source natively in the index. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param index: The name of the index that contains the document. + :param id: A unique document identifier. + :param force_synthetic_source: Indicates whether the request forces synthetic + `_source`. Use this paramater to test if the mapping supports synthetic `_source` + and to get a sense of the worst case performance. Fetches with this parameter + enabled will be slower than enabling synthetic source natively in the index. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. If it is + set to `_local`, the operation will prefer to be run on a local allocated + shard when possible. If it is set to a custom value, the value is used to + guarantee that the same shards will be used for the same custom value. This + can help with "jumping values" when hitting different shards in different + refresh states. A sample value can be something like the web session ID or + the user name. :param realtime: If `true`, the request is real-time as opposed to near-real-time. - :param refresh: If true, Elasticsearch refreshes the affected shards to make - this operation visible to search. If false, do nothing with refreshes. - :param routing: Target the specified primary 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 in - the response. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :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. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: internal, external, external_gte. + 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 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`. Only leaf fields can be retrieved with the `stored_field` option. + Object fields can't be returned;​if specified, the request fails. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2169,12 +2472,19 @@ def get_script( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a script or search template. Retrieves a stored script or search template. + .. raw:: html + +

Get a script or search template. + 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'") @@ -2211,9 +2521,13 @@ def get_script_context( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get script contexts. Get a list of supported script contexts and their methods. + .. raw:: html + +

Get script contexts.

+

Get a list of supported script contexts and their methods.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_context" @@ -2246,9 +2560,13 @@ def get_script_languages( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get script languages. Get a list of available script types, languages, and contexts. + .. raw:: html - ``_ +

Get script languages.

+

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

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_language" @@ -2301,29 +2619,41 @@ def get_source( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a document's source. Returns the source of a document. + .. raw:: html + +

Get a document's source.

+

Get the source of a document. + For example:

+
GET my-index-000001/_source/1
+          
+

You can use the source filtering parameters to control which parts of the _source are returned:

+
GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities
+          
+ ``_ - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param realtime: Boolean) If true, the request is real-time as opposed to near-real-time. - :param refresh: If true, Elasticsearch refreshes the affected shards to make - this operation visible to search. If false, do nothing with refreshes. - :param routing: Target the specified primary shard. - :param source: True or false to return the _source field or not, or a list of - fields to return. + :param index: The name of the index that contains the document. + :param id: A unique document identifier. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. + :param realtime: If `true`, the request is real-time as opposed to near-real-time. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. :param source_excludes: A comma-separated list of source fields to exclude in the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param stored_fields: - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: internal, external, external_gte. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2384,26 +2714,22 @@ def health_report( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the cluster health. Get a report with the health status of an Elasticsearch - cluster. The report contains a list of indicators that compose Elasticsearch - functionality. Each indicator has a health status of: green, unknown, yellow - or red. The indicator will provide an explanation and metadata describing the - reason for its current health status. The cluster’s status is controlled by the - worst indicator status. In the event that an indicator’s status is non-green, - a list of impacts may be present in the indicator result which detail the functionalities - that are negatively affected by the health issue. Each impact carries with it - a severity level, an area of the system that is affected, and a simple description - of the impact on the system. Some health indicators can determine the root cause - of a health problem and prescribe a set of steps that can be performed in order - to improve the health of the system. The root cause and remediation steps are - encapsulated in a diagnosis. A diagnosis contains a cause detailing a root cause - analysis, an action containing a brief description of the steps to take to fix - the problem, the list of affected resources (if applicable), and a detailed step-by-step - troubleshooting guide to fix the diagnosed problem. NOTE: The health indicators - perform root cause analysis of non-green health statuses. This can be computationally - expensive when called frequently. When setting up automated polling of the API - for health status, set verbose to false to disable the more expensive analysis - logic. + .. raw:: html + +

Get the cluster health. + Get a report with the health status of an Elasticsearch cluster. + The report contains a list of indicators that compose Elasticsearch functionality.

+

Each indicator has a health status of: green, unknown, yellow or red. + The indicator will provide an explanation and metadata describing the reason for its current health status.

+

The cluster’s status is controlled by the worst indicator status.

+

In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. + Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system.

+

Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. + The root cause and remediation steps are encapsulated in a diagnosis. + A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem.

+

NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. + When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic.

+ ``_ @@ -2478,44 +2804,148 @@ def index( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Index a document. Adds a JSON document to the specified data stream or index - and makes it searchable. If the target is an index and the document already exists, - the request updates the document and increments its version. + .. raw:: html + +

Create or update a document in an index.

+

Add a JSON document to the specified data stream or index and make it searchable. + If the target is an index and the document already exists, the request updates the document and increments its version.

+

NOTE: You cannot use this API to send update requests for existing documents in a data stream.

+

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

+
    +
  • To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege.
  • +
  • To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege.
  • +
  • To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

NOTE: Replica shards might not all be started when an indexing operation returns successfully. + By default, only the primary is required. Set wait_for_active_shards to change this default behavior.

+

Automatically create data streams and indices

+

If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream.

+

If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.

+

NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.

+

If no mapping exists, the index operation creates a dynamic mapping. + By default, new fields and objects are automatically added to the mapping if needed.

+

Automatic index creation is controlled by the action.auto_create_index setting. + If it is true, any index can be created automatically. + You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. + Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. + When a list is specified, the default behaviour is to disallow.

+

NOTE: The action.auto_create_index setting affects the automatic creation of indices only. + It does not affect the creation of data streams.

+

Optimistic concurrency control

+

Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. + If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409.

+

Routing

+

By default, shard placement — or routing — is controlled by using a hash of the document's ID value. + For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter.

+

When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. + This does come at the (very minimal) cost of an additional document parsing pass. + If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+
    +
  • ** Distributed**
  • +
+

The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. + After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.

+

Active shards

+

To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. + If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. + By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). + This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. + To alter this behavior per operation, use the wait_for_active_shards request parameter.

+

Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). + Specifying a negative value or a number greater than the number of shard copies will throw an error.

+

For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). + If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. + This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. + If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. + This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. + However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. + The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.

+

It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. + After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. + The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed.

+

No operation (noop) updates

+

When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. + If this isn't acceptable use the _update API with detect_noop set to true. + The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source.

+

There isn't a definitive rule for when noop updates aren't acceptable. + It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates.

+

Versioning

+

Each indexed document is given a version number. + By default, internal versioning is used that starts at 1 and increments with each update, deletes included. + Optionally, the version number can be set to an external value (for example, if maintained in a database). + To enable this functionality, version_type should be set to external. + The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18.

+

NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. + If no version is provided, the operation runs without any version checks.

+

When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. + If true, the document will be indexed and the new version number used. + If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example:

+
PUT my-index-000001/_doc/1?version=2&version_type=external
+          {
+            "user": {
+              "id": "elkbee"
+            }
+          }
+
+          In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
+          If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).
+
+          A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
+          Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.
+          
+ ``_ - :param index: Name of the data stream or index to target. + :param index: The name of the data stream or index to target. If the target doesn't + exist and matches the name or wildcard (`*`) pattern of an index template + with a `data_stream` definition, this request creates the data stream. If + the target doesn't exist and doesn't match a data stream template, this request + creates the index. You can check for existing targets with the resolve index + API. :param document: - :param id: Unique identifier for the document. + :param id: A unique identifier for the document. To automatically generate a + document ID, use the `POST //_doc/` request format and omit this + parameter. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. - :param op_type: Set to create to only index the document if it does not already + :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. Same as using the `/_create` endpoint. - Valid values: `index`, `create`. If document id is specified, it defaults - to `index`. Otherwise, it defaults to `create`. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. + the indexing operation will fail. The behavior is the same as using the `/_create` + endpoint. If a document ID is specified, this paramater defaults to `index`. + Otherwise, it defaults to `create`. If the request targets a data stream, + an `op_type` of `create` is required. + :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 refresh: If `true`, Elasticsearch refreshes the affected shards to make - this operation visible to search, if `wait_for` then wait for a refresh to - make this operation visible to search, if `false` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. :param require_alias: If `true`, the destination must be an index alias. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period the request waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param routing: A custom value that is used to route operations to a specific + shard. + :param timeout: The period the request waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. This + parameter is useful for situations where the primary shard assigned to perform + the operation might not be available when the operation runs. Some reasons + for this might be that the primary shard is currently recovering from a gateway + or undergoing relocation. By default, the operation will wait on the primary + shard to become available for at least 1 minute before failing and responding + with an error. The actual wait time could be longer, particularly when multiple + waits occur. + :param version: An explicit version number for concurrency control. It must be + a non-negative long number. + :param version_type: The version type. :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`). + before proceeding with the operation. You can set it to `all` or any positive + integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2589,7 +3019,11 @@ def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster info. Get basic build, version, and cluster information. + .. raw:: html + +

Get cluster info. + Get basic build, version, and cluster information.

+ ``_ """ @@ -2646,38 +3080,48 @@ def knn_search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a knn search. NOTE: The kNN search API has been replaced by the `knn` option - in the search API. Perform a k-nearest neighbor (kNN) search on a dense_vector - field and return the matching documents. Given a query vector, the API finds - the k closest vectors and returns those documents as search hits. Elasticsearch - uses the HNSW algorithm to support efficient kNN search. Like most kNN algorithms, - HNSW is an approximate method that sacrifices result accuracy for improved search - speed. 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. - - ``_ + .. raw:: html + +

Run a knn search.

+

NOTE: The kNN search API has been replaced by the knn option in the search API.

+

Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. + Given a query vector, the API finds the k closest vectors and returns those documents as search hits.

+

Elasticsearch uses the HNSW algorithm to support efficient kNN search. + Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. + 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'") @@ -2755,10 +3199,21 @@ def mget( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get multiple documents. 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. + .. raw:: html + +

Get multiple documents.

+

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.

+ ``_ @@ -2879,13 +3334,21 @@ def msearch( typed_keys: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Run multiple searches. The format of the request is similar to the bulk API format - and makes use of the newline delimited JSON (NDJSON) format. The structure is - as follows: ``` header\\n body\\n header\\n body\\n ``` This structure is specifically - optimized to reduce parsing if a specific search ends up redirected to another - node. IMPORTANT: The final line of data must end with a newline character `\\n`. - Each newline character may be preceded by a carriage return `\\r`. When sending - requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`. + .. raw:: html + +

Run multiple searches.

+

The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. + The structure is as follows:

+
header\\n
+          body\\n
+          header\\n
+          body\\n
+          
+

This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.

+

IMPORTANT: The final line of data must end with a newline character \\n. + Each newline character may be preceded by a carriage return \\r. + When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson.

+ ``_ @@ -3017,22 +3480,35 @@ def msearch_template( typed_keys: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Run multiple templated searches. + .. 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. """ @@ -3112,34 +3588,41 @@ def mtermvectors( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get multiple term vectors. 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. + .. raw:: html + +

Get multiple term vectors.

+

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: @@ -3228,36 +3711,59 @@ def open_point_in_time( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Open a point in time. A search request by default runs against the most recent - visible data of the target indices, which is called point in time. Elasticsearch - pit (point in time) is a lightweight view into the state of the data as it existed - when initiated. In some cases, it’s preferred to perform multiple search requests - using the same point in time. For example, if refreshes happen between `search_after` - requests, then the results of those requests might not be consistent as changes - happening between searches are only visible to the more recent point in time. - A point in time must be opened explicitly before being used in search requests. - The `keep_alive` parameter tells Elasticsearch how long it should persist. + .. raw:: html + +

Open a point in time.

+

A search request by default runs against the most recent visible data of the target indices, + which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the + state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple + search requests using the same point in time. For example, if refreshes happen between + search_after requests, then the results of those requests might not be consistent as changes happening + between searches are only visible to the more recent point in time.

+

A point in time must be opened explicitly before being used in search requests.

+

A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time.

+

Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. + If you want to retrieve more hits, use PIT with search_after.

+

IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request.

+

When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. + To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime.

+

Keeping point in time alive

+

The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. + The value does not need to be long enough to process all data — it just needs to be long enough for the next request.

+

Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. + Once the smaller segments are no longer needed they are deleted. + However, open point-in-times prevent the old segments from being deleted since they are still in use.

+

TIP: Keeping older segments alive means that more disk space and file handles are needed. + Ensure that you have configured your nodes to have ample free file handles.

+

Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. + Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. + Note that a point-in-time doesn't prevent its associated indices from being deleted. + You can check how many point-in-times (that is, search contexts) are open with the nodes stats API.

+ ``_ :param index: A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices - :param keep_alive: Extends the time to live of the corresponding point in time. - :param allow_partial_search_results: If `false`, creating a point in time request - when a shard is missing or unavailable will throw an exception. If `true`, - the point in time will contain all the shards that are available at the time - of the request. - :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 keep_alive: Extend the length of time that the point in time persists. + :param allow_partial_search_results: Indicates whether the point in time tolerates + unavailable shards or shard failures when initially creating the PIT. If + `false`, creating a point in time request when a shard is missing or unavailable + will throw an exception. If `true`, the point in time will contain all the + shards that are available at the time of the request. + :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 ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. - :param index_filter: Allows to filter indices if the provided query rewrites - to `match_none` on every shard. - :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 index_filter: Filter indices if the provided query rewrites to `match_none` + on every shard. + :param preference: The node or shard the operation should be performed on. By + default, it is random. + :param routing: A custom value that is used to route operations to a specific + shard. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3323,23 +3829,27 @@ def put_script( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a script or search template. 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. + .. raw:: html + +

Create or update a script or search template. + Creates or updates a stored script or search template.

+ + + ``_ + + :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'") @@ -3409,14 +3919,17 @@ def rank_eval( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evaluate ranked search results. Evaluate the quality of ranked search results - over a set of typical search queries. + .. raw:: html + +

Evaluate ranked search results.

+

Evaluate the quality of ranked search results over a set of typical search queries.

+ ``_ :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 `*`. @@ -3504,33 +4017,187 @@ def reindex( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reindex documents. Copies documents from a source to a destination. The source - can be any existing index, alias, or data stream. The destination must differ - from the source. For example, you cannot reindex a data stream into itself. + .. raw:: html + +

Reindex documents.

+

Copy documents from a source to a destination. + You can copy all documents to the destination index or reindex a subset of the documents. + The source can be any existing index, alias, or data stream. + The destination must differ from the source. + For example, you cannot reindex a data stream into itself.

+

IMPORTANT: Reindex requires _source to be enabled for all documents in the source. + The destination should be configured as wanted before calling the reindex API. + Reindex does not copy the settings from the source or its associated template. + Mappings, shard counts, and replicas, for example, must be configured ahead of time.

+

If the Elasticsearch security features are enabled, you must have the following security privileges:

+
    +
  • The read index privilege for the source data stream, index, or alias.
  • +
  • The write index privilege for the destination data stream, index, or index alias.
  • +
  • To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias.
  • +
  • If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias.
  • +
+

If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. + Automatic data stream creation requires a matching index template with data stream enabled.

+

The dest element can be configured like the index API to control optimistic concurrency control. + Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID.

+

Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source.

+

Setting op_type to create causes the reindex API to create only missing documents in the destination. + All existing documents will cause a version conflict.

+

IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. + A reindex can only add new documents to a destination data stream. + It cannot update existing documents in a destination data stream.

+

By default, version conflicts abort the reindex process. + To continue reindexing if there are conflicts, set the conflicts request body property to proceed. + In this case, the response includes a count of the version conflicts that were encountered. + Note that the handling of other error types is unaffected by the conflicts property. + Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query.

+

NOTE: The reindex API makes no effort to handle ID collisions. + The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. + Instead, make sure that IDs are unique by using a script.

+

Running reindex asynchronously

+

If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task 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_id>.

+

Reindex from multiple sources

+

If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. + That way you can resume the process if there are any errors by removing the partially completed source and starting over. + It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel.

+

For example, you can use a bash script like this:

+
for index in i1 i2 i3 i4 i5; do
+            curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{
+              "source": {
+                "index": "'$index'"
+              },
+              "dest": {
+                "index": "'$index'-reindexed"
+              }
+            }'
+          done
+          
+

** Throttling**

+

Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. + Requests are throttled by padding each batch with a wait time. + To turn off throttling, set requests_per_second to -1.

+

The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. + 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 then wait for a while before starting the next set. + This is "bursty" instead of "smooth".

+

Slicing

+

Reindex supports sliced scroll to parallelize the reindexing process. + This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts.

+

NOTE: Reindexing from remote clusters does not support manual or automatic slicing.

+

You can slice a reindex request manually by providing a slice ID and total number of slices to each request. + You can also let reindex automatically parallelize by using sliced scroll to slice on _id. + The slices parameter specifies the number of slices to use.

+

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

+
    +
  • You can see these requests in the tasks API. 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 previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed.
  • +
  • Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time.
  • +
+

If slicing automatically, setting slices to auto will choose a reasonable number for most indices. + If slicing manually or otherwise tuning automatic slicing, use the following guidelines.

+

Query performance is most efficient when the number of slices is equal to the number of shards in the index. + If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. + Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.

+

Indexing performance scales linearly across available resources with the number of slices.

+

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

+

Modify documents during reindexing

+

Like _update_by_query, reindex operations support a script that modifies the document. + Unlike _update_by_query, the script is allowed to modify the document's metadata.

+

Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. + For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. + Set ctx.op to delete if your script decides that the document must be deleted from the destination. + The deletion will be reported in the deleted counter in the response body. + Setting ctx.op to anything else will return an error, as will setting any other field in ctx.

+

Think of the possibilities! Just be careful; you are able to change:

+
    +
  • _id
  • +
  • _index
  • +
  • _version
  • +
  • _routing
  • +
+

Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. + It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API.

+

Reindex from remote

+

Reindex supports reindexing from a remote Elasticsearch cluster. + The host parameter must contain a scheme, host, port, and optional path. + The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. + Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. + There are a range of settings available to configure the behavior of the HTTPS connection.

+

When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. + Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. + It can be set to a comma delimited list of allowed remote host and port combinations. + Scheme is ignored; only the host and port are used. + For example:

+
reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"]
+          
+

The list of allowed hosts must be configured on any nodes that will coordinate the reindex. + This feature should work with remote clusters of any version of Elasticsearch. + This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version.

+

WARNING: Elasticsearch does not support forward compatibility across major versions. + For example, you cannot reindex from a 7.x cluster into a 6.x cluster.

+

To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification.

+

NOTE: Reindexing from remote clusters does not support manual or automatic slicing.

+

Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. + If the remote index includes very large documents you'll need to use a smaller batch size. + It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. + Both default to 30 seconds.

+

Configuring SSL parameters

+

Reindex from remote supports configurable SSL settings. + These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. + It is not possible to configure SSL in the body of the reindex request.

+ ``_ :param dest: The destination you are copying to. :param source: The source you are copying from. - :param conflicts: Set to proceed to continue reindexing even if there are conflicts. - :param max_docs: The maximum number of documents to reindex. + :param conflicts: Indicates whether to continue reindexing even when there are + conflicts. + :param max_docs: The maximum number of documents to reindex. By default, all + documents are reindexed. If it is a value less then or equal to `scroll_size`, + a scroll will not be used to retrieve the results for the operation. If `conflicts` + is set to `proceed`, the reindex operation could attempt to reindex more + documents from the source than `max_docs` until it has successfully indexed + `max_docs` documents into the target or it has gone through every document + in the source query. :param refresh: If `true`, the request refreshes affected shards to make this operation visible to search. :param requests_per_second: The throttle for this request in sub-requests per - second. Defaults to no throttle. + second. By default, there is no throttle. :param require_alias: If `true`, the destination must be an index alias. :param script: The script to run to update the document source or metadata when reindexing. - :param scroll: Specifies how long a consistent view of the index should be maintained - for scrolled search. + :param scroll: The period of time that a consistent view of the index should + be maintained for scrolled search. :param size: - :param slices: The number of slices this task should be divided into. Defaults - to 1 slice, meaning the task isn’t sliced into subtasks. - :param timeout: Period each indexing waits for automatic index creation, dynamic - mapping updates, and waiting for active shards. + :param slices: The number of slices this task should be divided into. It defaults + to one slice, which means the task isn't sliced into subtasks. Reindex supports + sliced scroll to parallelize the reindexing process. This parallelization + can improve efficiency and provide a convenient way to break the request + down into smaller parts. NOTE: Reindexing from remote clusters does not support + manual or automatic slicing. If set to `auto`, Elasticsearch chooses the + number of slices to use. This setting will use one slice per shard, up to + a certain limit. If there are multiple sources, it will choose the number + of slices based on the index or backing index with the smallest number of + shards. + :param timeout: The period each indexing waits for automatic index creation, + dynamic mapping updates, and waiting for active shards. By default, Elasticsearch + waits for at least one minute before failing. The actual wait time could + be longer, particularly when multiple waits occur. :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`). + before proceeding with the operation. Set it to `all` or any positive integer + up to the total number of shards in the index (`number_of_replicas+1`). The + default value is one, which means it waits for each primary shard to be active. :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ @@ -3602,14 +4269,24 @@ def reindex_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Throttle a reindex operation. Change the number of requests per second for a - particular reindex operation. + .. raw:: html + +

Throttle a reindex operation.

+

Change the number of requests per second for a particular reindex operation. + For example:

+
POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
+          
+

Rethrottling that speeds up the query takes effect immediately. + Rethrottling that slows down the query will take effect after completing the current batch. + This behavior prevents scroll timeouts.

+ ``_ - :param task_id: Identifier for the task. + :param task_id: The task identifier, which can be found by using the tasks API. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. It can be either `-1` to turn off throttling or any decimal number + like `1.7` or `12` to throttle to that level. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -3654,17 +4331,21 @@ def render_search_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Render a search template. Render a search template as a search request body. + .. raw:: html + +

Render a search template.

+

Render a search template as a search request body.

+ ``_ - :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] @@ -3723,7 +4404,11 @@ def scripts_painless_execute( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a script. Runs a script and returns a result. + .. raw:: html + +

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

+ ``_ @@ -3781,30 +4466,27 @@ def scroll( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a scrolling search. IMPORTANT: The scroll API is no longer recommend for - deep pagination. If you need to preserve the index state while paging through - more than 10,000 hits, use the `search_after` parameter with a point in time - (PIT). The scroll API gets large sets of results from a single scrolling search - request. To get the necessary scroll ID, submit a search API request that includes - an argument for the `scroll` query parameter. The `scroll` parameter indicates - how long Elasticsearch should retain the search context for the request. The - search response returns a scroll ID in the `_scroll_id` response body parameter. - You can then use the scroll ID with the scroll API to retrieve the next batch - of results for the request. If the Elasticsearch security features are enabled, - the access to the results of a specific scroll ID is restricted to the user or - API key that submitted the search. You can also use the scroll API to specify - a new scroll parameter that extends or shortens the retention period for the - search context. 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. + .. raw:: html + +

Run a scrolling search.

+

IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the search_after parameter with a point in time (PIT).

+

The scroll API gets large sets of results from a single scrolling search request. + To get the necessary scroll ID, submit a search API request that includes an argument for the scroll query parameter. + The scroll parameter indicates how long Elasticsearch should retain the search context for the request. + The search response returns a scroll ID in the _scroll_id response body parameter. + You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. + If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search.

+

You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.

+

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: 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'") @@ -3986,15 +4668,29 @@ def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a search. Get search hits that match the query defined in the request. You - can provide search queries using the `q` query string parameter or the request - body. If both are specified, only the query parameter is used. + .. raw:: html + +

Run a search.

+

Get search hits that match the query defined in the request. + You can provide search queries using the q query string parameter or the request body. + If both are specified, only the query parameter is used.

+

If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. + To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices.

+

Search slicing

+

When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. + By default the splitting is done first on the shards, then locally on each shard. + The local splitting partitions the shard into contiguous ranges based on Lucene document IDs.

+

For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard.

+

IMPORTANT: The same point-in-time ID should be used for all slices. + If different PIT IDs are used, slices can overlap and miss documents. + This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.

+ ``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams and indices, omit this - parameter or use `*` or `_all`. + :param 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 aggregations: Defines the aggregations that are run as part of the search request. :param aggs: Defines the aggregations that are run as part of the search request. @@ -4003,45 +4699,46 @@ def search( This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. - :param allow_partial_search_results: If true, returns partial results if there - are shard request timeouts or shard failures. If false, returns an error - with no partial results. - :param analyze_wildcard: If true, wildcard and prefix queries are analyzed. This - parameter can only be used when the q query string parameter is specified. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the q query string parameter is specified. + :param allow_partial_search_results: If `true` and there are shard request timeouts + or shard failures, the request returns partial results. If `false`, it returns + an error with no partial results. To override the default behavior, you can + set the `search.default_allow_partial_results` cluster setting to `false`. + :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. + 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 batched_reduce_size: The number of shard results that should be reduced - at once on the coordinating node. This value should be used as a protection - mechanism to reduce the memory overhead per search request if the potential - number of shards in the request can be large. - :param ccs_minimize_roundtrips: If true, network round-trips between the coordinating - node and the remote clusters are minimized when executing cross-cluster search + at once on the coordinating node. If the potential number of shards in the + request can be large, this value should be used as a protection mechanism + to reduce the memory overhead per search request. + :param ccs_minimize_roundtrips: If `true`, network round-trips between the coordinating + node and the remote clusters are minimized when running cross-cluster search (CCS) requests. :param collapse: Collapses search results the values of the specified field. - :param default_operator: The default operator for query string query: AND or - OR. This parameter can only be used when the `q` query string parameter is - specified. - :param df: Field to use as default where no field prefix is given in the query - string. This parameter can only be used when the q query string parameter + :param default_operator: The default operator for the query string query: `AND` + or `OR`. This parameter can be used only when the `q` query string parameter is specified. - :param docvalue_fields: Array of wildcard (`*`) patterns. The request returns - doc values for field names matching these patterns in the `hits.fields` property - of the response. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. - :param explain: If true, returns detailed information about score computation - as part of a hit. + :param df: The field to use as a default when no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param docvalue_fields: An array of wildcard (`*`) field patterns. The request + returns doc values for field names matching these patterns in the `hits.fields` + property of the response. + :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 explain: If `true`, the request returns detailed information about score + computation as part of a hit. :param ext: Configuration of search extensions defined by Elasticsearch plugins. - :param fields: Array of wildcard (`*`) patterns. The request returns values for - field names matching these patterns in the `hits.fields` property of the - response. + :param fields: An array of wildcard (`*`) field patterns. The request returns + values for field names matching these patterns in the `hits.fields` property + of the response. :param force_synthetic_source: Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. - :param from_: Starting document offset. Needs to be non-negative. By default, + :param from_: The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. :param highlight: Specifies the highlighter to use for retrieving highlighted @@ -4050,95 +4747,101 @@ def search( be ignored when frozen. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. - :param include_named_queries_score: Indicates whether hit.matched_queries should - be rendered as a map that includes the name of the matched query associated - with its score (true) or as an array containing the name of the matched queries - (false) This functionality reruns each named query on every hit in a search - response. Typically, this adds a small overhead to a request. However, using - computationally expensive named queries on a large number of hits may add - significant overhead. - :param indices_boost: Boosts the _score of documents from specified indices. - :param knn: Defines the approximate kNN search to run. + :param include_named_queries_score: If `true`, the response includes the score + contribution from any named queries. This functionality reruns each named + query on every hit in a search response. Typically, this adds a small overhead + to a request. However, using computationally expensive named queries on a + large number of hits may add significant overhead. + :param indices_boost: Boost the `_score` of documents from specified indices. + The boost value is the factor by which scores are multiplied. A boost value + greater than `1.0` increases the score. A boost value between `0` and `1.0` + decreases the score. + :param knn: The approximate kNN search to run. :param lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can - only be used when the `q` query string parameter is specified. - :param max_concurrent_shard_requests: Defines the number of concurrent shard - requests per node this search executes concurrently. This value should be - used to limit the impact of the search on the cluster in order to limit the - number of concurrent shard requests. + be used only when the `q` query string parameter is specified. + :param max_concurrent_shard_requests: The number of concurrent shard requests + per node that the search runs concurrently. This value should be used to + limit the impact of the search on the cluster in order to limit the number + of concurrent shard requests. :param min_compatible_shard_node: The minimum version of the node that can handle - the request Any handling node with a lower version will fail the request. - :param min_score: Minimum `_score` for matching documents. Documents with a lower - `_score` are not included in the search results. - :param pit: Limits the search to a point in time (PIT). If you provide a PIT, + the request. Any handling node with a lower version will fail the request. + :param min_score: The minimum `_score` for matching documents. Documents with + a lower `_score` are not included in the search results. + :param pit: Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an `` in the request path. :param post_filter: Use the `post_filter` parameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results. - :param pre_filter_shard_size: Defines a threshold that enforces a pre-filter - roundtrip to prefilter search shards based on query rewriting if the number - of shards the search request expands to exceeds the threshold. This filter - roundtrip can limit the number of shards significantly if for instance a - shard can not match any documents based on its rewrite method (if date filters - are mandatory to match but the shard bounds and the query are disjoint). - When unspecified, the pre-filter phase is executed if any of these conditions - is met: the request targets more than 128 shards; the request targets one - or more read-only index; the primary sort of the query targets an indexed + :param pre_filter_shard_size: A threshold that enforces a pre-filter roundtrip + to prefilter search shards based on query rewriting if the number of shards + the search request expands to exceeds the threshold. This filter roundtrip + can limit the number of shards significantly if for instance a shard can + not match any documents based on its rewrite method (if date filters are + mandatory to match but the shard bounds and the query are disjoint). When + unspecified, the pre-filter phase is executed if any of these conditions + is met: * The request targets more than 128 shards. * The request targets + one or more read-only index. * The primary sort of the query targets an indexed field. - :param preference: Nodes and shards used for the search. By default, Elasticsearch + :param preference: The nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, - accounting for allocation awareness. Valid values are: `_only_local` to run - the search only on shards on the local node; `_local` to, if possible, run - the search on shards on the local node, or if not, select shards using the - default method; `_only_nodes:,` to run the search on only - the specified nodes IDs, where, if suitable shards exist on more than one - selected node, use shards on those nodes using the default method, or if - none of the specified nodes are available, select shards from any available - node using the default method; `_prefer_nodes:,` to if + accounting for allocation awareness. Valid values are: * `_only_local` to + run the search only on shards on the local node; * `_local` to, if possible, + run the search on shards on the local node, or if not, select shards using + the default method; * `_only_nodes:,` to run the search + on only the specified nodes IDs, where, if suitable shards exist on more + than one selected node, use shards on those nodes using the default method, + or if none of the specified nodes are available, select shards from any available + node using the default method; * `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs, or if not, select shards - using the default method; `_shards:,` to run the search only - on the specified shards; `` (any string that does not start + using the default method; * `_shards:,` to run the search only + on the specified shards; * `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order. :param profile: Set to `true` to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. - :param q: Query in the Lucene query string syntax using query parameter search. - Query parameter searches do not support the full Elasticsearch Query DSL - but are handy for testing. - :param query: Defines the search definition using the Query DSL. - :param rank: Defines the Reciprocal Rank Fusion (RRF) to use. + :param q: A query in the Lucene query string syntax. Query parameter searches + do not support the full Elasticsearch Query DSL but are handy for testing. + IMPORTANT: This parameter overrides the query parameter in the request body. + If both parameters are specified, documents matching the query request body + parameter are not returned. + :param query: The search definition using the Query DSL. + :param rank: The Reciprocal Rank Fusion (RRF) to use. :param request_cache: If `true`, the caching of search results is enabled for - requests where `size` is `0`. Defaults to index level settings. + requests where `size` is `0`. It defaults to index level settings. :param rescore: Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases. :param rest_total_hits_as_int: Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response. :param retriever: A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that - also return top documents such as query and knn. - :param routing: Custom value used to route operations to a specific shard. - :param runtime_mappings: Defines one or more runtime fields in the search request. - These fields take precedence over mapped fields with the same name. + also return top documents such as `query` and `knn`. + :param routing: A custom value that is used to route operations to a specific + shard. + :param runtime_mappings: One or more runtime fields in the search request. These + fields take precedence over mapped fields with the same name. :param script_fields: Retrieve a script evaluation (based on different fields) for each hit. - :param scroll: Period to retain the search context for scrolling. See Scroll - search results. By default, this value cannot exceed `1d` (24 hours). You - can change this limit using the `search.max_keep_alive` cluster-level setting. + :param scroll: The period to retain the search context for scrolling. By default, + this value cannot exceed `1d` (24 hours). You can change this limit by using + the `search.max_keep_alive` cluster-level setting. :param search_after: Used to retrieve the next page of hits using a set of sort values from the previous page. - :param search_type: How distributed term frequencies are calculated for relevance - scoring. - :param seq_no_primary_term: If `true`, returns sequence number and primary term - of the last modification of each hit. - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param slice: Can be used to split a scrolled search into multiple slices that - can be consumed independently. + :param search_type: Indicates how distributed term frequencies are calculated + for relevance scoring. + :param seq_no_primary_term: If `true`, the request returns sequence number and + primary term of the last modification of each hit. + :param size: The number of hits to return, which must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` property. + :param slice: Split a scrolled search into multiple slices that can be consumed + independently. :param sort: A comma-separated list of : pairs. - :param source: Indicates which source fields are returned for matching documents. - These fields are returned in the hits._source property of the search response. + :param source: The source fields that are returned for matching documents. These + fields are returned in the `hits._source` property of the search response. + If the `stored_fields` property is specified, the `_source` property defaults + to `false`. Otherwise, it defaults to `true`. :param source_excludes: A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` @@ -4148,45 +4851,46 @@ def search( returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. - :param stats: Stats groups to associate with the search. Each group maintains + :param stats: The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the `_source` parameter defaults to `false`. You can - pass `_source: true` to return both source fields and stored fields in the - search response. + :param stored_fields: A comma-separated 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` property defaults to + `false`. You can pass `_source: true` to return both source fields and stored + fields in the search response. :param suggest: Defines a suggester that provides similar looking terms based on a provided text. - :param suggest_field: Specifies which field to use for suggestions. - :param suggest_mode: Specifies the suggest mode. This parameter can only be used - when the `suggest_field` and `suggest_text` query string parameters are specified. - :param suggest_size: Number of suggestions to return. This parameter can only - be used when the `suggest_field` and `suggest_text` query string parameters + :param suggest_field: The field to use for suggestions. + :param suggest_mode: The suggest mode. This parameter can be used only when the + `suggest_field` and `suggest_text` query string parameters are specified. + :param suggest_size: The number of suggestions to return. This parameter can + be used only when the `suggest_field` and `suggest_text` query string parameters are specified. :param suggest_text: The source text for which the suggestions should be returned. - This parameter can only be used when the `suggest_field` and `suggest_text` + This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. - :param terminate_after: Maximum number of documents to collect for each 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. - Elasticsearch collects documents before sorting. Use with caution. Elasticsearch - applies this parameter to each shard handling the request. When possible, - let Elasticsearch perform early termination automatically. Avoid specifying - this parameter for requests that target data streams with backing indices - across multiple data tiers. If set to `0` (default), the query does not terminate - early. - :param timeout: Specifies the period of time to wait for a response from each - shard. If no response is received before the timeout expires, the request - fails and returns an error. Defaults to no timeout. - :param track_scores: If true, calculate and return document scores, even if the - scores are not used for sorting. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this property to each shard handling the request. When + possible, let Elasticsearch perform early termination automatically. Avoid + specifying this property for requests that target data streams with backing + indices across multiple data tiers. If set to `0` (default), the query does + not terminate early. + :param timeout: The period of time to wait for a response from each shard. If + no response is received before the timeout expires, the request fails and + returns an error. Defaults to no timeout. + :param track_scores: If `true`, calculate and return document scores, even if + the scores are not used for sorting. :param track_total_hits: Number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. :param typed_keys: If `true`, aggregation and suggester names are be prefixed by their respective types in the response. - :param version: If true, returns document version as part of a hit. + :param version: If `true`, the request returns the document version as part of + a hit. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -4418,7 +5122,319 @@ def search_mvt( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> BinaryApiResponse: """ - Search a vector tile. Search a vector tile for geospatial values. + .. raw:: html + +

Search a vector tile.

+

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.

+ ``_ @@ -4427,43 +5443,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'") @@ -4572,15 +5600,20 @@ def search_shards( routing: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+

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 @@ -4594,9 +5627,9 @@ def search_shards( a missing or closed index. :param local: If `true`, the request retrieves information from the local node only. - :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 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: @@ -4676,12 +5709,15 @@ def search_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a search with a search template. + .. raw:: html + +

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 @@ -4689,32 +5725,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. """ @@ -4808,34 +5846,39 @@ def terms_enum( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

Get terms in an index.

+

Discover terms that match a partial string in an index. + 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'") @@ -4914,33 +5957,77 @@ def termvectors( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get term vector information. Get information and statistics about terms in the - fields of a particular document. + .. raw:: html + +

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'") @@ -5057,46 +6144,65 @@ def update( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a document. Updates a document by running a script or passing a partial - document. + .. raw:: html + +

Update a document.

+

Update a document by running a script or passing a partial document.

+

If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias.

+

The script can update, delete, or skip modifying the document. + The API also supports passing a partial document, which is merged into the existing document. + To fully replace an existing document, use the index API. + This operation:

+
    +
  • Gets the document (collocated with the shard) from the index.
  • +
  • Runs the specified script.
  • +
  • Indexes the result.
  • +
+

The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation.

+

The _source field must be enabled to use this API. + In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp).

+ ``_ - :param index: The name of the index - :param id: Document ID - :param detect_noop: Set to false to disable setting 'result' in the response - to 'noop' if no change to the document occurred. - :param doc: A partial update to an existing document. - :param doc_as_upsert: Set to true to use the contents of 'doc' as the value of - 'upsert' + :param index: The name of the target index. By default, the index is created + automatically if it doesn't exist. + :param id: A unique identifier for the document to be updated. + :param detect_noop: If `true`, the `result` in the response is set to `noop` + (no operation) when there are no changes to the document. + :param doc: A partial update to an existing document. If both `doc` and `script` + are specified, `doc` is ignored. + :param doc_as_upsert: If `true`, use the contents of 'doc' as the value of 'upsert'. + NOTE: Using ingest pipelines with `doc_as_upsert` is not supported. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param lang: The script language. :param refresh: If 'true', Elasticsearch refreshes the affected shards to make - this operation visible to search, if 'wait_for' then wait for a refresh to - make this operation visible to search, if 'false' do nothing with refreshes. - :param require_alias: If true, the destination must be an index alias. - :param retry_on_conflict: Specify how many times should the operation be retried + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', it does nothing with refreshes. + :param require_alias: If `true`, the destination must be an index alias. + :param retry_on_conflict: The number of times the operation should be retried when a conflict occurs. - :param routing: Custom value used to route operations to a specific shard. - :param script: Script to execute to update the document. - :param scripted_upsert: Set to true to execute the script whether or not the - document exists. - :param source: Set to false to disable source retrieval. You can also specify - a comma-separated list of the fields you want to retrieve. - :param source_excludes: Specify the source fields you want to exclude. - :param source_includes: Specify the source fields you want to retrieve. - :param timeout: Period to wait for dynamic mapping updates and active shards. - This guarantees Elasticsearch waits for at least the timeout before failing. - The actual wait time could be longer, particularly when multiple waits occur. + :param routing: A custom value used to route operations to a specific shard. + :param script: The script to run to update the document. + :param scripted_upsert: If `true`, run the script whether or not the document + exists. + :param source: If `false`, turn off source retrieval. You can also specify a + comma-separated list of the fields you want to retrieve. + :param source_excludes: The source fields you want to exclude. + :param source_includes: The source fields you want to retrieve. + :param timeout: The period to wait for the following operations: dynamic mapping + updates and waiting for active shards. Elasticsearch waits for at least the + timeout period before failing. The actual wait time could be longer, particularly + when multiple waits occur. :param upsert: If the document does not already exist, the contents of 'upsert' - are inserted as a new document. If the document exists, the 'script' is executed. - :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operations. Set to 'all' or any positive integer - up to the total number of shards in the index (number_of_replicas+1). Defaults - to 1 meaning the primary shard. + are inserted as a new document. If the document exists, the 'script' is run. + :param wait_for_active_shards: The number of copies of each shard 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). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5222,82 +6328,166 @@ def update_by_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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'") @@ -5420,16 +6610,18 @@ def update_by_query_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Throttle an update by query operation. Change the number of requests per second - for a particular update by query operation. 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. + .. raw:: html + +

Throttle an update by query operation.

+

Change the number of requests per second for a particular update by query operation. + 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 87a8e5707..9899aaf72 100644 --- a/elasticsearch/_sync/client/async_search.py +++ b/elasticsearch/_sync/client/async_search.py @@ -36,11 +36,13 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an async search. If the asynchronous search is still running, it is cancelled. - Otherwise, the saved search results are deleted. If the Elasticsearch security - features are enabled, the deletion of a specific async search is restricted to: - the authenticated user that submitted the original search request; users that - have the `cancel_task` cluster privilege. + .. raw:: html + +

Delete an async search.

+

If the asynchronous search is still running, it is cancelled. + Otherwise, the saved search results are deleted. + If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege.

+ ``_ @@ -85,10 +87,12 @@ def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get async search results. Retrieve the results of a previously submitted asynchronous - search request. If the Elasticsearch security features are enabled, access to - the results of a specific async search is restricted to the user or API key that - submitted it. + .. raw:: html + +

Get async search results.

+

Retrieve the results of a previously submitted asynchronous search request. + If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it.

+ ``_ @@ -149,10 +153,12 @@ def status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -264,6 +270,7 @@ def submit( ignore_throttled: t.Optional[bool] = None, ignore_unavailable: t.Optional[bool] = None, indices_boost: t.Optional[t.Sequence[t.Mapping[str, float]]] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, keep_on_completion: t.Optional[bool] = None, knn: t.Optional[ t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]] @@ -326,15 +333,14 @@ def submit( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run an async search. When the primary sort of the results is an indexed field, - shards get sorted based on minimum and maximum value that they hold for that - field. Partial results become available following the sort criteria that was - requested. Warning: Asynchronous search does not support scroll or search requests - that include only the suggest section. By default, Elasticsearch does not allow - you to store an async search response larger than 10Mb and an attempt to do this - results in an error. The maximum allowed size for a stored async search response - can be set by changing the `search.max_async_search_response_size` cluster level - setting. + .. raw:: html + +

Run an async search.

+

When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested.

+

Warning: Asynchronous search does not support scroll or search requests that include only the suggest section.

+

By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. + The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting.

+ ``_ @@ -379,6 +385,9 @@ def submit( :param ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed) :param indices_boost: Boosts the _score of documents from specified indices. + :param keep_alive: Specifies how long the async search needs to be available. + Ongoing async searches and any saved search results are deleted after this + period. :param keep_on_completion: If `true`, results are stored for later retrieval when the search completes within the `wait_for_completion_timeout`. :param knn: Defines the approximate kNN search to run. @@ -505,6 +514,8 @@ def submit( __query["ignore_throttled"] = ignore_throttled if ignore_unavailable is not None: __query["ignore_unavailable"] = ignore_unavailable + if keep_alive is not None: + __query["keep_alive"] = keep_alive if keep_on_completion is not None: __query["keep_on_completion"] = keep_on_completion if lenient is not None: diff --git a/elasticsearch/_sync/client/autoscaling.py b/elasticsearch/_sync/client/autoscaling.py index ab6ec9f21..6a3768a98 100644 --- a/elasticsearch/_sync/client/autoscaling.py +++ b/elasticsearch/_sync/client/autoscaling.py @@ -38,9 +38,11 @@ def delete_autoscaling_policy( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an autoscaling policy. NOTE: This feature is designed for indirect use - by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. - Direct use is not supported. + .. raw:: html + +

Delete an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ ``_ @@ -89,18 +91,18 @@ def get_autoscaling_capacity( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the autoscaling capacity. NOTE: This feature is designed for indirect use - by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. - Direct use is not supported. This API gets the current autoscaling capacity based - on the configured autoscaling policy. It will return information to size the - cluster appropriately to the current workload. The `required_capacity` is calculated - as the maximum of the `required_capacity` result of all individual deciders that - are enabled for the policy. The operator should verify that the `current_nodes` - match the operator’s knowledge of the cluster to avoid making autoscaling decisions - based on stale or incomplete information. The response contains decider-specific - information you can use to diagnose how and why autoscaling determined a certain - capacity was required. This information is provided for diagnosis only. Do not - use this information to make autoscaling decisions. + .. raw:: html + +

Get the autoscaling capacity.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

This API gets the current autoscaling capacity based on the configured autoscaling policy. + It will return information to size the cluster appropriately to the current workload.

+

The required_capacity is calculated as the maximum of the required_capacity result of all individual deciders that are enabled for the policy.

+

The operator should verify that the current_nodes match the operator’s knowledge of the cluster to avoid making autoscaling decisions based on stale or incomplete information.

+

The response contains decider-specific information you can use to diagnose how and why autoscaling determined a certain capacity was required. + This information is provided for diagnosis only. + Do not use this information to make autoscaling decisions.

+ ``_ @@ -143,9 +145,11 @@ def get_autoscaling_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an autoscaling policy. NOTE: This feature is designed for indirect use by - Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. - Direct use is not supported. + .. raw:: html + +

Get an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ ``_ @@ -196,9 +200,11 @@ def put_autoscaling_policy( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an autoscaling policy. NOTE: This feature is designed for indirect - use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on - Kubernetes. Direct use is not supported. + .. raw:: html + +

Create or update an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ ``_ diff --git a/elasticsearch/_sync/client/cat.py b/elasticsearch/_sync/client/cat.py index 15b0ac240..cbacf8a67 100644 --- a/elasticsearch/_sync/client/cat.py +++ b/elasticsearch/_sync/client/cat.py @@ -57,18 +57,22 @@ def aliases( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get aliases. Retrieves the cluster’s index aliases, including filter and routing - information. The API does not return data stream aliases. CAT APIs are only intended - for human consumption using the command line or the Kibana console. They are - not intended for use by applications. For application consumption, use the aliases - API. + .. raw:: html + +

Get aliases.

+

Get the cluster's index aliases, including filter and routing information. + This API does not return data stream aliases.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API.

+ ``_ :param name: A comma-separated list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :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 format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -78,7 +82,10 @@ def aliases( the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. To indicated that the request should never timeout, + you can set it to `-1`. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -147,13 +154,16 @@ def allocation( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Provides a snapshot of the number of shards allocated to each data node and their - disk space. IMPORTANT: cat APIs are only intended for human consumption using - the command line or Kibana console. They are not intended for use by applications. + .. raw:: html + +

Get shard allocation information.

+

Get a snapshot of the number of shards allocated to each data node and their disk space.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.

+ ``_ - :param node_id: Comma-separated list of node identifiers or names used to limit + :param node_id: A comma-separated list of node identifiers or names used to limit the returned information. :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set @@ -231,17 +241,19 @@ def component_templates( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get component templates. Returns information about component templates in a cluster. - Component templates are building blocks for constructing index templates that - specify index mappings, settings, and aliases. 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 get component template - API. + .. raw:: html + +

Get component templates.

+

Get information about component templates in a cluster. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+

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 get component template API.

+ ``_ - :param name: The name of the component template. Accepts wildcard expressions. - If omitted, all component templates are returned. + :param name: The name of the component template. It accepts wildcard expressions. + If it is omitted, all component templates are returned. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -251,7 +263,7 @@ def component_templates( the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. + :param master_timeout: The period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -313,17 +325,19 @@ def count( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get a document count. Provides quick access to a document count for a data stream, - an index, or an entire cluster. The document count only includes live documents, - not deleted documents which have not yet been removed by the merge process. 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 count API. + .. raw:: html + +

Get a document count.

+

Get quick access to a document count for a data stream, an index, or an entire cluster. + The document count only includes live documents, not deleted documents which have not yet been removed by the merge process.

+

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 count API.

+ ``_ - :param index: Comma-separated list of data streams, indices, and aliases used - to limit the request. Supports wildcards (`*`). To target all data streams + :param index: A comma-separated list of data streams, indices, and aliases used + to limit the request. It supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -390,10 +404,13 @@ def fielddata( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the amount of heap memory currently used by the field data cache on every - data node in the cluster. 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 nodes stats API. + .. raw:: html + +

Get field data cache information.

+

Get the amount of heap memory currently used by the field data cache on every data node in the cluster.

+

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 nodes stats API.

+ ``_ @@ -467,17 +484,19 @@ def health( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the health status of a cluster, similar to the cluster health API. 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 cluster health API. This API is often used to check malfunctioning clusters. - To help you track cluster health alongside log files and alerting systems, the - API returns timestamps in two formats: `HH:MM:SS`, which is human-readable but - includes no date information; `Unix epoch time`, which is machine-sortable and - includes date information. The latter format is useful for cluster recoveries - that take multiple days. You can use the cat health API to verify cluster health - across multiple nodes. You also can use the API to track the recovery of a large - cluster over a longer period of time. + .. raw:: html + +

Get the cluster health status.

+

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 cluster health API. + This API is often used to check malfunctioning clusters. + To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: + HH:MM:SS, which is human-readable but includes no date information; + Unix epoch time, which is machine-sortable and includes date information. + The latter format is useful for cluster recoveries that take multiple days. + You can use the cat health API to verify cluster health across multiple nodes. + You also can use the API to track the recovery of a large cluster over a longer period of time.

+ ``_ @@ -531,7 +550,11 @@ def health( @_rewrite_parameters() def help(self) -> TextApiResponse: """ - Get CAT help. Returns help for the CAT APIs. + .. raw:: html + +

Get CAT help.

+

Get help for the CAT APIs.

+ ``_ """ @@ -582,16 +605,23 @@ def indices( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get index information. Returns high-level information about indices in a cluster, - including backing indices for data streams. Use this request to get the following - information for each index in a cluster: - shard count - document count - deleted - document count - primary store size - total store size of all shards, including - shard replicas These metrics are retrieved directly from Lucene, which Elasticsearch - uses internally to power indexing and search. As a result, all document counts - include hidden nested documents. To get an accurate count of Elasticsearch documents, - use the cat count or count APIs. 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 an index endpoint. + .. raw:: html + +

Get index information.

+

Get high-level information about indices in a cluster, including backing indices for data streams.

+

Use this request to get the following information for each index in a cluster:

+
    +
  • shard count
  • +
  • document count
  • +
  • deleted document count
  • +
  • primary store size
  • +
  • total store size of all shards, including shard replicas
  • +
+

These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents. + To get an accurate count of Elasticsearch documents, use the cat count or count APIs.

+

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 an index endpoint.

+ ``_ @@ -684,10 +714,12 @@ def master( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the master node, including the ID, bound IP address, - and name. 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 nodes info API. + .. raw:: html + +

Get master node information.

+

Get information about the master node, including the ID, bound IP address, and name.

+

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 nodes info API.

+ ``_ @@ -858,11 +890,14 @@ def ml_data_frame_analytics( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get data frame analytics jobs. Returns configuration and usage information about - data frame analytics jobs. CAT APIs are only intended for human consumption using - the Kibana console or command line. They are not intended for use by applications. - For application consumption, use the get data frame analytics jobs statistics - API. + .. raw:: html + +

Get data frame analytics jobs.

+

Get configuration and usage information about data frame analytics jobs.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get data frame analytics jobs statistics API.

+ ``_ @@ -1020,12 +1055,17 @@ def ml_datafeeds( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get datafeeds. Returns configuration and usage information about datafeeds. This - API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features - are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` - cluster privileges to use this API. CAT APIs are only intended for human consumption - using the Kibana console or command line. They are not intended for use by applications. - For application consumption, use the get datafeed statistics API. + .. raw:: html + +

Get datafeeds.

+

Get configuration and usage information about datafeeds. + This API returns a maximum of 10,000 datafeeds. + If the Elasticsearch security features are enabled, you must have monitor_ml, monitor, manage_ml, or manage + cluster privileges to use this API.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get datafeed statistics API.

+ ``_ @@ -1381,13 +1421,17 @@ def ml_jobs( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get anomaly detection jobs. Returns configuration and usage information for anomaly - detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch - security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, - or `manage` cluster privileges to use this API. CAT APIs are only intended for - human consumption using the Kibana console or command line. They are not intended - for use by applications. For application consumption, use the get anomaly detection - job statistics API. + .. raw:: html + +

Get anomaly detection jobs.

+

Get configuration and usage information for anomaly detection jobs. + This API returns a maximum of 10,000 jobs. + If the Elasticsearch security features are enabled, you must have monitor_ml, + monitor, manage_ml, or manage cluster privileges to use this API.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get anomaly detection job statistics API.

+ ``_ @@ -1565,10 +1609,14 @@ def ml_trained_models( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get trained models. Returns configuration and usage information about inference - trained models. CAT APIs are only intended for human consumption using the Kibana - console or command line. They are not intended for use by applications. For application - consumption, use the get trained models statistics API. + .. raw:: html + +

Get trained models.

+

Get configuration and usage information about inference trained models.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get trained models statistics API.

+ ``_ @@ -1656,10 +1704,12 @@ def nodeattrs( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about custom node attributes. 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 - nodes info API. + .. raw:: html + +

Get node attribute information.

+

Get information about custom node attributes. + 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 nodes info API.

+ ``_ @@ -1737,10 +1787,12 @@ def nodes( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the nodes in a cluster. 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 - nodes info API. + .. raw:: html + +

Get node information.

+

Get information about the nodes in a cluster. + 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 nodes info API.

+ ``_ @@ -1822,10 +1874,12 @@ def pending_tasks( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns cluster-level changes that have not yet been executed. 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 pending cluster tasks API. + .. raw:: html + +

Get pending task information.

+

Get information about cluster-level changes that have not yet taken effect. + 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 pending cluster tasks API.

+ ``_ @@ -1900,10 +1954,12 @@ def plugins( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns a list of plugins running on each node of a cluster. 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 nodes info API. + .. raw:: html + +

Get plugin information.

+

Get a list of plugins running on each node of a cluster. + 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 nodes info API.

+ ``_ @@ -1984,14 +2040,14 @@ def recovery( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about ongoing and completed shard recoveries. Shard recovery - is the process of initializing a shard copy, such as restoring a primary shard - from a snapshot or syncing a replica shard from a primary shard. When a shard - recovery completes, the recovered shard is available for search and indexing. - For data streams, the API returns information about the stream’s backing indices. - 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 index recovery API. + .. raw:: html + +

Get shard recovery information.

+

Get information about ongoing and completed shard recoveries. + Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or syncing a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing. + For data streams, the API returns information about the stream’s backing indices. + 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 index recovery API.

+ ``_ @@ -2074,10 +2130,12 @@ def repositories( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the snapshot repositories for a cluster. 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 - get snapshot repository API. + .. raw:: html + +

Get snapshot repository information.

+

Get a list of snapshot repositories for a cluster. + 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 get snapshot repository API.

+ ``_ @@ -2152,11 +2210,13 @@ def segments( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns low-level information about the Lucene segments in index shards. For - data streams, the API returns information about the backing indices. 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 index segments API. + .. raw:: html + +

Get segment information.

+

Get low-level information about the Lucene segments in index shards. + For data streams, the API returns information about the backing indices. + 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 index segments API.

+ ``_ @@ -2244,10 +2304,13 @@ def shards( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the shards in a cluster. For data streams, the API - returns information about the backing indices. IMPORTANT: cat APIs are only intended - for human consumption using the command line or Kibana console. They are not - intended for use by applications. + .. raw:: html + +

Get shard information.

+

Get information about the shards in a cluster. + For data streams, the API returns information about the backing indices. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.

+ ``_ @@ -2330,11 +2393,13 @@ def snapshots( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the snapshots stored in one or more repositories. A - snapshot is a backup of an index or running Elasticsearch cluster. 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 get snapshot API. + .. raw:: html + +

Get snapshot information.

+

Get information about the snapshots stored in one or more repositories. + A snapshot is a backup of an index or running Elasticsearch cluster. + 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 get snapshot API.

+ ``_ @@ -2422,10 +2487,12 @@ def tasks( wait_for_completion: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about tasks currently executing in the cluster. 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. + .. raw:: html + +

Get task information.

+

Get information about tasks currently running in the cluster. + 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.

+ ``_ @@ -2513,11 +2580,13 @@ def templates( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about index templates in a cluster. You can use index templates - to apply index settings and field mappings to new indices at creation. 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 get index template API. + .. raw:: html + +

Get index template information.

+

Get information about the index templates in a cluster. + You can use index templates to apply index settings and field mappings to new indices at creation. + 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 get index template API.

+ ``_ @@ -2599,11 +2668,13 @@ def thread_pool( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns thread pool statistics for each node in a cluster. Returned information - includes all built-in thread pools and custom thread pools. 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 nodes info API. + .. raw:: html + +

Get thread pool statistics.

+

Get thread pool statistics for each node in a cluster. + Returned information includes all built-in thread pools and custom thread pools. + 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 nodes info API.

+ ``_ @@ -2853,10 +2924,14 @@ def transforms( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get transforms. Returns configuration and usage information about transforms. - CAT APIs are only intended for human consumption using the Kibana console or - command line. They are not intended for use by applications. For application - consumption, use the get transform statistics API. + .. raw:: html + +

Get transform information.

+

Get configuration and usage information about transforms.

+

CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get transform statistics API.

+ ``_ diff --git a/elasticsearch/_sync/client/ccr.py b/elasticsearch/_sync/client/ccr.py index aeca44c29..fed08925a 100644 --- a/elasticsearch/_sync/client/ccr.py +++ b/elasticsearch/_sync/client/ccr.py @@ -36,8 +36,11 @@ def delete_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete auto-follow patterns. Delete a collection of cross-cluster replication - auto-follow patterns. + .. raw:: html + +

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

+ ``_ @@ -108,10 +111,12 @@ def follow( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a follower. Create a cross-cluster replication follower index that follows - a specific leader index. When the API returns, the follower index exists and - cross-cluster replication starts replicating operations from the leader index - to the follower index. + .. raw:: html + +

Create a follower. + Create a cross-cluster replication follower index that follows a specific leader index. + When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index.

+ ``_ @@ -202,10 +207,12 @@ def follow_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -246,9 +253,12 @@ def follow_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -301,23 +311,19 @@ def forget_follower( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Forget a follower. Remove the cross-cluster replication follower retention leases - from the leader. A following index takes out retention leases on its leader index. - These leases are used to increase the likelihood that the shards of the leader - index retain the history of operations that the shards of the following index - need to run replication. When a follower index is converted to a regular index - by the unfollow API (either by directly calling the API or by index lifecycle - management tasks), these leases are removed. However, removal of the leases can - fail, for example when the remote cluster containing the leader index is unavailable. - While the leases will eventually expire on their own, their extended existence - can cause the leader index to hold more history than necessary and prevent index - lifecycle management from performing some operations on the leader index. This - API exists to enable manually removing the leases when the unfollow API is unable - to do so. NOTE: This API does not stop replication by a following index. If you - use this API with a follower index that is still actively following, the following - index will add back retention leases on the leader. The only purpose of this - API is to handle the case of failure to remove the following retention leases - after the unfollow API is invoked. + .. raw:: html + +

Forget a follower. + Remove the cross-cluster replication follower retention leases from the leader.

+

A following index takes out retention leases on its leader index. + These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. + When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. + However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. + While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. + This API exists to enable manually removing the leases when the unfollow API is unable to do so.

+

NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. + The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked.

+ ``_ @@ -373,7 +379,11 @@ def get_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get auto-follow patterns. Get cross-cluster replication auto-follow patterns. + .. raw:: html + +

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

+ ``_ @@ -417,14 +427,16 @@ def pause_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. When it - resumes, the auto-follow pattern is active again and automatically configures - follower indices for newly created indices on the remote cluster that match its - patterns. Remote indices that were created while the pattern was paused will - also be followed, unless they have been deleted or closed in the interim. + .. raw:: html + +

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. + When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. + Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim.

+ ``_ @@ -465,10 +477,14 @@ def pause_follow( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -543,14 +559,15 @@ def put_auto_follow_pattern( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update auto-follow patterns. Create a collection of cross-cluster replication - auto-follow patterns for a remote cluster. Newly created indices on the remote - cluster that match any of the patterns are automatically configured as follower - indices. Indices on the remote cluster that were created before the auto-follow - pattern was created will not be auto-followed even if they match the pattern. - This API can also be used to update auto-follow patterns. NOTE: Follower indices - that were configured automatically before updating an auto-follow pattern will - remain unchanged even if they do not match against the new patterns. + .. raw:: html + +

Create or update auto-follow patterns. + Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. + Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. + Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern.

+

This API can also be used to update auto-follow patterns. + NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns.

+ ``_ @@ -674,11 +691,13 @@ def resume_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -743,11 +762,14 @@ def resume_follow( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Resume a follower. Resume a cross-cluster replication follower index that was - paused. The follower index could have been paused with the pause follower API. - Alternatively it could be paused due to replication that cannot be retried due - to failures during following tasks. When this API returns, the follower index - will resume fetching operations from the leader index. + .. raw:: html + +

Resume a follower. + Resume a cross-cluster replication follower index that was paused. + The follower index could have been paused with the pause follower API. + Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. + When this API returns, the follower index will resume fetching operations from the leader index.

+ ``_ @@ -829,8 +851,11 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cross-cluster replication stats. This API returns stats about auto-following - and the same shard-level stats as the get follower stats API. + .. 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.

+ ``_ """ @@ -866,13 +891,14 @@ def unfollow( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ diff --git a/elasticsearch/_sync/client/cluster.py b/elasticsearch/_sync/client/cluster.py index 9989e889e..2045006e4 100644 --- a/elasticsearch/_sync/client/cluster.py +++ b/elasticsearch/_sync/client/cluster.py @@ -44,13 +44,14 @@ def allocation_explain( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain the shard allocations. Get explanations for shard allocations in the - cluster. For unassigned shards, it provides an explanation for why the shard - is unassigned. For assigned shards, it provides an explanation for why the shard - is remaining on its current node and has not moved or rebalanced to another node. - This API can be very useful when attempting to diagnose why a shard is unassigned - or why a shard continues to remain on its current node when you might expect - otherwise. + .. raw:: html + +

Explain the shard allocations. + Get explanations for shard allocations in the cluster. + For unassigned shards, it provides an explanation for why the shard is unassigned. + For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. + This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.

+ ``_ @@ -119,8 +120,11 @@ def delete_component_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete component templates. Component templates are building blocks for constructing - index templates that specify index mappings, settings, and aliases. + .. raw:: html + +

Delete component templates. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+ ``_ @@ -170,8 +174,11 @@ def delete_voting_config_exclusions( wait_for_removal: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear cluster voting config exclusions. Remove master-eligible nodes from the - voting configuration exclusion list. + .. raw:: html + +

Clear cluster voting config exclusions. + Remove master-eligible nodes from the voting configuration exclusion list.

+ ``_ @@ -218,8 +225,11 @@ def exists_component_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check component templates. Returns information about whether a particular component - template exists. + .. raw:: html + +

Check component templates. + Returns information about whether a particular component template exists.

+ ``_ @@ -274,7 +284,11 @@ def get_component_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get component templates. Get information about component templates. + .. raw:: html + +

Get component templates. + Get information about component templates.

+ ``_ @@ -337,8 +351,11 @@ def get_settings( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster-wide settings. By default, it returns only settings that have been - explicitly defined. + .. raw:: html + +

Get cluster-wide settings. + By default, it returns only settings that have been explicitly defined.

+ ``_ @@ -420,16 +437,17 @@ def health( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the cluster health status. You can also use the API to get the health status - of only specified data streams and indices. For data streams, the API retrieves - the health status of the stream’s backing indices. The cluster health status - is: green, yellow or red. On the shard level, a red status indicates that the - specific shard is not allocated in the cluster. Yellow means that the primary - shard is allocated but replicas are not. Green means that all shards are allocated. - The index level status is controlled by the worst shard status. One of the main - benefits of the API is the ability to wait until the cluster reaches a certain - high watermark health level. The cluster status is controlled by the worst index - status. + .. raw:: html + +

Get the cluster health status. + You can also use the API to get the health status of only specified data streams and indices. + For data streams, the API retrieves the health status of the stream’s backing indices.

+

The cluster health status is: green, yellow or red. + On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. + The index level status is controlled by the worst shard status.

+

One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. + The cluster status is controlled by the worst index status.

+ ``_ @@ -533,7 +551,11 @@ def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster info. Returns basic information about the cluster. + .. raw:: html + +

Get cluster info. + Returns basic information about the cluster.

+ ``_ @@ -575,14 +597,14 @@ def pending_tasks( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the pending cluster tasks. Get information about cluster-level changes (such - as create index, update mapping, allocate or fail shard) that have not yet taken - effect. NOTE: This API returns a list of any pending updates to the cluster state. - These are distinct from the tasks reported by the task management API which include - periodic tasks and tasks initiated by the user, such as node stats, search queries, - or create index requests. However, if a user-initiated task such as a create - index command causes a cluster state update, the activity of this task might - be reported by both task api and pending cluster tasks API. + .. raw:: html + +

Get the pending cluster tasks. + Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect.

+

NOTE: This API returns a list of any pending updates to the cluster state. + These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. + However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.

+ ``_ @@ -630,33 +652,24 @@ def post_voting_config_exclusions( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update voting configuration exclusions. Update the cluster voting config exclusions - by node IDs or node names. By default, if there are more than three master-eligible - nodes in the cluster and you remove fewer than half of the master-eligible nodes - in the cluster at once, the voting configuration automatically shrinks. If you - want to shrink the voting configuration to contain fewer than three nodes or - to remove half or more of the master-eligible nodes in the cluster at once, use - this API to remove departing nodes from the voting configuration manually. The - API adds an entry for each specified node to the cluster’s voting configuration - exclusions list. It then waits until the cluster has reconfigured its voting - configuration to exclude the specified nodes. Clusters should have no voting - configuration exclusions in normal operation. Once the excluded nodes have stopped, - clear the voting configuration exclusions with `DELETE /_cluster/voting_config_exclusions`. - This API waits for the nodes to be fully removed from the cluster before it returns. - If your cluster has voting configuration exclusions for nodes that you no longer - intend to remove, use `DELETE /_cluster/voting_config_exclusions?wait_for_removal=false` - to clear the voting configuration exclusions without waiting for the nodes to - leave the cluster. A response to `POST /_cluster/voting_config_exclusions` with - an HTTP status code of 200 OK guarantees that the node has been removed from - the voting configuration and will not be reinstated until the voting configuration - exclusions are cleared by calling `DELETE /_cluster/voting_config_exclusions`. - If the call to `POST /_cluster/voting_config_exclusions` fails or returns a response - with an HTTP status code other than 200 OK then the node may not have been removed - from the voting configuration. In that case, you may safely retry the call. NOTE: - Voting exclusions are required only when you remove at least half of the master-eligible - nodes from a cluster in a short time period. They are not required when removing - master-ineligible nodes or when removing fewer than half of the master-eligible - nodes. + .. raw:: html + +

Update voting configuration exclusions. + Update the cluster voting config exclusions by node IDs or node names. + By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. + If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. + The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. + It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes.

+

Clusters should have no voting configuration exclusions in normal operation. + Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. + This API waits for the nodes to be fully removed from the cluster before it returns. + If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster.

+

A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. + If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. + In that case, you may safely retry the call.

+

NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. + They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.

+ ``_ @@ -718,21 +731,23 @@ def put_component_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a component template. Component templates are building blocks - for constructing index templates that specify index mappings, settings, and aliases. - An index template can be composed of multiple component templates. To use a component - template, specify it in an index template’s `composed_of` list. Component templates - are only applied to new data streams and indices as part of a matching index - template. Settings and mappings specified directly in the index template or the - create index request override any settings or mappings specified in a component - template. Component templates are only used during index creation. For data streams, - this includes data stream creation and the creation of a stream’s backing indices. - Changes to component templates do not affect existing indices, including a stream’s - backing indices. You can use C-style `/* *\\/` block comments in component templates. - You can include comments anywhere in the request body except before the opening - curly bracket. **Applying component templates** You cannot directly apply a component - template to a data stream or index. To be applied, a component template must - be included in an index template's `composed_of` list. + .. raw:: html + +

Create or update a component template. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+

An index template can be composed of multiple component templates. + To use a component template, specify it in an index template’s composed_of list. + Component templates are only applied to new data streams and indices as part of a matching index template.

+

Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.

+

Component templates are only used during index creation. + For data streams, this includes data stream creation and the creation of a stream’s backing indices. + Changes to component templates do not affect existing indices, including a stream’s backing indices.

+

You can use C-style /* *\\/ block comments in component templates. + You can include comments anywhere in the request body except before the opening curly bracket.

+

Applying component templates

+

You cannot directly apply a component template to a data stream or index. + To be applied, a component template must be included in an index template's composed_of list.

+ ``_ @@ -821,26 +836,23 @@ def put_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the cluster settings. Configure and update dynamic settings on a running - cluster. You can also configure dynamic settings locally on an unstarted or shut - down node in `elasticsearch.yml`. Updates made with this API can be persistent, - which apply across cluster restarts, or transient, which reset after a cluster - restart. You can also reset transient or persistent settings by assigning them - a null value. If you configure the same setting using multiple methods, Elasticsearch - applies the settings in following order of precedence: 1) Transient setting; - 2) Persistent setting; 3) `elasticsearch.yml` setting; 4) Default setting value. - For example, you can apply a transient setting to override a persistent setting - or `elasticsearch.yml` setting. However, a change to an `elasticsearch.yml` setting - will not override a defined transient or persistent setting. TIP: In Elastic - Cloud, use the user settings feature to configure all cluster settings. This - method automatically rejects unsafe settings that could break your cluster. If - you run Elasticsearch on your own hardware, use this API to configure dynamic - cluster settings. Only use `elasticsearch.yml` for static cluster settings and - node settings. The API doesn’t require a restart and ensures a setting’s value - is the same on all nodes. WARNING: Transient cluster settings are no longer recommended. - Use persistent cluster settings instead. If a cluster becomes unstable, transient - settings can clear unexpectedly, resulting in a potentially undesired cluster - configuration. + .. raw:: html + +

Update the cluster settings. + Configure and update dynamic settings on a running cluster. + You can also configure dynamic settings locally on an unstarted or shut down node in elasticsearch.yml.

+

Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart. + You can also reset transient or persistent settings by assigning them a null value.

+

If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) elasticsearch.yml setting; 4) Default setting value. + For example, you can apply a transient setting to override a persistent setting or elasticsearch.yml setting. + However, a change to an elasticsearch.yml setting will not override a defined transient or persistent setting.

+

TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster. + If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings. + Only use elasticsearch.yml for static cluster settings and node settings. + The API doesn’t require a restart and ensures a setting’s value is the same on all nodes.

+

WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead. + If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration.

+ ``_ @@ -894,9 +906,12 @@ def remote_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. 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.

+ ``_ """ @@ -941,25 +956,19 @@ def reroute( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reroute the cluster. Manually change the allocation of individual shards in the - cluster. For example, a shard can be moved from one node to another explicitly, - an allocation can be canceled, and an unassigned shard can be explicitly allocated - to a specific node. It is important to note that after processing any reroute - commands Elasticsearch will perform rebalancing as normal (respecting the values - of settings such as `cluster.routing.rebalance.enable`) in order to remain in - a balanced state. For example, if the requested allocation includes moving a - shard from node1 to node2 then this may cause a shard to be moved from node2 - back to node1 to even things out. The cluster can be set to disable allocations - using the `cluster.routing.allocation.enable` setting. If allocations are disabled - then the only allocations that will be performed are explicit ones given using - the reroute command, and consequent allocations due to rebalancing. The cluster - will attempt to allocate a shard a maximum of `index.allocation.max_retries` - times in a row (defaults to `5`), before giving up and leaving the shard unallocated. - This scenario can be caused by structural problems such as having an analyzer - which refers to a stopwords file which doesn’t exist on all nodes. Once the problem - has been corrected, allocation can be manually retried by calling the reroute - API with the `?retry_failed` URI query parameter, which will attempt a single - retry round for these shards. + .. raw:: html + +

Reroute the cluster. + Manually change the allocation of individual shards in the cluster. + For example, a shard can be moved from one node to another explicitly, an allocation can be canceled, and an unassigned shard can be explicitly allocated to a specific node.

+

It is important to note that after processing any reroute commands Elasticsearch will perform rebalancing as normal (respecting the values of settings such as cluster.routing.rebalance.enable) in order to remain in a balanced state. + For example, if the requested allocation includes moving a shard from node1 to node2 then this may cause a shard to be moved from node2 back to node1 to even things out.

+

The cluster can be set to disable allocations using the cluster.routing.allocation.enable setting. + If allocations are disabled then the only allocations that will be performed are explicit ones given using the reroute command, and consequent allocations due to rebalancing.

+

The cluster will attempt to allocate a shard a maximum of index.allocation.max_retries times in a row (defaults to 5), before giving up and leaving the shard unallocated. + This scenario can be caused by structural problems such as having an analyzer which refers to a stopwords file which doesn’t exist on all nodes.

+

Once the problem has been corrected, allocation can be manually retried by calling the reroute API with the ?retry_failed URI query parameter, which will attempt a single retry round for these shards.

+ ``_ @@ -1048,26 +1057,23 @@ def state( wait_for_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the cluster state. Get comprehensive information about the state of the cluster. - The cluster state is an internal data structure which keeps track of a variety - of information needed by every node, including the identity and attributes of - the other nodes in the cluster; cluster-wide settings; index metadata, including - the mapping and settings for each index; the location and status of every shard - copy in the cluster. The elected master node ensures that every node in the cluster - has a copy of the same cluster state. This API lets you retrieve a representation - of this internal state for debugging or diagnostic purposes. You may need to - consult the Elasticsearch source code to determine the precise meaning of the - response. By default the API will route requests to the elected master node since - this node is the authoritative source of cluster states. You can also retrieve - the cluster state held on the node handling the API request by adding the `?local=true` - query parameter. Elasticsearch may need to expend significant effort to compute - a response to this API in larger clusters, and the response may comprise a very - large quantity of data. If you use this API repeatedly, your cluster may become - unstable. WARNING: The response is a representation of an internal data structure. - Its format is not subject to the same compatibility guarantees as other more - stable APIs and may change from version to version. Do not query this API using - external monitoring tools. Instead, obtain the information you require using - other more stable cluster APIs. + .. raw:: html + +

Get the cluster state. + Get comprehensive information about the state of the cluster.

+

The cluster state is an internal data structure which keeps track of a variety of information needed by every node, including the identity and attributes of the other nodes in the cluster; cluster-wide settings; index metadata, including the mapping and settings for each index; the location and status of every shard copy in the cluster.

+

The elected master node ensures that every node in the cluster has a copy of the same cluster state. + This API lets you retrieve a representation of this internal state for debugging or diagnostic purposes. + You may need to consult the Elasticsearch source code to determine the precise meaning of the response.

+

By default the API will route requests to the elected master node since this node is the authoritative source of cluster states. + You can also retrieve the cluster state held on the node handling the API request by adding the ?local=true query parameter.

+

Elasticsearch may need to expend significant effort to compute a response to this API in larger clusters, and the response may comprise a very large quantity of data. + If you use this API repeatedly, your cluster may become unstable.

+

WARNING: The response is a representation of an internal data structure. + Its format is not subject to the same compatibility guarantees as other more stable APIs and may change from version to version. + Do not query this API using external monitoring tools. + Instead, obtain the information you require using other more stable cluster APIs.

+ ``_ @@ -1151,9 +1157,11 @@ def stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster statistics. Get basic index metrics (shard numbers, store size, memory - usage) and information about the current nodes that form the cluster (number, - roles, os, jvm versions, memory usage, cpu and installed plugins). + .. raw:: html + +

Get cluster statistics. + Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).

+ ``_ diff --git a/elasticsearch/_sync/client/connector.py b/elasticsearch/_sync/client/connector.py index 7b334ab01..76c7d8735 100644 --- a/elasticsearch/_sync/client/connector.py +++ b/elasticsearch/_sync/client/connector.py @@ -43,8 +43,11 @@ def check_in( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Check in a connector. Update the `last_seen` field in the connector and set it - to the current timestamp. + .. raw:: html + +

Check in a connector.

+

Update the last_seen field in the connector and set it to the current timestamp.

+ ``_ @@ -86,10 +89,14 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a connector. Removes a connector and associated sync jobs. This is a destructive - action that is not recoverable. NOTE: This action doesn’t delete any API keys, - ingest pipelines, or data indices associated with the connector. These need to - be removed manually. + .. raw:: html + +

Delete a connector.

+

Removes a connector and associated sync jobs. + This is a destructive action that is not recoverable. + NOTE: This action doesn’t delete any API keys, ingest pipelines, or data indices associated with the connector. + These need to be removed manually.

+ ``_ @@ -134,7 +141,11 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a connector. Get the details about a connector. + .. raw:: html + +

Get a connector.

+

Get the details about a connector.

+ ``_ @@ -229,8 +240,12 @@ def last_sync( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector last sync stats. Update the fields related to the last sync - of a connector. This action is used for analytics and monitoring. + .. raw:: html + +

Update the connector last sync stats.

+

Update the fields related to the last sync of a connector. + This action is used for analytics and monitoring.

+ ``_ @@ -325,7 +340,11 @@ def list( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all connectors. Get information about all connectors. + .. raw:: html + +

Get all connectors.

+

Get information about all connectors.

+ ``_ @@ -400,11 +419,13 @@ def post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a connector. Connectors are Elasticsearch integrations that bring content - from third-party data sources, which can be deployed on Elastic Cloud or hosted - on your own infrastructure. Elastic managed connectors (Native connectors) are - a managed service on Elastic Cloud. Self-managed connectors (Connector clients) - are self-managed on your infrastructure. + .. raw:: html + +

Create a connector.

+

Connectors are Elasticsearch integrations that bring content from third-party data sources, which can be deployed on Elastic Cloud or hosted on your own infrastructure. + Elastic managed connectors (Native connectors) are a managed service on Elastic Cloud. + Self-managed connectors (Connector clients) are self-managed on your infrastructure.

+ ``_ @@ -483,7 +504,10 @@ def put( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a connector. + .. raw:: html + +

Create or update a connector.

+ ``_ @@ -553,10 +577,12 @@ def sync_job_cancel( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancel a connector sync job. Cancel a connector sync job, which sets the status - to cancelling and updates `cancellation_requested_at` to the current time. The - connector service is then responsible for setting the status of connector sync - jobs to cancelled. + .. raw:: html + +

Cancel a connector sync job.

+

Cancel a connector sync job, which sets the status to cancelling and updates cancellation_requested_at to the current time. + The connector service is then responsible for setting the status of connector sync jobs to cancelled.

+ ``_ @@ -601,11 +627,13 @@ def sync_job_check_in( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Check in a connector sync job. Check in a connector sync job and set the `last_seen` - field to the current time before updating it in the internal index. To sync data - using self-managed connectors, you need to deploy the Elastic connector service - on your own infrastructure. This service runs automatically on Elastic Cloud - for Elastic managed connectors. + .. raw:: html + +

Check in a connector sync job. + Check in a connector sync job and set the last_seen field to the current time before updating it in the internal index.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -656,14 +684,16 @@ def sync_job_claim( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Claim a connector sync job. This action updates the job status to `in_progress` - and sets the `last_seen` and `started_at` timestamps to the current time. Additionally, - it can set the `sync_cursor` property for the sync job. This API is not intended - for direct connector management by users. It supports the implementation of services - that utilize the connector protocol to communicate with Elasticsearch. To sync - data using self-managed connectors, you need to deploy the Elastic connector - service on your own infrastructure. This service runs automatically on Elastic - Cloud for Elastic managed connectors. + .. raw:: html + +

Claim a connector sync job. + This action updates the job status to in_progress and sets the last_seen and started_at timestamps to the current time. + Additionally, it can set the sync_cursor property for the sync job.

+

This API is not intended for direct connector management by users. + It supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -720,8 +750,12 @@ def sync_job_delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a connector sync job. Remove a connector sync job and its associated data. - This is a destructive action that is not recoverable. + .. raw:: html + +

Delete a connector sync job.

+

Remove a connector sync job and its associated data. + This is a destructive action that is not recoverable.

+ ``_ @@ -769,10 +803,13 @@ def sync_job_error( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Set a connector sync job error. Set the `error` field for a connector sync job - and set its `status` to `error`. To sync data using self-managed connectors, - you need to deploy the Elastic connector service on your own infrastructure. - This service runs automatically on Elastic Cloud for Elastic managed connectors. + .. raw:: html + +

Set a connector sync job error. + Set the error field for a connector sync job and set its status to error.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -823,7 +860,10 @@ def sync_job_get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a connector sync job. + .. raw:: html + +

Get a connector sync job.

+ ``_ @@ -892,8 +932,11 @@ def sync_job_list( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all connector sync jobs. Get information about all stored connector sync - jobs listed by their creation date in ascending order. + .. raw:: html + +

Get all connector sync jobs.

+

Get information about all stored connector sync jobs listed by their creation date in ascending order.

+ ``_ @@ -955,8 +998,11 @@ def sync_job_post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a connector sync job. Create a connector sync job document in the internal - index and initialize its counters and timestamps with default values. + .. raw:: html + +

Create a connector sync job.

+

Create a connector sync job document in the internal index and initialize its counters and timestamps with default values.

+ ``_ @@ -1024,12 +1070,15 @@ def sync_job_update_stats( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Set the connector sync job stats. Stats include: `deleted_document_count`, `indexed_document_count`, - `indexed_document_volume`, and `total_document_count`. You can also update `last_seen`. - This API is mainly used by the connector service for updating sync job information. - To sync data using self-managed connectors, you need to deploy the Elastic connector - service on your own infrastructure. This service runs automatically on Elastic - Cloud for Elastic managed connectors. + .. raw:: html + +

Set the connector sync job stats. + Stats include: deleted_document_count, indexed_document_count, indexed_document_volume, and total_document_count. + You can also update last_seen. + This API is mainly used by the connector service for updating sync job information.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -1108,8 +1157,11 @@ def update_active_filtering( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Activate the connector draft filter. Activates the valid draft filtering for - a connector. + .. raw:: html + +

Activate the connector draft filter.

+

Activates the valid draft filtering for a connector.

+ ``_ @@ -1155,11 +1207,14 @@ def update_api_key_id( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector API key ID. Update the `api_key_id` and `api_key_secret_id` - fields of a connector. You can specify the ID of the API key used for authorization - and the ID of the connector secret where the API key is stored. The connector - secret ID is required only for Elastic managed (native) connectors. Self-managed - connectors (connector clients) do not use this field. + .. raw:: html + +

Update the connector API key ID.

+

Update the api_key_id and api_key_secret_id fields of a connector. + You can specify the ID of the API key used for authorization and the ID of the connector secret where the API key is stored. + The connector secret ID is required only for Elastic managed (native) connectors. + Self-managed connectors (connector clients) do not use this field.

+ ``_ @@ -1214,8 +1269,11 @@ def update_configuration( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector configuration. Update the configuration field in the connector - document. + .. raw:: html + +

Update the connector configuration.

+

Update the configuration field in the connector document.

+ ``_ @@ -1269,10 +1327,13 @@ def update_error( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector error field. Set the error field for the connector. If the - error provided in the request body is non-null, the connector’s status is updated - to error. Otherwise, if the error is reset to null, the connector status is updated - to connected. + .. raw:: html + +

Update the connector error field.

+

Set the error field for the connector. + If the error provided in the request body is non-null, the connector’s status is updated to error. + Otherwise, if the error is reset to null, the connector status is updated to connected.

+ ``_ @@ -1325,14 +1386,22 @@ def update_features( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector features. Update the connector features in the connector - document. This API can be used to control the following aspects of a connector: - * document-level security * incremental syncs * advanced sync rules * basic sync - rules Normally, the running connector service automatically manages these features. - However, you can use this API to override the default behavior. To sync data - using self-managed connectors, you need to deploy the Elastic connector service - on your own infrastructure. This service runs automatically on Elastic Cloud - for Elastic managed connectors. + .. raw:: html + +

Update the connector features. + Update the connector features in the connector document. + This API can be used to control the following aspects of a connector:

+
    +
  • document-level security
  • +
  • incremental syncs
  • +
  • advanced sync rules
  • +
  • basic sync rules
  • +
+

Normally, the running connector service automatically manages these features. + However, you can use this API to override the default behavior.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ ``_ @@ -1387,10 +1456,13 @@ def update_filtering( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector filtering. Update the draft filtering configuration of a - connector and marks the draft validation state as edited. The filtering draft - is activated once validated by the running Elastic connector service. The filtering - property is used to configure sync rules (both basic and advanced) for a connector. + .. raw:: html + +

Update the connector filtering.

+

Update the draft filtering configuration of a connector and marks the draft validation state as edited. + The filtering draft is activated once validated by the running Elastic connector service. + The filtering property is used to configure sync rules (both basic and advanced) for a connector.

+ ``_ @@ -1447,8 +1519,11 @@ def update_filtering_validation( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector draft filtering validation. Update the draft filtering validation - info for a connector. + .. raw:: html + +

Update the connector draft filtering validation.

+

Update the draft filtering validation info for a connector.

+ ``_ @@ -1501,8 +1576,11 @@ def update_index_name( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector index name. Update the `index_name` field of a connector, - specifying the index where the data ingested by the connector is stored. + .. raw:: html + +

Update the connector index name.

+

Update the index_name field of a connector, specifying the index where the data ingested by the connector is stored.

+ ``_ @@ -1556,7 +1634,10 @@ def update_name( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector name and description. + .. raw:: html + +

Update the connector name and description.

+ ``_ @@ -1610,7 +1691,10 @@ def update_native( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector is_native flag. + .. raw:: html + +

Update the connector is_native flag.

+ ``_ @@ -1663,8 +1747,11 @@ def update_pipeline( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector pipeline. When you create a new connector, the configuration - of an ingest pipeline is populated with default settings. + .. raw:: html + +

Update the connector pipeline.

+

When you create a new connector, the configuration of an ingest pipeline is populated with default settings.

+ ``_ @@ -1717,7 +1804,10 @@ def update_scheduling( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector scheduling. + .. raw:: html + +

Update the connector scheduling.

+ ``_ @@ -1770,7 +1860,10 @@ def update_service_type( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector service type. + .. raw:: html + +

Update the connector service type.

+ ``_ @@ -1830,7 +1923,10 @@ def update_status( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update the connector status. + .. raw:: html + +

Update the connector status.

+ ``_ diff --git a/elasticsearch/_sync/client/dangling_indices.py b/elasticsearch/_sync/client/dangling_indices.py index 9e0ab3870..28f228ca6 100644 --- a/elasticsearch/_sync/client/dangling_indices.py +++ b/elasticsearch/_sync/client/dangling_indices.py @@ -39,10 +39,12 @@ def delete_dangling_index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a dangling index. If Elasticsearch encounters index data that is absent - from the current cluster state, those indices are considered to be dangling. - For example, this can happen if you delete more than `cluster.indices.tombstones.size` - indices while an Elasticsearch node is offline. + .. raw:: html + +

Delete a dangling index. + If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

+ ``_ @@ -98,10 +100,12 @@ def import_dangling_index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Import a dangling index. If Elasticsearch encounters index data that is absent - from the current cluster state, those indices are considered to be dangling. - For example, this can happen if you delete more than `cluster.indices.tombstones.size` - indices while an Elasticsearch node is offline. + .. raw:: html + +

Import a dangling index.

+

If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

+ ``_ @@ -156,11 +160,13 @@ def list_dangling_indices( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the dangling indices. If Elasticsearch encounters index data that is absent - from the current cluster state, those indices are considered to be dangling. - For example, this can happen if you delete more than `cluster.indices.tombstones.size` - indices while an Elasticsearch node is offline. Use this API to list dangling - indices, which you can then import or delete. + .. raw:: html + +

Get the dangling indices.

+

If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

+

Use this API to list dangling indices, which you can then import or delete.

+ ``_ """ diff --git a/elasticsearch/_sync/client/enrich.py b/elasticsearch/_sync/client/enrich.py index 0a8cbe5c1..1d76ab4d0 100644 --- a/elasticsearch/_sync/client/enrich.py +++ b/elasticsearch/_sync/client/enrich.py @@ -36,7 +36,11 @@ def delete_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an enrich policy. Deletes an existing enrich policy and its enrich index. + .. raw:: html + +

Delete an enrich policy. + Deletes an existing enrich policy and its enrich index.

+ ``_ @@ -77,7 +81,11 @@ def execute_policy( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Run an enrich policy. Create the enrich index for an existing enrich policy. + .. raw:: html + +

Run an enrich policy. + Create the enrich index for an existing enrich policy.

+ ``_ @@ -121,7 +129,11 @@ def get_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an enrich policy. Returns information about an enrich policy. + .. raw:: html + +

Get an enrich policy. + Returns information about an enrich policy.

+ ``_ @@ -171,7 +183,11 @@ def put_policy( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an enrich policy. Creates an enrich policy. + .. raw:: html + +

Create an enrich policy. + Creates an enrich policy.

+ ``_ @@ -224,8 +240,11 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get enrich stats. Returns enrich coordinator statistics and information about - enrich policies that are currently executing. + .. raw:: html + +

Get enrich stats. + Returns enrich coordinator statistics and information about enrich policies that are currently executing.

+ ``_ """ diff --git a/elasticsearch/_sync/client/eql.py b/elasticsearch/_sync/client/eql.py index e59e6dbea..6b97b985b 100644 --- a/elasticsearch/_sync/client/eql.py +++ b/elasticsearch/_sync/client/eql.py @@ -36,8 +36,12 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an async EQL search. Delete an async EQL search or a stored synchronous - EQL search. The API also deletes results for the search. + .. raw:: html + +

Delete an async EQL search. + Delete an async EQL search or a stored synchronous EQL search. + The API also deletes results for the search.

+ ``_ @@ -83,8 +87,11 @@ def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get async EQL search results. Get the current status and available results for - an async EQL search or a stored synchronous EQL search. + .. raw:: html + +

Get async EQL search results. + Get the current status and available results for an async EQL search or a stored synchronous EQL search.

+ ``_ @@ -134,8 +141,11 @@ def get_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the async EQL status. Get the current status for an async EQL search or a - stored synchronous EQL search without returning results. + .. raw:: html + +

Get the async EQL status. + Get the current status for an async EQL search or a stored synchronous EQL search without returning results.

+ ``_ @@ -223,9 +233,12 @@ def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get EQL search results. Returns search results for an Event Query Language (EQL) - query. EQL assumes each document in a data stream or index corresponds to an - event. + .. raw:: html + +

Get EQL search results. + Returns search results for an Event Query Language (EQL) query. + EQL assumes each document in a data stream or index corresponds to an event.

+ ``_ diff --git a/elasticsearch/_sync/client/esql.py b/elasticsearch/_sync/client/esql.py index 6d37a7f71..6fcfbfa50 100644 --- a/elasticsearch/_sync/client/esql.py +++ b/elasticsearch/_sync/client/esql.py @@ -20,7 +20,7 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import _rewrite_parameters +from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters class EsqlClient(NamespacedClient): @@ -30,6 +30,288 @@ class EsqlClient(NamespacedClient): "query", "columnar", "filter", + "include_ccs_metadata", + "locale", + "params", + "profile", + "tables", + ), + ignore_deprecated_options={"params"}, + ) + def async_query( + self, + *, + query: t.Optional[str] = None, + columnar: t.Optional[bool] = None, + delimiter: t.Optional[str] = None, + drop_null_columns: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter: t.Optional[t.Mapping[str, t.Any]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + format: t.Optional[ + t.Union[ + str, + t.Literal[ + "arrow", "cbor", "csv", "json", "smile", "tsv", "txt", "yaml" + ], + ] + ] = None, + human: t.Optional[bool] = None, + include_ccs_metadata: t.Optional[bool] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + keep_on_completion: t.Optional[bool] = None, + locale: t.Optional[str] = None, + params: t.Optional[ + t.Sequence[t.Union[None, bool, float, int, str, t.Any]] + ] = None, + pretty: t.Optional[bool] = None, + profile: t.Optional[bool] = None, + tables: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Mapping[str, t.Any]]] + ] = None, + wait_for_completion_timeout: t.Optional[ + t.Union[str, t.Literal[-1], t.Literal[0]] + ] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Run an async ES|QL query. + Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available.

+

The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties.

+ + + ``_ + + :param query: The ES|QL query API accepts an ES|QL query string in the query + parameter, runs it, and returns the results. + :param columnar: By default, ES|QL returns results as rows. For example, FROM + returns each individual document as one row. For the JSON, YAML, CBOR and + smile formats, ES|QL can return the results in a columnar fashion where one + row represents all the values of a certain column in the results. + :param delimiter: The character to use between values within a CSV row. It is + valid only for the CSV format. + :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. + :param filter: Specify a Query DSL query in the filter parameter to filter the + set of documents that an ES|QL query runs on. + :param format: A short version of the Accept header, for example `json` or `yaml`. + :param include_ccs_metadata: When set to `true` and performing a cross-cluster + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. + :param keep_alive: The period for which the query and its results are stored + in the cluster. The default period is five days. When this period expires, + the query and its results are deleted, even if the query is still ongoing. + If the `keep_on_completion` parameter is false, Elasticsearch only stores + async queries that do not complete within the period set by the `wait_for_completion_timeout` + parameter, regardless of this value. + :param keep_on_completion: Indicates whether the query and its results are stored + in the cluster. If false, the query and its results are stored in the cluster + only if the request does not complete during the period set by the `wait_for_completion_timeout` + parameter. + :param locale: + :param params: To avoid any attempts of hacking or code injection, extract the + values in a separate list of parameters. Use question mark placeholders (?) + in the query string for each of the parameters. + :param profile: If provided and `true` the response will include an extra `profile` + object with information on how the query was executed. This information is + for human debugging and its format can change at any time but it can give + some insight into the performance of each part of the query. + :param tables: Tables to use with the LOOKUP operation. The top level key is + the table name and the next level key is the column name. + :param wait_for_completion_timeout: The period to wait for the request to finish. + By default, the request waits for 1 second for the query results. If the + query completes during this period, results are returned Otherwise, a query + ID is returned that can later be used to retrieve the results. + """ + if query is None and body is None: + raise ValueError("Empty value passed for parameter 'query'") + __path_parts: t.Dict[str, str] = {} + __path = "/_query/async" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if delimiter is not None: + __query["delimiter"] = delimiter + 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 format is not None: + __query["format"] = format + if human is not None: + __query["human"] = human + if keep_alive is not None: + __query["keep_alive"] = keep_alive + if keep_on_completion is not None: + __query["keep_on_completion"] = keep_on_completion + if pretty is not None: + __query["pretty"] = pretty + if wait_for_completion_timeout is not None: + __query["wait_for_completion_timeout"] = wait_for_completion_timeout + if not __body: + if query is not None: + __body["query"] = query + if columnar is not None: + __body["columnar"] = columnar + if filter is not None: + __body["filter"] = filter + if include_ccs_metadata is not None: + __body["include_ccs_metadata"] = include_ccs_metadata + if locale is not None: + __body["locale"] = locale + if params is not None: + __body["params"] = params + if profile is not None: + __body["profile"] = profile + if tables is not None: + __body["tables"] = tables + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="esql.async_query", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + def async_query_delete( + self, + *, + id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Delete an async ES|QL query. + If the query is still running, it is cancelled. + Otherwise, the stored results are deleted.

+

If the Elasticsearch security features are enabled, only the following users can use this API to delete a query:

+
    +
  • The authenticated user that submitted the original query request
  • +
  • Users with the cancel_task cluster privilege
  • +
+ + + ``_ + + :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`. + """ + 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"]}' + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_delete", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + def async_query_get( + 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, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + wait_for_completion_timeout: t.Optional[ + t.Union[str, t.Literal[-1], t.Literal[0]] + ] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get async ES|QL query results. + Get the current status and available results or stored results for an ES|QL asynchronous query. + If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API.

+ + + ``_ + + :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. + :param keep_alive: The period for which the query and its results are stored + in the cluster. When this period expires, the query and its results are deleted, + even if the query is still ongoing. + :param wait_for_completion_timeout: The period to wait for the request to finish. + By default, the request waits for complete query results. If the request + completes during the period specified in this parameter, complete query results + are returned. Otherwise, the response returns an `is_running` value of `true` + and no results. + """ + 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"]}' + __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 keep_alive is not None: + __query["keep_alive"] = keep_alive + if pretty is not None: + __query["pretty"] = pretty + if wait_for_completion_timeout is not None: + __query["wait_for_completion_timeout"] = wait_for_completion_timeout + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_get", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=( + "query", + "columnar", + "filter", + "include_ccs_metadata", "locale", "params", "profile", @@ -56,6 +338,7 @@ def query( ] ] = None, human: t.Optional[bool] = None, + include_ccs_metadata: t.Optional[bool] = None, locale: t.Optional[str] = None, params: t.Optional[ t.Sequence[t.Union[None, bool, float, int, str, t.Any]] @@ -68,8 +351,11 @@ def query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run an ES|QL query. Get search results for an ES|QL (Elasticsearch query language) - query. + .. raw:: html + +

Run an ES|QL query. + Get search results for an ES|QL (Elasticsearch query language) query.

+ ``_ @@ -88,6 +374,10 @@ def query( :param filter: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. :param format: A short version of the Accept header, e.g. json, yaml. + :param include_ccs_metadata: When set to `true` and performing a cross-cluster + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. :param locale: :param params: To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) @@ -126,6 +416,8 @@ def query( __body["columnar"] = columnar if filter is not None: __body["filter"] = filter + if include_ccs_metadata is not None: + __body["include_ccs_metadata"] = include_ccs_metadata if locale is not None: __body["locale"] = locale if params is not None: diff --git a/elasticsearch/_sync/client/features.py b/elasticsearch/_sync/client/features.py index c74e73780..34c50adf2 100644 --- a/elasticsearch/_sync/client/features.py +++ b/elasticsearch/_sync/client/features.py @@ -35,17 +35,17 @@ def get_features( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the features. Get a list of features that can be included in snapshots using - the `feature_states` field when creating a snapshot. You can use this API to - determine which feature states to include when taking a snapshot. By default, - all feature states are included in a snapshot if that snapshot includes the global - state, or none if it does not. A feature state includes one or more system indices - necessary for a given feature to function. In order to ensure data integrity, - all system indices that comprise a feature state are snapshotted and restored - together. The features listed by this API are a combination of built-in features - and features defined by plugins. In order for a feature state to be listed in - this API and recognized as a valid feature state by the create snapshot API, - the plugin that defines that feature must be installed on the master node. + .. raw:: html + +

Get the features. + Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. + You can use this API to determine which feature states to include when taking a snapshot. + By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not.

+

A feature state includes one or more system indices necessary for a given feature to function. + In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together.

+

The features listed by this API are a combination of built-in features and features defined by plugins. + In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node.

+ ``_ """ @@ -81,20 +81,20 @@ def reset_features( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset the features. Clear all of the state information stored in system indices - by Elasticsearch features, including the security and machine learning indices. - WARNING: Intended for development and testing use only. Do not reset features - on a production cluster. Return a cluster to the same state as a new installation - by resetting the feature state for all Elasticsearch features. This deletes all - state information stored in system indices. The response code is HTTP 200 if - the state is successfully reset for all features. It is HTTP 500 if the reset - operation failed for any feature. Note that select features might provide a way - to reset particular system indices. Using this API resets all features, both - those that are built-in and implemented as plugins. To list the features that - will be affected, use the get features API. 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. + .. raw:: html + +

Reset the features. + Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices.

+

WARNING: Intended for development and testing use only. Do not reset features on a production cluster.

+

Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. + This deletes all state information stored in system indices.

+

The response code is HTTP 200 if the state is successfully reset for all features. + It is HTTP 500 if the reset operation failed for any feature.

+

Note that select features might provide a way to reset particular system indices. + Using this API resets all features, both those that are built-in and implemented as plugins.

+

To list the features that will be affected, use the get features API.

+

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.

+ ``_ """ diff --git a/elasticsearch/_sync/client/fleet.py b/elasticsearch/_sync/client/fleet.py index 39d30f376..f7bce669d 100644 --- a/elasticsearch/_sync/client/fleet.py +++ b/elasticsearch/_sync/client/fleet.py @@ -46,8 +46,10 @@ def global_checkpoints( wait_for_index: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current global checkpoints for an index. This API is design for internal - use by the fleet server project. + .. raw:: html + +

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

+ ``_ @@ -132,10 +134,12 @@ def msearch( wait_for_checkpoints: t.Optional[t.Sequence[int]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes several [fleet searches](https://www.elastic.co/guide/en/elasticsearch/reference/current/fleet-search.html) - with a single API request. The API follows the same structure as the [multi search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) - API. However, similar to the fleet search API, it supports the wait_for_checkpoints - parameter. + .. raw:: html + +

Executes several fleet searches with a single API request. + The API follows the same structure as the multi search API. However, similar to the fleet search API, it + supports the wait_for_checkpoints parameter.

+ :param searches: :param index: A single target to search. If the target is an index alias, it @@ -378,9 +382,11 @@ def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The purpose of the fleet search api is to provide a search api where the search - will only be executed after provided checkpoint has been processed and is visible - for searches inside of Elasticsearch. + .. raw:: html + +

The purpose of the fleet search api is to provide a search api where the search will only be executed + 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. diff --git a/elasticsearch/_sync/client/graph.py b/elasticsearch/_sync/client/graph.py index b8253cfc1..127b6172c 100644 --- a/elasticsearch/_sync/client/graph.py +++ b/elasticsearch/_sync/client/graph.py @@ -45,14 +45,15 @@ def explore( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explore graph analytics. Extract and summarize information about the documents - and terms in an Elasticsearch data stream or index. The easiest way to understand - the behavior of this API is to use the Graph UI to explore connections. An initial - request to the `_explore` API contains a seed query that identifies the documents - of interest and specifies the fields that define the vertices and connections - you want to include in the graph. Subsequent requests enable you to spider out - from one more vertices of interest. You can exclude vertices that have already - been returned. + .. raw:: html + +

Explore graph analytics. + Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. + The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. + An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. + Subsequent requests enable you to spider out from one more vertices of interest. + You can exclude vertices that have already been returned.

+ ``_ diff --git a/elasticsearch/_sync/client/ilm.py b/elasticsearch/_sync/client/ilm.py index 28e41c891..95d569acf 100644 --- a/elasticsearch/_sync/client/ilm.py +++ b/elasticsearch/_sync/client/ilm.py @@ -38,9 +38,11 @@ def delete_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a lifecycle policy. You cannot delete policies that are currently in use. - If the policy is being used to manage any indices, the request fails and returns - an error. + .. raw:: html + +

Delete a lifecycle policy. + You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error.

+ ``_ @@ -93,11 +95,13 @@ def explain_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain the lifecycle state. Get the current lifecycle status for one or more - indices. For data streams, the API retrieves the current lifecycle status for - the stream's backing indices. The response indicates when the index entered each - lifecycle state, provides the definition of the running phase, and information - about any failures. + .. raw:: html + +

Explain the lifecycle state. + Get the current lifecycle status for one or more indices. + For data streams, the API retrieves the current lifecycle status for the stream's backing indices.

+

The response indicates when the index entered each lifecycle state, provides the definition of the running phase, and information about any failures.

+ ``_ @@ -159,7 +163,10 @@ def get_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get lifecycle policies. + .. raw:: html + +

Get lifecycle policies.

+ ``_ @@ -210,7 +217,11 @@ def get_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the ILM status. Get the current index lifecycle management status. + .. raw:: html + +

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

+ ``_ """ @@ -251,18 +262,22 @@ def migrate_to_data_tiers( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Migrate to data tiers routing. Switch the indices, ILM policies, and legacy, - composable, and component templates from using custom node attributes and attribute-based - allocation filters to using data tiers. Optionally, delete one legacy index template. - Using node roles enables ILM to automatically move the indices between data tiers. - Migrating away from custom node attributes routing can be manually performed. - This API provides an automated way of performing three out of the four manual - steps listed in the migration guide: 1. Stop setting the custom hot attribute - on new indices. 1. Remove custom allocation settings from existing ILM policies. - 1. Replace custom allocation settings from existing indices with the corresponding - tier preference. ILM must be stopped before performing the migration. Use the - stop ILM and get ILM status APIs to wait until the reported operation mode is - `STOPPED`. + .. raw:: html + +

Migrate to data tiers routing. + Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. + Optionally, delete one legacy index template. + Using node roles enables ILM to automatically move the indices between data tiers.

+

Migrating away from custom node attributes routing can be manually performed. + This API provides an automated way of performing three out of the four manual steps listed in the migration guide:

+
    +
  1. Stop setting the custom hot attribute on new indices.
  2. +
  3. Remove custom allocation settings from existing ILM policies.
  4. +
  5. Replace custom allocation settings from existing indices with the corresponding tier preference.
  6. +
+

ILM must be stopped before performing the migration. + Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED.

+ ``_ @@ -322,21 +337,20 @@ def move_to_step( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Move to a lifecycle step. Manually move an index into a specific step in the - lifecycle policy and run that step. WARNING: This operation can result in the - loss of data. Manually moving an index into a specific step runs that step even - if it has already been performed. This is a potentially destructive action and - this should be considered an expert level API. You must specify both the current - step and the step to be executed in the body of the request. The request will - fail if the current step does not match the step currently running for the index - This is to prevent the index from being moved from an unexpected step into the - next step. When specifying the target (`next_step`) to which the index will be - moved, either the name or both the action and name fields are optional. If only - the phase is specified, the index will move to the first step of the first action - in the target phase. If the phase and action are specified, the index will move - to the first step of the specified action in the specified phase. Only actions - specified in the ILM policy are considered valid. An index cannot move to a step - that is not part of its policy. + .. raw:: html + +

Move to a lifecycle step. + Manually move an index into a specific step in the lifecycle policy and run that step.

+

WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API.

+

You must specify both the current step and the step to be executed in the body of the request. + The request will fail if the current step does not match the step currently running for the index + This is to prevent the index from being moved from an unexpected step into the next step.

+

When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. + If only the phase is specified, the index will move to the first step of the first action in the target phase. + If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. + Only actions specified in the ILM policy are considered valid. + An index cannot move to a step that is not part of its policy.

+ ``_ @@ -399,9 +413,12 @@ def put_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a lifecycle policy. If the specified policy exists, it is replaced - and the policy version is incremented. NOTE: Only the latest version of the policy - is stored, you cannot revert to previous versions. + .. raw:: html + +

Create or update a lifecycle policy. + If the specified policy exists, it is replaced and the policy version is incremented.

+

NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions.

+ ``_ @@ -460,8 +477,12 @@ def remove_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Remove policies from an index. Remove the assigned lifecycle policies from an - index or a data stream's backing indices. It also stops managing the indices. + .. raw:: html + +

Remove policies from an index. + Remove the assigned lifecycle policies from an index or a data stream's backing indices. + It also stops managing the indices.

+ ``_ @@ -501,10 +522,13 @@ def retry( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retry a policy. Retry running the lifecycle policy for an index that is in the - ERROR step. The API sets the policy back to the step where the error occurred - and runs the step. Use the explain lifecycle state API to determine whether an - index is in the ERROR step. + .. raw:: html + +

Retry a policy. + Retry running the lifecycle policy for an index that is in the ERROR step. + The API sets the policy back to the step where the error occurred and runs the step. + Use the explain lifecycle state API to determine whether an index is in the ERROR step.

+ ``_ @@ -546,9 +570,13 @@ def start( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start the ILM plugin. Start the index lifecycle management plugin if it is currently - stopped. ILM is started automatically when the cluster is formed. Restarting - ILM is necessary only when it has been stopped using the stop ILM API. + .. raw:: html + +

Start the ILM plugin. + Start the index lifecycle management plugin if it is currently stopped. + ILM is started automatically when the cluster is formed. + Restarting ILM is necessary only when it has been stopped using the stop ILM API.

+ ``_ @@ -592,12 +620,14 @@ def stop( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop the ILM plugin. Halt all lifecycle management operations and stop the index - lifecycle management plugin. This is useful when you are performing maintenance - on the cluster and need to prevent ILM from performing any actions on your indices. - The API returns as soon as the stop request has been acknowledged, but the plugin - might continue to run until in-progress operations complete and the plugin can - be safely stopped. Use the get ILM status API to check whether ILM is running. + .. raw:: html + +

Stop the ILM plugin. + Halt all lifecycle management operations and stop the index lifecycle management plugin. + This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices.

+

The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. + Use the get ILM status API to check whether ILM is running.

+ ``_ diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index c379acc2c..03bbc56c2 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -55,8 +55,11 @@ def add_block( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Add an index block. Limits the operations allowed on an index by blocking specific - operation types. + .. raw:: html + +

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

+ ``_ @@ -143,12 +146,15 @@ def analyze( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get tokens from text analysis. The analyze API performs analysis on a text string - and returns the resulting tokens. Generating excessive amount of tokens may cause - a node to run out of memory. The `index.analyze.max_token_count` setting enables - you to limit the number of tokens that can be produced. If more than this limit - of tokens gets generated, an error occurs. The `_analyze` endpoint without a - specified index will always use `10000` as its limit. + .. raw:: html + +

Get tokens from text analysis. + The analyze API performs analysis on a text string and returns the resulting tokens.

+

Generating excessive amount of tokens may cause a node to run out of memory. + The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. + If more than this limit of tokens gets generated, an error occurs. + The _analyze endpoint without a specified index will always use 10000 as its limit.

+ ``_ @@ -249,11 +255,15 @@ def clear_cache( request: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the cache. Clear the cache of one or more indices. For data streams, the - API clears the caches of the stream's backing indices. By default, the clear - cache API clears all caches. To clear only specific caches, use the `fielddata`, - `query`, or `request` parameters. To clear the cache only of specific fields, - use the `fields` parameter. + .. raw:: html + +

Clear the cache. + Clear the cache of one or more indices. + For data streams, the API clears the caches of the stream's backing indices.

+

By default, the clear cache API clears all caches. + To clear only specific caches, use the fielddata, query, or request parameters. + To clear the cache only of specific fields, use the fields parameter.

+ ``_ @@ -338,44 +348,44 @@ def clone( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clone an index. Clone an existing index into a new index. Each original primary - shard is cloned into a new primary shard in the new index. IMPORTANT: Elasticsearch - does not apply index templates to the resulting index. The API also does not - copy index metadata from the original index. Index metadata includes aliases, - index lifecycle management phase definitions, and cross-cluster replication (CCR) - follower information. For example, if you clone a CCR follower index, the resulting - clone will not be a follower index. The clone API copies most index settings - from the source index to the resulting index, with the exception of `index.number_of_replicas` - and `index.auto_expand_replicas`. To set the number of replicas in the resulting - index, configure these settings in the clone request. Cloning works as follows: - * First, it creates a new target index with the same definition as the source - index. * Then it hard-links segments from the source index into the target index. - If the file system does not support hard-linking, all segments are copied into - the new index, which is a much more time consuming process. * Finally, it recovers - the target index as though it were a closed index which had just been re-opened. - IMPORTANT: Indices can only be cloned if they meet the following requirements: - * The index must be marked as read-only and have a cluster health status of green. - * The target index must not exist. * The source index must have the same number - of primary shards as the target index. * The node handling the clone process - must have sufficient free disk space to accommodate a second copy of the existing - index. The current write index on a data stream cannot be cloned. In order to - clone the current write index, the data stream must first be rolled over so that - a new write index is created and then the previous write index can be cloned. - NOTE: Mappings cannot be specified in the `_clone` request. The mappings of the - source index will be used for the target index. **Monitor the cloning process** - The cloning process can be monitored with the cat recovery API or the cluster - health API can be used to wait until all primary shards have been allocated by - setting the `wait_for_status` parameter to `yellow`. The `_clone` API returns - as soon as the target index has been added to the cluster state, before any shards - have been allocated. At this point, all shards are in the state unassigned. If, - for any reason, the target index can't be allocated, its primary shard will remain - unassigned until it can be allocated on that node. Once the primary shard is - allocated, it moves to state initializing, and the clone process begins. When - the clone operation completes, the shard will become active. At that point, Elasticsearch - will try to allocate any replicas and may decide to relocate the primary shard - to another node. **Wait for active shards** Because the clone operation creates - a new index to clone the shards to, the wait for active shards setting on index - creation applies to the clone index action as well. + .. raw:: html + +

Clone an index. + Clone an existing index into a new index. + Each original primary shard is cloned into a new primary shard in the new index.

+

IMPORTANT: Elasticsearch does not apply index templates to the resulting index. + The API also does not copy index metadata from the original index. + Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. + For example, if you clone a CCR follower index, the resulting clone will not be a follower index.

+

The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. + To set the number of replicas in the resulting index, configure these settings in the clone request.

+

Cloning works as follows:

+
    +
  • First, it creates a new target index with the same definition as the source index.
  • +
  • Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process.
  • +
  • Finally, it recovers the target index as though it were a closed index which had just been re-opened.
  • +
+

IMPORTANT: Indices can only be cloned if they meet the following requirements:

+
    +
  • The index must be marked as read-only and have a cluster health status of green.
  • +
  • The target index must not exist.
  • +
  • The source index must have the same number of primary shards as the target index.
  • +
  • The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+

The current write index on a data stream cannot be cloned. + In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned.

+

NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index.

+

Monitor the cloning process

+

The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow.

+

The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. + At this point, all shards are in the state unassigned. + If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node.

+

Once the primary shard is allocated, it moves to state initializing, and the clone process begins. + When the clone operation completes, the shard will become active. + At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node.

+

Wait for active shards

+

Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well.

+ ``_ @@ -463,24 +473,23 @@ def close( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Close an index. A closed index is blocked for read or write operations and does - not allow all operations that opened indices allow. It is not possible to index - documents or to search for documents in a closed index. Closed indices do not - have to maintain internal data structures for indexing or searching documents, - which results in a smaller overhead on the cluster. When opening or closing an - index, the master node is responsible for restarting the index shards to reflect - the new state of the index. The shards will then go through the normal recovery - process. The data of opened and closed indices is automatically replicated by - the cluster to ensure that enough shard copies are safely kept around at all - times. You can open and close multiple indices. An error is thrown if the request - explicitly refers to a missing index. This behaviour can be turned off using - the `ignore_unavailable=true` parameter. By default, you must explicitly name - the indices you are opening or closing. To open or close indices with `_all`, - `*`, or other wildcard expressions, change the` action.destructive_requires_name` - setting to `false`. This setting can also be changed with the cluster update - settings API. Closed indices consume a significant amount of disk-space which - can cause problems in managed environments. Closing indices can be turned off - with the cluster settings API by setting `cluster.indices.close.enable` to `false`. + .. raw:: html + +

Close an index. + A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. + It is not possible to index documents or to search for documents in a closed index. + Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster.

+

When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. + The shards will then go through the normal recovery process. + The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.

+

You can open and close multiple indices. + An error is thrown if the request explicitly refers to a missing index. + This behaviour can be turned off using the ignore_unavailable=true parameter.

+

By default, you must explicitly name the indices you are opening or closing. + To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API.

+

Closed indices consume a significant amount of disk-space which can cause problems in managed environments. + Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false.

+ ``_ @@ -561,26 +570,27 @@ def create( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an index. You can use the create index API to add a new index to an Elasticsearch - cluster. When creating an index, you can specify the following: * Settings for - the index. * Mappings for fields in the index. * Index aliases **Wait for active - shards** By default, index creation will only return a response to the client - when the primary copies of each shard have been started, or the request times - out. The index creation response will indicate what happened. For example, `acknowledged` - indicates whether the index was successfully created in the cluster, `while shards_acknowledged` - indicates whether the requisite number of shard copies were started for each - shard in the index before timing out. Note that it is still possible for either - `acknowledged` or `shards_acknowledged` to be `false`, but for the index creation - to be successful. These values simply indicate whether the operation completed - before the timeout. If `acknowledged` is false, the request timed out before - the cluster state was updated with the newly created index, but it probably will - be created sometime soon. If `shards_acknowledged` is false, then the request - timed out before the requisite number of shards were started (by default just - the primaries), even if the cluster state was successfully updated to reflect - the newly created index (that is to say, `acknowledged` is `true`). You can change - the default of only waiting for the primary shards to start through the index - setting `index.write.wait_for_active_shards`. Note that changing this setting - will also affect the `wait_for_active_shards` value on all subsequent write operations. + .. raw:: html + +

Create an index. + You can use the create index API to add a new index to an Elasticsearch cluster. + When creating an index, you can specify the following:

+
    +
  • Settings for the index.
  • +
  • Mappings for fields in the index.
  • +
  • Index aliases
  • +
+

Wait for active shards

+

By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. + The index creation response will indicate what happened. + For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. + Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. + These values simply indicate whether the operation completed before the timeout. + If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. + If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true).

+

You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. + Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations.

+ ``_ @@ -653,8 +663,12 @@ def create_data_stream( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a data stream. Creates a data stream. You must have a matching index template - with data stream enabled. + .. raw:: html + +

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

+ ``_ @@ -715,7 +729,11 @@ def data_streams_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream stats. Retrieves statistics for one or more data streams. + .. raw:: html + +

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

+ ``_ @@ -776,11 +794,15 @@ def delete( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete indices. Deleting an index deletes its documents, shards, and metadata. - It does not delete related Kibana components, such as data views, visualizations, - or dashboards. You cannot delete the current write index of a data stream. To - delete the index, you must roll over the data stream so a new write index is - created. You can then use the delete index API to delete the previous write index. + .. raw:: html + +

Delete indices. + Deleting an index deletes its documents, shards, and metadata. + It does not delete related Kibana components, such as data views, visualizations, or dashboards.

+

You cannot delete the current write index of a data stream. + To delete the index, you must roll over the data stream so a new write index is created. + You can then use the delete index API to delete the previous write index.

+ ``_ @@ -850,7 +872,11 @@ def delete_alias( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an alias. Removes a data stream or index from an alias. + .. raw:: html + +

Delete an alias. + Removes a data stream or index from an alias.

+ ``_ @@ -914,8 +940,11 @@ def delete_data_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete data stream lifecycles. Removes the data stream lifecycle from a data - stream, rendering it not managed by the data stream lifecycle. + .. raw:: html + +

Delete data stream lifecycles. + Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle.

+ ``_ @@ -975,7 +1004,11 @@ def delete_data_stream( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete data streams. Deletes one or more data streams and their backing indices. + .. raw:: html + +

Delete data streams. + Deletes one or more data streams and their backing indices.

+ ``_ @@ -1027,10 +1060,13 @@ def delete_index_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an index template. The provided may contain multiple - template names separated by a comma. If multiple template names are specified - then there is no wildcard support and the provided names should match completely - with existing templates. + .. raw:: html + +

Delete an index template. + The provided may contain multiple template names separated by a comma. If multiple template + names are specified then there is no wildcard support and the provided names should match completely with + existing templates.

+ ``_ @@ -1082,7 +1118,10 @@ def delete_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a legacy index template. + .. raw:: html + +

Delete a legacy index template.

+ ``_ @@ -1145,16 +1184,16 @@ def disk_usage( run_expensive_tasks: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Analyze the index disk usage. Analyze the disk usage of each field of an index - or data stream. This API might not support indices created in previous Elasticsearch - versions. The result of a small index can be inaccurate as some parts of an index - might not be analyzed by the API. NOTE: The total size of fields of the analyzed - shards of the index in the response is usually smaller than the index `store_size` - value because some small metadata files are ignored and some parts of data files - might not be scanned by the API. Since stored fields are stored together in a - compressed format, the sizes of stored fields are also estimates and can be inaccurate. - The stored size of the `_id` field is likely underestimated while the `_source` - field is overestimated. + .. raw:: html + +

Analyze the index disk usage. + Analyze the disk usage of each field of an index or data stream. + This API might not support indices created in previous Elasticsearch versions. + The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API.

+

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

+ ``_ @@ -1228,14 +1267,16 @@ def downsample( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Downsample an index. Aggregate a time series (TSDS) index and store pre-computed - statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each - metric field grouped by a configured time interval. For example, a TSDS index - that contains metrics sampled every 10 seconds can be downsampled to an hourly - index. All documents within an hour interval are summarized and stored as a single - document in the downsample index. NOTE: Only indices in a time series data stream - are supported. Neither field nor document level security can be defined on the - source index. The source index must be read only (`index.blocks.write: true`). + .. raw:: html + +

Downsample an index. + Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. + For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. + All documents within an hour interval are summarized and stored as a single document in the downsample index.

+

NOTE: Only indices in a time series data stream are supported. + Neither field nor document level security can be defined on the source index. + The source index must be read only (index.blocks.write: true).

+ ``_ @@ -1303,7 +1344,11 @@ def exists( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check indices. Check if one or more indices, index aliases, or data streams exist. + .. raw:: html + +

Check indices. + Check if one or more indices, index aliases, or data streams exist.

+ ``_ @@ -1381,7 +1426,11 @@ def exists_alias( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check aliases. Checks if one or more data stream or index aliases exist. + .. raw:: html + +

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

+ ``_ @@ -1451,7 +1500,11 @@ def exists_index_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check index templates. Check whether index templates exist. + .. raw:: html + +

Check index templates. + Check whether index templates exist.

+ ``_ @@ -1500,11 +1553,13 @@ def exists_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check existence of index templates. Get information about whether index templates - exist. Index templates define settings, mappings, and aliases that can be applied - automatically to new indices. IMPORTANT: This documentation is about legacy index - templates, which are deprecated and will be replaced by the composable templates - introduced in Elasticsearch 7.8. + .. raw:: html + +

Check existence of index templates. + Get information about whether index templates exist. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+ ``_ @@ -1558,10 +1613,11 @@ def explain_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the status for a data stream lifecycle. Get information about an index or - data stream's current data stream lifecycle status, such as time since index - creation, time since rollover, the lifecycle configuration managing the index, - or any errors encountered during lifecycle execution. + .. raw:: html + +

Get the status for a data stream lifecycle. + Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution.

+ ``_ @@ -1625,13 +1681,15 @@ def field_usage_stats( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get field usage stats. Get field usage information for each shard and field of - an index. Field usage statistics are automatically captured when queries are - running on a cluster. A shard-level search request that accesses a given field, - even if multiple times during that request, is counted as a single use. The response - body reports the per-shard usage count of the data structures that back the fields - in the index. A given request will increment each count by a maximum value of - 1, even if the request accesses the same field multiple times. + .. raw:: html + +

Get field usage stats. + Get field usage information for each shard and field of an index. + Field usage statistics are automatically captured when queries are running on a cluster. + A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use.

+

The response body reports the per-shard usage count of the data structures that back the fields in the index. + A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times.

+ ``_ @@ -1719,22 +1777,18 @@ def flush( wait_if_ongoing: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Flush data streams or indices. Flushing a data stream or index is the process - of making sure that any data that is currently only stored in the transaction - log is also permanently stored in the Lucene index. When restarting, Elasticsearch - replays any unflushed operations from the transaction log into the Lucene index - to bring it back into the state that it was in before the restart. Elasticsearch - automatically triggers flushes as needed, using heuristics that trade off the - size of the unflushed transaction log against the cost of performing each flush. - After each operation has been flushed it is permanently stored in the Lucene - index. This may mean that there is no need to maintain an additional copy of - it in the transaction log. The transaction log is made up of multiple files, - called generations, and Elasticsearch will delete any generation files when they - are no longer needed, freeing up disk space. It is also possible to trigger a - flush on one or more indices using the flush API, although it is rare for users - to need to call this API directly. If you call the flush API after indexing some - documents then a successful response indicates that Elasticsearch has flushed - all the documents that were indexed before the flush API was called. + .. raw:: html + +

Flush data streams or indices. + Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. + When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. + Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush.

+

After each operation has been flushed it is permanently stored in the Lucene index. + This may mean that there is no need to maintain an additional copy of it in the transaction log. + The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space.

+

It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. + If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called.

+ ``_ @@ -1817,49 +1871,49 @@ def forcemerge( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Force a merge. Perform the force merge operation on the shards of one or more - indices. For data streams, the API forces a merge on the shards of the stream's - backing indices. Merging reduces the number of segments in each shard by merging - some of them together and also frees up the space used by deleted documents. - Merging normally happens automatically, but sometimes it is useful to trigger - a merge manually. WARNING: We recommend force merging only a read-only index - (meaning the index is no longer receiving writes). When documents are updated - or deleted, the old version is not immediately removed but instead soft-deleted - and marked with a "tombstone". These soft-deleted documents are automatically - cleaned up during regular segment merges. But force merge can cause very large - (greater than 5 GB) segments to be produced, which are not eligible for regular - merges. So the number of soft-deleted documents can then grow rapidly, resulting - in higher disk usage and worse search performance. If you regularly force merge - an index receiving writes, this can also make snapshots more expensive, since - the new documents can't be backed up incrementally. **Blocks during a force merge** - Calls to this API block until the merge is complete (unless request contains - `wait_for_completion=false`). If the client connection is lost before completion - then the force merge process will continue in the background. Any new requests - to force merge the same indices will also block until the ongoing force merge - is complete. **Running force merge asynchronously** If the request contains `wait_for_completion=false`, - Elasticsearch performs some preflight checks, launches the request, and returns - a task you can use to get the status of the task. However, you can not cancel - this task as the force merge task is not cancelable. Elasticsearch creates a - record of this task as a document at `_tasks/`. When you are done with - a task, you should delete the task document so Elasticsearch can reclaim the - space. **Force merging multiple indices** You can force merge multiple indices - with a single request by targeting: * One or more data streams that contain multiple - backing indices * Multiple indices * One or more aliases * All data streams and - indices in a cluster Each targeted shard is force-merged separately using the - force_merge threadpool. By default each node only has a single `force_merge` - thread which means that the shards on that node are force-merged one at a time. - If you expand the `force_merge` threadpool on a node then it will force merge - its shards in parallel Force merge makes the storage for the shard being merged - temporarily increase, as it may require free space up to triple its size in case - `max_num_segments parameter` is set to `1`, to rewrite all segments into a new - one. **Data streams and time-based indices** Force-merging is useful for managing - a data stream's older backing indices and other time-based indices, particularly - after a rollover. In these cases, each index only receives indexing traffic for - a certain period of time. Once an index receive no more writes, its shards can - be force-merged to a single segment. This can be a good idea because single-segment - shards can sometimes use simpler and more efficient data structures to perform - searches. For example: ``` POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - ``` + .. raw:: html + +

Force a merge. + Perform the force merge operation on the shards of one or more indices. + For data streams, the API forces a merge on the shards of the stream's backing indices.

+

Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. + Merging normally happens automatically, but sometimes it is useful to trigger a merge manually.

+

WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). + When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". + These soft-deleted documents are automatically cleaned up during regular segment merges. + But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. + So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. + If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally.

+

Blocks during a force merge

+

Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). + If the client connection is lost before completion then the force merge process will continue in the background. + Any new requests to force merge the same indices will also block until the ongoing force merge is complete.

+

Running force merge asynchronously

+

If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. + However, you can not cancel this task as the force merge task is not cancelable. + Elasticsearch creates a record of this task as a document at _tasks/<task_id>. + When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.

+

Force merging multiple indices

+

You can force merge multiple indices with a single request by targeting:

+
    +
  • One or more data streams that contain multiple backing indices
  • +
  • Multiple indices
  • +
  • One or more aliases
  • +
  • All data streams and indices in a cluster
  • +
+

Each targeted shard is force-merged separately using the force_merge threadpool. + By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. + If you expand the force_merge threadpool on a node then it will force merge its shards in parallel

+

Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one.

+

Data streams and time-based indices

+

Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. + In these cases, each index only receives indexing traffic for a certain period of time. + Once an index receive no more writes, its shards can be force-merged to a single segment. + This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. + For example:

+
POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1
+          
+ ``_ @@ -1952,8 +2006,12 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index information. Get information about one or more indices. For data streams, - the API returns information about the stream’s backing indices. + .. raw:: html + +

Get index information. + Get information about one or more indices. For data streams, the API returns information about the + stream’s backing indices.

+ ``_ @@ -2042,7 +2100,11 @@ def get_alias( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get aliases. Retrieves information for one or more data stream or index aliases. + .. raw:: html + +

Get aliases. + Retrieves information for one or more data stream or index aliases.

+ ``_ @@ -2124,8 +2186,11 @@ def get_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream lifecycles. Retrieves the data stream lifecycle configuration - of one or more data streams. + .. raw:: html + +

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

+ ``_ @@ -2179,8 +2244,11 @@ def get_data_lifecycle_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream lifecycle stats. Get statistics about the data streams that are - managed by a data stream lifecycle. + .. raw:: html + +

Get data stream lifecycle stats. + Get statistics about the data streams that are managed by a data stream lifecycle.

+ ``_ """ @@ -2227,7 +2295,11 @@ def get_data_stream( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data streams. Retrieves information about one or more data streams. + .. raw:: html + +

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

+ ``_ @@ -2302,10 +2374,13 @@ def get_field_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get mapping definitions. Retrieves mapping definitions for one or more fields. - For data streams, the API retrieves field mappings for the stream’s backing indices. - This API is useful if you don't need a complete mapping or if an index mapping - contains a large number of fields. + .. raw:: html + +

Get mapping definitions. + Retrieves mapping definitions for one or more fields. + For data streams, the API retrieves field mappings for the stream’s backing indices.

+

This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields.

+ ``_ @@ -2382,7 +2457,11 @@ def get_index_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index templates. Get information about one or more index templates. + .. raw:: html + +

Get index templates. + Get information about one or more index templates.

+ ``_ @@ -2455,8 +2534,11 @@ def get_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get mapping definitions. For data streams, the API retrieves mappings for the - stream’s backing indices. + .. raw:: html + +

Get mapping definitions. + For data streams, the API retrieves mappings for the stream’s backing indices.

+ ``_ @@ -2540,8 +2622,12 @@ def get_settings( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index settings. Get setting information for one or more indices. For data - streams, it returns setting information for the stream's backing indices. + .. raw:: html + +

Get index settings. + Get setting information for one or more indices. + For data streams, it returns setting information for the stream's backing indices.

+ ``_ @@ -2628,9 +2714,12 @@ def get_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index templates. Get information about one or more index templates. IMPORTANT: - This documentation is about legacy index templates, which are deprecated and - will be replaced by the composable templates introduced in Elasticsearch 7.8. + .. raw:: html + +

Get index templates. + Get information about one or more index templates.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+ ``_ @@ -2689,14 +2778,20 @@ def migrate_to_data_stream( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Convert an index alias to a data stream. Converts an index alias to a data stream. - You must have a matching index template that is data stream enabled. The alias - must meet the following criteria: The alias must have a write index; All indices - for the alias must have a `@timestamp` field mapping of a `date` or `date_nanos` - field type; The alias must not have any filters; The alias must not use custom - routing. If successful, the request removes the alias and creates a data stream - with the same name. The indices for the alias become hidden backing indices for - the stream. The write index for the alias becomes the write index for the stream. + .. raw:: html + +

Convert an index alias to a data stream. + Converts an index alias to a data stream. + You must have a matching index template that is data stream enabled. + The alias must meet the following criteria: + The alias must have a write index; + All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; + The alias must not have any filters; + The alias must not use custom routing. + If successful, the request removes the alias and creates a data stream with the same name. + The indices for the alias become hidden backing indices for the stream. + The write index for the alias becomes the write index for the stream.

+ ``_ @@ -2748,8 +2843,11 @@ def modify_data_stream( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update data streams. Performs one or more data stream modification actions in - a single atomic operation. + .. raw:: html + +

Update data streams. + Performs one or more data stream modification actions in a single atomic operation.

+ ``_ @@ -2809,27 +2907,26 @@ def open( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Open a closed index. For data streams, the API opens any closed backing indices. - A closed index is blocked for read/write operations and does not allow all operations - that opened indices allow. It is not possible to index documents or to search - for documents in a closed index. This allows closed indices to not have to maintain - internal data structures for indexing or searching documents, resulting in a - smaller overhead on the cluster. When opening or closing an index, the master - is responsible for restarting the index shards to reflect the new state of the - index. The shards will then go through the normal recovery process. The data - of opened or closed indices is automatically replicated by the cluster to ensure - that enough shard copies are safely kept around at all times. You can open and - close multiple indices. An error is thrown if the request explicitly refers to - a missing index. This behavior can be turned off by using the `ignore_unavailable=true` - parameter. By default, you must explicitly name the indices you are opening or - closing. To open or close indices with `_all`, `*`, or other wildcard expressions, - change the `action.destructive_requires_name` setting to `false`. This setting - can also be changed with the cluster update settings API. Closed indices consume - a significant amount of disk-space which can cause problems in managed environments. - Closing indices can be turned off with the cluster settings API by setting `cluster.indices.close.enable` - to `false`. Because opening or closing an index allocates its shards, the `wait_for_active_shards` - setting on index creation applies to the `_open` and `_close` index actions as - well. + .. raw:: html + +

Open a closed index. + For data streams, the API opens any closed backing indices.

+

A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. + It is not possible to index documents or to search for documents in a closed index. + This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster.

+

When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. + The shards will then go through the normal recovery process. + The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.

+

You can open and close multiple indices. + An error is thrown if the request explicitly refers to a missing index. + This behavior can be turned off by using the ignore_unavailable=true parameter.

+

By default, you must explicitly name the indices you are opening or closing. + To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. + This setting can also be changed with the cluster update settings API.

+

Closed indices consume a significant amount of disk-space which can cause problems in managed environments. + Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false.

+

Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well.

+ ``_ @@ -2904,18 +3001,18 @@ def promote_data_stream( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Promote a data stream. Promote a data stream from a replicated data stream managed - by cross-cluster replication (CCR) to a regular data stream. With CCR auto following, - a data stream from a remote cluster can be replicated to the local cluster. These - data streams can't be rolled over in the local cluster. These replicated data - streams roll over only if the upstream data stream rolls over. In the event that - the remote cluster is no longer available, the data stream in the local cluster - can be promoted to a regular data stream, which allows these data streams to - be rolled over in the local cluster. NOTE: When promoting a data stream, ensure - the local cluster has a data stream enabled index template that matches the data - stream. If this is missing, the data stream will not be able to roll over until - a matching index template is created. This will affect the lifecycle management - of the data stream and interfere with the data stream size and retention. + .. raw:: html + +

Promote a data stream. + Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream.

+

With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. + These data streams can't be rolled over in the local cluster. + These replicated data streams roll over only if the upstream data stream rolls over. + In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster.

+

NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. + If this is missing, the data stream will not be able to roll over until a matching index template is created. + This will affect the lifecycle management of the data stream and interfere with the data stream size and retention.

+ ``_ @@ -2977,7 +3074,11 @@ def put_alias( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an alias. Adds a data stream or index to an alias. + .. raw:: html + +

Create or update an alias. + Adds a data stream or index to an alias.

+ ``_ @@ -3079,8 +3180,11 @@ def put_data_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update data stream lifecycles. Update the data stream lifecycle of the specified - data streams. + .. raw:: html + +

Update data stream lifecycles. + Update the data stream lifecycle of the specified data streams.

+ ``_ @@ -3181,34 +3285,30 @@ def put_index_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an index template. Index templates define settings, mappings, - and aliases that can be applied automatically to new indices. Elasticsearch applies - templates to new indices based on an wildcard pattern that matches the index - name. Index templates are applied during data stream or index creation. For data - streams, these settings and mappings are applied when the stream's backing indices - are created. Settings and mappings specified in a create index API request override - any settings or mappings specified in an index template. Changes to index templates - do not affect existing indices, including the existing backing indices of a data - stream. You can use C-style `/* *\\/` block comments in index templates. You - can include comments anywhere in the request body, except before the opening - curly bracket. **Multiple matching templates** If multiple index templates match - the name of a new index or data stream, the template with the highest priority - is used. Multiple templates with overlapping index patterns at the same priority - are not allowed and an error will be thrown when attempting to create a template - matching an existing index template at identical priorities. **Composing aliases, - mappings, and settings** When multiple component templates are specified in the - `composed_of` field for an index template, they are merged in the order specified, - meaning that later component templates override earlier component templates. - Any mappings, settings, or aliases from the parent index template are merged - in next. Finally, any configuration on the index request itself is merged. Mapping - definitions are merged recursively, which means that later mapping components - can introduce new field mappings and update the mapping configuration. If a field - mapping is already contained in an earlier component, its definition will be - completely overwritten by the later one. This recursive merging strategy applies - not only to field mappings, but also root options like `dynamic_templates` and - `meta`. If an earlier component contains a `dynamic_templates` block, then by - default new `dynamic_templates` entries are appended onto the end. If an entry - already exists with the same key, then it is overwritten by the new definition. + .. raw:: html + +

Create or update an index template. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

+

Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. + Index templates are applied during data stream or index creation. + For data streams, these settings and mappings are applied when the stream's backing indices are created. + Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. + Changes to index templates do not affect existing indices, including the existing backing indices of a data stream.

+

You can use C-style /* *\\/ block comments in index templates. + You can include comments anywhere in the request body, except before the opening curly bracket.

+

Multiple matching templates

+

If multiple index templates match the name of a new index or data stream, the template with the highest priority is used.

+

Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities.

+

Composing aliases, mappings, and settings

+

When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. + Any mappings, settings, or aliases from the parent index template are merged in next. + Finally, any configuration on the index request itself is merged. + Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. + If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. + This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. + If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. + If an entry already exists with the same key, then it is overwritten by the new definition.

+ ``_ @@ -3341,10 +3441,7 @@ def put_mapping( ] = None, dynamic_date_formats: t.Optional[t.Sequence[str]] = None, dynamic_templates: t.Optional[ - t.Union[ - t.Mapping[str, t.Mapping[str, t.Any]], - t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]], - ] + t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]] ] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ @@ -3372,27 +3469,29 @@ def put_mapping( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update field mappings. Add new fields to an existing data stream or index. You - can also use this API to change the search settings of existing fields and add - new properties to existing object fields. For data streams, these changes are - applied to all backing indices by default. **Add multi-fields to an existing - field** Multi-fields let you index the same field in different ways. You can - use this API to update the fields mapping parameter and enable multi-fields for - an existing field. WARNING: If an index (or data stream) contains documents when - you add a multi-field, those documents will not have values for the new multi-field. - You can populate the new multi-field with the update by query API. **Change supported - mapping parameters for an existing field** The documentation for each mapping - parameter indicates whether you can update it for an existing field using this - API. For example, you can use the update mapping API to update the `ignore_above` - parameter. **Change the mapping of an existing field** Except for supported mapping - parameters, you can't change the mapping or field type of an existing field. - Changing an existing field could invalidate data that's already indexed. If you - need to change the mapping of a field in a data stream's backing indices, refer - to documentation about modifying data streams. If you need to change the mapping - of a field in other indices, create a new index with the correct mapping and - reindex your data into that index. **Rename a field** Renaming a field would - invalidate data already indexed under the old field name. Instead, add an alias - field to create an alternate field name. + .. raw:: html + +

Update field mappings. + Add new fields to an existing data stream or index. + You can also use this API to change the search settings of existing fields and add new properties to existing object fields. + For data streams, these changes are applied to all backing indices by default.

+

Add multi-fields to an existing field

+

Multi-fields let you index the same field in different ways. + You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. + WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. + You can populate the new multi-field with the update by query API.

+

Change supported mapping parameters for an existing field

+

The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. + For example, you can use the update mapping API to update the ignore_above parameter.

+

Change the mapping of an existing field

+

Except for supported mapping parameters, you can't change the mapping or field type of an existing field. + Changing an existing field could invalidate data that's already indexed.

+

If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. + If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.

+

Rename a field

+

Renaming a field would invalidate data already indexed under the old field name. + Instead, add an alias field to create an alternate field name.

+ ``_ @@ -3521,21 +3620,23 @@ def put_settings( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update index settings. Changes dynamic index settings in real time. For data - streams, index setting changes are applied to all backing indices by default. - To revert a setting to the default value, use a null value. The list of per-index - settings that can be updated dynamically on live indices can be found in index - module documentation. To preserve existing settings from being updated, set the - `preserve_existing` parameter to `true`. NOTE: You can only define new analyzers - on closed indices. To add an analyzer, you must close the index, define the analyzer, - and reopen the index. You cannot close the write index of a data stream. To update - the analyzer for a data stream's write index and future backing indices, update - the analyzer in the index template used by the stream. Then roll over the data - stream to apply the new analyzer to the stream's write index and future backing - indices. This affects searches and any new data added to the stream after the - rollover. However, it does not affect the data stream's backing indices or their - existing data. To change the analyzer for existing backing indices, you must - create a new data stream and reindex your data into it. + .. raw:: html + +

Update index settings. + Changes dynamic index settings in real time. + For data streams, index setting changes are applied to all backing indices by default.

+

To revert a setting to the default value, use a null value. + The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. + To preserve existing settings from being updated, set the preserve_existing parameter to true.

+

NOTE: You can only define new analyzers on closed indices. + To add an analyzer, you must close the index, define the analyzer, and reopen the index. + You cannot close the write index of a data stream. + To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. + Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. + This affects searches and any new data added to the stream after the rollover. + However, it does not affect the data stream's backing indices or their existing data. + To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it.

+ ``_ @@ -3639,24 +3740,24 @@ def put_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an index template. Index templates define settings, mappings, - and aliases that can be applied automatically to new indices. Elasticsearch applies - templates to new indices based on an index pattern that matches the index name. - IMPORTANT: This documentation is about legacy index templates, which are deprecated - and will be replaced by the composable templates introduced in Elasticsearch - 7.8. Composable templates always take precedence over legacy templates. If no - composable template matches a new index, matching legacy templates are applied - according to their order. Index templates are only applied during index creation. - Changes to index templates do not affect existing indices. Settings and mappings - specified in create index API requests override any settings or mappings specified - in an index template. You can use C-style `/* *\\/` block comments in index templates. - You can include comments anywhere in the request body, except before the opening - curly bracket. **Indices matching multiple templates** Multiple index templates - can potentially match an index, in this case, both the settings and mappings - are merged into the final configuration of the index. The order of the merging - can be controlled using the order parameter, with lower order being applied first, - and higher orders overriding them. NOTE: Multiple matching templates with the - same order value will result in a non-deterministic merging order. + .. raw:: html + +

Create or update an index template. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices. + Elasticsearch applies templates to new indices based on an index pattern that matches the index name.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+

Composable templates always take precedence over legacy templates. + If no composable template matches a new index, matching legacy templates are applied according to their order.

+

Index templates are only applied during index creation. + Changes to index templates do not affect existing indices. + Settings and mappings specified in create index API requests override any settings or mappings specified in an index template.

+

You can use C-style /* *\\/ block comments in index templates. + You can include comments anywhere in the request body, except before the opening curly bracket.

+

Indices matching multiple templates

+

Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. + The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. + NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order.

+ ``_ @@ -3737,27 +3838,28 @@ def recovery( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index recovery information. Get information about ongoing and completed shard - recoveries for one or more indices. For data streams, the API returns information - for the stream's backing indices. All recoveries, whether ongoing or complete, - are kept in the cluster state and may be reported on at any time. Shard recovery - is the process of initializing a shard copy, such as restoring a primary shard - from a snapshot or creating a replica shard from a primary shard. When a shard - recovery completes, the recovered shard is available for search and indexing. - Recovery automatically occurs during the following processes: * When creating - an index for the first time. * When a node rejoins the cluster and starts up - any missing primary shard copies using the data that it holds in its data path. - * Creation of new replica shard copies from the primary. * Relocation of a shard - copy to a different node in the same cluster. * A snapshot restore operation. - * A clone, shrink, or split operation. You can determine the cause of a shard - recovery using the recovery or cat recovery APIs. The index recovery API reports - information about completed recoveries only for shard copies that currently exist - in the cluster. It only reports the last recovery for each shard copy and does - not report historical information about earlier recoveries, nor does it report - information about the recoveries of shard copies that no longer exist. This means - that if a shard copy completes a recovery and then Elasticsearch relocates it - onto a different node then the information about the original recovery will not - be shown in the recovery API. + .. raw:: html + +

Get index recovery information. + Get information about ongoing and completed shard recoveries for one or more indices. + For data streams, the API returns information for the stream's backing indices.

+

All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time.

+

Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. + When a shard recovery completes, the recovered shard is available for search and indexing.

+

Recovery automatically occurs during the following processes:

+
    +
  • When creating an index for the first time.
  • +
  • When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path.
  • +
  • Creation of new replica shard copies from the primary.
  • +
  • Relocation of a shard copy to a different node in the same cluster.
  • +
  • A snapshot restore operation.
  • +
  • A clone, shrink, or split operation.
  • +
+

You can determine the cause of a shard recovery using the recovery or cat recovery APIs.

+

The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. + It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. + This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API.

+ ``_ @@ -3819,19 +3921,19 @@ def refresh( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Refresh an index. A refresh makes recent operations performed on one or more - indices available for search. For data streams, the API runs the refresh operation - on the stream’s backing indices. By default, Elasticsearch periodically refreshes - indices every second, but only on indices that have received one search request - or more in the last 30 seconds. You can change this default interval with the - `index.refresh_interval` setting. Refresh requests are synchronous and do not - return a response until the refresh operation completes. Refreshes are resource-intensive. - To ensure good cluster performance, it's recommended to wait for Elasticsearch's - periodic refresh rather than performing an explicit refresh when possible. If - your application workflow indexes documents and then runs a search to retrieve - the indexed document, it's recommended to use the index API's `refresh=wait_for` - query parameter option. This option ensures the indexing operation waits for - a periodic refresh before running the search. + .. raw:: html + +

Refresh an index. + A refresh makes recent operations performed on one or more indices available for search. + For data streams, the API runs the refresh operation on the stream’s backing indices.

+

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

+

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

+

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

+

If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. + This option ensures the indexing operation waits for a periodic refresh before running the search.

+ ``_ @@ -3901,21 +4003,20 @@ def reload_search_analyzers( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reload search analyzers. Reload an index's search analyzers and their resources. - For data streams, the API reloads search analyzers and resources for the stream's - backing indices. IMPORTANT: After reloading the search analyzers you should clear - the request cache to make sure it doesn't contain responses derived from the - previous versions of the analyzer. You can use the reload search analyzers API - to pick up changes to synonym files used in the `synonym_graph` or `synonym` - token filter of a search analyzer. To be eligible, the token filter must have - an `updateable` flag of `true` and only be used in search analyzers. NOTE: This - API does not perform a reload for each shard of an index. Instead, it performs - a reload for each node containing index shards. As a result, the total shard - count returned by the API can differ from the number of index shards. Because - reloading affects every node with an index shard, it is important to update the - synonym file on every data node in the cluster--including nodes that don't contain - a shard replica--before using this API. This ensures the synonym file is updated - everywhere in the cluster in case shards are relocated in the future. + .. raw:: html + +

Reload search analyzers. + Reload an index's search analyzers and their resources. + For data streams, the API reloads search analyzers and resources for the stream's backing indices.

+

IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer.

+

You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. + To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers.

+

NOTE: This API does not perform a reload for each shard of an index. + Instead, it performs a reload for each node containing index shards. + As a result, the total shard count returned by the API can differ from the number of index shards. + Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. + This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future.

+ ``_ @@ -3979,38 +4080,33 @@ def resolve_cluster( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. 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 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). * Cluster version information, including the Elasticsearch server version. - 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** 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. * A cluster has no matching - indices, aliases or data streams for the index expression (or your user does - not have permissions to search them). For example, suppose your index expression - is `logs*,remote1:logs*` and the remote1 cluster has no indices, aliases or data - streams that match `logs*`. In that case, that cluster will return no results - from that cluster if you include it in a cross-cluster search. * 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. + .. 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.

+

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 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).
  • +
  • Cluster version information, including the Elasticsearch server version.
  • +
+

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

+

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.
  • +
  • A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search.
  • +
  • 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.
  • +
+ ``_ @@ -4083,8 +4179,12 @@ def resolve_index( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resolve indices. Resolve the names and/or index patterns for indices, aliases, - and data streams. Multiple patterns and remote clusters are supported. + .. raw:: html + +

Resolve indices. + Resolve the names and/or index patterns for indices, aliases, and data streams. + Multiple patterns and remote clusters are supported.

+ ``_ @@ -4157,33 +4257,35 @@ def rollover( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Roll over to a new index. TIP: It is recommended to use the index lifecycle rollover - action to automate rollovers. The rollover API creates a new index for a data - stream or index alias. The API behavior depends on the rollover target. **Roll - over a data stream** If you roll over a data stream, the API creates a new write - index for the stream. The stream's previous write index becomes a regular backing - index. A rollover also increments the data stream's generation. **Roll over an - index alias with a write index** TIP: Prior to Elasticsearch 7.9, you'd typically - use an index alias with a write index to manage time series data. Data streams - replace this functionality, require less maintenance, and automatically integrate - with data tiers. If an index alias points to multiple indices, one of the indices - must be a write index. The rollover API creates a new write index for the alias - with `is_write_index` set to `true`. The API also `sets is_write_index` to `false` - for the previous write index. **Roll over an index alias with one index** If - you roll over an index alias that points to only one index, the API creates a - new index for the alias and removes the original index from the alias. NOTE: - A rollover creates a new index and is subject to the `wait_for_active_shards` - setting. **Increment index names for an alias** When you roll over an index alias, - you can specify a name for the new index. If you don't specify a name and the - current index ends with `-` and a number, such as `my-index-000001` or `my-index-3`, - the new index name increments that number. For example, if you roll over an alias - with a current index of `my-index-000001`, the rollover creates a new index named - `my-index-000002`. This number is always six characters and zero-padded, regardless - of the previous index's name. If you use an index alias for time series data, - you can use date math in the index name to track the rollover date. For example, - you can create an alias that points to an index named ``. - If you create the index on May 6, 2099, the index's name is `my-index-2099.05.06-000001`. - If you roll over the alias on May 7, 2099, the new index's name is `my-index-2099.05.07-000002`. + .. raw:: html + +

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

+

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

+

Roll over a data stream

+

If you roll over a data stream, the API creates a new write index for the stream. + The stream's previous write index becomes a regular backing index. + A rollover also increments the data stream's generation.

+

Roll over an index alias with a write index

+

TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. + Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers.

+

If an index alias points to multiple indices, one of the indices must be a write index. + The rollover API creates a new write index for the alias with is_write_index set to true. + The API also sets is_write_index to false for the previous write index.

+

Roll over an index alias with one index

+

If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias.

+

NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting.

+

Increment index names for an alias

+

When you roll over an index alias, you can specify a name for the new index. + If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. + For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. + This number is always six characters and zero-padded, regardless of the previous index's name.

+

If you use an index alias for time series data, you can use date math in the index name to track the rollover date. + For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. + If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. + If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002.

+ ``_ @@ -4288,9 +4390,12 @@ def segments( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index segments. Get low-level information about the Lucene segments in index - shards. For data streams, the API returns information about the stream's backing - indices. + .. raw:: html + +

Get index segments. + Get low-level information about the Lucene segments in index shards. + For data streams, the API returns information about the stream's backing indices.

+ ``_ @@ -4369,14 +4474,20 @@ def shard_stores( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index shard stores. Get store information about replica shards in one or - more indices. For data streams, the API retrieves store information for the stream's - backing indices. The index shard stores API returns the following information: - * The node on which each replica shard exists. * The allocation ID for each replica - shard. * A unique ID for each replica shard. * Any errors encountered while opening - the shard index or from an earlier failure. By default, the API returns store - information only for primary shards that are unassigned or have one or more unassigned - replica shards. + .. raw:: html + +

Get index shard stores. + Get store information about replica shards in one or more indices. + For data streams, the API retrieves store information for the stream's backing indices.

+

The index shard stores API returns the following information:

+
    +
  • The node on which each replica shard exists.
  • +
  • The allocation ID for each replica shard.
  • +
  • A unique ID for each replica shard.
  • +
  • Any errors encountered while opening the shard index or from an earlier failure.
  • +
+

By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards.

+ ``_ @@ -4447,39 +4558,38 @@ def shrink( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Shrink an index. Shrink an index into a new index with fewer primary shards. - Before you can shrink an index: * The index must be read-only. * A copy of every - shard in the index must reside on the same node. * The index must have a green - health status. To make shard allocation easier, we recommend you also remove - the index's replica shards. You can later re-add replica shards as part of the - shrink operation. The requested number of primary shards in the target index - must be a factor of the number of shards in the source index. For example an - index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an - index with 15 primary shards can be shrunk into 5, 3 or 1. If the number of shards - in the index is a prime number it can only be shrunk into a single primary shard - Before shrinking, a (primary or replica) copy of every shard in the index must - be present on the same node. The current write index on a data stream cannot - be shrunk. In order to shrink the current write index, the data stream must first - be rolled over so that a new write index is created and then the previous write - index can be shrunk. A shrink operation: * Creates a new target index with the - same definition as the source index, but with a smaller number of primary shards. - * Hard-links segments from the source index into the target index. If the file - system does not support hard-linking, then all segments are copied into the new - index, which is a much more time consuming process. Also if using multiple data - paths, shards on different data paths require a full copy of segment files if - they are not on the same disk since hardlinks do not work across disks. * Recovers - the target index as though it were a closed index which had just been re-opened. - Recovers shards to the `.routing.allocation.initial_recovery._id` index setting. - IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - * The target index must not exist. * The source index must have more primary - shards than the target index. * The number of primary shards in the target index - must be a factor of the number of primary shards in the source index. The source - index must have more primary shards than the target index. * The index must not - contain more than 2,147,483,519 documents in total across all shards that will - be shrunk into a single shard on the target index as this is the maximum number - of docs that can fit into a single shard. * The node handling the shrink process - must have sufficient free disk space to accommodate a second copy of the existing - index. + .. raw:: html + +

Shrink an index. + Shrink an index into a new index with fewer primary shards.

+

Before you can shrink an index:

+
    +
  • The index must be read-only.
  • +
  • A copy of every shard in the index must reside on the same node.
  • +
  • The index must have a green health status.
  • +
+

To make shard allocation easier, we recommend you also remove the index's replica shards. + You can later re-add replica shards as part of the shrink operation.

+

The requested number of primary shards in the target index must be a factor of the number of shards in the source index. + For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. + If the number of shards in the index is a prime number it can only be shrunk into a single primary shard + Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node.

+

The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk.

+

A shrink operation:

+
    +
  • Creates a new target index with the same definition as the source index, but with a smaller number of primary shards.
  • +
  • Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks.
  • +
  • Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting.
  • +
+

IMPORTANT: Indices can only be shrunk if they satisfy the following requirements:

+
    +
  • The target index must not exist.
  • +
  • The source index must have more primary shards than the target index.
  • +
  • The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index.
  • +
  • The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard.
  • +
  • The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+ ``_ @@ -4554,8 +4664,11 @@ def simulate_index_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate an index. Get the index configuration that would be applied to the specified - index from an existing index template. + .. raw:: html + +

Simulate an index. + Get the index configuration that would be applied to the specified index from an existing index template.

+ ``_ @@ -4632,8 +4745,11 @@ def simulate_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate an index template. Get the index configuration that would be applied - by a particular index template. + .. raw:: html + +

Simulate an index template. + Get the index configuration that would be applied by a particular index template.

+ ``_ @@ -4764,31 +4880,44 @@ def split( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Split an index. Split an index into a new index with more primary shards. * Before - you can split an index: * The index must be read-only. * The cluster health status - must be green. You can do make an index read-only with the following request - using the add index block API: ``` PUT /my_source_index/_block/write ``` The - current write index on a data stream cannot be split. In order to split the current - write index, the data stream must first be rolled over so that a new write index - is created and then the previous write index can be split. The number of times - the index can be split (and the number of shards that each original shard can - be split into) is determined by the `index.number_of_routing_shards` setting. - The number of routing shards specifies the hashing space that is used internally - to distribute documents across shards with consistent hashing. For instance, - a 5 shard index with `number_of_routing_shards` set to 30 (5 x 2 x 3) could be - split by a factor of 2 or 3. A split operation: * Creates a new target index - with the same definition as the source index, but with a larger number of primary - shards. * Hard-links segments from the source index into the target index. If - the file system doesn't support hard-linking, all segments are copied into the - new index, which is a much more time consuming process. * Hashes all documents - again, after low level files are created, to delete documents that belong to - a different shard. * Recovers the target index as though it were a closed index - which had just been re-opened. IMPORTANT: Indices can only be split if they satisfy - the following requirements: * The target index must not exist. * The source index - must have fewer primary shards than the target index. * The number of primary - shards in the target index must be a multiple of the number of primary shards - in the source index. * The node handling the split process must have sufficient - free disk space to accommodate a second copy of the existing index. + .. raw:: html + +

Split an index. + Split an index into a new index with more primary shards.

+
    +
  • +

    Before you can split an index:

    +
  • +
  • +

    The index must be read-only.

    +
  • +
  • +

    The cluster health status must be green.

    +
  • +
+

You can do make an index read-only with the following request using the add index block API:

+
PUT /my_source_index/_block/write
+          
+

The current write index on a data stream cannot be split. + In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split.

+

The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. + The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. + For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3.

+

A split operation:

+
    +
  • Creates a new target index with the same definition as the source index, but with a larger number of primary shards.
  • +
  • Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process.
  • +
  • Hashes all documents again, after low level files are created, to delete documents that belong to a different shard.
  • +
  • Recovers the target index as though it were a closed index which had just been re-opened.
  • +
+

IMPORTANT: Indices can only be split if they satisfy the following requirements:

+
    +
  • The target index must not exist.
  • +
  • The source index must have fewer primary shards than the target index.
  • +
  • The number of primary shards in the target index must be a multiple of the number of primary shards in the source index.
  • +
  • The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+ ``_ @@ -4880,14 +5009,17 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index statistics. For data streams, the API retrieves statistics for the - stream's backing indices. By default, the returned statistics are index-level - with `primaries` and `total` aggregations. `primaries` are the values for only - the primary shards. `total` are the accumulated values for both primary and replica - shards. To get shard-level statistics, set the `level` parameter to `shards`. - NOTE: When moving to another node, the shard-level statistics for a shard are - cleared. Although the shard is no longer part of the node, that node retains - any node-level statistics to which the shard contributed. + .. raw:: html + +

Get index statistics. + For data streams, the API retrieves statistics for the stream's backing indices.

+

By default, the returned statistics are index-level with primaries and total aggregations. + primaries are the values for only the primary shards. + total are the accumulated values for both primary and replica shards.

+

To get shard-level statistics, set the level parameter to shards.

+

NOTE: When moving to another node, the shard-level statistics for a shard are cleared. + Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed.

+ ``_ @@ -4990,8 +5122,11 @@ def unfreeze( wait_for_active_shards: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Unfreeze an index. When a frozen index is unfrozen, the index goes through the - normal recovery process and becomes writeable again. + .. raw:: html + +

Unfreeze an index. + When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.

+ ``_ @@ -5065,7 +5200,11 @@ def update_aliases( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an alias. Adds a data stream or index to an alias. + .. raw:: html + +

Create or update an alias. + Adds a data stream or index to an alias.

+ ``_ @@ -5140,7 +5279,11 @@ def validate_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Validate a query. Validates a query without running it. + .. raw:: html + +

Validate a query. + Validates a query without running it.

+ ``_ diff --git a/elasticsearch/_sync/client/inference.py b/elasticsearch/_sync/client/inference.py index 553789086..5430e7283 100644 --- a/elasticsearch/_sync/client/inference.py +++ b/elasticsearch/_sync/client/inference.py @@ -44,7 +44,10 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an inference endpoint + .. raw:: html + +

Delete an inference endpoint

+ ``_ @@ -109,7 +112,10 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an inference endpoint + .. raw:: html + +

Get an inference endpoint

+ ``_ @@ -172,7 +178,10 @@ def inference( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Perform inference on the service + .. raw:: html + +

Perform inference on the service

+ ``_ @@ -255,21 +264,18 @@ def put( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an inference endpoint. When you create an inference endpoint, the associated - machine learning model is automatically deployed if it is not already running. - After creating the endpoint, wait for the model deployment to complete before - using it. To verify the deployment status, use the get trained model statistics - API. Look for `"state": "fully_allocated"` in the response and ensure that the - `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating - multiple endpoints for the same model unless required, as each endpoint consumes - significant resources. IMPORTANT: The inference APIs enable you to use certain - services, such as built-in machine learning models (ELSER, E5), models uploaded - through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, 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. + .. raw:: html + +

Create an inference endpoint. + When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. + After creating the endpoint, wait for the model deployment to complete before using it. + To verify the deployment status, use the get trained model statistics API. + Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". + Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.

+

IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, 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.

+ ``_ @@ -339,16 +345,14 @@ def update( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an inference endpoint. Modify `task_settings`, secrets (within `service_settings`), - or `num_allocations` for an inference endpoint, depending on the specific endpoint - service and `task_type`. IMPORTANT: 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. + .. raw:: html + +

Update an inference endpoint.

+

Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type.

+

IMPORTANT: 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.

+ ``_ diff --git a/elasticsearch/_sync/client/ingest.py b/elasticsearch/_sync/client/ingest.py index f47ad1c84..303fdc9f0 100644 --- a/elasticsearch/_sync/client/ingest.py +++ b/elasticsearch/_sync/client/ingest.py @@ -38,8 +38,11 @@ def delete_geoip_database( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete GeoIP database configurations. Delete one or more IP geolocation database - configurations. + .. raw:: html + +

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

+ ``_ @@ -90,7 +93,10 @@ def delete_ip_location_database( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete IP geolocation database configurations. + .. raw:: html + +

Delete IP geolocation database configurations.

+ ``_ @@ -143,7 +149,11 @@ def delete_pipeline( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete pipelines. Delete one or more ingest pipelines. + .. raw:: html + +

Delete pipelines. + Delete one or more ingest pipelines.

+ ``_ @@ -192,8 +202,11 @@ def geo_ip_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get GeoIP statistics. Get download statistics for GeoIP2 databases that are used - with the GeoIP processor. + .. raw:: html + +

Get GeoIP statistics. + Get download statistics for GeoIP2 databases that are used with the GeoIP processor.

+ ``_ """ @@ -230,8 +243,11 @@ def get_geoip_database( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get GeoIP database configurations. Get information about one or more IP geolocation - database configurations. + .. raw:: html + +

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

+ ``_ @@ -282,7 +298,10 @@ def get_ip_location_database( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get IP geolocation database configurations. + .. raw:: html + +

Get IP geolocation database configurations.

+ ``_ @@ -335,8 +354,12 @@ def get_pipeline( summary: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get pipelines. Get information about one or more ingest pipelines. This API returns - a local reference of the pipeline. + .. raw:: html + +

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

+ ``_ @@ -387,10 +410,13 @@ def processor_grok( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a grok processor. Extract structured fields out of a single text field within - a document. You must choose which field to extract matched fields from, as well - as the grok pattern you expect will match. A grok pattern is like a regular expression - that supports aliased expressions that can be reused. + .. raw:: html + +

Run a grok processor. + Extract structured fields out of a single text field within a document. + You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. + A grok pattern is like a regular expression that supports aliased expressions that can be reused.

+ ``_ """ @@ -433,8 +459,11 @@ def put_geoip_database( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a GeoIP database configuration. Refer to the create or update - IP geolocation database configuration API. + .. raw:: html + +

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

+ ``_ @@ -506,7 +535,10 @@ def put_ip_location_database( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an IP geolocation database configuration. + .. raw:: html + +

Create or update an IP geolocation database configuration.

+ ``_ @@ -588,7 +620,11 @@ def put_pipeline( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a pipeline. Changes made using this API take effect immediately. + .. raw:: html + +

Create or update a pipeline. + Changes made using this API take effect immediately.

+ ``_ @@ -680,9 +716,12 @@ def simulate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ diff --git a/elasticsearch/_sync/client/license.py b/elasticsearch/_sync/client/license.py index b1f97a9fe..d018e4bb5 100644 --- a/elasticsearch/_sync/client/license.py +++ b/elasticsearch/_sync/client/license.py @@ -35,9 +35,12 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ """ @@ -74,11 +77,13 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. If you receive an unexpected 404 response after cluster - startup, wait a short period and retry the request. + .. 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. + If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request.

+ ``_ @@ -124,7 +129,10 @@ def get_basic_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the basic license status. + .. raw:: html + +

Get the basic license status.

+ ``_ """ @@ -159,7 +167,10 @@ def get_trial_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the trial status. + .. raw:: html + +

Get the trial status.

+ ``_ """ @@ -200,14 +211,16 @@ def post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. NOTE: If Elasticsearch security features - are enabled and you are installing a gold or higher license, you must enable - TLS on the transport networking layer before you install the license. If the - operator privileges feature is enabled, only operator users can use this API. + .. raw:: html + +

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.

+

NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. + If the operator privileges feature is enabled, only operator users can use this API.

+ ``_ @@ -261,13 +274,15 @@ def post_start_basic( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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`. To check the status of your basic license, use the get - basic license API. + .. raw:: html + +

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.

+

To check the status of your basic license, use the get basic license API.

+ ``_ @@ -309,12 +324,14 @@ def post_start_trial( type_query_string: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a trial. Start a 30-day trial, which gives access to all subscription features. - NOTE: You are allowed to start a trial only if your cluster has not already activated - a trial for the current major product version. For example, if you have already - activated a trial for v8.0, you cannot start a new trial until v9.0. You can, - however, request an extended trial at https://www.elastic.co/trialextension. - To check the status of your trial, use the get trial status API. + .. raw:: html + +

Start a trial. + Start a 30-day trial, which gives access to all subscription features.

+

NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. + For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension.

+

To check the status of your trial, use the get trial status API.

+ ``_ diff --git a/elasticsearch/_sync/client/logstash.py b/elasticsearch/_sync/client/logstash.py index 7bd02551f..e329058a3 100644 --- a/elasticsearch/_sync/client/logstash.py +++ b/elasticsearch/_sync/client/logstash.py @@ -36,9 +36,12 @@ def delete_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a Logstash pipeline. Delete a pipeline that is used for Logstash Central - Management. If the request succeeds, you receive an empty response with an appropriate - status code. + .. raw:: html + +

Delete a Logstash pipeline. + Delete a pipeline that is used for Logstash Central Management. + If the request succeeds, you receive an empty response with an appropriate status code.

+ ``_ @@ -78,7 +81,11 @@ def get_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get Logstash pipelines. Get pipelines that are used for Logstash Central Management. + .. raw:: html + +

Get Logstash pipelines. + Get pipelines that are used for Logstash Central Management.

+ ``_ @@ -125,8 +132,12 @@ def put_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a Logstash pipeline. Create a pipeline that is used for Logstash - Central Management. If the specified pipeline exists, it is replaced. + .. raw:: html + +

Create or update a Logstash pipeline.

+

Create a pipeline that is used for Logstash Central Management. + If the specified pipeline exists, it is replaced.

+ ``_ diff --git a/elasticsearch/_sync/client/migration.py b/elasticsearch/_sync/client/migration.py index a1d3160c5..a9476162c 100644 --- a/elasticsearch/_sync/client/migration.py +++ b/elasticsearch/_sync/client/migration.py @@ -36,10 +36,13 @@ def deprecations( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get deprecation information. Get information about different cluster, node, and - index level settings that use deprecated features that will be removed or changed - in the next major version. TIP: This APIs is designed for indirect use by the - Upgrade Assistant. You are strongly recommended to use the Upgrade Assistant. + .. raw:: html + +

Get deprecation information. + Get information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version.

+

TIP: This APIs is designed for indirect use by the Upgrade Assistant. + You are strongly recommended to use the Upgrade Assistant.

+ ``_ @@ -82,11 +85,14 @@ def get_feature_upgrade_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get feature migration information. Version upgrades sometimes require changes - to how features store configuration information and data in system indices. Check - which features need to be migrated and the status of any migrations that are - in progress. TIP: This API is designed for indirect use by the Upgrade Assistant. - You are strongly recommended to use the Upgrade Assistant. + .. raw:: html + +

Get feature migration information. + Version upgrades sometimes require changes to how features store configuration information and data in system indices. + Check which features need to be migrated and the status of any migrations that are in progress.

+

TIP: This API is designed for indirect use by the Upgrade Assistant. + You are strongly recommended to use the Upgrade Assistant.

+ ``_ """ @@ -121,11 +127,14 @@ def post_feature_upgrade( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Start the feature migration. Version upgrades sometimes require changes to how - features store configuration information and data in system indices. This API - starts the automatic migration process. Some functionality might be temporarily - unavailable during the migration process. TIP: The API is designed for indirect - use by the Upgrade Assistant. We strongly recommend you use the Upgrade Assistant. + .. raw:: html + +

Start the feature migration. + Version upgrades sometimes require changes to how features store configuration information and data in system indices. + This API starts the automatic migration process.

+

Some functionality might be temporarily unavailable during the migration process.

+

TIP: The API is designed for indirect use by the Upgrade Assistant. We strongly recommend you use the Upgrade Assistant.

+ ``_ """ diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index b80edd0c6..b964925f2 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -36,11 +36,14 @@ def clear_trained_model_deployment_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -88,19 +91,14 @@ def close_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. 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. + 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 +159,11 @@ def delete_calendar( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a calendar. Removes all scheduled events from a calendar, then deletes - it. + .. raw:: html + +

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

+ ``_ @@ -203,7 +204,10 @@ def delete_calendar_event( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete events from a calendar. + .. raw:: html + +

Delete events from a calendar.

+ ``_ @@ -251,7 +255,10 @@ def delete_calendar_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete anomaly jobs from a calendar. + .. raw:: html + +

Delete anomaly jobs from a calendar.

+ ``_ @@ -300,7 +307,10 @@ def delete_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a data frame analytics job. + .. raw:: html + +

Delete a data frame analytics job.

+ ``_ @@ -348,7 +358,10 @@ def delete_datafeed( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a datafeed. + .. raw:: html + +

Delete a datafeed.

+ ``_ @@ -400,13 +413,18 @@ def delete_expired_data( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete expired ML data. Deletes 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 , or by omitting the . + .. raw:: html + +

Delete expired ML data. + Deletes 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>.

+ ``_ @@ -465,9 +483,12 @@ def delete_filter( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -510,10 +531,14 @@ def delete_forecast( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -580,12 +605,16 @@ def delete_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 the - delete datafeed API with the same timeout and force parameters as the delete - job request. + .. raw:: html + +

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 + the delete datafeed API with the same timeout and force parameters as the + delete job request.

+ ``_ @@ -639,9 +668,13 @@ def delete_model_snapshot( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -688,8 +721,11 @@ def delete_trained_model( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an unreferenced trained model. The request deletes a trained inference - model that is not referenced by an ingest pipeline. + .. raw:: html + +

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

+ ``_ @@ -734,9 +770,13 @@ def delete_trained_model_alias( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -791,9 +831,13 @@ def estimate_model_memory( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 estimates for the fields it references. + .. 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 + estimates for the fields it references.

+ ``_ @@ -858,10 +902,14 @@ def evaluate_data_frame( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. + .. raw:: html + +

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.

+ ``_ @@ -935,13 +983,18 @@ def explain_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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: * which fields are included or - not in the analysis and why, * how much memory is estimated to be required. The - estimate can be used when deciding the appropriate value for model_memory_limit - setting later on. If you have object fields or fields that are excluded via source - filtering, they are not included in the explanation. + .. raw:: html + +

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:

+
    +
  • which fields are included or not in the analysis and why,
  • +
  • how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. + If you have object fields or fields that are excluded via source filtering, they are not included in the explanation.
  • +
+ ``_ @@ -1041,14 +1094,18 @@ def flush_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Force buffered data to be processed. The flush jobs API is only applicable when - sending data for analysis using the post data API. Depending on the content of - the buffer, then it might additionally calculate new results. Both flush and - close operations are similar, however the flush is more efficient if you are - expecting to send more data for analysis. When flushing, the job remains open - and is available to continue analyzing data. A close operation additionally prunes - and persists the model state to disk and the job must be opened again before - analyzing further data. + .. raw:: html + +

Force buffered data to be processed. + The flush jobs API is only applicable when sending data for analysis using + the post data API. Depending on the content of the buffer, then it might + additionally calculate new results. Both flush and close operations are + similar, however the flush is more efficient if you are expecting to send + more data for analysis. When flushing, the job remains open and is available + to continue analyzing data. A close operation additionally prunes and + persists the model state to disk and the job must be opened again before + analyzing further data.

+ ``_ @@ -1116,10 +1173,14 @@ def forecast( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Predict future behavior of a time series. Forecasts are not supported for jobs - that perform population analysis; an error occurs if you try to create a forecast - for a job that has an `over_field_name` in its configuration. Forcasts predict - future behavior based on historical data. + .. raw:: html + +

Predict future behavior of a time series.

+

Forecasts are not supported for jobs that perform population analysis; an + error occurs if you try to create a forecast for a job that has an + over_field_name in its configuration. Forcasts predict future behavior + based on historical data.

+ ``_ @@ -1201,8 +1262,11 @@ def get_buckets( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for buckets. The API presents a chronological - view of the records, grouped by bucket. + .. raw:: html + +

Get anomaly detection job results for buckets. + The API presents a chronological view of the records, grouped by bucket.

+ ``_ @@ -1297,7 +1361,10 @@ def get_calendar_events( start: t.Optional[t.Union[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get info about events in calendars. + .. raw:: html + +

Get info about events in calendars.

+ ``_ @@ -1363,7 +1430,10 @@ def get_calendars( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get calendar configuration info. + .. raw:: html + +

Get calendar configuration info.

+ ``_ @@ -1436,7 +1506,10 @@ def get_categories( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for categories. + .. raw:: html + +

Get anomaly detection job results for categories.

+ ``_ @@ -1518,9 +1591,13 @@ def get_data_frame_analytics( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data frame analytics job configuration info. You can get information for - multiple data frame analytics jobs in a single API request by using a comma-separated - list of data frame analytics jobs or a wildcard expression. + .. raw:: html + +

Get data frame analytics job configuration info. + You can get information for multiple data frame analytics jobs in a single + API request by using a comma-separated list of data frame analytics jobs or a + wildcard expression.

+ ``_ @@ -1592,7 +1669,10 @@ def get_data_frame_analytics_stats( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data frame analytics jobs usage info. + .. raw:: html + +

Get data frame analytics jobs usage info.

+ ``_ @@ -1657,12 +1737,16 @@ def get_datafeed_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get datafeeds usage info. You can get statistics for multiple datafeeds in a - single API request by using a comma-separated list of datafeeds or a wildcard - expression. You can get statistics for all datafeeds by using `_all`, by specifying - `*` as the ``, or by omitting the ``. If the datafeed is stopped, - the only information you receive is the `datafeed_id` and the `state`. This API - returns a maximum of 10,000 datafeeds. + .. raw:: html + +

Get datafeeds usage info. + You can get statistics for multiple datafeeds in a single API request by + using a comma-separated list of datafeeds or a wildcard expression. You can + get statistics for all datafeeds by using _all, by specifying * as the + <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the + only information you receive is the datafeed_id and the state. + This API returns a maximum of 10,000 datafeeds.

+ ``_ @@ -1718,11 +1802,15 @@ def get_datafeeds( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get datafeeds configuration info. You can get information for multiple datafeeds - in a single API request by using a comma-separated list of datafeeds or a wildcard - expression. You can get information for all datafeeds by using `_all`, by specifying - `*` as the ``, or by omitting the ``. This API returns a maximum - of 10,000 datafeeds. + .. raw:: html + +

Get datafeeds configuration info. + You can get information for multiple datafeeds in a single API request by + using a comma-separated list of datafeeds or a wildcard expression. You can + get information for all datafeeds by using _all, by specifying * as the + <feed_id>, or by omitting the <feed_id>. + This API returns a maximum of 10,000 datafeeds.

+ ``_ @@ -1785,7 +1873,11 @@ def get_filters( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get filters. You can get a single filter or all filters. + .. raw:: html + +

Get filters. + You can get a single filter or all filters.

+ ``_ @@ -1847,9 +1939,13 @@ def get_influencers( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for influencers. Influencers are the entities - that have contributed to, or are to blame for, the anomalies. Influencer results - are available only if an `influencer_field_name` is specified in the job configuration. + .. raw:: html + +

Get anomaly detection job results for influencers. + Influencers are the entities that have contributed to, or are to blame for, + the anomalies. Influencer results are available only if an + influencer_field_name is specified in the job configuration.

+ ``_ @@ -1930,7 +2026,10 @@ def get_job_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection jobs usage info. + .. raw:: html + +

Get anomaly detection jobs usage info.

+ ``_ @@ -1987,11 +2086,14 @@ def get_jobs( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection jobs configuration info. You can get information for multiple - anomaly detection jobs in a single API request by using a group name, a comma-separated - list of jobs, or a wildcard expression. You can get information for all anomaly - detection jobs by using `_all`, by specifying `*` as the ``, or by omitting - the ``. + .. raw:: html + +

Get anomaly detection jobs configuration info. + You can get information for multiple anomaly detection jobs in a single API + request by using a group name, a comma-separated list of jobs, or a wildcard + expression. You can get information for all anomaly detection jobs by using + _all, by specifying * as the <job_id>, or by omitting the <job_id>.

+ ``_ @@ -2052,9 +2154,12 @@ def get_memory_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get machine learning memory usage info. Get information about how machine learning - jobs and trained models are using memory, on each node, both within the JVM heap, - and natively, outside of the JVM. + .. raw:: html + +

Get machine learning memory usage info. + Get information about how machine learning jobs and trained models are using memory, + on each node, both within the JVM heap, and natively, outside of the JVM.

+ ``_ @@ -2109,7 +2214,10 @@ def get_model_snapshot_upgrade_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job model snapshot upgrade usage info. + .. raw:: html + +

Get anomaly detection job model snapshot upgrade usage info.

+ ``_ @@ -2180,7 +2288,10 @@ def get_model_snapshots( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get model snapshots info. + .. raw:: html + +

Get model snapshots info.

+ ``_ @@ -2281,19 +2392,26 @@ def get_overall_buckets( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get overall bucket results. Retrievs overall bucket results that summarize the - bucket results of multiple anomaly detection jobs. The `overall_score` is calculated - by combining the scores of all the buckets within the overall bucket span. First, - the maximum `anomaly_score` per anomaly detection job in the overall bucket is - calculated. Then the `top_n` of those scores are averaged to result in the `overall_score`. - This means that you can fine-tune the `overall_score` so that it is more or less - sensitive to the number of jobs that detect an anomaly at the same time. For - example, if you set `top_n` to `1`, the `overall_score` is the maximum bucket - score in the overall bucket. Alternatively, if you set `top_n` to the number - of jobs, the `overall_score` is high only when all jobs detect anomalies in that - overall bucket. If you set the `bucket_span` parameter (to a value greater than - its default), the `overall_score` is the maximum `overall_score` of the overall - buckets that have a span equal to the jobs' largest bucket span. + .. raw:: html + +

Get overall bucket results.

+

Retrievs overall bucket results that summarize the bucket results of + multiple anomaly detection jobs.

+

The overall_score is calculated by combining the scores of all the + buckets within the overall bucket span. First, the maximum + anomaly_score per anomaly detection job in the overall bucket is + calculated. Then the top_n of those scores are averaged to result in + the overall_score. This means that you can fine-tune the + overall_score so that it is more or less sensitive to the number of + jobs that detect an anomaly at the same time. For example, if you set + top_n to 1, the overall_score is the maximum bucket score in the + overall bucket. Alternatively, if you set top_n to the number of jobs, + the overall_score is high only when all jobs detect anomalies in that + overall bucket. If you set the bucket_span parameter (to a value + greater than its default), the overall_score is the maximum + overall_score of the overall buckets that have a span equal to the + jobs' largest bucket span.

+ ``_ @@ -2390,15 +2508,20 @@ def get_records( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly records for an anomaly detection job. Records contain the detailed - analytical results. They describe the anomalous activity that has been identified - in the input data based on the detector configuration. There can be many anomaly - records depending on the characteristics and size of the input data. In practice, - there are often too many to be able to manually process them. The machine learning - features therefore perform a sophisticated aggregation of the anomaly records - into buckets. The number of record results depends on the number of anomalies - found in each bucket, which relates to the number of time series being modeled - and the number of detectors. + .. raw:: html + +

Get anomaly records for an anomaly detection job. + Records contain the detailed analytical results. They describe the anomalous + activity that has been identified in the input data based on the detector + configuration. + There can be many anomaly records depending on the characteristics and size + of the input data. In practice, there are often too many to be able to + manually process them. The machine learning features therefore perform a + sophisticated aggregation of the anomaly records into buckets. + The number of record results depends on the number of anomalies found in each + bucket, which relates to the number of time series being modeled and the + number of detectors.

+ ``_ @@ -2494,7 +2617,10 @@ def get_trained_models( tags: t.Optional[t.Union[str, t.Sequence[str]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get trained model configuration info. + .. raw:: html + +

Get trained model configuration info.

+ ``_ @@ -2580,9 +2706,12 @@ def get_trained_models_stats( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get trained models usage info. You can get usage information for multiple trained - models in a single API request by using a comma-separated list of model IDs or - a wildcard expression. + .. raw:: html + +

Get trained models usage info. + You can get usage information for multiple trained + models in a single API request by using a comma-separated list of model IDs or a wildcard expression.

+ ``_ @@ -2645,7 +2774,10 @@ def infer_trained_model( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evaluate a trained model. + .. raw:: html + +

Evaluate a trained model.

+ ``_ @@ -2702,12 +2834,17 @@ def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get machine learning information. Get defaults and limits used by machine learning. - This endpoint is designed to be used by a user interface that needs to fully - understand machine learning configurations where some options are not specified, - meaning that the defaults should be used. This endpoint may be used to find out - what those defaults are. It also provides information about the maximum size - of machine learning jobs that could run in the current cluster configuration. + .. raw:: html + +

Get machine learning information. + Get defaults and limits used by machine learning. + This endpoint is designed to be used by a user interface that needs to fully + understand machine learning configurations where some options are not + specified, meaning that the defaults should be used. This endpoint may be + used to find out what those defaults are. It also provides information about + the maximum size of machine learning jobs that could run in the current + cluster configuration.

+ ``_ """ @@ -2747,12 +2884,16 @@ def open_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 loaded. The - job is ready to resume its analysis from where it left off, once new data is - received. + .. raw:: html + +

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 + loaded. The job is ready to resume its analysis from where it left off, once + new data is received.

+ ``_ @@ -2806,7 +2947,10 @@ def post_calendar_events( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Add scheduled events to the calendar. + .. raw:: html + +

Add scheduled events to the calendar.

+ ``_ @@ -2862,9 +3006,12 @@ def post_data( reset_start: t.Optional[t.Union[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Send data to an anomaly detection job for analysis. IMPORTANT: For each job, - data can be accepted from only a single connection at a time. It is not currently - possible to post data to multiple jobs using wildcards or a comma-separated list. + .. raw:: html + +

Send data to an anomaly detection job for analysis.

+

IMPORTANT: For each job, data can be accepted from only a single connection at a time. + It is not currently possible to post data to multiple jobs using wildcards or a comma-separated list.

+ ``_ @@ -2927,8 +3074,11 @@ def preview_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview features used by data frame analytics. Previews the extracted features - used by a data frame analytics config. + .. raw:: html + +

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

+ ``_ @@ -2990,15 +3140,18 @@ def preview_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview a datafeed. This API returns the first "page" of search results from - a datafeed. You can preview an existing datafeed or provide configuration details - for a datafeed and anomaly detection job in the API. The preview shows the structure - of the data that will be passed to the anomaly detection engine. IMPORTANT: When - Elasticsearch security features are enabled, the preview uses the credentials - of the user that called the API. However, when the datafeed starts it uses the - roles of the last user that created or updated the datafeed. To get a preview - that accurately reflects the behavior of the datafeed, use the appropriate credentials. - You can also use secondary authorization headers to supply the credentials. + .. raw:: html + +

Preview a datafeed. + This API returns the first "page" of search results from a datafeed. + You can preview an existing datafeed or provide configuration details for a datafeed + and anomaly detection job in the API. The preview shows the structure of the data + that will be passed to the anomaly detection engine. + IMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that + called the API. However, when the datafeed starts it uses the roles of the last user that created or updated the + datafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials. + You can also use secondary authorization headers to supply the credentials.

+ ``_ @@ -3074,7 +3227,10 @@ def put_calendar( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a calendar. + .. raw:: html + +

Create a calendar.

+ ``_ @@ -3128,7 +3284,10 @@ def put_calendar_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Add anomaly detection job to calendar. + .. raw:: html + +

Add anomaly detection job to calendar.

+ ``_ @@ -3203,13 +3362,15 @@ def put_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a data frame analytics job. This API creates a data frame analytics job - that performs an analysis on the source indices and stores the outcome in a destination - index. By default, the query used in the source configuration is `{"match_all": - {}}`. If the destination index does not exist, it is created automatically when - you start the job. If you supply only a subset of the regression or classification - parameters, hyperparameter optimization occurs. It determines a value for each - of the undefined parameters. + .. raw:: html + +

Create a data frame analytics job. + This API creates a data frame analytics job that performs an analysis on the + source indices and stores the outcome in a destination index. + By default, the query used in the source configuration is {"match_all": {}}.

+

If the destination index does not exist, it is created automatically when you start the job.

+

If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters.

+ ``_ @@ -3382,18 +3543,19 @@ def put_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a datafeed. Datafeeds retrieve data from Elasticsearch for analysis by - an anomaly detection job. You can associate only one datafeed with each anomaly - detection job. The datafeed contains a query that runs at a defined interval - (`frequency`). If you are concerned about delayed data, you can add a delay (`query_delay') - at each interval. By default, the datafeed uses the following query: `{"match_all": - {"boost": 1}}`. When Elasticsearch security features are enabled, your datafeed - remembers which roles the user who created it had at the time of creation and - runs the query using those same roles. If you provide secondary authorization - headers, those credentials are used instead. You must use Kibana, this API, or - the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - directly to the `.ml-config` index. Do not give users `write` privileges on the - `.ml-config` index. + .. raw:: html + +

Create a datafeed. + Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. + You can associate only one datafeed with each anomaly detection job. + The datafeed contains a query that runs at a defined interval (frequency). + If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`.

+

When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had + at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, + those credentials are used instead. + You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed + directly to the .ml-config index. Do not give users write privileges on the .ml-config index.

+ ``_ @@ -3550,9 +3712,12 @@ def put_filter( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a filter. A filter contains a list of strings. It can be used by one or - more anomaly detection jobs. Specifically, filters are referenced in the `custom_rules` - property of detector configuration objects. + .. raw:: html + +

Create a filter. + A filter contains a list of strings. It can be used by one or more anomaly detection jobs. + Specifically, filters are referenced in the custom_rules property of detector configuration objects.

+ ``_ @@ -3649,9 +3814,12 @@ def put_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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}}`. + .. raw:: html + +

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}}.

+ ``_ @@ -3855,8 +4023,11 @@ def put_trained_model( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a trained model. Enable you to supply a trained model that is not created - by data frame analytics. + .. raw:: html + +

Create a trained model. + Enable you to supply a trained model that is not created by data frame analytics.

+ ``_ @@ -3958,19 +4129,26 @@ def put_trained_model_alias( reassign: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a trained model alias. A trained model alias is a logical name - used to reference a single trained model. You can use aliases instead of trained - model identifiers to make it easier to reference your models. For example, you - can use aliases in inference aggregations and processors. An alias must be unique - and refer to only a single trained model. However, you can have multiple aliases - for each trained model. If you use this API to update an alias such that it references - a different trained model ID and the model uses a different type of data frame - analytics, an error occurs. For example, this situation occurs if you have a - trained model for regression analysis and a trained model for classification - analysis; you cannot reassign an alias from one type of trained model to another. - If you use this API to update an alias and there are very few input fields in - common between the old and new trained models for the model alias, the API returns - a warning. + .. raw:: html + +

Create or update a trained model alias. + A trained model alias is a logical name used to reference a single trained + model. + You can use aliases instead of trained model identifiers to make it easier to + reference your models. For example, you can use aliases in inference + aggregations and processors. + An alias must be unique and refer to only a single trained model. However, + you can have multiple aliases for each trained model. + If you use this API to update an alias such that it references a different + trained model ID and the model uses a different type of data frame analytics, + an error occurs. For example, this situation occurs if you have a trained + model for regression analysis and a trained model for classification + analysis; you cannot reassign an alias from one type of trained model to + another. + If you use this API to update an alias and there are very few input fields in + common between the old and new trained models for the model alias, the API + returns a warning.

+ ``_ @@ -4028,7 +4206,10 @@ def put_trained_model_definition_part( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create part of a trained model definition. + .. raw:: html + +

Create part of a trained model definition.

+ ``_ @@ -4105,9 +4286,12 @@ def put_trained_model_vocabulary( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a trained model vocabulary. This API is supported only for natural language - processing (NLP) models. The vocabulary is stored in the index as described in - `inference_config.*.vocabulary` of the trained model definition. + .. raw:: html + +

Create a trained model vocabulary. + This API is supported only for natural language processing (NLP) models. + The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition.

+ ``_ @@ -4163,9 +4347,14 @@ def reset_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset an anomaly detection job. All model state and results are deleted. The - job is ready to start over as if it had just been created. It is not currently - possible to reset multiple jobs using wildcards or a comma separated list. + .. raw:: html + +

Reset an anomaly detection job. + All model state and results are deleted. The job is ready to start over as if + it had just been created. + It is not currently possible to reset multiple jobs using wildcards or a + comma separated list.

+ ``_ @@ -4219,13 +4408,17 @@ def revert_model_snapshot( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Revert to a snapshot. The machine learning features react quickly to anomalous - input, learning new behaviors in data. Highly anomalous input increases the variance - in the models whilst the system learns whether this is a new step-change in behavior - or a one-off event. In the case where this anomalous input is known to be a one-off, - then it might be appropriate to reset the model state to a time before this event. - For example, you might consider reverting to a saved snapshot after Black Friday - or a critical system failure. + .. raw:: html + +

Revert to a snapshot. + The machine learning features react quickly to anomalous input, learning new + behaviors in data. Highly anomalous input increases the variance in the + models whilst the system learns whether this is a new step-change in behavior + or a one-off event. In the case where this anomalous input is known to be a + one-off, then it might be appropriate to reset the model state to a time + before this event. For example, you might consider reverting to a saved + snapshot after Black Friday or a critical system failure.

+ ``_ @@ -4285,17 +4478,22 @@ def set_upgrade_mode( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Set upgrade_mode for ML indices. Sets a cluster wide upgrade_mode setting that - prepares machine learning indices for an upgrade. When upgrading your cluster, - in some circumstances you must restart your nodes and reindex your machine learning - indices. In those circumstances, there must be no machine learning jobs running. - You can close the machine learning jobs, do the upgrade, then open all the jobs - again. Alternatively, you can use this API to temporarily halt tasks associated - with the jobs and datafeeds and prevent new jobs from opening. You can also use - this API during upgrades that do not require you to reindex your machine learning - indices, though stopping jobs is not a requirement in that case. You can see - the current value for the upgrade_mode setting by using the get machine learning - info API. + .. raw:: html + +

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

+ ``_ @@ -4341,16 +4539,21 @@ def start_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a data frame analytics job. A data frame analytics job can be started and - stopped multiple times throughout its lifecycle. If the destination index does - not exist, it is created automatically the first time you start the data frame - analytics job. The `index.number_of_shards` and `index.number_of_replicas` settings - for the destination index are copied from the source index. If there are multiple - source indices, the destination index copies the highest setting values. The - mappings for the destination index are also copied from the source indices. If - there are any mapping conflicts, the job fails to start. If the destination index - exists, it is used as is. You can therefore set up the destination index in advance - with custom settings and mappings. + .. raw:: html + +

Start a data frame analytics job. + A data frame analytics job can be started and stopped multiple times + throughout its lifecycle. + If the destination index does not exist, it is created automatically the + first time you start the data frame analytics job. The + index.number_of_shards and index.number_of_replicas settings for the + destination index are copied from the source index. If there are multiple + source indices, the destination index copies the highest setting values. The + mappings for the destination index are also copied from the source indices. + If there are any mapping conflicts, the job fails to start. + If the destination index exists, it is used as is. You can therefore set up + the destination index in advance with custom settings and mappings.

+ ``_ @@ -4402,17 +4605,18 @@ def start_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start datafeeds. A datafeed must be started in order to retrieve data from Elasticsearch. - A datafeed can be started and stopped multiple times throughout its lifecycle. - Before you can start a datafeed, the anomaly detection job must be open. Otherwise, - an error occurs. If you restart a stopped datafeed, it continues processing input - data from the next millisecond after it was stopped. If new data was indexed - for that exact millisecond between stopping and starting, it will be ignored. - When Elasticsearch security features are enabled, your datafeed remembers which - roles the last user to create or update it had at the time of creation or update - and runs the query using those same roles. If you provided secondary authorization - headers when you created or updated the datafeed, those credentials are used - instead. + .. raw:: html + +

Start datafeeds.

+

A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped + multiple times throughout its lifecycle.

+

Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs.

+

If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. + If new data was indexed for that exact millisecond between stopping and starting, it will be ignored.

+

When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or + update it had at the time of creation or update and runs the query using those same roles. If you provided secondary + authorization headers when you created or updated the datafeed, those credentials are used instead.

+ ``_ @@ -4481,8 +4685,11 @@ def start_trained_model_deployment( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a trained model deployment. It allocates the model to every machine learning - node. + .. raw:: html + +

Start a trained model deployment. + It allocates the model to every machine learning node.

+ ``_ @@ -4565,8 +4772,12 @@ def stop_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop data frame analytics jobs. A data frame analytics job can be started and - stopped multiple times throughout its lifecycle. + .. raw:: html + +

Stop data frame analytics jobs. + A data frame analytics job can be started and stopped multiple times + throughout its lifecycle.

+ ``_ @@ -4631,8 +4842,12 @@ def stop_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop datafeeds. A datafeed that is stopped ceases to retrieve data from Elasticsearch. - A datafeed can be started and stopped multiple times throughout its lifecycle. + .. raw:: html + +

Stop datafeeds. + A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped + multiple times throughout its lifecycle.

+ ``_ @@ -4694,7 +4909,10 @@ def stop_trained_model_deployment( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop a trained model deployment. + .. raw:: html + +

Stop a trained model deployment.

+ ``_ @@ -4759,7 +4977,10 @@ def update_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a data frame analytics job. + .. raw:: html + +

Update a data frame analytics job.

+ ``_ @@ -4867,11 +5088,14 @@ def update_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a datafeed. You must stop and start the datafeed for the changes to be - applied. When Elasticsearch security features are enabled, your datafeed remembers - which roles the user who updated it had at the time of the update and runs the - query using those same roles. If you provide secondary authorization headers, - those credentials are used instead. + .. raw:: html + +

Update a datafeed. + You must stop and start the datafeed for the changes to be applied. + When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at + the time of the update and runs the query using those same roles. If you provide secondary authorization headers, + those credentials are used instead.

+ ``_ @@ -5034,8 +5258,11 @@ def update_filter( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a filter. Updates the description of a filter, adds items, or removes - items from the list. + .. raw:: html + +

Update a filter. + Updates the description of a filter, adds items, or removes items from the list.

+ ``_ @@ -5125,8 +5352,11 @@ def update_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an anomaly detection job. Updates certain properties of an anomaly detection - job. + .. raw:: html + +

Update an anomaly detection job. + Updates certain properties of an anomaly detection job.

+ ``_ @@ -5254,7 +5484,11 @@ def update_model_snapshot( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a snapshot. Updates certain properties of a snapshot. + .. raw:: html + +

Update a snapshot. + Updates certain properties of a snapshot.

+ ``_ @@ -5315,7 +5549,10 @@ def update_trained_model_deployment( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a trained model deployment. + .. raw:: html + +

Update a trained model deployment.

+ ``_ @@ -5374,14 +5611,19 @@ def upgrade_job_snapshot( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Upgrade a snapshot. Upgrades 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. This API provides a means to upgrade a snapshot to the current - major version. This aids in preparing the cluster for an upgrade to the next - major version. Only one snapshot per anomaly detection job can be upgraded at - a time and the upgraded snapshot cannot be the current snapshot of the anomaly - detection job. + .. raw:: html + +

Upgrade a snapshot. + Upgrades 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. + This API provides a means to upgrade a snapshot to the current major version. + This aids in preparing the cluster for an upgrade to the next major version. + Only one snapshot per anomaly detection job can be upgraded at a time and the + upgraded snapshot cannot be the current snapshot of the anomaly detection + job.

+ ``_ @@ -5457,7 +5699,10 @@ def validate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Validate an anomaly detection job. + .. raw:: html + +

Validate an anomaly detection job.

+ ``_ @@ -5527,7 +5772,10 @@ def validate_detector( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Validate an anomaly detection job. + .. raw:: html + +

Validate an anomaly detection job.

+ ``_ diff --git a/elasticsearch/_sync/client/monitoring.py b/elasticsearch/_sync/client/monitoring.py index 455a78304..eae014b19 100644 --- a/elasticsearch/_sync/client/monitoring.py +++ b/elasticsearch/_sync/client/monitoring.py @@ -42,8 +42,11 @@ def bulk( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Send monitoring data. This API is used by the monitoring features to send monitoring - data. + .. raw:: html + +

Send monitoring data. + This API is used by the monitoring features to send monitoring data.

+ ``_ diff --git a/elasticsearch/_sync/client/nodes.py b/elasticsearch/_sync/client/nodes.py index e3c467ade..612470b03 100644 --- a/elasticsearch/_sync/client/nodes.py +++ b/elasticsearch/_sync/client/nodes.py @@ -44,8 +44,11 @@ def clear_repositories_metering_archive( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the archived repositories metering. Clear the archived repositories metering - information in the cluster. + .. raw:: html + +

Clear the archived repositories metering. + Clear the archived repositories metering information in the cluster.

+ ``_ @@ -94,11 +97,13 @@ def get_repositories_metering_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster repositories metering. Get repositories metering information for - a cluster. This API exposes monotonically non-decreasing counters and it is expected - that clients would durably store the information needed to compute aggregations - over a period of time. Additionally, the information exposed by this API is volatile, - meaning that it will not be present after node restarts. + .. raw:: html + +

Get cluster repositories metering. + Get repositories metering information for a cluster. + This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. + Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts.

+ ``_ @@ -151,9 +156,12 @@ def hot_threads( ] = None, ) -> TextApiResponse: """ - Get the hot threads for nodes. Get a breakdown of the hot threads on each selected - node in the cluster. The output is plain text with a breakdown of the top hot - threads for each node. + .. raw:: html + +

Get the hot threads for nodes. + Get a breakdown of the hot threads on each selected node in the cluster. + The output is plain text with a breakdown of the top hot threads for each node.

+ ``_ @@ -228,8 +236,11 @@ def info( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get node information. By default, the API returns all attributes and core settings - for cluster nodes. + .. raw:: html + +

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

+ ``_ @@ -298,18 +309,16 @@ def reload_secure_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reload the keystore on nodes in the cluster. Secure settings are stored in an - on-disk keystore. Certain of these settings are reloadable. That is, you can - change them on disk and reload them without restarting any nodes in the cluster. - When you have updated reloadable secure settings in your keystore, you can use - this API to reload those settings on each node. When the Elasticsearch keystore - is password protected and not simply obfuscated, you must provide the password - for the keystore when you reload the secure settings. Reloading the settings - for the whole cluster assumes that the keystores for all nodes are protected - with the same password; this method is allowed only when inter-node communications - are encrypted. Alternatively, you can reload the secure settings on each node - by locally accessing the API and passing the node-specific Elasticsearch keystore - password. + .. raw:: html + +

Reload the keystore on nodes in the cluster.

+

Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. + That is, you can change them on disk and reload them without restarting any nodes in the cluster. + When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node.

+

When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. + Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. + Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.

+ ``_ @@ -380,8 +389,12 @@ def stats( types: t.Optional[t.Sequence[str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get node statistics. Get statistics for nodes in a cluster. By default, all stats - are returned. You can limit the returned information by using metrics. + .. raw:: html + +

Get node statistics. + Get statistics for nodes in a cluster. + By default, all stats are returned. You can limit the returned information by using metrics.

+ ``_ @@ -498,7 +511,10 @@ def usage( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get feature usage information. + .. raw:: html + +

Get feature usage information.

+ ``_ diff --git a/elasticsearch/_sync/client/query_rules.py b/elasticsearch/_sync/client/query_rules.py index 147642436..2b322949c 100644 --- a/elasticsearch/_sync/client/query_rules.py +++ b/elasticsearch/_sync/client/query_rules.py @@ -37,9 +37,12 @@ def delete_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a query rule. Delete a query rule within a query ruleset. This is a destructive - action that is only recoverable by re-adding the same rule with the create or - update query rule API. + .. raw:: html + +

Delete a query rule. + Delete a query rule within a query ruleset. + This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API.

+ ``_ @@ -87,8 +90,12 @@ def delete_ruleset( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a query ruleset. Remove a query ruleset and its associated data. This - is a destructive action that is not recoverable. + .. raw:: html + +

Delete a query ruleset. + Remove a query ruleset and its associated data. + This is a destructive action that is not recoverable.

+ ``_ @@ -129,7 +136,11 @@ def get_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a query rule. Get details about a query rule within a query ruleset. + .. raw:: html + +

Get a query rule. + Get details about a query rule within a query ruleset.

+ ``_ @@ -177,7 +188,11 @@ def get_ruleset( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a query ruleset. Get details about a query ruleset. + .. raw:: html + +

Get a query ruleset. + Get details about a query ruleset.

+ ``_ @@ -220,7 +235,11 @@ def list_rulesets( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all query rulesets. Get summarized information about the query rulesets. + .. raw:: html + +

Get all query rulesets. + Get summarized information about the query rulesets.

+ ``_ @@ -273,13 +292,15 @@ def put_rule( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a query rule. Create or update a query rule within a query ruleset. - IMPORTANT: Due to limitations within pinned queries, you can only pin documents - using ids or docs, but cannot use both in single rule. It is advised to use one - or the other in query rulesets, to avoid errors. Additionally, pinned queries - have a maximum limit of 100 pinned hits. If multiple matching rules pin more - than 100 documents, only the first 100 documents are pinned in the order they - are specified in the ruleset. + .. raw:: html + +

Create or update a query rule. + Create or update a query rule within a query ruleset.

+

IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. + It is advised to use one or the other in query rulesets, to avoid errors. + Additionally, pinned queries have a maximum limit of 100 pinned hits. + If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.

+ ``_ @@ -357,14 +378,16 @@ def put_ruleset( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a query ruleset. There is a limit of 100 rules per ruleset. - This limit can be increased by using the `xpack.applications.rules.max_rules_per_ruleset` - cluster setting. IMPORTANT: Due to limitations within pinned queries, you can - only select documents using `ids` or `docs`, but cannot use both in single rule. - It is advised to use one or the other in query rulesets, to avoid errors. Additionally, - pinned queries have a maximum limit of 100 pinned hits. If multiple matching - rules pin more than 100 documents, only the first 100 documents are pinned in - the order they are specified in the ruleset. + .. raw:: html + +

Create or update a query ruleset. + There is a limit of 100 rules per ruleset. + This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting.

+

IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. + It is advised to use one or the other in query rulesets, to avoid errors. + Additionally, pinned queries have a maximum limit of 100 pinned hits. + If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.

+ ``_ @@ -417,8 +440,11 @@ def test( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Test a query ruleset. Evaluate match criteria against a query ruleset to identify - the rules that would match that criteria. + .. raw:: html + +

Test a query ruleset. + Evaluate match criteria against a query ruleset to identify the rules that would match that criteria.

+ ``_ diff --git a/elasticsearch/_sync/client/rollup.py b/elasticsearch/_sync/client/rollup.py index 3baa6c10c..84ca3d410 100644 --- a/elasticsearch/_sync/client/rollup.py +++ b/elasticsearch/_sync/client/rollup.py @@ -43,20 +43,29 @@ def delete_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a rollup job. A job must be stopped before it can be deleted. If you attempt - to delete a started job, an error occurs. Similarly, if you attempt to delete - a nonexistent job, an exception occurs. IMPORTANT: When you delete a job, you - remove only the process that is actively monitoring and rolling up data. The - API does not delete any previously rolled up data. This is by design; a user - may wish to roll up a static data set. Because the data set is static, after - it has been fully rolled up there is no need to keep the indexing rollup job - around (as there will be no new data). Thus the job can be deleted, leaving behind - the rolled up data for analysis. If you wish to also remove the rollup data and - the rollup index contains the data for only a single job, you can delete the - whole rollup index. If the rollup index stores data from several jobs, you must - issue a delete-by-query that targets the rollup job's identifier in the rollup - index. For example: ``` POST my_rollup_index/_delete_by_query { "query": { "term": - { "_rollup.id": "the_rollup_job_id" } } } ``` + .. raw:: html + +

Delete a rollup job.

+

A job must be stopped before it can be deleted. + If you attempt to delete a started job, an error occurs. + Similarly, if you attempt to delete a nonexistent job, an exception occurs.

+

IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. + The API does not delete any previously rolled up data. + This is by design; a user may wish to roll up a static data set. + Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). + Thus the job can be deleted, leaving behind the rolled up data for analysis. + If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. + If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example:

+
POST my_rollup_index/_delete_by_query
+          {
+            "query": {
+              "term": {
+                "_rollup.id": "the_rollup_job_id"
+              }
+            }
+          }
+          
+ ``_ @@ -97,11 +106,14 @@ def get_jobs( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get rollup job information. Get the configuration, stats, and status of rollup - jobs. NOTE: This API returns only active (both `STARTED` and `STOPPED`) jobs. - If a job was created, ran for a while, then was deleted, the API does not return - any details about it. For details about a historical rollup job, the rollup capabilities - API may be more useful. + .. raw:: html + +

Get rollup job information. + Get the configuration, stats, and status of rollup jobs.

+

NOTE: This API returns only active (both STARTED and STOPPED) jobs. + If a job was created, ran for a while, then was deleted, the API does not return any details about it. + For details about a historical rollup job, the rollup capabilities API may be more useful.

+ ``_ @@ -146,15 +158,18 @@ def get_rollup_caps( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the rollup job capabilities. Get the capabilities of any rollup jobs that - have been configured for a specific index or index pattern. This API is useful - because a rollup job is often configured to rollup only a subset of fields from - the source index. Furthermore, only certain aggregations can be configured for - various fields, leading to a limited subset of functionality depending on that - configuration. This API enables you to inspect an index and determine: 1. Does - this index have associated rollup data somewhere in the cluster? 2. If yes to - the first question, what fields were rolled up, what aggregations can be performed, - and where does the data live? + .. raw:: html + +

Get the rollup job capabilities. + Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern.

+

This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. + Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. + This API enables you to inspect an index and determine:

+
    +
  1. Does this index have associated rollup data somewhere in the cluster?
  2. +
  3. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live?
  4. +
+ ``_ @@ -199,12 +214,16 @@ def get_rollup_index_caps( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the rollup index capabilities. Get the rollup capabilities of all jobs inside - of a rollup index. A single rollup index may store the data for multiple rollup - jobs and may have a variety of capabilities depending on those jobs. This API - enables you to determine: * What jobs are stored in an index (or indices specified - via a pattern)? * What target indices were rolled up, what fields were used in - those rollups, and what aggregations can be performed on each job? + .. raw:: html + +

Get the rollup index capabilities. + Get the rollup capabilities of all jobs inside of a rollup index. + A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine:

+
    +
  • What jobs are stored in an index (or indices specified via a pattern)?
  • +
  • What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job?
  • +
+ ``_ @@ -267,16 +286,14 @@ def put_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a rollup job. WARNING: From 8.15.0, calling this API in a cluster with - no rollup usage will fail with a message about the deprecation and planned removal - of rollup features. A cluster needs to contain either a rollup job or a rollup - index in order for this API to be allowed to run. The rollup job configuration - contains all the details about how the job should run, when it indexes documents, - and what future queries will be able to run against the rollup index. There are - three main sections to the job configuration: the logistical details about the - job (for example, the cron schedule), the fields that are used for grouping, - and what metrics to collect for each group. Jobs are created in a `STOPPED` state. - You can start them with the start rollup jobs API. + .. raw:: html + +

Create a rollup job.

+

WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run.

+

The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index.

+

There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group.

+

Jobs are created in a STOPPED state. You can start them with the start rollup jobs API.

+ ``_ @@ -393,25 +410,38 @@ def rollup_search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Search rolled-up data. The rollup search endpoint is needed because, internally, - rolled-up documents utilize a different document structure than the original - data. It rewrites standard Query DSL into a format that matches the rollup documents - then takes the response and rewrites it back to what a client would expect given - the original query. The request body supports a subset of features from the regular - search API. The following functionality is not available: `size`: Because rollups - work on pre-aggregated data, no search hits can be returned and so size must - be set to zero or omitted entirely. `highlighter`, `suggestors`, `post_filter`, - `profile`, `explain`: These are similarly disallowed. **Searching both historical - rollup and non-rollup data** The rollup search API has the capability to search - across both "live" non-rollup data and the aggregated rollup data. This is done - by simply adding the live indices to the URI. For example: ``` GET sensor-1,sensor_rollup/_rollup_search - { "size": 0, "aggregations": { "max_temperature": { "max": { "field": "temperature" - } } } } ``` The rollup search endpoint does two things when the search runs: - * The original request is sent to the non-rollup index unaltered. * A rewritten - version of the original request is sent to the rollup index. When the two responses - are received, the endpoint rewrites the rollup response and merges the two together. - During the merging process, if there is any overlap in buckets between the two - responses, the buckets from the non-rollup index are used. + .. raw:: html + +

Search rolled-up data. + The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. + It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query.

+

The request body supports a subset of features from the regular search API. + The following functionality is not available:

+

size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. + highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed.

+

Searching both historical rollup and non-rollup data

+

The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. + This is done by simply adding the live indices to the URI. For example:

+
GET sensor-1,sensor_rollup/_rollup_search
+          {
+            "size": 0,
+            "aggregations": {
+               "max_temperature": {
+                "max": {
+                  "field": "temperature"
+                }
+              }
+            }
+          }
+          
+

The rollup search endpoint does two things when the search runs:

+
    +
  • The original request is sent to the non-rollup index unaltered.
  • +
  • A rewritten version of the original request is sent to the rollup index.
  • +
+

When the two responses are received, the endpoint rewrites the rollup response and merges the two together. + During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used.

+ ``_ @@ -484,8 +514,12 @@ def start_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Start rollup jobs. If you try to start a job that does not exist, an exception - occurs. If you try to start a job that is already started, nothing happens. + .. raw:: html + +

Start rollup jobs. + If you try to start a job that does not exist, an exception occurs. + If you try to start a job that is already started, nothing happens.

+ ``_ @@ -528,14 +562,18 @@ def stop_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop rollup jobs. If you try to stop a job that does not exist, an exception - occurs. If you try to stop a job that is already stopped, nothing happens. Since - only a stopped job can be deleted, it can be useful to block the API until the - indexer has fully stopped. This is accomplished with the `wait_for_completion` - query parameter, and optionally a timeout. For example: ``` POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - ``` The parameter blocks the API call from returning until either the job has - moved to STOPPED or the specified time has elapsed. If the specified time elapses - without the job moving to STOPPED, a timeout exception occurs. + .. raw:: html + +

Stop rollup jobs. + If you try to stop a job that does not exist, an exception occurs. + If you try to stop a job that is already stopped, nothing happens.

+

Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. + This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example:

+
POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s
+          
+

The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. + If the specified time elapses without the job moving to STOPPED, a timeout exception occurs.

+ ``_ diff --git a/elasticsearch/_sync/client/search_application.py b/elasticsearch/_sync/client/search_application.py index 64858faae..76ef2d456 100644 --- a/elasticsearch/_sync/client/search_application.py +++ b/elasticsearch/_sync/client/search_application.py @@ -43,8 +43,11 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a search application. Remove a search application and its associated alias. - Indices attached to the search application are not removed. + .. raw:: html + +

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

+ ``_ @@ -85,8 +88,11 @@ def delete_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a behavioral analytics collection. The associated data stream is also - deleted. + .. raw:: html + +

Delete a behavioral analytics collection. + The associated data stream is also deleted.

+ ``_ @@ -127,7 +133,10 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get search application details. + .. raw:: html + +

Get search application details.

+ ``_ @@ -168,7 +177,10 @@ def get_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get behavioral analytics collections. + .. raw:: html + +

Get behavioral analytics collections.

+ ``_ @@ -216,7 +228,11 @@ def list( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get search applications. Get information about search applications. + .. raw:: html + +

Get search applications. + Get information about search applications.

+ ``_ @@ -269,7 +285,10 @@ def post_behavioral_analytics_event( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a behavioral analytics collection event. + .. raw:: html + +

Create a behavioral analytics collection event.

+ ``_ @@ -333,7 +352,10 @@ def put( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a search application. + .. raw:: html + +

Create or update a search application.

+ ``_ @@ -387,7 +409,10 @@ def put_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a behavioral analytics collection. + .. raw:: html + +

Create a behavioral analytics collection.

+ ``_ @@ -433,13 +458,14 @@ def render_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Render a search application query. Generate an Elasticsearch query using the - specified query parameters and the search template associated with the search - application or a default template if none is specified. If a parameter used in - the search template is not specified in `params`, the parameter's default value - will be used. The API returns the specific Elasticsearch query that would be - generated and run by calling the search application search API. You must have - `read` privileges on the backing alias of the search application. + .. raw:: html + +

Render a search application query. + Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. + If a parameter used in the search template is not specified in params, the parameter's default value will be used. + The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.

+

You must have read privileges on the backing alias of the search application.

+ ``_ @@ -498,10 +524,12 @@ def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a search application search. Generate and run an Elasticsearch query that - uses the specified query parameteter and the search template associated with - the search application or default template. Unspecified template parameters are - assigned their default values if applicable. + .. raw:: html + +

Run a search application search. + Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. + Unspecified template parameters are assigned their default values if applicable.

+ ``_ diff --git a/elasticsearch/_sync/client/searchable_snapshots.py b/elasticsearch/_sync/client/searchable_snapshots.py index 63c1d4fda..0d5575c0c 100644 --- a/elasticsearch/_sync/client/searchable_snapshots.py +++ b/elasticsearch/_sync/client/searchable_snapshots.py @@ -44,8 +44,11 @@ def cache_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cache statistics. Get statistics about the shared cache for partially mounted - indices. + .. raw:: html + +

Get cache statistics. + Get statistics about the shared cache for partially mounted indices.

+ ``_ @@ -102,8 +105,11 @@ def clear_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the cache. Clear indices and data streams from the shared cache for partially - mounted indices. + .. raw:: html + +

Clear the cache. + Clear indices and data streams from the shared cache for partially mounted indices.

+ ``_ @@ -176,9 +182,13 @@ def mount( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Mount a snapshot. Mount a snapshot as a searchable snapshot index. Do not use - this API for snapshots managed by index lifecycle management (ILM). Manually - mounting ILM-managed snapshots can interfere with ILM processes. + .. raw:: html + +

Mount a snapshot. + Mount a snapshot as a searchable snapshot index. + Do not use this API for snapshots managed by index lifecycle management (ILM). + Manually mounting ILM-managed snapshots can interfere with ILM processes.

+ ``_ @@ -263,7 +273,10 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get searchable snapshot statistics. + .. raw:: html + +

Get searchable snapshot statistics.

+ ``_ diff --git a/elasticsearch/_sync/client/security.py b/elasticsearch/_sync/client/security.py index d69e0d2d6..c8bb4cf4e 100644 --- a/elasticsearch/_sync/client/security.py +++ b/elasticsearch/_sync/client/security.py @@ -44,21 +44,19 @@ def activate_user_profile( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Activate a user profile. Create or update a user profile on behalf of another - user. NOTE: The user profile feature is designed only for use by Kibana and Elastic's - Observability, Enterprise Search, and Elastic Security solutions. Individual - users and external applications should not call this API directly. The calling - application must have either an `access_token` or a combination of `username` - and `password` for the user that the profile document is intended for. Elastic - reserves the right to change or remove this feature in future releases without - prior notice. This API creates or updates a profile document for end users with - information that is extracted from the user's authentication object including - `username`, `full_name,` `roles`, and the authentication realm. For example, - in the JWT `access_token` case, the profile user's `username` is extracted from - the JWT token claim pointed to by the `claims.principal` setting of the JWT realm - that authenticated the token. When updating a profile document, the API enables - the document if it was disabled. Any updates do not change existing content for - either the `labels` or `data` fields. + .. raw:: html + +

Activate a user profile.

+

Create or update a user profile on behalf of another user.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. + For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token.

+

When updating a profile document, the API enables the document if it was disabled. + Any updates do not change existing content for either the labels or data fields.

+ ``_ @@ -117,12 +115,14 @@ def authenticate( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Authenticate a user. Authenticates a user and returns information about the authenticated - user. Include the user information in a [basic auth header](https://en.wikipedia.org/wiki/Basic_access_authentication). - A successful call returns a JSON structure that shows user information such as - their username, the roles that are assigned to the user, any assigned metadata, - and information about the realms that authenticated and authorized the user. - If the user cannot be authenticated, this API returns a 401 status code. + .. raw:: html + +

Authenticate a user.

+

Authenticates a user and returns information about the authenticated user. + Include the user information in a basic auth header. + A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + If the user cannot be authenticated, this API returns a 401 status code.

+ ``_ """ @@ -164,9 +164,12 @@ def bulk_delete_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk delete roles. The role management APIs are generally the preferred way to - manage roles, rather than using file-based role management. The bulk delete roles - API cannot delete roles that are defined in roles files. + .. raw:: html + +

Bulk delete roles.

+

The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The bulk delete roles API cannot delete roles that are defined in roles files.

+ ``_ @@ -222,9 +225,12 @@ def bulk_put_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk create or update roles. The role management APIs are generally the preferred - way to manage roles, rather than using file-based role management. The bulk create - or update roles API cannot update roles that are defined in roles files. + .. raw:: html + +

Bulk create or update roles.

+

The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The bulk create or update roles API cannot update roles that are defined in roles files.

+ ``_ @@ -280,23 +286,19 @@ def bulk_update_api_keys( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk update API keys. Update the attributes for multiple API keys. IMPORTANT: - It is not possible to use an API key as the authentication credential for this - API. To update API keys, the owner user's credentials are required. This API - is similar to the update API key API but enables you to apply the same update - to multiple API keys in one API call. This operation can greatly improve performance - over making individual updates. It is not possible to update expired or invalidated - API keys. This API supports updates to API key access scope, metadata and expiration. - The access scope of each API key is derived from the `role_descriptors` you specify - in the request and a snapshot of the owner user's permissions at the time of - the request. The snapshot of the owner's permissions is updated automatically - on every call. IMPORTANT: If you don't specify `role_descriptors` in the request, - a call to this API might still change an API key's access scope. This change - can occur if the owner user's permissions have changed since the API key was - created or last modified. A successful request returns a JSON structure that - contains the IDs of all updated API keys, the IDs of API keys that already had - the requested changes and did not require an update, and error details for any - failed update. + .. raw:: html + +

Bulk update API keys. + Update the attributes for multiple API keys.

+

IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required.

+

This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates.

+

It is not possible to update expired or invalidated API keys.

+

This API supports updates to API key access scope, metadata and expiration. + The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. + The snapshot of the owner's permissions is updated automatically on every call.

+

IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified.

+

A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update.

+ ``_ @@ -370,8 +372,11 @@ def change_password( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Change passwords. Change the passwords of users in the native realm and built-in - users. + .. raw:: html + +

Change passwords.

+

Change the passwords of users in the native realm and built-in users.

+ ``_ @@ -433,8 +438,12 @@ def clear_api_key_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the API key cache. Evict a subset of all entries from the API key cache. - The cache is also automatically cleared on state changes of the security index. + .. raw:: html + +

Clear the API key cache.

+

Evict a subset of all entries from the API key cache. + The cache is also automatically cleared on state changes of the security index.

+ ``_ @@ -475,13 +484,17 @@ def clear_cached_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the privileges cache. Evict privileges from the native application privilege - cache. The cache is also automatically cleared for applications that have their - privileges updated. + .. raw:: html + +

Clear the privileges cache.

+

Evict privileges from the native application privilege cache. + The cache is also automatically cleared for applications that have their privileges updated.

+ ``_ - :param application: A comma-separated list of application names + :param application: A comma-separated list of applications. To clear all applications, + use an asterism (`*`). It does not support other wildcard patterns. """ if application in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'application'") @@ -518,13 +531,23 @@ def clear_cached_realms( usernames: t.Optional[t.Sequence[str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the user cache. Evict users from the user cache. You can completely clear - the cache or evict specific users. + .. raw:: html + +

Clear the user cache.

+

Evict users from the user cache. + You can completely clear the cache or evict specific users.

+

User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. + There are realm settings that you can use to configure the user cache. + For more information, refer to the documentation about controlling the user cache.

+ ``_ - :param realms: Comma-separated list of realms to clear - :param usernames: Comma-separated list of usernames to clear from the cache + :param realms: A comma-separated list of realms. To clear all realms, use an + asterisk (`*`). It does not support other wildcard patterns. + :param usernames: A comma-separated list of the users to clear from the cache. + If you do not specify this parameter, the API evicts all users from the user + cache. """ if realms in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'realms'") @@ -562,11 +585,17 @@ def clear_cached_roles( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the roles cache. Evict roles from the native role cache. + .. raw:: html + +

Clear the roles cache.

+

Evict roles from the native role cache.

+ ``_ - :param name: Role name + :param name: A comma-separated list of roles to evict from the role cache. To + evict all roles, use an asterisk (`*`). It does not support other wildcard + patterns. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -604,14 +633,23 @@ def clear_cached_service_tokens( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear service account token caches. Evict a subset of all entries from the service - account token caches. + .. raw:: html + +

Clear service account token caches.

+

Evict a subset of all entries from the service account token caches. + Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. + This API clears matching entries from both caches.

+

The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. + The cache for tokens backed by the service_tokens file is cleared automatically on file changes.

+ ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: A comma-separated list of service token names + :param namespace: The namespace, which is a top-level grouping of service accounts. + :param service: The name of the service, which must be unique within its namespace. + :param name: A comma-separated list of token names to evict from the service + account token caches. Use a wildcard (`*`) to evict all tokens that belong + to a service account. It does not support other wildcard patterns. """ if namespace in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'namespace'") @@ -664,31 +702,43 @@ def create_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an API key. Create an API key for access without requiring basic authentication. - A successful request returns a JSON structure that contains the API key, its - unique id, and its name. If applicable, it also returns expiration information - for the API key in milliseconds. NOTE: By default, API keys never expire. You - can specify expiration information when you create the API keys. + .. raw:: html + +

Create an API key.

+

Create an API key for access without requiring basic authentication.

+

IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. + If you specify privileges, the API returns an error.

+

A successful request returns a JSON structure that contains the API key, its unique id, and its name. + If applicable, it also returns expiration information for the API key in milliseconds.

+

NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys.

+

The API keys are created by the Elasticsearch API key service, which is automatically enabled. + To configure or turn off the API key service, refer to API key service setting documentation.

+ ``_ - :param expiration: Expiration time for the API key. By default, API keys never - expire. + :param expiration: The expiration time for the API key. By default, API keys + never expire. :param metadata: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. - :param name: Specifies the name for this API key. + :param name: A name for the API key. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - :param role_descriptors: An array of role descriptors for this API key. This - parameter is optional. When it is not specified or is an empty array, then - the API key will have a point in time snapshot of permissions of the authenticated - user. If you supply role descriptors then the resultant permissions would - be an intersection of API keys permissions and authenticated user’s permissions - thereby limiting the access scope for API keys. The structure of role descriptor - is the same as the request for create role API. For more details, see create - or update roles API. + :param role_descriptors: An array of role descriptors for this API key. When + it is not specified or it is an empty array, the API key will have a point + in time snapshot of permissions of the authenticated user. If you supply + role descriptors, the resultant permissions are an intersection of API keys + permissions and the authenticated user's permissions thereby limiting the + access scope for API keys. The structure of role descriptor is the same as + the request for the create role API. For more details, refer to the create + or update roles API. NOTE: Due to the way in which this permission intersection + is calculated, it is not possible to create an API key that is a child of + another API key, unless the derived key is created without any privileges. + In this case, you must explicitly specify a role descriptor with no privileges. + The derived API key can be used for authentication; it will not have authority + to call Elasticsearch APIs. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" @@ -741,21 +791,19 @@ def create_cross_cluster_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a cross-cluster API key. Create an API key of the `cross_cluster` type - for the API key based remote cluster access. A `cross_cluster` API key cannot - be used to authenticate through the REST interface. IMPORTANT: To authenticate - this request you must use a credential that is not an API key. Even if you use - an API key that has the required privilege, the API returns an error. Cross-cluster - API keys are created by the Elasticsearch API key service, which is automatically - enabled. NOTE: Unlike REST API keys, a cross-cluster API key does not capture - permissions of the authenticated user. The API key’s effective permission is - exactly as specified with the `access` property. A successful request returns - a JSON structure that contains the API key, its unique ID, and its name. If applicable, - it also returns expiration information for the API key in milliseconds. By default, - API keys never expire. You can specify expiration information when you create - the API keys. Cross-cluster API keys can only be updated with the update cross-cluster - API key API. Attempting to update them with the update REST API key API or the - bulk update REST API keys API will result in an error. + .. raw:: html + +

Create a cross-cluster API key.

+

Create an API key of the cross_cluster type for the API key based remote cluster access. + A cross_cluster API key cannot be used to authenticate through the REST interface.

+

IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error.

+

Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled.

+

NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property.

+

A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds.

+

By default, API keys never expire. You can specify expiration information when you create the API keys.

+

Cross-cluster API keys can only be updated with the update cross-cluster API key API. + Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error.

+ ``_ @@ -824,14 +872,26 @@ def create_service_token( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a service account token. Create a service accounts token for access without - requiring basic authentication. + .. raw:: html + +

Create a service account token.

+

Create a service accounts token for access without requiring basic authentication.

+

NOTE: Service account tokens never expire. + You must actively delete them if they are no longer needed.

+ ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: An identifier for the token name + :param namespace: The name of the namespace, which is a top-level grouping of + service accounts. + :param service: The name of the service. + :param name: The name for the service account token. If omitted, a random name + will be generated. Token names must be at least one and no more than 256 + characters. They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes + (`-`), and underscores (`_`), but cannot begin with an underscore. NOTE: + Token names must be unique in the context of the associated service account. + They must also be globally unique with their fully qualified names, which + are comprised of the service account principal and token name, such as `//`. :param refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -894,20 +954,17 @@ def delegate_pki( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delegate PKI authentication. This API implements the exchange of an X509Certificate - chain for an Elasticsearch access token. The certificate chain is validated, - according to RFC 5280, by sequentially considering the trust configuration of - every installed PKI realm that has `delegation.enabled` set to `true`. A successfully - trusted client certificate is also subject to the validation of the subject distinguished - name according to thw `username_pattern` of the respective realm. This API is - called by smart and trusted proxies, such as Kibana, which terminate the user's - TLS session but still want to authenticate the user by using a PKI realm—-​as - if the user connected directly to Elasticsearch. IMPORTANT: The association between - the subject public key in the target certificate and the corresponding private - key is not validated. This is part of the TLS authentication process and it is - delegated to the proxy that calls this API. The proxy is trusted to have performed - the TLS authentication and this API translates that authentication into an Elasticsearch - access token. + .. raw:: html + +

Delegate PKI authentication.

+

This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. + The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. + A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm.

+

This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch.

+

IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. + This is part of the TLS authentication process and it is delegated to the proxy that calls this API. + The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token.

+ ``_ @@ -963,12 +1020,21 @@ def delete_privileges( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete application privileges. + .. raw:: html + +

Delete application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_security cluster privilege (or a greater privilege such as all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
+ ``_ - :param application: Application name - :param name: Privilege name + :param application: The name of the application. Application privileges are always + associated with exactly one application. + :param name: The name of the privilege. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1019,11 +1085,17 @@ def delete_role( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete roles. Delete roles in the native realm. + .. raw:: html + +

Delete roles.

+

Delete roles in the native realm. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The delete roles API cannot remove roles that are defined in roles files.

+ ``_ - :param name: Role name + :param name: The name of the role. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1067,11 +1139,19 @@ def delete_role_mapping( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete role mappings. + .. raw:: html + +

Delete role mappings.

+

Role mappings define which roles are assigned to each user. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. + The delete role mappings API cannot remove role mappings that are defined in role mapping files.

+ ``_ - :param name: Role-mapping name + :param name: The distinct name that identifies the role mapping. The name is + used solely as an identifier to facilitate interaction via the API; it does + not affect the behavior of the mapping in any way. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1117,14 +1197,17 @@ def delete_service_token( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete service account tokens. Delete service account tokens for a service in - a specified namespace. + .. raw:: html + +

Delete service account tokens.

+

Delete service account tokens for a service in a specified namespace.

+ ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: An identifier for the token name + :param namespace: The namespace, which is a top-level grouping of service accounts. + :param service: The service name. + :param name: The name of the service account token. :param refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1176,11 +1259,15 @@ def delete_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete users. Delete users from the native realm. + .. raw:: html + +

Delete users.

+

Delete users from the native realm.

+ ``_ - :param username: username + :param username: An identifier for the user. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1224,11 +1311,17 @@ def disable_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Disable users. Disable users in the native realm. + .. raw:: html + +

Disable users.

+

Disable users in the native realm. + By default, when you create users, they are enabled. + You can use this API to revoke a user's access to Elasticsearch.

+ ``_ - :param username: The username of the user to disable + :param username: An identifier for the user. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1272,15 +1365,16 @@ def disable_user_profile( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Disable a user profile. Disable user profiles so that they are not visible in - user profile searches. NOTE: The user profile feature is designed only for use - by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security - solutions. Individual users and external applications should not call this API - directly. Elastic reserves the right to change or remove this feature in future - releases without prior notice. When you activate a user profile, its automatically - enabled and visible in user profile searches. You can use the disable user profile - API to disable a user profile so it’s not visible in these searches. To re-enable - a disabled user profile, use the enable user profile API . + .. raw:: html + +

Disable a user profile.

+

Disable user profiles so that they are not visible in user profile searches.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. + To re-enable a disabled user profile, use the enable user profile API .

+ ``_ @@ -1328,11 +1422,16 @@ def enable_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Enable users. Enable users in the native realm. + .. raw:: html + +

Enable users.

+

Enable users in the native realm. + By default, when you create users, they are enabled.

+ ``_ - :param username: The username of the user to enable + :param username: An identifier for the user. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -1376,14 +1475,16 @@ def enable_user_profile( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Enable a user profile. Enable user profiles to make them visible in user profile - searches. NOTE: The user profile feature is designed only for use by Kibana and - Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual - users and external applications should not call this API directly. Elastic reserves - the right to change or remove this feature in future releases without prior notice. - When you activate a user profile, it's automatically enabled and visible in user - profile searches. If you later disable the user profile, you can use the enable - user profile API to make the profile visible in these searches again. + .. raw:: html + +

Enable a user profile.

+

Enable user profiles to make them visible in user profile searches.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

When you activate a user profile, it's automatically enabled and visible in user profile searches. + If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again.

+ ``_ @@ -1427,8 +1528,13 @@ def enroll_kibana( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Enroll Kibana. Enable a Kibana instance to configure itself for communication - with a secured Elasticsearch cluster. + .. raw:: html + +

Enroll Kibana.

+

Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster.

+

NOTE: This API is currently intended for internal use only by Kibana. + Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled.

+ ``_ """ @@ -1463,8 +1569,13 @@ def enroll_node( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Enroll a node. Enroll a new node to allow it to join an existing cluster with - security features enabled. + .. raw:: html + +

Enroll a node.

+

Enroll a new node to allow it to join an existing cluster with security features enabled.

+

The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. + The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster.

+ ``_ """ @@ -1507,11 +1618,13 @@ def get_api_key( with_profile_uid: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get API key information. Retrieves information for one or more API keys. NOTE: - If you have only the `manage_own_api_key` privilege, this API returns only the - API keys that you own. If you have `read_security`, `manage_api_key` or greater - privileges (including `manage_security`), this API returns all API keys regardless - of ownership. + .. raw:: html + +

Get API key information.

+

Retrieves information for one or more API keys. + NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership.

+ ``_ @@ -1585,8 +1698,11 @@ def get_builtin_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get builtin privileges. Get the list of cluster privileges and index privileges - that are available in this version of Elasticsearch. + .. raw:: html + +

Get builtin privileges.

+

Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch.

+ ``_ """ @@ -1623,12 +1739,23 @@ def get_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get application privileges. + .. raw:: html + +

Get application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The read_security cluster privilege (or a greater privilege such as manage_security or all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
+ ``_ - :param application: Application name - :param name: Privilege name + :param application: The name of the application. Application privileges are always + associated with exactly one application. If you do not specify this parameter, + the API returns information about all privileges for all applications. + :param name: The name of the privilege. If you do not specify this parameter, + the API returns information about all privileges for the requested application. """ __path_parts: t.Dict[str, str] if application not in SKIP_IN_PATH and name not in SKIP_IN_PATH: @@ -1670,9 +1797,13 @@ def get_role( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get roles. Get roles in the native realm. The role management APIs are generally - the preferred way to manage roles, rather than using file-based role management. - The get roles API cannot retrieve roles that are defined in roles files. + .. raw:: html + +

Get roles.

+

Get roles in the native realm. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The get roles API cannot retrieve roles that are defined in roles files.

+ ``_ @@ -1717,10 +1848,13 @@ def get_role_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get role mappings. Role mappings define which roles are assigned to each user. - The role mapping APIs are generally the preferred way to manage role mappings - rather than using role mapping files. The get role mappings API cannot retrieve - role mappings that are defined in role mapping files. + .. raw:: html + +

Get role mappings.

+

Role mappings define which roles are assigned to each user. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. + The get role mappings API cannot retrieve role mappings that are defined in role mapping files.

+ ``_ @@ -1768,15 +1902,19 @@ def get_service_accounts( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get service accounts. Get a list of service accounts that match the provided - path parameters. + .. raw:: html + +

Get service accounts.

+

Get a list of service accounts that match the provided path parameters.

+

NOTE: Currently, only the elastic/fleet-server service account is available.

+ ``_ - :param namespace: Name of the namespace. Omit this parameter to retrieve information - about all service accounts. If you omit this parameter, you must also omit - the `service` parameter. - :param service: Name of the service name. Omit this parameter to retrieve information + :param namespace: The name of the namespace. Omit this parameter to retrieve + information about all service accounts. If you omit this parameter, you must + also omit the `service` parameter. + :param service: The service name. Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. """ __path_parts: t.Dict[str, str] @@ -1820,12 +1958,19 @@ def get_service_credentials( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get service account credentials. + .. raw:: html + +

Get service account credentials.

+

To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security).

+

The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster.

+

NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. + Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens.

+ ``_ - :param namespace: Name of the namespace. - :param service: Name of the service name. + :param namespace: The name of the namespace. + :param service: The service name. """ if namespace in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'namespace'") @@ -1866,8 +2011,17 @@ def get_settings( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get security index settings. Get the user-configurable settings for the security - internal index (`.security` and associated indices). + .. raw:: html + +

Get security index settings.

+

Get the user-configurable settings for the security internal index (.security and associated indices). + Only a subset of the index settings — those that are user-configurable—will be shown. + This includes:

+
    +
  • index.auto_expand_replicas
  • +
  • index.number_of_replicas
  • +
+ ``_ @@ -1931,16 +2085,39 @@ def get_token( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a token. Create a bearer token for access without requiring basic authentication. + .. raw:: html + +

Get a token.

+

Create a bearer token for access without requiring basic authentication. + The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. + Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. + When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface.

+

The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body.

+

A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available.

+

The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. + That time period is defined by the xpack.security.authc.token.timeout setting. + If you want to invalidate a token immediately, you can do so by using the invalidate token API.

+ ``_ - :param grant_type: - :param kerberos_ticket: - :param password: - :param refresh_token: - :param scope: - :param username: + :param grant_type: The type of grant. Supported grant types are: `password`, + `_kerberos`, `client_credentials`, and `refresh_token`. + :param kerberos_ticket: The base64 encoded kerberos ticket. If you specify the + `_kerberos` grant type, this parameter is required. This parameter is not + valid with any other supported grant type. + :param password: The user's password. If you specify the `password` grant type, + this parameter is required. This parameter is not valid with any other supported + grant type. + :param refresh_token: The string that was returned when you created the token, + which enables you to extend its life. If you specify the `refresh_token` + grant type, this parameter is required. This parameter is not valid with + any other supported grant type. + :param scope: The scope of the token. Currently tokens are only issued for a + scope of FULL regardless of the value sent with the request. + :param username: The username that identifies the user. If you specify the `password` + grant type, this parameter is required. This parameter is not valid with + any other supported grant type. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" @@ -1990,15 +2167,19 @@ def get_user( with_profile_uid: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get users. Get information about users in the native realm and built-in users. + .. raw:: html + +

Get users.

+

Get information about users in the native realm and built-in users.

+ ``_ :param username: An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users. - :param with_profile_uid: If true will return the User Profile ID for a user, - if any. + :param with_profile_uid: Determines whether to retrieve the user profile UID, + if it exists, for the users. """ __path_parts: t.Dict[str, str] if username not in SKIP_IN_PATH: @@ -2041,7 +2222,14 @@ def get_user_privileges( username: t.Optional[t.Union[None, str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get user privileges. + .. raw:: html + +

Get user privileges.

+

Get the security privileges for the logged in user. + All users can use this API, but only to determine their own privileges. + To check the privileges of other users, you must use the run as feature. + To check whether a user has a specific list of privileges, use the has privileges API.

+ ``_ @@ -2091,11 +2279,14 @@ def get_user_profile( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a user profile. Get a user's profile using the unique profile ID. NOTE: The - user profile feature is designed only for use by Kibana and Elastic's Observability, - Enterprise Search, and Elastic Security solutions. Individual users and external - applications should not call this API directly. Elastic reserves the right to - change or remove this feature in future releases without prior notice. + .. raw:: html + +

Get a user profile.

+

Get a user's profile using the unique profile ID.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ ``_ @@ -2159,31 +2350,37 @@ def grant_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Grant an API key. Create an API key on behalf of another user. This API is similar - to the create API keys API, however it creates the API key for a user that is - different than the user that runs the API. The caller must have authentication - credentials (either an access token, or a username and password) for the user - on whose behalf the API key will be created. It is not possible to use this API - to create an API key without that user’s credentials. The user, for whom the - authentication credentials is provided, can optionally "run as" (impersonate) - another user. In this case, the API key will be created on behalf of the impersonated - user. This API is intended be used by applications that need to create and manage - API keys for end users, but cannot guarantee that those users have permission - to create API keys on their own behalf. A successful grant API key API call returns - a JSON structure that contains the API key, its unique id, and its name. If applicable, - it also returns expiration information for the API key in milliseconds. By default, - API keys never expire. You can specify expiration information when you create - the API keys. + .. raw:: html + +

Grant an API key.

+

Create an API key on behalf of another user. + This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. + The caller must have authentication credentials for the user on whose behalf the API key will be created. + It is not possible to use this API to create an API key without that user's credentials. + The supported user authentication credential types are:

+
    +
  • username and password
  • +
  • Elasticsearch access tokens
  • +
  • JWTs
  • +
+

The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + In this case, the API key will be created on behalf of the impersonated user.

+

This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + The API keys are created by the Elasticsearch API key service, which is automatically enabled.

+

A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + If applicable, it also returns expiration information for the API key in milliseconds.

+

By default, API keys never expire. You can specify expiration information when you create the API keys.

+ ``_ - :param api_key: Defines the API key. + :param api_key: The API key. :param grant_type: The type of grant. Supported grant types are: `access_token`, `password`. - :param access_token: The user’s access token. If you specify the `access_token` + :param access_token: The user's access token. If you specify the `access_token` grant type, this parameter is required. It is not valid with other grant types. - :param password: The user’s password. If you specify the `password` grant type, + :param password: The user's password. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. :param run_as: The name of the user to be impersonated. :param username: The user name that identifies the user. If you specify the `password` @@ -2314,8 +2511,13 @@ def has_privileges( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Check user privileges. Determine whether the specified user has a specified list - of privileges. + .. raw:: html + +

Check user privileges.

+

Determine whether the specified user has a specified list of privileges. + All users can use this API, but only to determine their own privileges. + To check the privileges of other users, you must use the run as feature.

+ ``_ @@ -2374,12 +2576,13 @@ def has_privileges_user_profile( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Check user profile privileges. Determine whether the users associated with the - specified user profile IDs have all the requested privileges. NOTE: The user - profile feature is designed only for use by Kibana and Elastic's Observability, - Enterprise Search, and Elastic Security solutions. Individual users and external - applications should not call this API directly. Elastic reserves the right to - change or remove this feature in future releases without prior notice. + .. raw:: html + +

Check user profile privileges.

+

Determine whether the users associated with the specified user profile IDs have all the requested privileges.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ ``_ @@ -2438,17 +2641,22 @@ def invalidate_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidate API keys. This API invalidates API keys created by the create API - key or grant API key APIs. Invalidated API keys fail authentication, but they - can still be viewed using the get API key information and query API key information - APIs, for at least the configured retention period, until they are automatically - deleted. The `manage_api_key` privilege allows deleting any API keys. The `manage_own_api_key` - only allows deleting API keys that are owned by the user. In addition, with the - `manage_own_api_key` privilege, an invalidation request must be issued in one - of the three formats: - Set the parameter `owner=true`. - Or, set both `username` - and `realm_name` to match the user’s identity. - Or, if the request is issued - by an API key, that is to say an API key invalidates itself, specify its ID in - the `ids` field. + .. raw:: html + +

Invalidate API keys.

+

This API invalidates API keys created by the create API key or grant API key APIs. + Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted.

+

To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. + The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. + The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. + The manage_own_api_key only allows deleting REST API keys that are owned by the user. + In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats:

+
    +
  • Set the parameter owner=true.
  • +
  • Or, set both username and realm_name to match the user's identity.
  • +
  • Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field.
  • +
+ ``_ @@ -2457,14 +2665,15 @@ def invalidate_api_key( `name`, `realm_name`, or `username`. :param name: An API key name. This parameter cannot be used with any of `ids`, `realm_name` or `username`. - :param owner: Can be used to query API keys owned by the currently authenticated - user. The `realm_name` or `username` parameters cannot be specified when - this parameter is set to `true` as they are assumed to be the currently authenticated - ones. + :param owner: Query API keys owned by the currently authenticated user. The `realm_name` + or `username` parameters cannot be specified when this parameter is set to + `true` as they are assumed to be the currently authenticated ones. NOTE: + At least one of `ids`, `name`, `username`, and `realm_name` must be specified + if `owner` is `false`. :param realm_name: The name of an authentication realm. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. :param username: The username of a user. This parameter cannot be used with either - `ids` or `name`, or when `owner` flag is set to `true`. + `ids` or `name` or when `owner` flag is set to `true`. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" @@ -2519,19 +2728,30 @@ def invalidate_token( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidate a token. The access tokens returned by the get token API have a finite - period of time for which they are valid. After that time period, they can no - longer be used. The time period is defined by the `xpack.security.authc.token.timeout` - setting. The refresh tokens returned by the get token API are only valid for - 24 hours. They can also be used exactly once. If you want to invalidate one or - more access or refresh tokens immediately, use this invalidate token API. + .. raw:: html + +

Invalidate a token.

+

The access tokens returned by the get token API have a finite period of time for which they are valid. + After that time period, they can no longer be used. + The time period is defined by the xpack.security.authc.token.timeout setting.

+

The refresh tokens returned by the get token API are only valid for 24 hours. + They can also be used exactly once. + If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API.

+

NOTE: While all parameters are optional, at least one of them is required. + More specifically, either one of token or refresh_token parameters is required. + If none of these two are specified, then realm_name and/or username need to be specified.

+ ``_ - :param realm_name: - :param refresh_token: - :param token: - :param username: + :param realm_name: The name of an authentication realm. This parameter cannot + be used with either `refresh_token` or `token`. + :param refresh_token: A refresh token. This parameter cannot be used if any of + `refresh_token`, `realm_name`, or `username` are used. + :param token: An access token. This parameter cannot be used if any of `refresh_token`, + `realm_name`, or `username` are used. + :param username: The username of a user. This parameter cannot be used with either + `refresh_token` or `token`. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" @@ -2582,12 +2802,13 @@ def oidc_authenticate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Authenticate OpenID Connect. Exchange an OpenID Connect authentication response - message for an Elasticsearch internal access token and refresh token that can - be subsequently used for authentication. Elasticsearch exposes all the necessary - OpenID Connect related functionality with the OpenID Connect APIs. These APIs - are used internally by Kibana in order to provide OpenID Connect based authentication, - but can also be used by other, custom web applications or other clients. + .. raw:: html + +

Authenticate OpenID Connect.

+

Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ ``_ @@ -2660,15 +2881,14 @@ def oidc_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Logout of OpenID Connect. Invalidate an access token and a refresh token that - were generated as a response to the `/_security/oidc/authenticate` API. If the - OpenID Connect authentication realm in Elasticsearch is accordingly configured, - the response to this call will contain a URI pointing to the end session endpoint - of the OpenID Connect Provider in order to perform single logout. Elasticsearch - exposes all the necessary OpenID Connect related functionality with the OpenID - Connect APIs. These APIs are used internally by Kibana in order to provide OpenID - Connect based authentication, but can also be used by other, custom web applications - or other clients. + .. raw:: html + +

Logout of OpenID Connect.

+

Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API.

+

If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ ``_ @@ -2723,15 +2943,14 @@ def oidc_prepare_authentication( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Prepare OpenID connect authentication. Create an oAuth 2.0 authentication request - as a URL string based on the configuration of the OpenID Connect authentication - realm in Elasticsearch. The response of this API is a URL pointing to the Authorization - Endpoint of the configured OpenID Connect Provider, which can be used to redirect - the browser of the user in order to continue the authentication process. Elasticsearch - exposes all the necessary OpenID Connect related functionality with the OpenID - Connect APIs. These APIs are used internally by Kibana in order to provide OpenID - Connect based authentication, but can also be used by other, custom web applications - or other clients. + .. raw:: html + +

Prepare OpenID connect authentication.

+

Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch.

+

The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ ``_ @@ -2808,7 +3027,26 @@ def put_privileges( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update application privileges. + .. raw:: html + +

Create or update application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_security cluster privilege (or a greater privilege such as all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
+

Application names are formed from a prefix, with an optional suffix that conform to the following rules:

+
    +
  • The prefix must begin with a lowercase ASCII letter.
  • +
  • The prefix must contain only ASCII letters or digits.
  • +
  • The prefix must be at least 3 characters long.
  • +
  • If the suffix exists, it must begin with either a dash - or _.
  • +
  • The suffix cannot contain any of the following characters: \\, /, *, ?, ", <, >, |, ,, *.
  • +
  • No part of the name can contain whitespace.
  • +
+

Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and ..

+

Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :.

+ ``_ @@ -2954,10 +3192,13 @@ def put_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update roles. The role management APIs are generally the preferred - way to manage roles in the native realm, rather than using file-based role management. - The create or update roles API cannot update roles that are defined in roles - files. File-based role management is not available in Elastic Serverless. + .. raw:: html + +

Create or update roles.

+

The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. + The create or update roles API cannot update roles that are defined in roles files. + File-based role management is not available in Elastic Serverless.

+ ``_ @@ -2976,7 +3217,10 @@ def put_role( this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. :param remote_cluster: A list of remote cluster permissions entries. - :param remote_indices: A list of remote indices permissions entries. + :param remote_indices: A list of remote indices permissions entries. NOTE: Remote + indices are effective for remote clusters configured with the API key based + model. They have no effect for remote clusters configured with the certificate + based model. :param run_as: A list of users that the owners of this role can impersonate. *Note*: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will @@ -3066,26 +3310,48 @@ def put_role_mapping( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update role mappings. Role mappings define which roles are assigned - to each user. Each mapping has rules that identify users and a list of roles - that are granted to those users. The role mapping APIs are generally the preferred - way to manage role mappings rather than using role mapping files. The create - or update role mappings API cannot update role mappings that are defined in role - mapping files. This API does not create roles. Rather, it maps users to existing - roles. Roles can be created by using the create or update roles API or roles - files. + .. raw:: html + +

Create or update role mappings.

+

Role mappings define which roles are assigned to each user. + Each mapping has rules that identify users and a list of roles that are granted to those users. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files.

+

NOTE: This API does not create roles. Rather, it maps users to existing roles. + Roles can be created by using the create or update roles API or roles files.

+

Role templates

+

The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. + For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. + The roles field is used for this purpose.

+

For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. + The role_templates field is used for this purpose.

+

NOTE: To use role templates successfully, the relevant scripting feature must be enabled. + Otherwise, all attempts to create a role mapping with role templates fail.

+

All of the user fields that are available in the role mapping rules are also available in the role templates. + Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated.

+

By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. + If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names.

+ ``_ - :param name: Role-mapping name - :param enabled: - :param metadata: + :param name: The distinct name that identifies the role mapping. The name is + used solely as an identifier to facilitate interaction via the API; it does + not affect the behavior of the mapping in any way. + :param enabled: Mappings that have `enabled` set to `false` are ignored when + role mapping is performed. + :param metadata: Additional metadata that helps define which roles are assigned + to each user. Within the metadata object, keys beginning with `_` are reserved + for system usage. :param refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - :param role_templates: - :param roles: - :param rules: + :param role_templates: A list of Mustache templates that will be evaluated to + determine the roles names that should granted to the users that match the + role mapping rules. Exactly one of `roles` or `role_templates` must be specified. + :param roles: A list of role names that are granted to the users that match the + role mapping rules. Exactly one of `roles` or `role_templates` must be specified. + :param rules: The rules that determine which users should be matched by the mapping. + A rule is a logical condition that is expressed by using a JSON DSL. :param run_as: """ if name in SKIP_IN_PATH: @@ -3160,23 +3426,41 @@ def put_user( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update users. A password is required for adding a new user but is optional - when updating an existing user. To change a user’s password without updating - any other fields, use the change password API. + .. raw:: html + +

Create or update users.

+

Add and update users in the native realm. + A password is required for adding a new user but is optional when updating an existing user. + To change a user's password without updating any other fields, use the change password API.

+ ``_ - :param username: The username of the User - :param email: - :param enabled: - :param full_name: - :param metadata: - :param password: - :param password_hash: - :param refresh: If `true` (the default) then refresh the affected shards to make - this operation visible to search, if `wait_for` then wait for a refresh to - make this operation visible to search, if `false` then do nothing with refreshes. - :param roles: + :param username: An identifier for the user. NOTE: Usernames must be at least + 1 and no more than 507 characters. They can contain alphanumeric characters + (a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic + Latin (ASCII) block. Leading or trailing whitespace is not allowed. + :param email: The email of the user. + :param enabled: Specifies whether the user is enabled. + :param full_name: The full name of the user. + :param metadata: Arbitrary metadata that you want to associate with the user. + :param password: The user's password. Passwords must be at least 6 characters + long. When adding a user, one of `password` or `password_hash` is required. + When updating an existing user, the password is optional, so that other fields + on the user (such as their roles) may be updated without modifying the user's + password + :param password_hash: A hash of the user's password. This must be produced using + the same hashing algorithm as has been configured for password storage. For + more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm` + setting in the user cache and password hash algorithm documentation. Using + this parameter allows the client to pre-hash the password for performance + and/or confidentiality reasons. The `password` parameter and the `password_hash` + parameter cannot be used in the same request. + :param refresh: Valid values are `true`, `false`, and `wait_for`. These values + have the same meaning as in the index API, but the default value for this + API is true. + :param roles: A set of roles the user has. The roles determine the user's access + permissions. To create a user without any roles, specify an empty list (`[]`). """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") @@ -3259,8 +3543,15 @@ def query_api_keys( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Find API keys with a query. Get a paginated list of API keys and their information. - You can optionally filter the results with a query. + .. raw:: html + +

Find API keys with a query.

+

Get a paginated list of API keys and their information. + You can optionally filter the results with a query.

+

To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. + If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership.

+ ``_ @@ -3276,30 +3567,39 @@ def query_api_keys( `terms`, `range`, `date_range`, `missing`, `cardinality`, `value_count`, `composite`, `filter`, and `filters`. Additionally, aggregations only run over the same subset of fields that query works with. - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which API keys to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following public information associated with an API key: `id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`, - `username`, `realm`, and `metadata`. - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: Other than `id`, all public fields of an API key are eligible for - sorting. In addition, sort can also be applied to the `_doc` field to sort - by index order. + `username`, `realm`, and `metadata`. NOTE: The queryable string values associated + with API keys are internally mapped as keywords. Consequently, if no `analyzer` + parameter is specified for a `match` query, then the provided match query + string is interpreted as a single keyword value. Such a match query is hence + equivalent to a `term` query. + :param search_after: The search after definition. + :param size: The number of hits to return. It must not be negative. The `size` + parameter can be set to `0`, in which case no API key matches are returned, + only the aggregation results. By default, you cannot page through more than + 10,000 hits using the `from` and `size` parameters. To page through more + hits, use the `search_after` parameter. + :param sort: The sort definition. Other than `id`, all public fields of an API + key are eligible for sorting. In addition, sort can also be applied to the + `_doc` field to sort by index order. :param typed_keys: Determines whether aggregation names are prefixed by their respective types in the response. :param with_limited_by: Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection - of its assigned role descriptors and the owner user's role descriptors. - :param with_profile_uid: Determines whether to also retrieve the profile uid, - for the API key owner principal, if it exists. + of its assigned role descriptors and the owner user's role descriptors (effectively + limited by it). An API key cannot retrieve any API key’s limited-by role + descriptors (including itself) unless it has `manage_api_key` or higher privileges. + :param with_profile_uid: Determines whether to also retrieve the profile UID + for the API key owner principal. If it exists, the profile UID is returned + under the `profile_uid` response field for each API key. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/api_key" @@ -3386,26 +3686,34 @@ def query_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Find roles with a query. Get roles in a paginated manner. You can optionally - filter the results with a query. + .. raw:: html + +

Find roles with a query.

+

Get roles in a paginated manner. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. + You can optionally filter the results with a query. + Also, the results can be paginated and sorted.

+ ``_ - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which roles to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with roles: `name`, `description`, - `metadata`, `applications.application`, `applications.privileges`, `applications.resources`. - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: All public fields of a role are eligible for sorting. In addition, - sort can also be applied to the `_doc` field to sort by index order. + `metadata`, `applications.application`, `applications.privileges`, and `applications.resources`. + :param search_after: The search after definition. + :param size: The number of hits to return. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param sort: The sort definition. You can sort on `username`, `roles`, or `enabled`. + In addition, sort can also be applied to the `_doc` field to sort by index + order. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/role" @@ -3472,28 +3780,35 @@ def query_user( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Find users with a query. Get information for users in a paginated manner. You - can optionally filter the results with a query. + .. raw:: html + +

Find users with a query.

+

Get information for users in a paginated manner. + You can optionally filter the results with a query.

+

NOTE: As opposed to the get user API, built-in users are excluded from the result. + This API is only for native users.

+ ``_ - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which users to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with user: `username`, - `roles`, `enabled` - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: Fields eligible for sorting are: username, roles, enabled In addition, - sort can also be applied to the `_doc` field to sort by index order. - :param with_profile_uid: If true will return the User Profile ID for the users - in the query result, if any. + `roles`, `enabled`, `full_name`, and `email`. + :param search_after: The search after definition + :param size: The number of hits to return. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param sort: The sort definition. Fields eligible for sorting are: `username`, + `roles`, `enabled`. In addition, sort can also be applied to the `_doc` field + to sort by index order. + :param with_profile_uid: Determines whether to retrieve the user profile UID, + if it exists, for the users. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/user" @@ -3551,19 +3866,21 @@ def saml_authenticate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Authenticate SAML. Submit a SAML response message to Elasticsearch for consumption. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. The SAML message that is submitted can be: * A response - to a SAML authentication request that was previously created using the SAML prepare - authentication API. * An unsolicited SAML message in the case of an IdP-initiated - single sign-on (SSO) flow. In either case, the SAML message needs to be a base64 - encoded XML document with a root element of ``. After successful validation, - Elasticsearch responds with an Elasticsearch internal access token and refresh - token that can be subsequently used for authentication. This API endpoint essentially - exchanges SAML responses that indicate successful authentication in the IdP for - Elasticsearch access and refresh tokens, which can be used for authentication - against Elasticsearch. + .. raw:: html + +

Authenticate SAML.

+

Submit a SAML response message to Elasticsearch for consumption.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The SAML message that is submitted can be:

+
    +
  • A response to a SAML authentication request that was previously created using the SAML prepare authentication API.
  • +
  • An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow.
  • +
+

In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>.

+

After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. + This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch.

+ ``_ @@ -3625,16 +3942,18 @@ def saml_complete_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Logout of SAML completely. Verifies the logout response sent from the SAML IdP. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. The SAML IdP may send a logout response back to the SP - after handling the SP-initiated SAML Single Logout. This API verifies the response - by ensuring the content is relevant and validating its signature. An empty response - is returned if the verification process is successful. The response can be sent - by the IdP with either the HTTP-Redirect or the HTTP-Post binding. The caller - of this API must prepare the request accordingly so that this API can handle - either of them. + .. raw:: html + +

Logout of SAML completely.

+

Verifies the logout response sent from the SAML IdP.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. + This API verifies the response by ensuring the content is relevant and validating its signature. + An empty response is returned if the verification process is successful. + The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. + The caller of this API must prepare the request accordingly so that this API can handle either of them.

+ ``_ @@ -3700,15 +4019,17 @@ def saml_invalidate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidate SAML. Submit a SAML LogoutRequest message to Elasticsearch for consumption. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. The logout request comes from the SAML IdP during an IdP - initiated Single Logout. The custom web application can use this API to have - Elasticsearch process the `LogoutRequest`. After successful validation of the - request, Elasticsearch invalidates the access token and refresh token that corresponds - to that specific SAML principal and provides a URL that contains a SAML LogoutResponse - message. Thus the user can be redirected back to their IdP. + .. raw:: html + +

Invalidate SAML.

+

Submit a SAML LogoutRequest message to Elasticsearch for consumption.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The logout request comes from the SAML IdP during an IdP initiated Single Logout. + The custom web application can use this API to have Elasticsearch process the LogoutRequest. + After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. + Thus the user can be redirected back to their IdP.

+ ``_ @@ -3775,14 +4096,15 @@ def saml_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Logout of SAML. Submits a request to invalidate an access token and refresh token. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. This API invalidates the tokens that were generated for - a user by the SAML authenticate API. If the SAML realm in Elasticsearch is configured - accordingly and the SAML IdP supports this, the Elasticsearch response contains - a URL to redirect the user to the IdP that contains a SAML logout request (starting - an SP-initiated SAML Single Logout). + .. raw:: html + +

Logout of SAML.

+

Submits a request to invalidate an access token and refresh token.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

This API invalidates the tokens that were generated for a user by the SAML authenticate API. + If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout).

+ ``_ @@ -3839,20 +4161,20 @@ def saml_prepare_authentication( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Prepare SAML authentication. Create a SAML authentication request (``) - as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - NOTE: This API is intended for use by custom web applications other than Kibana. - If you are using Kibana, refer to the documentation for configuring SAML single-sign-on - on the Elastic Stack. This API returns a URL pointing to the SAML Identity Provider. - You can use the URL to redirect the browser of the user in order to continue - the authentication process. The URL includes a single parameter named `SAMLRequest`, - which contains a SAML Authentication request that is deflated and Base64 encoded. - If the configuration dictates that SAML authentication requests should be signed, - the URL has two extra parameters named `SigAlg` and `Signature`. These parameters - contain the algorithm used for the signature and the signature value itself. - It also returns a random string that uniquely identifies this SAML Authentication - request. The caller of this API needs to store this identifier as it needs to - be used in a following step of the authentication process. + .. raw:: html + +

Prepare SAML authentication.

+

Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

This API returns a URL pointing to the SAML Identity Provider. + You can use the URL to redirect the browser of the user in order to continue the authentication process. + The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. + If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. + These parameters contain the algorithm used for the signature and the signature value itself. + It also returns a random string that uniquely identifies this SAML Authentication request. + The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process.

+ ``_ @@ -3907,11 +4229,13 @@ def saml_service_provider_metadata( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create SAML service provider metadata. Generate SAML metadata for a SAML 2.0 - Service Provider. The SAML 2.0 specification provides a mechanism for Service - Providers to describe their capabilities and configuration using a metadata file. - This API generates Service Provider metadata based on the configuration of a - SAML realm in Elasticsearch. + .. raw:: html + +

Create SAML service provider metadata.

+

Generate SAML metadata for a SAML 2.0 Service Provider.

+

The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. + This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch.

+ ``_ @@ -3957,12 +4281,14 @@ def suggest_user_profiles( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Suggest a user profile. Get suggestions for user profiles that match specified - search criteria. NOTE: The user profile feature is designed only for use by Kibana - and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - Individual users and external applications should not call this API directly. - Elastic reserves the right to change or remove this feature in future releases - without prior notice. + .. raw:: html + +

Suggest a user profile.

+

Get suggestions for user profiles that match specified search criteria.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ ``_ @@ -4033,38 +4359,43 @@ def update_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an API key. Updates attributes of an existing API key. Users can only - update API keys that they created or that were granted to them. Use this API - to update API keys created by the create API Key or grant API Key APIs. If you - need to apply the same update to many API keys, you can use bulk update API Keys - to reduce overhead. It’s not possible to update expired API keys, or API keys - that have been invalidated by invalidate API Key. This API supports updates to - an API key’s access scope and metadata. The access scope of an API key is derived - from the `role_descriptors` you specify in the request, and a snapshot of the - owner user’s permissions at the time of the request. The snapshot of the owner’s - permissions is updated automatically on every call. If you don’t specify `role_descriptors` - in the request, a call to this API might still change the API key’s access scope. - This change can occur if the owner user’s permissions have changed since the - API key was created or last modified. To update another user’s API key, use the - `run_as` feature to submit a request on behalf of another user. IMPORTANT: It’s - not possible to use an API key as the authentication credential for this API. - To update an API key, the owner user’s credentials are required. + .. raw:: html + +

Update an API key.

+

Update attributes of an existing API key. + This API supports updates to an API key's access scope, expiration, and metadata.

+

To use this API, you must have at least the manage_own_api_key cluster privilege. + Users can only update API keys that they created or that were granted to them. + To update another user’s API key, use the run_as feature to submit a request on behalf of another user.

+

IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required.

+

Use this API to update API keys created by the create API key or grant API Key APIs. + If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. + It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API.

+

The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. + The snapshot of the owner's permissions is updated automatically on every call.

+

IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. + This change can occur if the owner user's permissions have changed since the API key was created or last modified.

+ ``_ :param id: The ID of the API key to update. - :param expiration: Expiration time for the API key. + :param expiration: The expiration time for the API key. By default, API keys + never expire. This property can be omitted to leave the expiration unchanged. :param metadata: Arbitrary metadata that you want to associate with the API key. - It supports nested data structure. Within the metadata object, keys beginning - with _ are reserved for system usage. - :param role_descriptors: An array of role descriptors for this API key. This - parameter is optional. When it is not specified or is an empty array, then - the API key will have a point in time snapshot of permissions of the authenticated - user. If you supply role descriptors then the resultant permissions would - be an intersection of API keys permissions and authenticated user’s permissions - thereby limiting the access scope for API keys. The structure of role descriptor - is the same as the request for create role API. For more details, see create - or update roles API. + It supports a nested data structure. Within the metadata object, keys beginning + with `_` are reserved for system usage. When specified, this value fully + replaces the metadata previously associated with the API key. + :param role_descriptors: The role descriptors to assign to this API key. The + API key's effective permissions are an intersection of its assigned privileges + and the point in time snapshot of permissions of the owner user. You can + assign new privileges by specifying them in this parameter. To remove assigned + privileges, you can supply an empty `role_descriptors` parameter, that is + to say, an empty object `{}`. If an API key has no assigned privileges, it + inherits the owner user's full permissions. The snapshot of the owner's permissions + is always updated, whether you supply the `role_descriptors` parameter or + not. The structure of a role descriptor is the same as the request for the + create API keys API. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -4119,19 +4450,20 @@ def update_cross_cluster_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a cross-cluster API key. Update the attributes of an existing cross-cluster - API key, which is used for API key based remote cluster access. To use this API, - you must have at least the `manage_security` cluster privilege. Users can only - update API keys that they created. To update another user's API key, use the - `run_as` feature to submit a request on behalf of another user. IMPORTANT: It's - not possible to use an API key as the authentication credential for this API. - To update an API key, the owner user's credentials are required. It's not possible - to update expired API keys, or API keys that have been invalidated by the invalidate - API key API. This API supports updates to an API key's access scope, metadata, - and expiration. The owner user's information, such as the `username` and `realm`, - is also updated automatically on every call. NOTE: This API cannot update REST - API keys, which should be updated by either the update API key or bulk update - API keys API. + .. raw:: html + +

Update a cross-cluster API key.

+

Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access.

+

To use this API, you must have at least the manage_security cluster privilege. + Users can only update API keys that they created. + To update another user's API key, use the run_as feature to submit a request on behalf of another user.

+

IMPORTANT: It's not possible to use an API key as the authentication credential for this API. + To update an API key, the owner user's credentials are required.

+

It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API.

+

This API supports updates to an API key's access scope, metadata, and expiration. + The owner user's information, such as the username and realm, is also updated automatically on every call.

+

NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API.

+ ``_ @@ -4203,12 +4535,14 @@ def update_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update security index settings. Update the user-configurable settings for the - security internal index (`.security` and associated indices). Only a subset of - settings are allowed to be modified, for example `index.auto_expand_replicas` - and `index.number_of_replicas`. If a specific index is not in use on the system - and settings are provided for it, the request will be rejected. This API does - not yet support configuring the settings for indices before they are in use. + .. raw:: html + +

Update security index settings.

+

Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas.

+

NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates.

+

If a specific index is not in use on the system and settings are provided for it, the request will be rejected. + This API does not yet support configuring the settings for indices before they are in use.

+ ``_ @@ -4277,19 +4611,23 @@ def update_user_profile_data( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update user profile data. Update specific data for the user profile that is associated - with a unique ID. NOTE: The user profile feature is designed only for use by - Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - Individual users and external applications should not call this API directly. - Elastic reserves the right to change or remove this feature in future releases - without prior notice. To use this API, you must have one of the following privileges: - * The `manage_user_profile` cluster privilege. * The `update_profile_data` global - privilege for the namespaces that are referenced in the request. This API updates - the `labels` and `data` fields of an existing user profile document with JSON - objects. New keys and their values are added to the profile document and conflicting - keys are replaced by data that's included in the request. For both labels and - data, content is namespaced by the top-level fields. The `update_profile_data` - global privilege grants privileges for updating only the allowed namespaces. + .. raw:: html + +

Update user profile data.

+

Update specific data for the user profile that is associated with a unique ID.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_user_profile cluster privilege.
  • +
  • The update_profile_data global privilege for the namespaces that are referenced in the request.
  • +
+

This API updates the labels and data fields of an existing user profile document with JSON objects. + New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request.

+

For both labels and data, content is namespaced by the top-level fields. + The update_profile_data global privilege grants privileges for updating only the allowed namespaces.

+ ``_ diff --git a/elasticsearch/_sync/client/shutdown.py b/elasticsearch/_sync/client/shutdown.py index be6c38d55..8aa81ae35 100644 --- a/elasticsearch/_sync/client/shutdown.py +++ b/elasticsearch/_sync/client/shutdown.py @@ -42,13 +42,16 @@ def delete_node( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancel node shutdown preparations. Remove a node from the shutdown list so it - can resume normal operations. You must explicitly clear the shutdown request - when a node rejoins the cluster or when a node has permanently left the cluster. - Shutdown requests are never removed automatically by Elasticsearch. NOTE: This - feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, - and Elastic Cloud on Kubernetes. Direct use is not supported. If the operator - privileges feature is enabled, you must be an operator to use this API. + .. raw:: html + +

Cancel node shutdown preparations. + Remove a node from the shutdown list so it can resume normal operations. + You must explicitly clear the shutdown request when a node rejoins the cluster or when a node has permanently left the cluster. + Shutdown requests are never removed automatically by Elasticsearch.

+

NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. + Direct use is not supported.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+ ``_ @@ -103,13 +106,14 @@ def get_node( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the shutdown status. Get information about nodes that are ready to be shut - down, have shut down preparations still in progress, or have stalled. The API - returns status information for each part of the shut down process. NOTE: This - feature is designed for indirect use by Elasticsearch Service, Elastic Cloud - Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported. If - the operator privileges feature is enabled, you must be an operator to use this - API. + .. raw:: html + +

Get the shutdown status.

+

Get information about nodes that are ready to be shut down, have shut down preparations still in progress, or have stalled. + The API returns status information for each part of the shut down process.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+ ``_ @@ -176,18 +180,19 @@ def put_node( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Prepare a node to be shut down. NOTE: This feature is designed for indirect use - by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. - Direct use is not supported. If you specify a node that is offline, it will be - prepared for shut down when it rejoins the cluster. If the operator privileges - feature is enabled, you must be an operator to use this API. The API migrates - ongoing tasks and index shards to other nodes as needed to prepare a node to - be restarted or shut down and removed from the cluster. This ensures that Elasticsearch - can be stopped safely with minimal disruption to the cluster. You must specify - the type of shutdown: `restart`, `remove`, or `replace`. If a node is already - being prepared for shutdown, you can use this API to change the shutdown type. - IMPORTANT: This API does NOT terminate the Elasticsearch process. Monitor the - node shutdown status to determine when it is safe to stop Elasticsearch. + .. raw:: html + +

Prepare a node to be shut down.

+

NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

If you specify a node that is offline, it will be prepared for shut down when it rejoins the cluster.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+

The API migrates ongoing tasks and index shards to other nodes as needed to prepare a node to be restarted or shut down and removed from the cluster. + This ensures that Elasticsearch can be stopped safely with minimal disruption to the cluster.

+

You must specify the type of shutdown: restart, remove, or replace. + If a node is already being prepared for shutdown, you can use this API to change the shutdown type.

+

IMPORTANT: This API does NOT terminate the Elasticsearch process. + Monitor the node shutdown status to determine when it is safe to stop Elasticsearch.

+ ``_ diff --git a/elasticsearch/_sync/client/simulate.py b/elasticsearch/_sync/client/simulate.py index 0139e229f..36339f412 100644 --- a/elasticsearch/_sync/client/simulate.py +++ b/elasticsearch/_sync/client/simulate.py @@ -64,28 +64,22 @@ def ingest( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate data ingestion. Run ingest pipelines against a set of provided documents, - optionally with substitute pipeline definitions, to simulate ingesting data into - an index. This API is meant to be used for troubleshooting or pipeline development, - as it does not actually index any data into Elasticsearch. The API runs the default - and final pipeline for that index against a set of documents provided in the - body of the request. If a pipeline contains a reroute processor, it follows that - reroute processor to the new index, running that index's pipelines as well the - same way that a non-simulated ingest would. No data is indexed into Elasticsearch. - Instead, the transformed document is returned, along with the list of pipelines - that have been run and the name of the index where the document would have been - indexed if this were not a simulation. The transformed document is validated - against the mappings that would apply to this index, and any validation error - is reported in the result. This API differs from the simulate pipeline API in - that you specify a single pipeline for that API, and it runs only that one pipeline. - The simulate pipeline API is more useful for developing a single pipeline, while - the simulate ingest API is more useful for troubleshooting the interaction of - the various pipelines that get applied when ingesting into an index. By default, - the pipeline definitions that are currently in the system are used. However, - you can supply substitute pipeline definitions in the body of the request. These - will be used in place of the pipeline definitions that are already in the system. - This can be used to replace existing pipeline definitions or to create new ones. - The pipeline substitutions are used only within this request. + .. raw:: html + +

Simulate data ingestion. + Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index.

+

This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch.

+

The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. + If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. + No data is indexed into Elasticsearch. + Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. + The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result.

+

This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. + The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index.

+

By default, the pipeline definitions that are currently in the system are used. + However, you can supply substitute pipeline definitions in the body of the request. + These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request.

+ ``_ diff --git a/elasticsearch/_sync/client/slm.py b/elasticsearch/_sync/client/slm.py index ff7c59c8d..9196bc57c 100644 --- a/elasticsearch/_sync/client/slm.py +++ b/elasticsearch/_sync/client/slm.py @@ -38,9 +38,12 @@ def delete_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a policy. Delete a snapshot lifecycle policy definition. This operation - prevents any future snapshots from being taken but does not cancel in-progress - snapshots or remove previously-taken snapshots. + .. raw:: html + +

Delete a policy. + Delete a snapshot lifecycle policy definition. + This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots.

+ ``_ @@ -91,10 +94,12 @@ def execute_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a policy. Immediately create a snapshot according to the snapshot lifecycle - policy without waiting for the scheduled time. The snapshot policy is normally - applied according to its schedule, but you might want to manually run a policy - before performing an upgrade or other maintenance. + .. raw:: html + +

Run a policy. + Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. + The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance.

+ ``_ @@ -144,9 +149,12 @@ def execute_retention( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a retention policy. Manually apply the retention policy to force immediate - removal of snapshots that are expired according to the snapshot lifecycle policy - retention rules. The retention policy is normally applied according to its schedule. + .. raw:: html + +

Run a retention policy. + Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. + The retention policy is normally applied according to its schedule.

+ ``_ @@ -194,8 +202,11 @@ def get_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get policy information. Get snapshot lifecycle policy definitions and information - about the latest snapshot attempts. + .. raw:: html + +

Get policy information. + Get snapshot lifecycle policy definitions and information about the latest snapshot attempts.

+ ``_ @@ -248,8 +259,11 @@ def get_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get snapshot lifecycle management statistics. Get global and policy-level statistics - about actions taken by snapshot lifecycle management. + .. raw:: html + +

Get snapshot lifecycle management statistics. + Get global and policy-level statistics about actions taken by snapshot lifecycle management.

+ ``_ @@ -296,7 +310,10 @@ def get_status( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the snapshot lifecycle management status. + .. raw:: html + +

Get the snapshot lifecycle management status.

+ ``_ @@ -354,9 +371,13 @@ def put_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a policy. Create or update a snapshot lifecycle policy. If the - policy already exists, this request increments the policy version. Only the latest - version of a policy is stored. + .. raw:: html + +

Create or update a policy. + Create or update a snapshot lifecycle policy. + If the policy already exists, this request increments the policy version. + Only the latest version of a policy is stored.

+ ``_ @@ -437,9 +458,12 @@ def start( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start snapshot lifecycle management. Snapshot lifecycle management (SLM) starts - automatically when a cluster is formed. Manually starting SLM is necessary only - if it has been stopped using the stop SLM API. + .. raw:: html + +

Start snapshot lifecycle management. + Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. + Manually starting SLM is necessary only if it has been stopped using the stop SLM API.

+ ``_ @@ -488,15 +512,16 @@ def stop( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop snapshot lifecycle management. Stop all snapshot lifecycle management (SLM) - operations and the SLM plugin. This API is useful when you are performing maintenance - on a cluster and need to prevent SLM from performing any actions on your data - streams or indices. Stopping SLM does not stop any snapshots that are in progress. - You can manually trigger snapshots with the run snapshot lifecycle policy API - even if SLM is stopped. The API returns a response as soon as the request is - acknowledged, but the plugin might continue to run until in-progress operations - complete and it can be safely stopped. Use the get snapshot lifecycle management - status API to see if SLM is running. + .. raw:: html + +

Stop snapshot lifecycle management. + Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. + This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. + Stopping SLM does not stop any snapshots that are in progress. + You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped.

+

The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. + Use the get snapshot lifecycle management status API to see if SLM is running.

+ ``_ diff --git a/elasticsearch/_sync/client/snapshot.py b/elasticsearch/_sync/client/snapshot.py index ed74387ba..c80951da9 100644 --- a/elasticsearch/_sync/client/snapshot.py +++ b/elasticsearch/_sync/client/snapshot.py @@ -44,8 +44,11 @@ def cleanup_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clean up the snapshot repository. Trigger the review of the contents of a snapshot - repository and delete any stale data not referenced by existing snapshots. + .. raw:: html + +

Clean up the snapshot repository. + Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots.

+ ``_ @@ -99,8 +102,11 @@ def clone( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clone a snapshot. Clone part of all of a snapshot into another snapshot in the - same repository. + .. raw:: html + +

Clone a snapshot. + Clone part of all of a snapshot into another snapshot in the same repository.

+ ``_ @@ -183,7 +189,11 @@ def create( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a snapshot. Take a snapshot of a cluster or of data streams and indices. + .. raw:: html + +

Create a snapshot. + Take a snapshot of a cluster or of data streams and indices.

+ ``_ @@ -287,11 +297,13 @@ def create_repository( verify: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a snapshot repository. IMPORTANT: If you are migrating searchable - snapshots, the repository name must be identical in the source and destination - clusters. To register a snapshot repository, the cluster's global metadata must - be writeable. Ensure there are no cluster blocks (for example, `cluster.blocks.read_only` - and `clsuter.blocks.read_only_allow_delete` settings) that prevent write access. + .. raw:: html + +

Create or update a snapshot repository. + IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. + To register a snapshot repository, the cluster's global metadata must be writeable. + Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access.

+ ``_ @@ -351,7 +363,10 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete snapshots. + .. raw:: html + +

Delete snapshots.

+ ``_ @@ -402,9 +417,12 @@ def delete_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete snapshot repositories. When a repository is unregistered, Elasticsearch - removes only the reference to the location where the repository is storing the - snapshots. The snapshots themselves are left untouched and in place. + .. raw:: html + +

Delete snapshot repositories. + When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. + The snapshots themselves are left untouched and in place.

+ ``_ @@ -478,7 +496,10 @@ def get( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get snapshot information. + .. raw:: html + +

Get snapshot information.

+ ``_ @@ -590,7 +611,10 @@ def get_repository( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get snapshot repository information. + .. raw:: html + +

Get snapshot repository information.

+ ``_ @@ -652,120 +676,83 @@ def repository_analyze( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Analyze a snapshot repository. Analyze the performance characteristics and any - incorrect behaviour found in a repository. The response exposes implementation - details of the analysis which may change from version to version. The response - body format is therefore not considered stable and may be different in newer - versions. There are a large number of third-party storage systems available, - not all of which are suitable for use as a snapshot repository by Elasticsearch. - Some storage systems behave incorrectly, or perform poorly, especially when accessed - concurrently by multiple clients as the nodes of an Elasticsearch cluster do. - This API performs a collection of read and write operations on your repository - which are designed to detect incorrect behaviour and to measure the performance - characteristics of your storage system. The default values for the parameters - are deliberately low to reduce the impact of running an analysis inadvertently - and to provide a sensible starting point for your investigations. Run your first - analysis with the default parameter values to check for simple problems. If successful, - run a sequence of increasingly large analyses until you encounter a failure or - you reach a `blob_count` of at least `2000`, a `max_blob_size` of at least `2gb`, - a `max_total_data_size` of at least `1tb`, and a `register_operation_count` of - at least `100`. Always specify a generous timeout, possibly `1h` or longer, to - allow time for each analysis to run to completion. Perform the analyses using - a multi-node cluster of a similar size to your production cluster so that it - can detect any problems that only arise when the repository is accessed by many - nodes at once. If the analysis fails, Elasticsearch detected that your repository - behaved unexpectedly. This usually means you are using a third-party storage - system with an incorrect or incompatible implementation of the API it claims - to support. If so, this storage system is not suitable for use as a snapshot - repository. You will need to work with the supplier of your storage system to - address the incompatibilities that Elasticsearch detects. If the analysis is - successful, the API returns details of the testing process, optionally including - how long each operation took. You can use this information to determine the performance - of your storage system. If any operation fails or returns an incorrect result, - the API returns an error. If the API returns an error, it may not have removed - all the data it wrote to the repository. The error will indicate the location - of any leftover data and this path is also recorded in the Elasticsearch logs. - You should verify that this location has been cleaned up correctly. If there - is still leftover data at the specified location, you should manually remove - it. If the connection from your client to Elasticsearch is closed while the client - is waiting for the result of the analysis, the test is cancelled. Some clients - are configured to close their connection if no response is received within a - certain timeout. An analysis takes a long time to complete so you might need - to relax any such client-side timeouts. On cancellation the analysis attempts - to clean up the data it was writing, but it may not be able to remove it all. - The path to the leftover data is recorded in the Elasticsearch logs. You should - verify that this location has been cleaned up correctly. If there is still leftover - data at the specified location, you should manually remove it. If the analysis - is successful then it detected no incorrect behaviour, but this does not mean - that correct behaviour is guaranteed. The analysis attempts to detect common - bugs but it does not offer 100% coverage. Additionally, it does not test the - following: * Your repository must perform durable writes. Once a blob has been - written it must remain in place until it is deleted, even after a power loss - or similar disaster. * Your repository must not suffer from silent data corruption. - Once a blob has been written, its contents must remain unchanged until it is - deliberately modified or deleted. * Your repository must behave correctly even - if connectivity from the cluster is disrupted. Reads and writes may fail in this - case, but they must not return incorrect results. IMPORTANT: An analysis writes - a substantial amount of data to your repository and then reads it back again. - This consumes bandwidth on the network between the cluster and the repository, - and storage space and I/O bandwidth on the repository itself. You must ensure - this load does not affect other users of these systems. Analyses respect the - repository settings `max_snapshot_bytes_per_sec` and `max_restore_bytes_per_sec` - if available and the cluster setting `indices.recovery.max_bytes_per_sec` which - you can use to limit the bandwidth they consume. NOTE: This API is intended for - exploratory use by humans. You should expect the request parameters and the response - format to vary in future versions. NOTE: Different versions of Elasticsearch - may perform different checks for repository compatibility, with newer versions - typically being stricter than older ones. A storage system that passes repository - analysis with one version of Elasticsearch may fail with a different version. - This indicates it behaves incorrectly in ways that the former version did not - detect. You must work with the supplier of your storage system to address the - incompatibilities detected by the repository analysis API in any version of Elasticsearch. - NOTE: This API may not work correctly in a mixed-version cluster. *Implementation - details* NOTE: This section of documentation describes how the repository analysis - API works in this version of Elasticsearch, but you should expect the implementation - to vary between versions. The request parameters and response format depend on - details of the implementation so may also be different in newer versions. The - analysis comprises a number of blob-level tasks, as set by the `blob_count` parameter - and a number of compare-and-exchange operations on linearizable registers, as - set by the `register_operation_count` parameter. These tasks are distributed - over the data and master-eligible nodes in the cluster for execution. For most - blob-level tasks, the executing node first writes a blob to the repository and - then instructs some of the other nodes in the cluster to attempt to read the - data it just wrote. The size of the blob is chosen randomly, according to the - `max_blob_size` and `max_total_data_size` parameters. If any of these reads fails - then the repository does not implement the necessary read-after-write semantics - that Elasticsearch requires. For some blob-level tasks, the executing node will - instruct some of its peers to attempt to read the data before the writing process - completes. These reads are permitted to fail, but must not return partial data. - If any read returns partial data then the repository does not implement the necessary - atomicity semantics that Elasticsearch requires. For some blob-level tasks, the - executing node will overwrite the blob while its peers are reading it. In this - case the data read may come from either the original or the overwritten blob, - but the read operation must not return partial data or a mix of data from the - two blobs. If any of these reads returns partial data or a mix of the two blobs - then the repository does not implement the necessary atomicity semantics that - Elasticsearch requires for overwrites. The executing node will use a variety - of different methods to write the blob. For instance, where applicable, it will - use both single-part and multi-part uploads. Similarly, the reading nodes will - use a variety of different methods to read the data back again. For instance - they may read the entire blob from start to end or may read only a subset of - the data. For some blob-level tasks, the executing node will cancel the write - before it is complete. In this case, it still instructs some of the other nodes - in the cluster to attempt to read the blob but all of these reads must fail to - find the blob. Linearizable registers are special blobs that Elasticsearch manipulates - using an atomic compare-and-exchange operation. This operation ensures correct - and strongly-consistent behavior even when the blob is accessed by multiple nodes - at the same time. The detailed implementation of the compare-and-exchange operation - on linearizable registers varies by repository type. Repository analysis verifies - that that uncontended compare-and-exchange operations on a linearizable register - blob always succeed. Repository analysis also verifies that contended operations - either succeed or report the contention but do not return incorrect results. - If an operation fails due to contention, Elasticsearch retries the operation - until it succeeds. Most of the compare-and-exchange operations performed by repository - analysis atomically increment a counter which is represented as an 8-byte blob. - Some operations also verify the behavior on small blobs with sizes other than - 8 bytes. + .. raw:: html + +

Analyze a snapshot repository. + Analyze the performance characteristics and any incorrect behaviour found in a repository.

+

The response exposes implementation details of the analysis which may change from version to version. + The response body format is therefore not considered stable and may be different in newer versions.

+

There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. + Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system.

+

The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. + Run your first analysis with the default parameter values to check for simple problems. + If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. + Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. + Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once.

+

If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. + This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. + If so, this storage system is not suitable for use as a snapshot repository. + You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects.

+

If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. + You can use this information to determine the performance of your storage system. + If any operation fails or returns an incorrect result, the API returns an error. + If the API returns an error, it may not have removed all the data it wrote to the repository. + The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. + You should verify that this location has been cleaned up correctly. + If there is still leftover data at the specified location, you should manually remove it.

+

If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. + Some clients are configured to close their connection if no response is received within a certain timeout. + An analysis takes a long time to complete so you might need to relax any such client-side timeouts. + On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. + The path to the leftover data is recorded in the Elasticsearch logs. + You should verify that this location has been cleaned up correctly. + If there is still leftover data at the specified location, you should manually remove it.

+

If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. + The analysis attempts to detect common bugs but it does not offer 100% coverage. + Additionally, it does not test the following:

+
    +
  • Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster.
  • +
  • Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted.
  • +
  • Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results.
  • +
+

IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. + This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. + You must ensure this load does not affect other users of these systems. + Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume.

+

NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.

+

NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. + A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. + This indicates it behaves incorrectly in ways that the former version did not detect. + You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch.

+

NOTE: This API may not work correctly in a mixed-version cluster.

+

Implementation details

+

NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions.

+

The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. + These tasks are distributed over the data and master-eligible nodes in the cluster for execution.

+

For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. + The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. + If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires.

+

For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. + These reads are permitted to fail, but must not return partial data. + If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires.

+

For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. + In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. + If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites.

+

The executing node will use a variety of different methods to write the blob. + For instance, where applicable, it will use both single-part and multi-part uploads. + Similarly, the reading nodes will use a variety of different methods to read the data back again. + For instance they may read the entire blob from start to end or may read only a subset of the data.

+

For some blob-level tasks, the executing node will cancel the write before it is complete. + In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob.

+

Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. + This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. + The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. + Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. + Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. + If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. + Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. + Some operations also verify the behavior on small blobs with sizes other than 8 bytes.

+ ``_ @@ -868,40 +855,31 @@ def repository_verify_integrity( verify_blob_contents: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Verify the repository integrity. Verify the integrity of the contents of a snapshot - repository. This API enables you to perform a comprehensive check of the contents - of a repository, looking for any anomalies in its data or metadata which might - prevent you from restoring snapshots from the repository or which might cause - future snapshot create or delete operations to fail. If you suspect the integrity - of the contents of one of your snapshot repositories, cease all write activity - to this repository immediately, set its `read_only` option to `true`, and use - this API to verify its integrity. Until you do so: * It may not be possible to - restore some snapshots from this repository. * Searchable snapshots may report - errors when searched or may have unassigned shards. * Taking snapshots into this - repository may fail or may appear to succeed but have created a snapshot which - cannot be restored. * Deleting snapshots from this repository may fail or may - appear to succeed but leave the underlying data on disk. * Continuing to write - to the repository while it is in an invalid state may causing additional damage - to its contents. If the API finds any problems with the integrity of the contents - of your repository, Elasticsearch will not be able to repair the damage. The - only way to bring the repository back into a fully working state after its contents - have been damaged is by restoring its contents from a repository backup which - was taken before the damage occurred. You must also identify what caused the - damage and take action to prevent it from happening again. If you cannot restore - a repository backup, register a new repository and use this for all future snapshot - operations. In some cases it may be possible to recover some of the contents - of a damaged repository, either by restoring as many of its snapshots as needed - and taking new snapshots of the restored data, or by using the reindex API to - copy data from any searchable snapshots mounted from the damaged repository. - Avoid all operations which write to the repository while the verify repository - integrity API is running. If something changes the repository contents while - an integrity verification is running then Elasticsearch may incorrectly report - having detected some anomalies in its contents due to the concurrent writes. - It may also incorrectly fail to report some anomalies that the concurrent writes - prevented it from detecting. NOTE: This API is intended for exploratory use by - humans. You should expect the request parameters and the response format to vary - in future versions. NOTE: This API may not work correctly in a mixed-version - cluster. + .. raw:: html + +

Verify the repository integrity. + Verify the integrity of the contents of a snapshot repository.

+

This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail.

+

If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. + Until you do so:

+
    +
  • It may not be possible to restore some snapshots from this repository.
  • +
  • Searchable snapshots may report errors when searched or may have unassigned shards.
  • +
  • Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored.
  • +
  • Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk.
  • +
  • Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents.
  • +
+

If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. + The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. + You must also identify what caused the damage and take action to prevent it from happening again.

+

If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. + In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository.

+

Avoid all operations which write to the repository while the verify repository integrity API is running. + If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. + It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting.

+

NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.

+

NOTE: This API may not work correctly in a mixed-version cluster.

+ ``_ @@ -998,20 +976,20 @@ def restore( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Restore a snapshot. Restore a snapshot of a cluster or data streams and indices. - You can restore a snapshot only to a running cluster with an elected master node. - The snapshot repository must be registered and available to the cluster. The - snapshot and cluster versions must be compatible. To restore a snapshot, the - cluster's global metadata must be writable. Ensure there are't any cluster blocks - that prevent writes. The restore operation ignores index blocks. Before you restore - a data stream, ensure the cluster contains a matching index template with data - streams enabled. To check, use the index management feature in Kibana or the - get index template API: ``` GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - ``` If no such template exists, you can create one or restore a cluster state - that contains one. Without a matching index template, a data stream can't roll - over or create backing indices. If your snapshot contains data from App Search - or Workplace Search, you must restore the Enterprise Search encryption key before - you restore the snapshot. + .. raw:: html + +

Restore a snapshot. + Restore a snapshot of a cluster or data streams and indices.

+

You can restore a snapshot only to a running cluster with an elected master node. + The snapshot repository must be registered and available to the cluster. + The snapshot and cluster versions must be compatible.

+

To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks.

+

Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API:

+
GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream
+          
+

If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices.

+

If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot.

+ ``_ @@ -1104,18 +1082,18 @@ def status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the snapshot status. Get a detailed description of the current state for - each shard participating in the snapshot. Note that this API should be used only - to obtain detailed shard-level information for ongoing snapshots. If this detail - is not needed or you want to obtain information about one or more existing snapshots, - use the get snapshot API. WARNING: Using the API to return the status of any - snapshots other than currently running snapshots can be expensive. The API requires - a read from the repository for each shard in each snapshot. For example, if you - have 100 snapshots with 1,000 shards each, an API request that includes all snapshots - will require 100,000 reads (100 snapshots x 1,000 shards). Depending on the latency - of your storage, such requests can take an extremely long time to return results. - These requests can also tax machine resources and, when using cloud storage, - incur high processing costs. + .. raw:: html + +

Get the snapshot status. + Get a detailed description of the current state for each shard participating in the snapshot. + Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. + If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API.

+

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

+

Depending on the latency of your storage, such requests can take an extremely long time to return results. + These requests can also tax machine resources and, when using cloud storage, incur high processing costs.

+ ``_ @@ -1174,8 +1152,11 @@ def verify_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Verify a snapshot repository. Check for common misconfigurations in a snapshot - repository. + .. raw:: html + +

Verify a snapshot repository. + Check for common misconfigurations in a snapshot repository.

+ ``_ diff --git a/elasticsearch/_sync/client/sql.py b/elasticsearch/_sync/client/sql.py index d56edbd03..ecdb49a22 100644 --- a/elasticsearch/_sync/client/sql.py +++ b/elasticsearch/_sync/client/sql.py @@ -39,7 +39,10 @@ def clear_cursor( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear an SQL search cursor. + .. raw:: html + +

Clear an SQL search cursor.

+ ``_ @@ -84,11 +87,17 @@ def delete_async( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an async SQL search. Delete an async SQL search or a stored synchronous - SQL search. If the search is still running, the API cancels it. If the Elasticsearch - security features are enabled, only the following users can use this API to delete - a search: * Users with the `cancel_task` cluster privilege. * The user who first - submitted the search. + .. raw:: html + +

Delete an async SQL search. + Delete an async SQL search or a stored synchronous SQL search. + If the search is still running, the API cancels it.

+

If the Elasticsearch security features are enabled, only the following users can use this API to delete a search:

+
    +
  • Users with the cancel_task cluster privilege.
  • +
  • The user who first submitted the search.
  • +
+ ``_ @@ -134,10 +143,12 @@ def get_async( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get async SQL search results. Get the current status and available results for - an async SQL search or stored synchronous SQL search. If the Elasticsearch security - features are enabled, only the user who first submitted the SQL search can retrieve - the search using this API. + .. raw:: html + +

Get async SQL search results. + Get the current status and available results for an async SQL search or stored synchronous SQL search.

+

If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API.

+ ``_ @@ -195,8 +206,11 @@ def get_async_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the async SQL search status. Get the current status of an async SQL search - or a stored synchronous SQL search. + .. raw:: html + +

Get the async SQL search status. + Get the current status of an async SQL search or a stored synchronous SQL search.

+ ``_ @@ -281,7 +295,11 @@ def query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get SQL search results. Run an SQL request. + .. raw:: html + +

Get SQL search results. + Run an SQL request.

+ ``_ @@ -402,9 +420,12 @@ def translate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Translate SQL into Elasticsearch queries. Translate an SQL search into a search - API request containing Query DSL. It accepts the same request body parameters - as the SQL search API, excluding `cursor`. + .. raw:: html + +

Translate SQL into Elasticsearch queries. + Translate an SQL search into a search API request containing Query DSL. + It accepts the same request body parameters as the SQL search API, excluding cursor.

+ ``_ diff --git a/elasticsearch/_sync/client/ssl.py b/elasticsearch/_sync/client/ssl.py index 1f3cb3bed..d65003825 100644 --- a/elasticsearch/_sync/client/ssl.py +++ b/elasticsearch/_sync/client/ssl.py @@ -35,23 +35,22 @@ def certificates( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get SSL certificates. Get information about the X.509 certificates that are used - to encrypt communications in the cluster. The API returns a list that includes - certificates from all TLS contexts including: - Settings for transport and HTTP - interfaces - TLS settings that are used within authentication realms - TLS settings - for remote monitoring exporters The list includes certificates that are used - for configuring trust, such as those configured in the `xpack.security.transport.ssl.truststore` - and `xpack.security.transport.ssl.certificate_authorities` settings. It also - includes certificates that are used for configuring server identity, such as - `xpack.security.http.ssl.keystore` and `xpack.security.http.ssl.certificate settings`. - The list does not include certificates that are sourced from the default SSL - context of the Java Runtime Environment (JRE), even if those certificates are - in use within Elasticsearch. NOTE: When a PKCS#11 token is configured as the - truststore of the JRE, the API returns all the certificates that are included - in the PKCS#11 token irrespective of whether these are used in the Elasticsearch - TLS configuration. If Elasticsearch is configured to use a keystore or truststore, - the API output includes all certificates in that store, even though some of the - certificates might not be in active use within the cluster. + .. raw:: html + +

Get SSL certificates.

+

Get information about the X.509 certificates that are used to encrypt communications in the cluster. + The API returns a list that includes certificates from all TLS contexts including:

+
    +
  • Settings for transport and HTTP interfaces
  • +
  • TLS settings that are used within authentication realms
  • +
  • TLS settings for remote monitoring exporters
  • +
+

The list includes certificates that are used for configuring trust, such as those configured in the xpack.security.transport.ssl.truststore and xpack.security.transport.ssl.certificate_authorities settings. + It also includes certificates that are used for configuring server identity, such as xpack.security.http.ssl.keystore and xpack.security.http.ssl.certificate settings.

+

The list does not include certificates that are sourced from the default SSL context of the Java Runtime Environment (JRE), even if those certificates are in use within Elasticsearch.

+

NOTE: When a PKCS#11 token is configured as the truststore of the JRE, the API returns all the certificates that are included in the PKCS#11 token irrespective of whether these are used in the Elasticsearch TLS configuration.

+

If Elasticsearch is configured to use a keystore or truststore, the API output includes all certificates in that store, even though some of the certificates might not be in active use within the cluster.

+ ``_ """ diff --git a/elasticsearch/_sync/client/synonyms.py b/elasticsearch/_sync/client/synonyms.py index 92639b50c..e58ab5ee4 100644 --- a/elasticsearch/_sync/client/synonyms.py +++ b/elasticsearch/_sync/client/synonyms.py @@ -36,21 +36,22 @@ def delete_synonym( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a synonym set. You can only delete a synonyms set that is not in use by - any index analyzer. Synonyms sets can be used in synonym graph token filters - and synonym token filters. These synonym filters can be used as part of search - analyzers. Analyzers need to be loaded when an index is restored (such as when - a node starts, or the index becomes open). Even if the analyzer is not used on - any field mapping, it still needs to be loaded on the index recovery phase. If - any analyzers cannot be loaded, the index becomes unavailable and the cluster - status becomes red or yellow as index shards are not available. To prevent that, - synonyms sets that are used in analyzers can't be deleted. A delete request in - this case will return a 400 response code. To remove a synonyms set, you must - first remove all indices that contain analyzers using it. You can migrate an - index by creating a new index that does not contain the token filter with the - synonyms set, and use the reindex API in order to copy over the index data. Once - finished, you can delete the index. When the synonyms set is not used in analyzers, - you will be able to delete it. + .. raw:: html + +

Delete a synonym set.

+

You can only delete a synonyms set that is not in use by any index analyzer.

+

Synonyms sets can be used in synonym graph token filters and synonym token filters. + These synonym filters can be used as part of search analyzers.

+

Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). + Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase.

+

If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. + To prevent that, synonyms sets that are used in analyzers can't be deleted. + A delete request in this case will return a 400 response code.

+

To remove a synonyms set, you must first remove all indices that contain analyzers using it. + You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. + Once finished, you can delete the index. + When the synonyms set is not used in analyzers, you will be able to delete it.

+ ``_ @@ -91,7 +92,11 @@ def delete_synonym_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a synonym rule. Delete a synonym rule from a synonym set. + .. raw:: html + +

Delete a synonym rule. + Delete a synonym rule from a synonym set.

+ ``_ @@ -141,7 +146,10 @@ def get_synonym( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a synonym set. + .. raw:: html + +

Get a synonym set.

+ ``_ @@ -188,7 +196,11 @@ def get_synonym_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a synonym rule. Get a synonym rule from a synonym set. + .. raw:: html + +

Get a synonym rule. + Get a synonym rule from a synonym set.

+ ``_ @@ -237,7 +249,11 @@ def get_synonyms_sets( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all synonym sets. Get a summary of all defined synonym sets. + .. raw:: html + +

Get all synonym sets. + Get a summary of all defined synonym sets.

+ ``_ @@ -286,12 +302,14 @@ def put_synonym( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a synonym set. Synonyms sets are limited to a maximum of 10,000 - synonym rules per set. If you need to manage more synonym rules, you can create - multiple synonym sets. When an existing synonyms set is updated, the search analyzers - that use the synonyms set are reloaded automatically for all indices. This is - equivalent to invoking the reload search analyzers API for all indices that use - the synonyms set. + .. raw:: html + +

Create or update a synonym set. + Synonyms sets are limited to a maximum of 10,000 synonym rules per set. + If you need to manage more synonym rules, you can create multiple synonym sets.

+

When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. + This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set.

+ ``_ @@ -344,10 +362,13 @@ def put_synonym_rule( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a synonym rule. Create or update a synonym rule in a synonym - set. If any of the synonym rules included is invalid, the API returns an error. - When you update a synonym rule, all analyzers using the synonyms set will be - reloaded automatically to reflect the new rule. + .. raw:: html + +

Create or update a synonym rule. + Create or update a synonym rule in a synonym set.

+

If any of the synonym rules included is invalid, the API returns an error.

+

When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule.

+ ``_ diff --git a/elasticsearch/_sync/client/tasks.py b/elasticsearch/_sync/client/tasks.py index 6eb303050..5e5e7d85b 100644 --- a/elasticsearch/_sync/client/tasks.py +++ b/elasticsearch/_sync/client/tasks.py @@ -47,19 +47,18 @@ def cancel( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancel a task. WARNING: The task management API is new and should still be considered - a beta feature. The API may change in ways that are not backwards compatible. - A task may continue to run for some time after it has been cancelled because - it may not be able to safely stop its current activity straight away. It is also - possible that Elasticsearch must complete its work on other tasks before it can - process the cancellation. The get task information API will continue to list - these cancelled tasks until they complete. The cancelled flag in the response - indicates that the cancellation command has been processed and the task will - stop as soon as possible. To troubleshoot why a cancelled task does not complete - promptly, use the get task information API with the `?detailed` parameter to - identify the other tasks the system is running. You can also use the node hot - threads API to obtain detailed information about the work the system is doing - instead of completing the cancelled task. + .. raw:: html + +

Cancel a task.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. + It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. + The get task information API will continue to list these cancelled tasks until they complete. + The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible.

+

To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. + You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task.

+ ``_ @@ -120,11 +119,14 @@ def get( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get task information. Get information about a task currently running in the cluster. - WARNING: The task management API is new and should still be considered a beta - feature. The API may change in ways that are not backwards compatible. If the - task identifier is not found, a 404 response code indicates that there are no - resources that match the request. + .. raw:: html + +

Get task information. + Get information about a task currently running in the cluster.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

If the task identifier is not found, a 404 response code indicates that there are no resources that match the request.

+ ``_ @@ -182,27 +184,60 @@ def list( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get all tasks. Get information about the tasks currently running on one or more - nodes in the cluster. WARNING: The task management API is new and should still - be considered a beta feature. The API may change in ways that are not backwards - compatible. **Identifying running tasks** The `X-Opaque-Id header`, when provided - on the HTTP request header, is going to be returned as a header in the response - as well as in the headers field for in the task information. This enables you - to track certain calls or associate certain tasks with the client that started - them. For example: ``` curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - ``` The API returns the following result: ``` HTTP/1.1 200 OK X-Opaque-Id: 123456 - content-type: application/json; charset=UTF-8 content-length: 831 { "tasks" : - { "u5lcZHqcQhu-rUoFaqDphA:45" : { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 45, - "type" : "transport", "action" : "cluster:monitor/tasks/lists", "start_time_in_millis" - : 1513823752749, "running_time_in_nanos" : 293139, "cancellable" : false, "headers" - : { "X-Opaque-Id" : "123456" }, "children" : [ { "node" : "u5lcZHqcQhu-rUoFaqDphA", - "id" : 46, "type" : "direct", "action" : "cluster:monitor/tasks/lists[n]", "start_time_in_millis" - : 1513823752750, "running_time_in_nanos" : 92133, "cancellable" : false, "parent_task_id" - : "u5lcZHqcQhu-rUoFaqDphA:45", "headers" : { "X-Opaque-Id" : "123456" } } ] } - } } ``` In this example, `X-Opaque-Id: 123456` is the ID as a part of the response - header. The `X-Opaque-Id` in the task `headers` is the ID for the task that was - initiated by the REST request. The `X-Opaque-Id` in the children `headers` is - the child task of the task that was initiated by the REST request. + .. raw:: html + +

Get all tasks. + Get information about the tasks currently running on one or more nodes in the cluster.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

Identifying running tasks

+

The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. + This enables you to track certain calls or associate certain tasks with the client that started them. + For example:

+
curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents"
+          
+

The API returns the following result:

+
HTTP/1.1 200 OK
+          X-Opaque-Id: 123456
+          content-type: application/json; charset=UTF-8
+          content-length: 831
+
+          {
+            "tasks" : {
+              "u5lcZHqcQhu-rUoFaqDphA:45" : {
+                "node" : "u5lcZHqcQhu-rUoFaqDphA",
+                "id" : 45,
+                "type" : "transport",
+                "action" : "cluster:monitor/tasks/lists",
+                "start_time_in_millis" : 1513823752749,
+                "running_time_in_nanos" : 293139,
+                "cancellable" : false,
+                "headers" : {
+                  "X-Opaque-Id" : "123456"
+                },
+                "children" : [
+                  {
+                    "node" : "u5lcZHqcQhu-rUoFaqDphA",
+                    "id" : 46,
+                    "type" : "direct",
+                    "action" : "cluster:monitor/tasks/lists[n]",
+                    "start_time_in_millis" : 1513823752750,
+                    "running_time_in_nanos" : 92133,
+                    "cancellable" : false,
+                    "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45",
+                    "headers" : {
+                      "X-Opaque-Id" : "123456"
+                    }
+                  }
+                ]
+              }
+            }
+           }
+          
+

In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. + The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. + The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request.

+ ``_ diff --git a/elasticsearch/_sync/client/text_structure.py b/elasticsearch/_sync/client/text_structure.py index 2acc56893..b5c7b67d2 100644 --- a/elasticsearch/_sync/client/text_structure.py +++ b/elasticsearch/_sync/client/text_structure.py @@ -53,22 +53,24 @@ def find_field_structure( timestamp_format: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Find the structure of a text field. Find the structure of a text field in an - Elasticsearch index. This API provides a starting point for extracting further - information from log messages already ingested into Elasticsearch. For example, - if you have ingested data into a very simple index that has just `@timestamp` - and message fields, you can use this API to see what common structure exists - in the message field. The response from the API contains: * Sample messages. - * Statistics that reveal the most common values for all fields detected within - the text and basic numeric statistics for numeric fields. * Information about - the structure of the text, which is useful when you write ingest configurations - to index it or similarly formatted text. * Appropriate mappings for an Elasticsearch - index, which you could use to ingest the text. All this information can be calculated - by the structure finder with no guidance. However, you can optionally override - some of the decisions about the text structure by specifying one or more query - parameters. If the structure finder produces unexpected results, specify the - `explain` query parameter and an explanation will appear in the response. It - helps determine why the returned structure was chosen. + .. raw:: html + +

Find the structure of a text field. + Find the structure of a text field in an Elasticsearch index.

+

This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. + For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field.

+

The response from the API contains:

+
    +
  • Sample messages.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.
  • +
  • Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+

If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. + It helps determine why the returned structure was chosen.

+ ``_ @@ -237,23 +239,25 @@ def find_message_structure( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Find the structure of text messages. Find the structure of a list of text messages. - The messages must contain data that is suitable to be ingested into Elasticsearch. - This API provides a starting point for ingesting data into Elasticsearch in a - format that is suitable for subsequent use with other Elastic Stack functionality. - Use this API rather than the find text structure API if your input text has already - been split up into separate messages by some other process. The response from - the API contains: * Sample messages. * Statistics that reveal the most common - values for all fields detected within the text and basic numeric statistics for - numeric fields. * Information about the structure of the text, which is useful - when you write ingest configurations to index it or similarly formatted text. - Appropriate mappings for an Elasticsearch index, which you could use to ingest - the text. All this information can be calculated by the structure finder with - no guidance. However, you can optionally override some of the decisions about - the text structure by specifying one or more query parameters. If the structure - finder produces unexpected results, specify the `explain` query parameter and - an explanation will appear in the response. It helps determine why the returned - structure was chosen. + .. raw:: html + +

Find the structure of text messages. + Find the structure of a list of text messages. + The messages must contain data that is suitable to be ingested into Elasticsearch.

+

This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. + Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.

+

The response from the API contains:

+
    +
  • Sample messages.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. + Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+

If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. + It helps determine why the returned structure was chosen.

+ ``_ @@ -410,22 +414,24 @@ def find_structure( timestamp_format: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Find the structure of a text file. The text file must contain data that is suitable - to be ingested into Elasticsearch. This API provides a starting point for ingesting - data into Elasticsearch in a format that is suitable for subsequent use with - other Elastic Stack functionality. Unlike other Elasticsearch endpoints, the - data that is posted to this endpoint does not need to be UTF-8 encoded and in - JSON format. It must, however, be text; binary text formats are not currently - supported. The size is limited to the Elasticsearch HTTP receive buffer size, - which defaults to 100 Mb. The response from the API contains: * A couple of messages - from the beginning of the text. * Statistics that reveal the most common values - for all fields detected within the text and basic numeric statistics for numeric - fields. * Information about the structure of the text, which is useful when you - write ingest configurations to index it or similarly formatted text. * Appropriate - mappings for an Elasticsearch index, which you could use to ingest the text. - All this information can be calculated by the structure finder with no guidance. - However, you can optionally override some of the decisions about the text structure - by specifying one or more query parameters. + .. raw:: html + +

Find the structure of a text file. + The text file must contain data that is suitable to be ingested into Elasticsearch.

+

This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. + Unlike other Elasticsearch endpoints, the data that is posted to this endpoint does not need to be UTF-8 encoded and in JSON format. + It must, however, be text; binary text formats are not currently supported. + The size is limited to the Elasticsearch HTTP receive buffer size, which defaults to 100 Mb.

+

The response from the API contains:

+
    +
  • A couple of messages from the beginning of the text.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.
  • +
  • Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+ ``_ @@ -607,9 +613,12 @@ def test_grok_pattern( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Test a Grok pattern. Test a Grok pattern on one or more lines of text. The API - indicates whether the lines match the pattern together with the offsets and lengths - of the matched substrings. + .. raw:: html + +

Test a Grok pattern. + Test a Grok pattern on one or more lines of text. + The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings.

+ ``_ diff --git a/elasticsearch/_sync/client/transform.py b/elasticsearch/_sync/client/transform.py index d44e65432..1cf4632c6 100644 --- a/elasticsearch/_sync/client/transform.py +++ b/elasticsearch/_sync/client/transform.py @@ -39,7 +39,11 @@ def delete_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a transform. Deletes a transform. + .. raw:: html + +

Delete a transform. + Deletes a transform.

+ ``_ @@ -99,7 +103,11 @@ def get_transform( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get transforms. Retrieves configuration information for transforms. + .. raw:: html + +

Get transforms. + Retrieves configuration information for transforms.

+ ``_ @@ -168,7 +176,11 @@ def get_transform_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get transform stats. Retrieves usage information for transforms. + .. raw:: html + +

Get transform stats. + Retrieves usage information for transforms.

+ ``_ @@ -249,12 +261,14 @@ def preview_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview a transform. Generates a preview of the results that you will get when - you create a transform with the same configuration. It returns a maximum of 100 - results. The calculations are based on all the current data in the source index. - It also generates a list of mappings and settings for the destination index. - These values are determined based on the field types of the source index and - the transform aggregations. + .. raw:: html + +

Preview a transform. + Generates a preview of the results that you will get when you create a transform with the same configuration.

+

It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also + generates a list of mappings and settings for the destination index. These values are determined based on the field + types of the source index and the transform aggregations.

+ ``_ @@ -371,27 +385,27 @@ def put_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a transform. Creates a transform. A transform copies data from source - indices, transforms it, and persists it into an entity-centric destination index. - You can also think of the destination index as a two-dimensional tabular data - structure (known as a data frame). The ID for each document in the data frame - is generated from a hash of the entity, so there is a unique row per entity. - You must choose either the latest or pivot method for your transform; you cannot - use both in a single transform. If you choose to use the pivot method for your - transform, the entities are defined by the set of `group_by` fields in the pivot - object. If you choose to use the latest method, the entities are defined by the - `unique_key` field values in the latest object. You must have `create_index`, - `index`, and `read` privileges on the destination index and `read` and `view_index_metadata` - privileges on the source indices. When Elasticsearch security features are enabled, - the transform remembers which roles the user that created it had at the time - of creation and uses those same roles. If those roles do not have the required - privileges on the source and destination indices, the transform fails when it - attempts unauthorized operations. NOTE: You must use Kibana or this API to create - a transform. Do not add a transform directly into any `.transform-internal*` - indices using the Elasticsearch index API. If Elasticsearch security features - are enabled, do not give users any privileges on `.transform-internal*` indices. - If you used transforms prior to 7.5, also do not give users any privileges on - `.data-frame-internal*` indices. + .. raw:: html + +

Create a transform. + Creates a transform.

+

A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as + a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a + unique row per entity.

+

You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If + you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in + the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values + in the latest object.

+

You must have create_index, index, and read privileges on the destination index and read and + view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the + transform remembers which roles the user that created it had at the time of creation and uses those same roles. If + those roles do not have the required privileges on the source and destination indices, the transform fails when it + attempts unauthorized operations.

+

NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any + .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do + not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not + give users any privileges on .data-frame-internal* indices.

+ ``_ @@ -491,9 +505,13 @@ def reset_transform( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset a transform. Resets 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. + .. raw:: html + +

Reset a transform. + Resets 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.

+ ``_ @@ -541,11 +559,15 @@ def schedule_now_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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 is called again in the meantime. + .. 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 + is called again in the meantime.

+ ``_ @@ -592,24 +614,24 @@ def start_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a transform. Starts 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 destination index are - derived from scripts (as in the case of `scripted_metric` or `bucket_script` - aggregations), the transform uses dynamic mappings unless an index template exists. - If it is a latest transform, it does not deduce mapping definitions; it uses - dynamic mappings. To use explicit mappings, create the destination index before - you start the transform. Alternatively, you can create an index template, though - it does not affect the deduced mappings in a pivot transform. When the transform - starts, a series of validations occur to ensure its success. If you deferred - validation when you created the transform, they occur when you start the transform—​with - the exception of privilege checks. When Elasticsearch security features are enabled, - the transform remembers which roles the user that created it had at the time - of creation and uses those same roles. If those roles do not have the required - privileges on the source and destination indices, the transform fails when it - attempts unauthorized operations. + .. raw:: html + +

Start a transform. + Starts 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 + destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), + the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce + mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you + start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings + in a pivot transform.

+

When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you + created the transform, they occur when you start the transform—​with the exception of privilege checks. When + Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the + time of creation and uses those same roles. If those roles do not have the required privileges on the source and + destination indices, the transform fails when it attempts unauthorized operations.

+ ``_ @@ -663,7 +685,11 @@ def stop_transform( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop transforms. Stops one or more transforms. + .. raw:: html + +

Stop transforms. + Stops one or more transforms.

+ ``_ @@ -756,14 +782,16 @@ def update_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a transform. Updates certain properties of a transform. All updated properties - except `description` do not take effect until after the transform starts the - next checkpoint, thus there is data consistency in each checkpoint. To use this - API, you must have `read` and `view_index_metadata` privileges for the source - indices. You must also have `index` and `read` privileges for the destination - index. When Elasticsearch security features are enabled, the transform remembers - which roles the user who updated it had at the time of update and runs with those - privileges. + .. raw:: html + +

Update a transform. + Updates certain properties of a transform.

+

All updated properties except description do not take effect until after the transform starts the next checkpoint, + thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata + privileges for the source indices. You must also have index and read privileges for the destination index. When + Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the + time of update and runs with those privileges.

+ ``_ @@ -844,20 +872,21 @@ def upgrade_transforms( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - 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. The upgrade does - not affect the source and destination indices. The upgrade also does not affect - the roles that transforms use when Elasticsearch security features are enabled; - the role used to read source data and write to the destination index remains - unchanged. If a transform upgrade step fails, the upgrade stops and an error - is returned about the underlying issue. Resolve the issue then re-run the process - again. A summary is returned when the upgrade is finished. To ensure continuous - transforms remain running during a major version upgrade of the cluster – for - example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading - the cluster. You may want to perform a recent cluster backup prior to the upgrade. + .. raw:: html + +

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. + The upgrade does not affect the source and destination indices. + The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged.

+

If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. + Resolve the issue then re-run the process again. + A summary is returned when the upgrade is finished.

+

To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. + You may want to perform a recent cluster backup prior to the upgrade.

+ ``_ diff --git a/elasticsearch/_sync/client/watcher.py b/elasticsearch/_sync/client/watcher.py index a3f5e3933..3c54dd219 100644 --- a/elasticsearch/_sync/client/watcher.py +++ b/elasticsearch/_sync/client/watcher.py @@ -37,14 +37,16 @@ def ack_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Acknowledge a watch. Acknowledging a watch enables you to manually throttle the - execution of the watch's actions. The acknowledgement state of an action is stored - in the `status.actions..ack.state` structure. IMPORTANT: If the specified - watch is currently being executed, this API will return an error The reason for - this behavior is to prevent overwriting the watch status from a watch execution. - Acknowledging an action throttles further executions of that action until its - `ack.state` is reset to `awaits_successful_execution`. This happens when the - condition of the watch is not met (the condition evaluates to false). + .. raw:: html + +

Acknowledge a watch. + Acknowledging a watch enables you to manually throttle the execution of the watch's actions.

+

The acknowledgement state of an action is stored in the status.actions.<id>.ack.state structure.

+

IMPORTANT: If the specified watch is currently being executed, this API will return an error + The reason for this behavior is to prevent overwriting the watch status from a watch execution.

+

Acknowledging an action throttles further executions of that action until its ack.state is reset to awaits_successful_execution. + This happens when the condition of the watch is not met (the condition evaluates to false).

+ ``_ @@ -96,7 +98,11 @@ def activate_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Activate a watch. A watch can be either active or inactive. + .. raw:: html + +

Activate a watch. + A watch can be either active or inactive.

+ ``_ @@ -136,7 +142,11 @@ def deactivate_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deactivate a watch. A watch can be either active or inactive. + .. raw:: html + +

Deactivate a watch. + A watch can be either active or inactive.

+ ``_ @@ -176,13 +186,15 @@ def delete_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a watch. When the watch is removed, the document representing the watch - in the `.watches` index is gone and it will never be run again. Deleting a watch - does not delete any watch execution records related to this watch from the watch - history. IMPORTANT: Deleting a watch must be done by using only this API. Do - not delete the watch directly from the `.watches` index using the Elasticsearch - delete document API When Elasticsearch security features are enabled, make sure - no write privileges are granted to anyone for the `.watches` index. + .. raw:: html + +

Delete a watch. + When the watch is removed, the document representing the watch in the .watches index is gone and it will never be run again.

+

Deleting a watch does not delete any watch execution records related to this watch from the watch history.

+

IMPORTANT: Deleting a watch must be done by using only this API. + Do not delete the watch directly from the .watches index using the Elasticsearch delete document API + When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the .watches index.

+ ``_ @@ -251,21 +263,19 @@ def execute_watch( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a watch. This API can be used to force execution of the watch outside of - its triggering logic or to simulate the watch execution for debugging purposes. - For testing and debugging purposes, you also have fine-grained control on how - the watch runs. You can run the watch without running all of its actions or alternatively - by simulating them. You can also force execution by ignoring the watch condition - and control whether a watch record would be written to the watch history after - it runs. You can use the run watch API to run watches that are not yet registered - by specifying the watch definition inline. This serves as great tool for testing - and debugging your watches prior to adding them to Watcher. When Elasticsearch - security features are enabled on your cluster, watches are run with the privileges - of the user that stored the watches. If your user is allowed to read index `a`, - but not index `b`, then the exact same set of rules will apply during execution - of a watch. When using the run watch API, the authorization data of the user - that called the API will be used as a base, instead of the information who stored - the watch. + .. raw:: html + +

Run a watch. + This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.

+

For testing and debugging purposes, you also have fine-grained control on how the watch runs. + You can run the watch without running all of its actions or alternatively by simulating them. + You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.

+

You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline. + This serves as great tool for testing and debugging your watches prior to adding them to Watcher.

+

When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches. + If your user is allowed to read index a, but not index b, then the exact same set of rules will apply during execution of a watch.

+

When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.

+ ``_ @@ -348,9 +358,12 @@ def get_settings( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get Watcher index settings. Get settings for the Watcher internal index (`.watches`). - Only a subset of settings are shown, for example `index.auto_expand_replicas` - and `index.number_of_replicas`. + .. raw:: html + +

Get Watcher index settings. + Get settings for the Watcher internal index (.watches). + Only a subset of settings are shown, for example index.auto_expand_replicas and index.number_of_replicas.

+ ``_ @@ -392,7 +405,10 @@ def get_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a watch. + .. raw:: html + +

Get a watch.

+ ``_ @@ -456,17 +472,18 @@ def put_watch( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a watch. When a watch is registered, a new document that represents - the watch is added to the `.watches` index and its trigger is immediately registered - with the relevant trigger engine. Typically for the `schedule` trigger, the scheduler - is the trigger engine. IMPORTANT: You must use Kibana or this API to create a - watch. Do not add a watch directly to the `.watches` index by using the Elasticsearch - index API. If Elasticsearch security features are enabled, do not give users - write privileges on the `.watches` index. When you add a watch you can also define - its initial active state by setting the *active* parameter. When Elasticsearch - security features are enabled, your watch can index or search only on indices - for which the user that stored the watch has privileges. If the user is able - to read index `a`, but not index `b`, the same will apply when the watch runs. + .. raw:: html + +

Create or update a watch. + When a watch is registered, a new document that represents the watch is added to the .watches index and its trigger is immediately registered with the relevant trigger engine. + Typically for the schedule trigger, the scheduler is the trigger engine.

+

IMPORTANT: You must use Kibana or this API to create a watch. + Do not add a watch directly to the .watches index by using the Elasticsearch index API. + If Elasticsearch security features are enabled, do not give users write privileges on the .watches index.

+

When you add a watch you can also define its initial active state by setting the active parameter.

+

When Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges. + If the user is able to read index a, but not index b, the same will apply when the watch runs.

+ ``_ @@ -574,9 +591,12 @@ def query_watches( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Query watches. Get all registered watches in a paginated manner and optionally - filter watches by a query. Note that only the `_id` and `metadata.*` fields are - queryable or sortable. + .. raw:: html + +

Query watches. + Get all registered watches in a paginated manner and optionally filter watches by a query.

+

Note that only the _id and metadata.* fields are queryable or sortable.

+ ``_ @@ -646,7 +666,11 @@ def start( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Start the watch service. Start the Watcher service if it is not already running. + .. raw:: html + +

Start the watch service. + Start the Watcher service if it is not already running.

+ ``_ """ @@ -703,8 +727,12 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get Watcher statistics. This API always returns basic metrics. You retrieve more - metrics by using the metric parameter. + .. raw:: html + +

Get Watcher statistics. + This API always returns basic metrics. + You retrieve more metrics by using the metric parameter.

+ ``_ @@ -751,7 +779,11 @@ def stop( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop the watch service. Stop the Watcher service if it is running. + .. raw:: html + +

Stop the watch service. + Stop the Watcher service if it is running.

+ ``_ @@ -803,9 +835,13 @@ def update_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update Watcher index settings. Update settings for the Watcher internal index - (`.watches`). Only a subset of settings can be modified. This includes `index.auto_expand_replicas` - and `index.number_of_replicas`. + .. raw:: html + +

Update Watcher index settings. + Update settings for the Watcher internal index (.watches). + Only a subset of settings can be modified. + This includes index.auto_expand_replicas and index.number_of_replicas.

+ ``_ diff --git a/elasticsearch/_sync/client/xpack.py b/elasticsearch/_sync/client/xpack.py index a2f26ab91..d52c8dd69 100644 --- a/elasticsearch/_sync/client/xpack.py +++ b/elasticsearch/_sync/client/xpack.py @@ -43,10 +43,16 @@ def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get information. The information provided by the API includes: * Build information - including the build number and timestamp. * License information about the currently - installed license. * Feature information for the features that are currently - enabled and available under the current license. + .. raw:: html + +

Get information. + The information provided by the API includes:

+
    +
  • Build information including the build number and timestamp.
  • +
  • License information about the currently installed license.
  • +
  • Feature information for the features that are currently enabled and available under the current license.
  • +
+ ``_ @@ -90,9 +96,12 @@ def usage( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get usage information. Get information about the features that are currently - enabled and available under the current license. The API also provides some usage - statistics. + .. raw:: html + +

Get usage information. + Get information about the features that are currently enabled and available under the current license. + The API also provides some usage statistics.

+ ``_