diff --git a/docs/sphinx/api.rst b/docs/sphinx/api.rst index 72977c161..b79067909 100644 --- a/docs/sphinx/api.rst +++ b/docs/sphinx/api.rst @@ -144,6 +144,12 @@ Nodes .. autoclass:: NodesClient :members: +Query rules +----------- + +.. autoclass:: QueryRulesetClient + :members: + Rollup Indices -------------- @@ -192,6 +198,12 @@ SQL .. autoclass:: SqlClient :members: +Synonyms +-------- + +.. autoclass:: SynonymsClient + :members: + TLS/SSL ------- diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index bd6f94898..a2d3cc795 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -61,6 +61,7 @@ from .ml import MlClient from .monitoring import MonitoringClient from .nodes import NodesClient +from .query_ruleset import QueryRulesetClient from .rollup import RollupClient from .search_application import SearchApplicationClient from .searchable_snapshots import SearchableSnapshotsClient @@ -70,6 +71,7 @@ from .snapshot import SnapshotClient from .sql import SqlClient from .ssl import SslClient +from .synonyms import SynonymsClient from .tasks import TasksClient from .text_structure import TextStructureClient from .transform import TransformClient @@ -449,6 +451,7 @@ def __init__( self.migration = MigrationClient(self) self.ml = MlClient(self) self.monitoring = MonitoringClient(self) + self.query_ruleset = QueryRulesetClient(self) self.rollup = RollupClient(self) self.search_application = SearchApplicationClient(self) self.searchable_snapshots = SearchableSnapshotsClient(self) @@ -457,6 +460,7 @@ def __init__( self.shutdown = ShutdownClient(self) self.sql = SqlClient(self) self.ssl = SslClient(self) + self.synonyms = SynonymsClient(self) self.text_structure = TextStructureClient(self) self.transform = TransformClient(self) self.watcher = WatcherClient(self) @@ -644,26 +648,30 @@ async def bulk( ``_ :param operations: - :param index: Default index for items which don't provide one - :param pipeline: The pipeline id to preprocess incoming documents with - :param refresh: If `true` 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` (the default) then do nothing with refreshes. - :param require_alias: Sets require_alias for all incoming documents. Defaults - to unset (false) - :param routing: Specific routing value - :param source: True or false to return the _source field or not, or default list - of fields to return, can be overridden on each sub-request - :param source_excludes: Default list of fields to exclude from the returned _source - field, can be overridden on each sub-request - :param source_includes: Default list of fields to extract and return from the - _source field, can be overridden on each sub-request - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the bulk operation. Defaults to 1, meaning the primary - shard only. Set to `all` for all shard copies, otherwise set to any non-negative - value less than or equal to the total number of copies for the shard (number - of replicas + 1) + :param index: Name of the data stream, index, or index alias to perform bulk + actions on. + :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 + 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 require_alias: If `true`, the request’s actions must target an index alias. + :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 + of fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. + :param source_includes: A comma-separated list of source fields to include in + the response. + :param timeout: Period each action waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. + :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`). """ if operations is None: raise ValueError("Empty value passed for parameter 'operations'") @@ -728,7 +736,7 @@ async def clear_scroll( ``_ - :param scroll_id: + :param scroll_id: Scroll IDs to clear. To clear all scroll IDs, use `_all`. """ __path = "/_search/scroll" __query: t.Dict[str, t.Any] = {} @@ -771,7 +779,7 @@ async def close_point_in_time( ``_ - :param id: + :param id: The ID of the point-in-time. """ if id is None: raise ValueError("Empty value passed for parameter 'id'") @@ -848,34 +856,42 @@ async def count( ``_ - :param index: A comma-separated list of indices to restrict the results - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_throttled: Whether specified concrete, expanded or aliased indices - should be ignored when throttled - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param min_score: Include only documents with a specific `_score` value in the - result - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param q: Query in the Lucene query string syntax - :param query: - :param routing: A comma-separated list of specific routing values - :param terminate_after: The maximum count for each shard, upon reaching which - the query execution will terminate early + :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 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. + :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 default_operator: The default operator for query string query: `AND` or + `OR`. This parameter can only be used when the `q` query string parameter + is specified. + :param df: Field to use as default where no field prefix is given in the query + string. This parameter can only be used when the `q` query string parameter + is specified. + :param 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 ignore_throttled: If `true`, concrete, expanded or aliased indices are + ignored when frozen. + :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. + :param min_score: Sets the minimum `_score` value that documents must have to + be included in the result. + :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: Defines the search definition using the Query DSL. + :param routing: Custom value used to route operations to a specific shard. + :param terminate_after: Maximum number of documents to collect for each shard. + If a query reaches this limit, Elasticsearch terminates the query early. + Elasticsearch collects documents before sorting. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_count" @@ -965,22 +981,32 @@ async def create( ``_ - :param index: The name of the index - :param id: Document ID + :param index: 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. + :param id: Unique identifier for the document. :param document: - :param pipeline: The pipeline id to preprocess incoming documents with - :param refresh: If `true` 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` (the default) then do nothing with refreshes. - :param routing: Specific routing value - :param timeout: Explicit operation timeout - :param version: Explicit version number for concurrency control - :param version_type: Specific version type - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the index operation. Defaults to 1, meaning the primary - shard only. Set to `all` for all shard copies, otherwise set to any non-negative - value less than or equal to the total number of copies for the shard (number - of replicas + 1) + :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 + 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`. + :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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1050,24 +1076,25 @@ async def delete( ``_ - :param index: The name of the index - :param id: The document ID - :param if_primary_term: only perform the delete operation if the last operation - that has changed the document has the specified primary term - :param if_seq_no: only perform the delete operation if the last operation that - has changed the document has the specified sequence number - :param refresh: If `true` 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` (the default) then do nothing with refreshes. - :param routing: Specific routing value - :param timeout: Explicit operation timeout - :param version: Explicit version number for concurrency control - :param version_type: Specific version type - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the delete operation. Defaults to 1, meaning the primary - shard only. Set to `all` for all shard copies, otherwise set to any non-negative - value less than or equal to the total number of copies for the shard (number - of replicas + 1) + :param index: Name of the target index. + :param id: 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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1178,60 +1205,68 @@ async def delete_by_query( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string - :param conflicts: What to do when the delete by query hits version conflicts? - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :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 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 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`. :param from_: Starting offset (default: 0) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param max_docs: - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param q: Query in the Lucene query string syntax - :param query: - :param refresh: Should the affected indexes be refreshed? - :param request_cache: Specify if request cache should be used for this request - or not, defaults to index level setting + :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. + :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 refresh: If `true`, Elasticsearch refreshes all shards involved in the + delete by query after the request completes. + :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. -1 means no throttle. - :param routing: A comma-separated list of specific routing values - :param scroll: Specify how long a consistent view of the index should be maintained - for scrolled search - :param scroll_size: Size on the scroll request powering the delete by query + 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: Search operation type - :param slice: - :param slices: The number of slices this task should be divided into. Defaults - to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. - :param sort: A comma-separated list of : pairs - :param stats: Specific 'tag' of the request for logging and statistical purposes - :param terminate_after: The maximum number of documents to collect for each shard, - upon reaching which the query execution will terminate early. - :param timeout: Time each individual bulk request should wait for shards that - are unavailable. - :param version: Specify whether to return document version as part of a hit - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the delete by query operation. Defaults to 1, meaning - the primary shard only. Set to `all` for all shard copies, otherwise set - to any non-negative value less than or equal to the total number of copies - for the shard (number of replicas + 1) - :param wait_for_completion: Should the request should block until the delete - by query is complete. + :param search_type: The type of the search operation. Available options: `query_then_fetch`, + `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. + 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 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`). + :param wait_for_completion: If `true`, the request blocks until the operation + is complete. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1342,9 +1377,9 @@ async def delete_by_query_rethrottle( ``_ - :param task_id: The task id to rethrottle - :param requests_per_second: The throttle to set on this request in floating sub-requests - per second. -1 means set no throttle. + :param task_id: The ID for the task. + :param requests_per_second: The throttle for this request in sub-requests per + second. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -1386,9 +1421,12 @@ async def delete_script( ``_ - :param id: Script ID - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :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. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -1455,25 +1493,28 @@ async def exists( ``_ - :param index: The name of the index - :param id: The document ID - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param realtime: Specify whether to perform the operation in realtime or search - mode - :param refresh: Refresh the shard containing the document before performing the - operation - :param routing: Specific routing value - :param source: True or false to return the _source field or not, or a list of - fields to return - :param source_excludes: A list of fields to exclude from the returned _source - field - :param source_includes: A list of fields to extract and return from the _source - field - :param stored_fields: A comma-separated list of stored fields to return in the - response - :param version: Explicit version number for concurrency control - :param version_type: Specific version type + :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 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: 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`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1555,23 +1596,25 @@ async def exists_source( ``_ - :param index: The name of the index - :param id: The document ID - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param realtime: Specify whether to perform the operation in realtime or search - mode - :param refresh: Refresh the shard containing the document before performing the - operation - :param routing: Specific routing value - :param source: True or false to return the _source field or not, or a list of - fields to return - :param source_excludes: A list of fields to exclude from the returned _source - field - :param source_includes: A list of fields to extract and return from the _source - field - :param version: Explicit version number for concurrency control - :param version_type: Specific version type + :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 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`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1656,29 +1699,31 @@ async def explain( ``_ - :param index: The name of the index - :param id: The document ID - :param analyze_wildcard: Specify whether wildcards and prefix queries in the - query string query should be analyzed (default: false) - :param analyzer: The analyzer for the query string query - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The default field for query string query (default: _all) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param q: Query in the Lucene query string syntax - :param query: - :param routing: Specific routing value - :param source: True or false to return the _source field or not, or a list of - fields to return - :param source_excludes: A list of fields to exclude from the returned _source - field - :param source_includes: A list of fields to extract and return from the _source - field + :param 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 analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. + :param analyzer: Analyzer to use for the query string. This parameter can only + be used when the `q` query string parameter is specified. + :param default_operator: The default operator for query string query: `AND` or + `OR`. + :param df: Field to use as default where no field prefix is given in the query + string. + :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. + :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 + of fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. + :param source_includes: A comma-separated list of source fields to include in + the response. :param stored_fields: A comma-separated list of stored fields to return in the - response + response. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1893,7 +1938,7 @@ async def get( :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 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. @@ -1903,8 +1948,9 @@ async def get( the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param stored_fields: A comma-separated list of stored fields to return 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. @@ -1969,7 +2015,7 @@ async def get_script( ``_ - :param id: Script ID + :param id: Identifier for the stored script or search template. :param master_timeout: Specify timeout for connection to master """ if id in SKIP_IN_PATH: @@ -2246,31 +2292,38 @@ async def index( ``_ - :param index: The name of the index + :param index: Name of the data stream or index to target. :param document: - :param id: Document ID - :param if_primary_term: only perform the index operation if the last operation - that has changed the document has the specified primary term - :param if_seq_no: only perform the index operation if the last operation that - has changed the document has the specified sequence number - :param op_type: Explicit operation type. Defaults to `index` for requests with - an explicit document ID, and to `create`for requests without an explicit - document ID - :param pipeline: The pipeline id to preprocess incoming documents with - :param refresh: If `true` 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` (the default) then do nothing with refreshes. - :param require_alias: When true, requires destination to be an alias. Default - is false - :param routing: Specific routing value - :param timeout: Explicit operation timeout - :param version: Explicit version number for concurrency control - :param version_type: Specific version type - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the index operation. Defaults to 1, meaning the primary - shard only. Set to `all` for all shard copies, otherwise set to any non-negative - value less than or equal to the total number of copies for the shard (number - of replicas + 1) + :param id: 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 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. + 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`. + :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 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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2726,16 +2779,19 @@ async def msearch_template( ``_ :param search_templates: - :param index: A comma-separated list of index names to use as default - :param ccs_minimize_roundtrips: Indicates whether network round-trips should - be minimized as part of cross-cluster search requests execution - :param max_concurrent_searches: Controls the maximum number of concurrent searches - the multi search api will execute - :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 search_type: Search operation type - :param typed_keys: Specify whether aggregation and suggester names should be - prefixed by their respective types in the response + :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 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 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 typed_keys: If `true`, the response prefixes aggregation and suggester + names with their respective types. """ if search_templates is None: raise ValueError("Empty value passed for parameter 'search_templates'") @@ -2809,32 +2865,26 @@ async def mtermvectors( ``_ - :param index: The index in which the document resides. - :param docs: - :param field_statistics: Specifies if document count, sum of document frequencies - and sum of total term frequencies should be returned. Applies to all returned - documents unless otherwise specified in body "params" or "docs". - :param fields: A comma-separated list of fields to return. Applies to all returned - documents unless otherwise specified in body "params" or "docs". - :param ids: - :param offsets: Specifies if term offsets should be returned. Applies to all - returned documents unless otherwise specified in body "params" or "docs". - :param payloads: Specifies if term payloads should be returned. Applies to all - returned documents unless otherwise specified in body "params" or "docs". - :param positions: Specifies if term positions should be returned. Applies to - all returned documents unless otherwise specified in body "params" or "docs". - :param preference: Specify the node or shard the operation should be performed - on (default: random) .Applies to all returned documents unless otherwise - specified in body "params" or "docs". - :param realtime: Specifies if requests are real-time as opposed to near-real-time - (default: true). - :param routing: Specific routing value. Applies to all returned documents unless - otherwise specified in body "params" or "docs". - :param term_statistics: Specifies if total term frequency and document frequency - should be returned. Applies to all returned documents unless otherwise specified - in body "params" or "docs". - :param version: Explicit version number for concurrency control - :param version_type: Specific version type + :param index: Name of the index that contains the documents. + :param docs: 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 + 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 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 version: If `true`, returns the document version as part of a hit. + :param version_type: Specific version type. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_mtermvectors" @@ -2926,14 +2976,16 @@ async def open_point_in_time( :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: Specific the time to live for the point in time - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param routing: Specific routing value + :param keep_alive: Extends the time to live of the corresponding point in time. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :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. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2989,11 +3041,18 @@ async def put_script( ``_ - :param id: Script ID - :param script: - :param context: Script context - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :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. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -3158,27 +3217,28 @@ async def reindex( ``_ - :param dest: - :param source: - :param conflicts: - :param max_docs: - :param refresh: Should the affected indexes be refreshed? - :param requests_per_second: The throttle to set on this request in sub-requests - per second. -1 means no throttle. - :param require_alias: - :param script: - :param scroll: Control how long to keep the search context alive + :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 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. + :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 size: :param slices: The number of slices this task should be divided into. Defaults - to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. - :param timeout: Time each individual bulk request should wait for shards that - are unavailable. - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the reindex operation. Defaults to 1, meaning the - primary shard only. Set to `all` for all shard copies, otherwise set to any - non-negative value less than or equal to the total number of copies for the - shard (number of replicas + 1) - :param wait_for_completion: Should the request should block until the reindex + 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 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`). + :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ if dest is None: @@ -3247,9 +3307,9 @@ async def reindex_rethrottle( ``_ - :param task_id: The task id to rethrottle - :param requests_per_second: The throttle to set on this request in floating sub-requests - per second. -1 means set no throttle. + :param task_id: Identifier for the task. + :param requests_per_second: The throttle for this request in sub-requests per + second. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -3293,10 +3353,14 @@ async def render_search_template( ``_ - :param id: The id of the stored search template + :param id: 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: - :param source: + :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. + If no `id` or `` is specified, this parameter is required. """ if id not in SKIP_IN_PATH: __path = f"/_render/template/{_quote(id)}" @@ -3348,9 +3412,9 @@ async def scripts_painless_execute( ``_ - :param context: - :param context_setup: - :param script: + :param context: The context that the script should run in. + :param context_setup: Additional parameters for the `context`. + :param script: The Painless script to execute. """ __path = "/_scripts/painless/_execute" __body: t.Dict[str, t.Any] = {} @@ -4126,20 +4190,24 @@ async def search_shards( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param routing: Specific routing value + :param index: Returns the indices and shards that a search request would be executed + against. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. 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 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. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_search_shards" @@ -4228,24 +4296,30 @@ async def search_template( :param index: Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*). - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param ccs_minimize_roundtrips: Indicates whether network round-trips should - be minimized as part of cross-cluster search requests execution - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param explain: + :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 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 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. - :param ignore_throttled: Whether specified concrete, expanded or aliased indices - should be ignored when throttled - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param params: - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param profile: + :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 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. @@ -4255,8 +4329,8 @@ async def search_template( :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. - :param typed_keys: Specify whether aggregation and suggester names should be - prefixed by their respective types in the response + :param typed_keys: If `true`, the response prefixes aggregation and suggester + names with their respective types. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_search/template" @@ -4431,26 +4505,28 @@ async def termvectors( ``_ - :param index: The index in which the document resides. - :param id: The id of the document, when not specified a doc param should be supplied. - :param doc: - :param field_statistics: Specifies if document count, sum of document frequencies - and sum of total term frequencies should be returned. - :param fields: A comma-separated list of fields to return. - :param filter: - :param offsets: Specifies if term offsets should be returned. - :param payloads: Specifies if term payloads should be returned. - :param per_field_analyzer: - :param positions: Specifies if term positions should be returned. - :param preference: Specify the node or shard the operation should be performed - on (default: random). - :param realtime: Specifies if request is real-time as opposed to near-real-time - (default: true). - :param routing: Specific routing value. - :param term_statistics: Specifies if total term frequency and document frequency - should be returned. - :param version: Explicit version number for concurrency control - :param version_type: Specific version type + :param index: Name of the index that contains the document. + :param id: Unique identifier of 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 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 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 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 version: If `true`, returns the document version as part of a hit. + :param version_type: Specific version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4727,64 +4803,75 @@ async def update_by_query( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string - :param conflicts: - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :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 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`. + :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`. :param from_: Starting offset (default: 0) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param max_docs: - :param pipeline: Ingest pipeline to set on index requests made by this action. - (default: none) - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param query: - :param refresh: Should the affected indexes be refreshed? - :param request_cache: Specify if request cache should be used for this request - or not, defaults to index level setting - :param requests_per_second: The throttle to set on this request in sub-requests - per second. -1 means no throttle. - :param routing: A comma-separated list of specific routing values - :param script: - :param scroll: Specify how long a consistent view of the index should be maintained - for scrolled search - :param scroll_size: Size on the scroll request powering the update by query - :param search_timeout: Explicit timeout for each search request. Defaults to - no timeout. - :param search_type: Search operation type - :param slice: - :param slices: The number of slices this task should be divided into. Defaults - to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. - :param sort: A comma-separated list of : pairs - :param stats: Specific 'tag' of the request for logging and statistical purposes - :param terminate_after: The maximum number of documents to collect for each shard, - upon reaching which the query execution will terminate early. - :param timeout: Time each individual bulk request should wait for shards that - are unavailable. - :param version: Specify whether to return document version as part of a hit + :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. + :param max_docs: The maximum number of documents to update. + :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 + parameter. + :param preference: Specifies the node or shard the operation should be performed + on. Random by default. + :param query: Specifies the documents to update using the Query DSL. + :param refresh: If `true`, Elasticsearch refreshes affected shards to make the + operation visible to search. + :param request_cache: If `true`, the request cache is used for this request. + :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 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 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. + 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. + :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: Sets the number of shard copies that must be active - before proceeding with the update by query operation. Defaults to 1, meaning - the primary shard only. Set to `all` for all shard copies, otherwise set - to any non-negative value less than or equal to the total number of copies - for the shard (number of replicas + 1) - :param wait_for_completion: Should the request should block until the update - by query operation is complete. + :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`). + :param wait_for_completion: If `true`, the request blocks until the operation + is complete. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4903,9 +4990,9 @@ async def update_by_query_rethrottle( ``_ - :param task_id: The task id to rethrottle - :param requests_per_second: The throttle to set on this request in floating sub-requests - per second. -1 means set no throttle. + :param task_id: The ID for the task. + :param requests_per_second: The throttle for this request in sub-requests per + second. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") diff --git a/elasticsearch/_async/client/enrich.py b/elasticsearch/_async/client/enrich.py index 088ec6812..62abc72a5 100644 --- a/elasticsearch/_async/client/enrich.py +++ b/elasticsearch/_async/client/enrich.py @@ -41,7 +41,7 @@ async def delete_policy( ``_ - :param name: The name of the enrich policy + :param name: Enrich policy to delete. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -78,9 +78,9 @@ async def execute_policy( ``_ - :param name: The name of the enrich policy - :param wait_for_completion: Should the request should block until the execution - is complete. + :param name: Enrich policy to execute. + :param wait_for_completion: If `true`, the request blocks other enrich policy + execution requests until complete. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -118,7 +118,8 @@ async def get_policy( ``_ - :param name: A comma-separated list of enrich policy names + :param name: Comma-separated list of enrich policy names used to limit the request. + To return information for all enrich policies, omit this parameter. """ if name not in SKIP_IN_PATH: __path = f"/_enrich/policy/{_quote(name)}" @@ -160,10 +161,12 @@ async def put_policy( ``_ - :param name: The name of the enrich policy - :param geo_match: - :param match: - :param range: + :param name: Name of the enrich policy to create or update. + :param geo_match: Matches enrich data to incoming documents based on a `geo_shape` + query. + :param match: Matches enrich data to incoming documents based on a `term` query. + :param range: Matches a number, date, or IP address in incoming documents to + a range in the enrich index based on a `term` query. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") diff --git a/elasticsearch/_async/client/eql.py b/elasticsearch/_async/client/eql.py index 99ec0d9b1..056e45b3d 100644 --- a/elasticsearch/_async/client/eql.py +++ b/elasticsearch/_async/client/eql.py @@ -42,7 +42,9 @@ async def delete( ``_ - :param id: Identifier for the search to delete. + :param id: Identifier for the search to delete. A search ID is provided in the + EQL search API's response for an async search. A search ID is also provided + if the request’s `keep_on_completion` parameter is `true`. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -80,7 +82,7 @@ async def get( """ Returns async results from previously executed Event Query Language (EQL) search - ``_ + `< https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-eql-search-api.html>`_ :param id: Identifier for the search. :param keep_alive: Period for which the search and its results are stored on @@ -127,7 +129,7 @@ async def get_status( Returns the status of a previously submitted async or stored Event Query Language (EQL) search - ``_ + `< https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-eql-status-api.html>`_ :param id: Identifier for the search. """ diff --git a/elasticsearch/_async/client/graph.py b/elasticsearch/_async/client/graph.py index e1f21fe26..214bd31f8 100644 --- a/elasticsearch/_async/client/graph.py +++ b/elasticsearch/_async/client/graph.py @@ -52,14 +52,18 @@ async def explore( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param connections: - :param controls: - :param query: - :param routing: Specific routing value - :param timeout: Explicit operation timeout - :param vertices: + :param index: Name of the index. + :param connections: Specifies or more fields from which you want to extract terms + that are associated with the specified vertices. + :param controls: Direct the Graph API how to build the graph. + :param query: A seed query that identifies the documents of interest. Can be + any valid Elasticsearch query. + :param routing: Custom value used to route operations to a specific shard. + :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 vertices: Specifies one or more fields that contain the terms you want + to include in the graph as vertices. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index df06ab052..0a2961182 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -146,16 +146,26 @@ async def analyze( ``_ - :param index: The name of the index to scope the operation - :param analyzer: - :param attributes: - :param char_filter: - :param explain: - :param field: - :param filter: - :param normalizer: - :param text: - :param tokenizer: + :param index: Index used to derive the analyzer. If specified, the `analyzer` + or field parameter overrides this value. If no index is specified or the + index does not have a default analyzer, the analyze API uses the standard + analyzer. + :param analyzer: The name of the analyzer that should be applied to the provided + `text`. This could be a built-in analyzer, or an analyzer that’s been configured + in the index. + :param attributes: Array of token attributes used to filter the output of the + `explain` parameter. + :param char_filter: Array of character filters used to preprocess characters + before the tokenizer. + :param explain: If `true`, the response includes token attributes and additional + details. + :param field: Field used to derive the analyzer. To use this parameter, you must + specify an index. If specified, the `analyzer` parameter overrides this value. + :param filter: Array of token filters used to apply after the tokenizer. + :param normalizer: Normalizer to use to convert text into a single token. + :param text: Text to analyze. If an array of strings is provided, it is analyzed + as a multi-value field. + :param tokenizer: Tokenizer to use to convert text into tokens. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_analyze" @@ -241,19 +251,24 @@ async def clear_cache( ``_ - :param index: A comma-separated list of index name to limit the operation - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param fielddata: Clear field data - :param fields: A comma-separated list of fields to clear when using the `fielddata` - parameter (default: all) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param query: Clear query caches - :param request: Clear request cache + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :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 fielddata: If `true`, clears the fields cache. Use the `fields` parameter + to clear the cache of specific fields only. + :param fields: Comma-separated list of field names used to limit the `fielddata` + parameter. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param query: If `true`, clears the query cache. + :param request: If `true`, clears the request cache. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_cache/clear" @@ -316,14 +331,18 @@ async def clone( ``_ - :param index: The name of the source index to clone - :param target: The name of the target index to clone into - :param aliases: - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for on - the cloned index before the operation returns. + :param index: Name of the source index to clone. + :param target: Name of the target index to create. + :param aliases: Aliases for the resulting index. + :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 settings: Configuration options for the target index. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -401,20 +420,27 @@ async def close( """ Closes an index. - ``_ + ``_ - :param index: A comma separated list of indices to close - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Sets the number of active shards to wait for before - the operation returns. + :param index: Comma-separated list or wildcard expression of index names used + to limit the request. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -474,15 +500,19 @@ async def create( ``_ - :param index: The name of the index - :param aliases: + :param index: Name of the index you wish to create. + :param aliases: Aliases for the index. :param mappings: Mapping for fields in the index. If specified, this mapping can include: - Field names - Field data types - Mapping parameters - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for before - the operation returns. + :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 settings: Configuration options for the index. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -660,15 +690,24 @@ async def delete( ``_ - :param index: A comma-separated list of indices to delete; use `_all` or `*` - string to delete all indices - :param allow_no_indices: Ignore if a wildcard expression resolves to no concrete - indices (default: false) - :param expand_wildcards: Whether wildcard expressions should get expanded to - open, closed, or hidden indices - :param ignore_unavailable: Ignore unavailable indexes (default: false) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :param index: Comma-separated list of indices to delete. You cannot specify index + aliases. By default, this parameter does not support wildcards (`*`) or `_all`. + To use wildcards or `_all`, set the `action.destructive_requires_name` cluster + setting to `false`. + :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. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -719,12 +758,15 @@ async def delete_alias( ``_ - :param index: A comma-separated list of index names (supports wildcards); use - `_all` for all indices - :param name: A comma-separated list of aliases to delete (supports wildcards); - use `_all` to delete all aliases for the specified indices. - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit timestamp for the document + :param index: Comma-separated list of data streams or indices used to limit the + request. Supports wildcards (`*`). + :param name: Comma-separated list of aliases to remove. Supports wildcards (`*`). + To remove all aliases, use `*` or `_all`. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -784,12 +826,12 @@ async def delete_data_lifecycle( timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes the data lifecycle of the selected data streams. + Deletes the data stream lifecycle of the selected data streams. - ``_ + ``_ - :param name: A comma-separated list of data streams of which the data lifecycle - will be deleted; use `*` to get all data streams + :param name: A comma-separated list of data streams of which the data stream + lifecycle will be deleted; use `*` to get all data streams :param expand_wildcards: Whether wildcard expressions should get expanded to open or closed indices (default: open) :param master_timeout: Specify timeout for connection to master @@ -948,9 +990,13 @@ async def delete_template( ``_ - :param name: The name of the template - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :param name: The name of the legacy index template to delete. Wildcard (`*`) + expressions are supported. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -1017,20 +1063,20 @@ async def disk_usage( index (or the latest backing index of a data stream) as the API consumes resources significantly. :param allow_no_indices: If false, the request returns an error if any wildcard - expression, index alias, or _all value targets only missing or closed indices. + expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For - example, a request targeting foo*,bar* returns an error if an index starts - with foo but no index starts with bar. + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. :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 flush: If true, the API performs a flush before analysis. If false, the - response may not include uncommitted data. - :param ignore_unavailable: If true, missing or closed indices are not included + as `open,hidden`. + :param flush: If `true`, the API performs a flush before analysis. If `false`, + the response may not include uncommitted data. + :param ignore_unavailable: If `true`, missing or closed indices are not included in the response. :param run_expensive_tasks: Analyzing field disk usage is resource-intensive. - To use the API, this parameter must be set to true. + To use the API, this parameter must be set to `true`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1078,10 +1124,10 @@ async def downsample( """ Downsample an index - ``_ + ``_ - :param index: The index to downsample - :param target_index: The name of the target index to store downsampled data + :param index: Name of the time series index to downsample. + :param target_index: Name of the index to create. :param config: """ if index in SKIP_IN_PATH: @@ -1146,17 +1192,21 @@ async def exists( ``_ - :param index: A comma-separated list of index names - :param allow_no_indices: Ignore if a wildcard expression resolves to no concrete - indices (default: false) - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) - :param flat_settings: Return settings in flat format (default: false) - :param ignore_unavailable: Ignore unavailable indexes (default: false) - :param include_defaults: Whether to return all default setting for each of the - indices. - :param local: Return local information, do not retrieve the state from master - node (default: false) + :param index: Comma-separated list of data streams, indices, and aliases. 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. + :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 flat_settings: If `true`, returns settings in flat format. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param include_defaults: If `true`, return all default settings in the response. + :param local: If `true`, the request retrieves information from the local node + only. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1226,17 +1276,21 @@ async def exists_alias( ``_ - :param name: A comma-separated list of alias names to return - :param index: A comma-separated list of index names to filter aliases - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param local: Return local information, do not retrieve the state from master - node (default: false) + :param name: Comma-separated list of aliases to check. Supports wildcards (`*`). + :param index: Comma-separated list of data streams or indices used to limit the + request. Supports wildcards (`*`). To target all data streams and indices, + omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, requests that include a missing data stream + or index in the target indices or data streams return an error. + :param local: If `true`, the request retrieves information from the local node + only. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -1381,10 +1435,10 @@ async def explain_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the index's current DLM lifecycle, such as any potential - encountered error, time since creation etc. + Retrieves information about the index's current data stream lifecycle, such as + any potential encountered error, time since creation etc. - ``_ + ``_ :param index: The name of the index to explain :param include_defaults: indicates if the API should return the default values @@ -1461,8 +1515,8 @@ async def field_usage_stats( :param index: Comma-separated list or wildcard expression of index names used to limit the request. - :param allow_no_indices: If false, the request returns an error if any wildcard - expression, index alias, or _all value targets only missing or closed indices. + :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`. @@ -1472,7 +1526,7 @@ async def field_usage_stats( as `open,hidden`. :param fields: Comma-separated list or wildcard expressions of fields to include in the statistics. - :param ignore_unavailable: If true, missing or closed indices are not included + :param ignore_unavailable: If `true`, missing or closed indices are not included in the response. :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 @@ -1553,23 +1607,23 @@ async def flush( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - for all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param force: Whether a flush should be forced even if it is not necessarily - needed ie. if no changes will be committed to the index. This is useful if - transaction log IDs should be incremented even if no uncommitted changes - are present. (This setting can be considered as internal) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param wait_if_ongoing: If set to true the flush operation will block until the - flush can be executed if another flush operation is already executing. The - default is true. If set to false the flush will be skipped iff if another - flush operation is already running. + :param index: Comma-separated list of data streams, indices, and aliases to flush. + Supports wildcards (`*`). To flush 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. + :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 force: If `true`, the request forces a flush even if there are no changes + to commit to the index. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param wait_if_ongoing: If `true`, the flush operation blocks until execution + when another flush operation is running. If `false`, Elasticsearch returns + an error if you request a flush when another flush operation is running. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_flush" @@ -1842,17 +1896,22 @@ async def get_alias( ``_ - :param index: A comma-separated list of index names to filter aliases - :param name: A comma-separated list of alias names to return - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param local: Return local information, do not retrieve the state from master - node (default: false) + :param index: Comma-separated list of data streams or indices used to limit the + request. Supports wildcards (`*`). To target all data streams and indices, + omit this parameter or use `*` or `_all`. + :param name: Comma-separated list of aliases to retrieve. Supports wildcards + (`*`). To retrieve all aliases, 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. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param local: If `true`, the request retrieves information from the local node + only. """ if index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_alias/{_quote(name)}" @@ -1916,16 +1975,17 @@ async def get_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the data lifecycle of the selected data streams. + Returns the data stream lifecycle of the selected data streams. - ``_ + ``_ - :param name: A comma-separated list of data streams to get; use `*` to get all - data streams - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) - :param include_defaults: Return all relevant default configurations for the data - stream (default: false) + :param name: Comma-separated list of data streams to limit the request. Supports + wildcards (`*`). To target all data streams, omit this parameter or use `*` + or `_all`. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values, such as `open,hidden`. Valid values are: + `all`, `open`, `closed`, `hidden`, `none`. + :param include_defaults: If `true`, return all default settings in the response. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -2054,19 +2114,23 @@ async def get_field_mapping( ``_ - :param fields: A comma-separated list of fields - :param index: A comma-separated list of index names - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param include_defaults: Whether the default mapping values should be returned - as well - :param local: Return local information, do not retrieve the state from master - node (default: false) + :param fields: Comma-separated list or wildcard expression of fields used to + limit returned information. + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param include_defaults: If `true`, return all default settings in the response. + :param local: If `true`, the request retrieves information from the local node + only. """ if fields in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'fields'") @@ -2202,17 +2266,23 @@ async def get_mapping( ``_ - :param index: A comma-separated list of index names - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Specify timeout for connection to master + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param 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. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param local: If `true`, the request retrieves information from the local node + only. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_mapping" @@ -2367,11 +2437,15 @@ async def get_template( ``_ - :param name: The comma separated names of the index templates - :param flat_settings: Return settings in flat format (default: false) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Explicit operation timeout for connection to master node + :param name: Comma-separated list of index template names used to limit the request. + Wildcard (`*`) expressions are supported. To return all index templates, + omit this parameter or use a value of `_all` or `*`. + :param flat_settings: If `true`, returns settings in flat format. + :param local: If `true`, the request retrieves information from the local node + only. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. """ if name not in SKIP_IN_PATH: __path = f"/_template/{_quote(name)}" @@ -2520,18 +2594,29 @@ async def open( ``_ - :param index: A comma separated list of indices to open - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Sets the number of active shards to wait for before - the operation returns. + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). By default, you must explicitly + name the indices you using to limit the request. To limit a request using + `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` + setting to false. You can update this setting in the `elasticsearch.yml` + file or using the cluster update settings API. + :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. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2628,16 +2713,31 @@ async def put_alias( ``_ - :param index: A comma-separated list of index names the alias should point to - (supports wildcards); use `_all` to perform the operation on all indices. - :param name: The name of the alias to be created or updated - :param filter: - :param index_routing: - :param is_write_index: - :param master_timeout: Specify timeout for connection to master - :param routing: - :param search_routing: - :param timeout: Explicit timestamp for the document + :param index: Comma-separated list of data streams or indices to add. Supports + wildcards (`*`). Wildcard patterns that match both data streams and indices + return an error. + :param name: Alias to update. If the alias doesn’t exist, the request creates + it. Index alias names support date math. + :param filter: Query used to limit documents the alias can access. + :param index_routing: Value used to route indexing operations to a specific shard. + If specified, this overwrites the `routing` value for indexing operations. + Data stream aliases don’t support this parameter. + :param is_write_index: If `true`, sets the write index or data stream for the + alias. If an alias points to multiple indices or data streams and `is_write_index` + isn’t set, the alias rejects write requests. If an index alias points to + one index and `is_write_index` isn’t set, the index automatically acts as + the write index. Data stream aliases don’t automatically set a write data + stream, even if the alias points to one data stream. + :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 routing: Value used to route indexing and search operations to a specific + shard. Data stream aliases don’t support this parameter. + :param search_routing: Value used to route search operations to a specific shard. + If specified, this overwrites the `routing` value for search operations. + Data stream aliases don’t support this parameter. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2687,6 +2787,7 @@ async def put_data_lifecycle( data_retention: t.Optional[ t.Union["t.Literal[-1]", "t.Literal[0]", str] ] = None, + downsampling: t.Optional[t.Mapping[str, t.Any]] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ t.Union[ @@ -2717,17 +2818,27 @@ async def put_data_lifecycle( timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the data lifecycle of the selected data streams. + Updates the data stream lifecycle of the selected data streams. - ``_ + ``_ - :param name: A comma-separated list of data streams whose lifecycle will be updated; - use `*` to set the lifecycle to all data streams - :param data_retention: - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit timestamp for the document + :param name: Comma-separated list of data streams used to limit the request. + Supports wildcards (`*`). To target all data streams use `*` or `_all`. + :param data_retention: If defined, every document added to this data stream will + be stored at least for this time frame. Any time after this duration the + document could be deleted. When empty, every document in this data stream + will be stored indefinitely. + :param downsampling: If defined, every backing index will execute the configured + downsampling configuration after the backing index is not the data stream + write index anymore. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values, such as `open,hidden`. Valid values are: + `all`, `hidden`, `open`, `closed`, `none`. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -2736,6 +2847,8 @@ async def put_data_lifecycle( __query: t.Dict[str, t.Any] = {} if data_retention is not None: __body["data_retention"] = data_retention + if downsampling is not None: + __body["downsampling"] = downsampling if error_trace is not None: __query["error_trace"] = error_trace if expand_wildcards is not None: @@ -2790,15 +2903,26 @@ async def put_index_template( ``_ :param name: Index or template name - :param composed_of: - :param create: Whether the index template should only be added if new or can - also replace an existing one - :param data_stream: - :param index_patterns: - :param meta: - :param priority: - :param template: - :param version: + :param composed_of: An ordered list of component template names. Component templates + are merged in the order specified, meaning that the last component template + specified has the highest precedence. + :param create: If `true`, this request cannot replace or update existing index + templates. + :param data_stream: If this object is included, the template is used to create + data streams and their backing indices. Supports an empty object. Data streams + require a matching index template with a `data_stream` object. + :param index_patterns: Name of the index template to create. + :param meta: Optional user metadata about the index template. May have any contents. + This map is not automatically generated by Elasticsearch. + :param priority: Priority to determine index template precedence when a new data + stream or index is created. The index template with the highest priority + is chosen. If no priority is specified the template is treated as though + it is of priority 0 (lowest priority). This number is not automatically generated + by Elasticsearch. + :param template: Template to be applied. It may optionally include an `aliases`, + `mappings`, or `settings` configuration. + :param version: Version number used to manage index templates externally. This + number is not automatically generated by Elasticsearch. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -2909,21 +3033,25 @@ async def put_mapping( :param index: A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) + :param 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. :param date_detection: Controls whether dynamic date detection is enabled. :param dynamic: Controls whether new fields are added dynamically. :param dynamic_date_formats: If date detection is enabled then new string fields are checked against 'dynamic_date_formats' and if the value matches then a new date field is added instead of string. :param dynamic_templates: Specify dynamic templates for the mapping. - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. :param field_names: Control whether field names are enabled for the index. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. :param meta: A mapping type can have custom meta data associated with it. These are not used at all by Elasticsearch, but can be used to store application-specific metadata. @@ -2934,9 +3062,10 @@ async def put_mapping( :param routing: Enable making a routing value required on indexed documents. :param runtime: Mapping of runtime fields for the index. :param source: Control whether the _source field is enabled on the index. - :param timeout: Explicit operation timeout - :param write_index_only: When true, applies mappings only to the write index - of an alias or data stream + :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 write_index_only: If `true`, the mappings are applied only to the current + write index for the target. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3130,7 +3259,7 @@ async def put_template( :param aliases: Aliases for the index. :param create: If true, this request cannot replace or update existing index templates. - :param flat_settings: + :param flat_settings: If `true`, returns settings in flat format. :param index_patterns: Array of wildcard expressions used to match the names of indices during creation. :param mappings: Mapping for fields in the index. @@ -3142,7 +3271,8 @@ async def put_template( Templates with higher 'order' values are merged later, overriding templates with lower values. :param settings: Configuration options for the index. - :param timeout: + :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 version: Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. """ @@ -3203,10 +3333,12 @@ async def recovery( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param active_only: Display only those recoveries that are currently on-going - :param detailed: Whether to display detailed information about shard recovery + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param active_only: If `true`, the response only includes ongoing shard recoveries. + :param detailed: If `true`, the response includes detailed information about + shard recoveries. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_recovery" @@ -3267,15 +3399,18 @@ async def refresh( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_refresh" @@ -3405,9 +3540,13 @@ async def resolve_index( ``_ - :param name: A comma-separated list of names or wildcard expressions - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) + :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, + and data streams to resolve. Resources on remote clusters can be specified + using the ``:`` syntax. + :param 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`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3461,18 +3600,31 @@ async def rollover( ``_ - :param alias: The name of the alias to rollover - :param new_index: The name of the rollover index - :param aliases: - :param conditions: - :param dry_run: If set to true the rollover action will only be validated but - not actually performed even if a condition matches. The default is false - :param mappings: - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for on - the newly created rollover index before the operation returns. + :param alias: Name of the data stream or index alias to roll over. + :param new_index: Name of the index to create. Supports date math. Data streams + do not support this parameter. + :param aliases: Aliases for the target index. Data streams do not support this + parameter. + :param conditions: Conditions for the rollover. If specified, Elasticsearch only + performs the rollover if the current index satisfies these conditions. If + this parameter is not specified, Elasticsearch performs the rollover unconditionally. + If conditions are specified, at least one of them must be a `max_*` condition. + The index will rollover if any `max_*` condition is satisfied and all `min_*` + conditions are satisfied. + :param dry_run: If `true`, checks whether the current index satisfies the specified + conditions but does not perform a rollover. + :param mappings: Mapping for fields in the index. If specified, this mapping + can include field names, field data types, and mapping paramaters. + :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 settings: Configuration options for the index. Data streams do not support + this parameter. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if alias in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'alias'") @@ -3555,16 +3707,19 @@ async def segments( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param verbose: Includes detailed memory usage by Lucene. + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param verbose: If `true`, the request returns a verbose response. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_segments" @@ -3706,14 +3861,18 @@ async def shrink( ``_ - :param index: The name of the source index to shrink - :param target: The name of the target index to shrink into - :param aliases: - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for on - the shrunken index before the operation returns. + :param index: Name of the source index to shrink. + :param target: Name of the target index to create. + :param aliases: The key is the alias name. Index alias names support date math. + :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 settings: Configuration options for the target index. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3785,23 +3944,40 @@ async def simulate_index_template( ``_ :param name: Index or template name to simulate - :param allow_auto_create: - :param composed_of: + :param allow_auto_create: This setting overrides the value of the `action.auto_create_index` + cluster setting. If set to `true` in a template, then indices can be automatically + created using that template even if auto-creation of indices is disabled + via `actions.auto_create_index`. If set to `false`, then indices or data + streams matching the template must always be explicitly created, and may + never be automatically created. + :param composed_of: An ordered list of component template names. Component templates + are merged in the order specified, meaning that the last component template + specified has the highest precedence. :param create: If `true`, the template passed in the body is only used if no existing templates match the same index patterns. If `false`, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. - :param data_stream: + :param data_stream: If this object is included, the template is used to create + data streams and their backing indices. Supports an empty object. Data streams + require a matching index template with a `data_stream` object. :param include_defaults: If true, returns all relevant default configurations for the index template. - :param index_patterns: + :param index_patterns: Array of wildcard (`*`) expressions used to match the + names of data streams and indices during creation. :param master_timeout: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - :param meta: - :param priority: - :param template: - :param version: + :param meta: Optional user metadata about the index template. May have any contents. + This map is not automatically generated by Elasticsearch. + :param priority: Priority to determine index template precedence when a new data + stream or index is created. The index template with the highest priority + is chosen. If no priority is specified the template is treated as though + it is of priority 0 (lowest priority). This number is not automatically generated + by Elasticsearch. + :param template: Template to be applied. It may optionally include an `aliases`, + `mappings`, or `settings` configuration. + :param version: Version number used to manage index templates externally. This + number is not automatically generated by Elasticsearch. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3944,14 +4120,18 @@ async def split( ``_ - :param index: The name of the source index to split - :param target: The name of the target index to split into - :param aliases: - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for on - the shrunken index before the operation returns. + :param index: Name of the source index to split. + :param target: Name of the target index to create. + :param aliases: Aliases for the resulting index. + :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 settings: Configuration options for the target index. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4151,18 +4331,24 @@ async def unfreeze( ``_ - :param index: The name of the index to unfreeze - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Sets the number of active shards to wait for before - the operation returns. + :param index: Identifier for the index. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4218,9 +4404,12 @@ async def update_aliases( ``_ - :param actions: - :param master_timeout: Specify timeout for connection to master - :param timeout: Request timeout + :param actions: Actions to perform. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ __path = "/_aliases" __body: t.Dict[str, t.Any] = {} @@ -4293,31 +4482,36 @@ async def validate_query( ``_ - :param index: A comma-separated list of index names to restrict the operation; - use `_all` or empty string to perform the operation on all indices - :param all_shards: Execute validation on all shards instead of one random shard - per index - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param explain: Return detailed information about the error - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param q: Query in the Lucene query string syntax - :param query: - :param rewrite: Provide a more detailed explanation showing the actual Lucene - query that will be executed. + :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 all_shards: If `true`, the validation is executed on all shards instead + of one random shard per index. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. + :param analyzer: Analyzer to use for the query string. This parameter can only + be used when the `q` query string parameter is specified. + :param default_operator: The default operator for query string query: `AND` or + `OR`. + :param df: Field to use as default where no field prefix is given in the query + string. This parameter can only be used when the `q` query string parameter + is specified. + :param 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 explain: If `true`, the response returns detailed information if an error + has occurred. + :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. + :param q: Query in the Lucene query string syntax. + :param query: Query in the Lucene query string syntax. + :param rewrite: If `true`, returns a more detailed explanation showing the actual + Lucene query that will be executed. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_validate/query" diff --git a/elasticsearch/_async/client/ingest.py b/elasticsearch/_async/client/ingest.py index d3cbebe90..583e236b4 100644 --- a/elasticsearch/_async/client/ingest.py +++ b/elasticsearch/_async/client/ingest.py @@ -45,9 +45,13 @@ async def delete_pipeline( ``_ - :param id: Pipeline ID - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout + :param id: Pipeline ID or wildcard expression of pipeline IDs used to limit the + request. To delete all ingest pipelines in a cluster, use a value of `*`. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -84,7 +88,7 @@ async def geo_ip_stats( """ Returns statistical information about geoip databases - ``_ + ``_ """ __path = "/_ingest/geoip/stats" __query: t.Dict[str, t.Any] = {} @@ -122,8 +126,11 @@ async def get_pipeline( ``_ - :param id: Comma separated list of pipeline ids. Wildcards supported - :param master_timeout: Explicit operation timeout for connection to master node + :param id: Comma-separated list of pipeline IDs to retrieve. Wildcard (`*`) expressions + are supported. To get all ingest pipelines, omit this parameter or use `*`. + :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 summary: Return pipelines without their definitions (default: false) """ if id not in SKIP_IN_PATH: @@ -162,7 +169,7 @@ async def processor_grok( """ Returns a list of the built-in patterns. - ``_ + ``_ """ __path = "/_ingest/processor/grok" __query: t.Dict[str, t.Any] = {} @@ -211,7 +218,7 @@ async def put_pipeline( """ Creates or updates a pipeline. - ``_ + ``_ :param id: ID of the ingest pipeline to create or update. :param description: Description of the ingest pipeline. @@ -294,11 +301,14 @@ async def simulate( ``_ - :param id: Pipeline ID - :param docs: - :param pipeline: - :param verbose: Verbose mode. Display data output for each processor in executed - pipeline + :param id: Pipeline to test. If you don’t specify a `pipeline` in the request + body, this parameter is required. + :param docs: Sample documents to test in the pipeline. + :param pipeline: Pipeline to test. If you don’t specify the `pipeline` request + path parameter, this parameter is required. If you specify both this and + the request path parameter, the API only uses the request path parameter. + :param verbose: If `true`, the response includes output data for each processor + in the executed pipeline. """ if id not in SKIP_IN_PATH: __path = f"/_ingest/pipeline/{_quote(id)}/_simulate" diff --git a/elasticsearch/_async/client/logstash.py b/elasticsearch/_async/client/logstash.py index db2206418..967b16d03 100644 --- a/elasticsearch/_async/client/logstash.py +++ b/elasticsearch/_async/client/logstash.py @@ -41,7 +41,7 @@ async def delete_pipeline( ``_ - :param id: The ID of the Pipeline + :param id: Identifier for the pipeline. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -77,7 +77,7 @@ async def get_pipeline( ``_ - :param id: A comma-separated list of Pipeline IDs + :param id: Comma-separated list of pipeline identifiers. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -119,7 +119,7 @@ async def put_pipeline( ``_ - :param id: The ID of the Pipeline + :param id: Identifier for the pipeline. :param pipeline: """ if id in SKIP_IN_PATH: diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index aeca216b5..972ebc85b 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -175,8 +175,9 @@ async def delete_calendar_event( ``_ - :param calendar_id: The ID of the calendar to modify - :param event_id: The ID of the event to remove from the calendar + :param calendar_id: A string that uniquely identifies a calendar. + :param event_id: Identifier for the scheduled event. You can obtain this identifier + by using the get calendar events API. """ if calendar_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'calendar_id'") @@ -1223,7 +1224,8 @@ async def get_categories( API returns information about all categories. If you specify only the partition_field_value, it returns information about all categories for the specified partition. :param from_: Skips the specified number of categories. - :param page: + :param page: Configures pagination. This parameter has the `from` and `size` + properties. :param partition_field_value: Only return categories for the specified partition. :param size: Specifies the maximum number of categories to obtain. """ @@ -1587,7 +1589,8 @@ async def get_influencers( :param from_: Skips the specified number of influencers. :param influencer_score: Returns influencers with anomaly scores greater than or equal to this value. - :param page: + :param page: Configures pagination. This parameter has the `from` and `size` + properties. :param size: Specifies the maximum number of influencers to obtain. :param sort: Specifies the sort field for the requested influencers. By default, the influencers are sorted by the `influencer_score` value. diff --git a/elasticsearch/_async/client/nodes.py b/elasticsearch/_async/client/nodes.py index 9f0272e99..cc3d38d6f 100644 --- a/elasticsearch/_async/client/nodes.py +++ b/elasticsearch/_async/client/nodes.py @@ -273,10 +273,10 @@ async def reload_secure_settings( ``_ - :param node_id: A comma-separated list of node IDs to span the reload/reinit - call. Should stay empty because reloading usually involves all cluster nodes. - :param secure_settings_password: - :param timeout: Explicit operation timeout + :param node_id: The names of particular nodes in the cluster to target. + :param secure_settings_password: The password for the Elasticsearch keystore. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if node_id not in SKIP_IN_PATH: __path = f"/_nodes/{_quote(node_id)}/reload_secure_settings" @@ -367,8 +367,8 @@ async def stats( :param include_segment_file_sizes: If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). - :param include_unloaded_segments: If set to true segment stats will include stats - for segments that are not currently loaded into memory + :param include_unloaded_segments: If `true`, the response includes information + from segments that are not loaded into memory. :param level: Indicates whether statistics are aggregated at the cluster, index, or shard level. :param master_timeout: Period to wait for a connection to the master node. If @@ -455,8 +455,10 @@ async def usage( :param node_id: A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - :param metric: Limit the information returned to the specified metrics - :param timeout: Explicit operation timeout + :param metric: Limits the information returned to the specific metrics. A comma-separated + list of the following options: `_all`, `rest_actions`. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: __path = f"/_nodes/{_quote(node_id)}/usage/{_quote(metric)}" diff --git a/elasticsearch/_async/client/query_ruleset.py b/elasticsearch/_async/client/query_ruleset.py new file mode 100644 index 000000000..2edfc60a4 --- /dev/null +++ b/elasticsearch/_async/client/query_ruleset.py @@ -0,0 +1,187 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import typing as t + +from elastic_transport import ObjectApiResponse + +from ._base import NamespacedClient +from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters + + +class QueryRulesetClient(NamespacedClient): + @_rewrite_parameters() + async def delete( + self, + *, + ruleset_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Deletes a query ruleset. + + ``_ + + :param ruleset_id: The unique identifier of the query ruleset to delete + """ + if ruleset_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'ruleset_id'") + __path = f"/_query_rules/{_quote(ruleset_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 + ) + + @_rewrite_parameters() + async def get( + self, + *, + ruleset_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Returns the details about a query ruleset. + + ``_ + + :param ruleset_id: The unique identifier of the query ruleset + """ + if ruleset_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'ruleset_id'") + __path = f"/_query_rules/{_quote(ruleset_id)}" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters( + parameter_aliases={"from": "from_"}, + ) + async def list( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + from_: t.Optional[int] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + size: t.Optional[int] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Lists query rulesets. + + ``_ + + :param from_: Starting offset (default: 0) + :param size: specifies a max number of results to get + """ + __path = "/_query_rules" + __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 from_ is not None: + __query["from"] = from_ + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if size is not None: + __query["size"] = size + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters( + body_fields=True, + ) + async def put( + self, + *, + ruleset_id: str, + rules: t.Union[ + t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...] + ], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Creates or updates a query ruleset. + + ``_ + + :param ruleset_id: The unique identifier of the query ruleset to be created or + updated + :param rules: + """ + if ruleset_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'ruleset_id'") + if rules is None: + raise ValueError("Empty value passed for parameter 'rules'") + __path = f"/_query_rules/{_quote(ruleset_id)}" + __body: t.Dict[str, t.Any] = {} + __query: t.Dict[str, t.Any] = {} + if rules is not None: + __body["rules"] = rules + 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", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", __path, params=__query, headers=__headers, body=__body + ) diff --git a/elasticsearch/_async/client/rollup.py b/elasticsearch/_async/client/rollup.py index 3c1a4d74a..f9756ad22 100644 --- a/elasticsearch/_async/client/rollup.py +++ b/elasticsearch/_async/client/rollup.py @@ -41,7 +41,7 @@ async def delete_job( ``_ - :param id: The ID of the job to delete + :param id: Identifier for the job. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -77,8 +77,8 @@ async def get_jobs( ``_ - :param id: The ID of the job(s) to fetch. Accepts glob patterns, or left blank - for all jobs + :param id: Identifier for the rollup job. If it is `_all` or omitted, the API + returns all rollup jobs. """ if id not in SKIP_IN_PATH: __path = f"/_rollup/job/{_quote(id)}" @@ -116,8 +116,8 @@ async def get_rollup_caps( ``_ - :param id: The ID of the index to check rollup capabilities on, or left blank - for all jobs + :param id: Index, indices or index-pattern to return rollup capabilities for. + `_all` may be used to fetch rollup capabilities from all jobs. """ if id not in SKIP_IN_PATH: __path = f"/_rollup/data/{_quote(id)}" @@ -155,8 +155,8 @@ async def get_rollup_index_caps( ``_ - :param index: The rollup index or index pattern to obtain rollup capabilities - from. + :param index: Data stream or index to check for rollup capabilities. Wildcard + (`*`) expressions are supported. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -316,14 +316,13 @@ async def rollup_search( ``_ - :param index: The indices or index-pattern(s) (containing rollup or regular data) - that should be searched - :param aggregations: - :param aggs: - :param query: + :param index: Enables searching rolled-up data using the standard Query DSL. + :param aggregations: Specifies aggregations. + :param aggs: Specifies aggregations. + :param query: Specifies a DSL query. :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 size: Must be zero if set, as rollups work on pre-aggregated data + :param size: Must be zero if set, as rollups work on pre-aggregated data. :param typed_keys: Specify whether aggregation and suggester names should be prefixed by their respective types in the response """ @@ -374,7 +373,7 @@ async def start_job( ``_ - :param id: The ID of the job to start + :param id: Identifier for the rollup job. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -412,11 +411,13 @@ async def stop_job( ``_ - :param id: The ID of the job to stop - :param timeout: Block for (at maximum) the specified duration while waiting for - the job to stop. Defaults to 30s. - :param wait_for_completion: True if the API should block until the job has fully - stopped, false if should be executed async. Defaults to false. + :param id: Identifier for the rollup job. + :param timeout: If `wait_for_completion` is `true`, the API blocks for (at maximum) + the specified duration while waiting for the job to stop. If more than `timeout` + time has passed, the API throws a timeout exception. + :param wait_for_completion: If set to `true`, causes the API to block until the + indexer state completely stops. If set to `false`, the API returns immediately + and the indexer is stopped asynchronously in the background. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") diff --git a/elasticsearch/_async/client/search_application.py b/elasticsearch/_async/client/search_application.py index 9b927a363..7defb82e8 100644 --- a/elasticsearch/_async/client/search_application.py +++ b/elasticsearch/_async/client/search_application.py @@ -190,9 +190,9 @@ async def list( ``_ - :param from_: Starting offset (default: 0) - :param q: Query in the Lucene query string syntax" - :param size: specifies a max number of results to get + :param from_: Starting offset. + :param q: Query in the Lucene query string syntax. + :param size: Specifies a max number of results to get. """ __path = "/_application/search_application" __query: t.Dict[str, t.Any] = {} @@ -236,10 +236,10 @@ async def put( ``_ - :param name: The name of the search application to be created or updated + :param name: The name of the search application to be created or updated. :param search_application: - :param create: If true, requires that a search application with the specified - resource_id does not already exist. (default: false) + :param create: If `true`, this request cannot replace or update existing Search + Applications. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -280,7 +280,7 @@ async def put_behavioral_analytics( ``_ - :param name: The name of the analytics collection to be created or updated + :param name: The name of the analytics collection to be created or updated. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -320,8 +320,9 @@ async def search( ``_ - :param name: The name of the search application to be searched - :param params: + :param name: The name of the search application to be searched. + :param params: Query parameters specific to this request, which will override + any defaults specified in the template. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") diff --git a/elasticsearch/_async/client/sql.py b/elasticsearch/_async/client/sql.py index a84171f3d..b5134d7c4 100644 --- a/elasticsearch/_async/client/sql.py +++ b/elasticsearch/_async/client/sql.py @@ -43,7 +43,7 @@ async def clear_cursor( ``_ - :param cursor: + :param cursor: Cursor to clear. """ if cursor is None: raise ValueError("Empty value passed for parameter 'cursor'") @@ -83,7 +83,7 @@ async def delete_async( ``_ - :param id: The async search ID + :param id: Identifier for the search. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -126,7 +126,7 @@ async def get_async( ``_ - :param id: The async search ID + :param id: Identifier for the search. :param delimiter: Separator for CSV results. The API only supports this parameter for CSV responses. :param format: Format for the response. You must specify a format using this @@ -180,7 +180,7 @@ async def get_async_status( ``_ - :param id: The async search ID + :param id: Identifier for the search. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -243,14 +243,16 @@ async def query( execute on the data in the local cluster only. :param columnar: If true, the results in a columnar fashion: one row represents all the values of a certain column from the current page of results. - :param cursor: + :param cursor: Cursor used to retrieve a set of paginated results. If you specify + a cursor, the API only uses the `columnar` and `time_zone` request body parameters. + It ignores other request body parameters. :param fetch_size: The maximum number of rows (or entries) to return in one response :param field_multi_value_leniency: Throw an exception when encountering multiple values for a field (default) or be lenient and return the first value from the list (without any guarantees of what that will be - typically the first in natural ascending order). - :param filter: Optional Elasticsearch query DSL for additional filtering. - :param format: a short version of the Accept header, e.g. json, yaml + :param filter: Elasticsearch query DSL for additional filtering. + :param format: Format for the response. :param index_using_frozen: If true, the search can run on frozen indices. Defaults to false. :param keep_alive: Retention period for an async or saved synchronous search. @@ -259,12 +261,11 @@ async def query( Elasticsearch only stores async searches that don’t finish before the wait_for_completion_timeout. :param page_timeout: The timeout before a pagination request fails. :param params: Values for parameters in the query. - :param query: SQL query to execute + :param query: SQL query to run. :param request_timeout: The timeout before the request fails. :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 time_zone: Time-zone in ISO 8601 used for executing the query on the server. - More information available here. + :param time_zone: ISO-8601 time zone ID for the search. :param wait_for_completion_timeout: Period to wait for complete results. Defaults to no timeout, meaning the request waits for complete search results. If the search doesn’t finish within this period, the search becomes async. @@ -341,10 +342,10 @@ async def translate( ``_ - :param query: - :param fetch_size: - :param filter: - :param time_zone: + :param query: SQL query to run. + :param fetch_size: The maximum number of rows (or entries) to return in one response. + :param filter: Elasticsearch query DSL for additional filtering. + :param time_zone: ISO-8601 time zone ID for the search. """ if query is None: raise ValueError("Empty value passed for parameter 'query'") diff --git a/elasticsearch/_async/client/synonyms.py b/elasticsearch/_async/client/synonyms.py new file mode 100644 index 000000000..b6e7a0d73 --- /dev/null +++ b/elasticsearch/_async/client/synonyms.py @@ -0,0 +1,325 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import typing as t + +from elastic_transport import ObjectApiResponse + +from ._base import NamespacedClient +from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters + + +class SynonymsClient(NamespacedClient): + @_rewrite_parameters() + async def delete_synonym( + self, + *, + id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Deletes a synonym set + + ``_ + + :param id: The id of the synonyms set to be deleted + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path = f"/_synonyms/{_quote(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 + ) + + @_rewrite_parameters() + async def delete_synonym_rule( + self, + *, + set_id: str, + rule_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Deletes a synonym rule in a synonym set + + ``_ + + :param set_id: The id of the synonym set to be updated + :param rule_id: The id of the synonym rule to be deleted + """ + if set_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'set_id'") + if rule_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'rule_id'") + __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_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 + ) + + @_rewrite_parameters( + parameter_aliases={"from": "from_"}, + ) + async def get_synonym( + self, + *, + id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + from_: t.Optional[int] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + size: t.Optional[int] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Retrieves a synonym set + + ``_ + + :param id: "The id of the synonyms set to be retrieved + :param from_: Starting offset for query rules to be retrieved + :param size: specifies a max number of query rules to retrieve + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path = f"/_synonyms/{_quote(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 from_ is not None: + __query["from"] = from_ + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if size is not None: + __query["size"] = size + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters() + async def get_synonym_rule( + self, + *, + set_id: str, + rule_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Retrieves a synonym rule from a synonym set + + ``_ + + :param set_id: The id of the synonym set to retrieve the synonym rule from + :param rule_id: The id of the synonym rule to retrieve + """ + if set_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'set_id'") + if rule_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'rule_id'") + __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters( + parameter_aliases={"from": "from_"}, + ) + async def get_synonyms_sets( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + from_: t.Optional[int] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + size: t.Optional[int] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Retrieves a summary of all defined synonym sets + + ``_ + + :param from_: Starting offset + :param size: specifies a max number of results to get + """ + __path = "/_synonyms" + __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 from_ is not None: + __query["from"] = from_ + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if size is not None: + __query["size"] = size + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters( + body_fields=True, + ) + async def put_synonym( + self, + *, + id: str, + synonyms_set: t.Union[ + t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...] + ], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Creates or updates a synonyms set + + ``_ + + :param id: The id of the synonyms set to be created or updated + :param synonyms_set: The synonym set information to update + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if synonyms_set is None: + raise ValueError("Empty value passed for parameter 'synonyms_set'") + __path = f"/_synonyms/{_quote(id)}" + __body: t.Dict[str, t.Any] = {} + __query: t.Dict[str, t.Any] = {} + if synonyms_set is not None: + __body["synonyms_set"] = synonyms_set + 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", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", __path, params=__query, headers=__headers, body=__body + ) + + @_rewrite_parameters( + body_fields=True, + ) + async def put_synonym_rule( + self, + *, + set_id: str, + rule_id: str, + synonyms: t.Union[t.List[str], t.Tuple[str, ...]], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Creates or updates a synonym rule in a synonym set + + ``_ + + :param set_id: The id of the synonym set to be updated with the synonym rule + :param rule_id: The id of the synonym rule to be updated or created + :param synonyms: + """ + if set_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'set_id'") + if rule_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'rule_id'") + if synonyms is None: + raise ValueError("Empty value passed for parameter 'synonyms'") + __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __body: t.Dict[str, t.Any] = {} + __query: t.Dict[str, t.Any] = {} + if synonyms is not None: + __body["synonyms"] = synonyms + 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", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", __path, params=__query, headers=__headers, body=__body + ) diff --git a/elasticsearch/_async/client/tasks.py b/elasticsearch/_async/client/tasks.py index fc75f5b0c..be1167e22 100644 --- a/elasticsearch/_async/client/tasks.py +++ b/elasticsearch/_async/client/tasks.py @@ -47,14 +47,11 @@ async def cancel( ``_ - :param task_id: Cancel the task with specified task id (node_id:task_number) - :param actions: A comma-separated list of actions that should be cancelled. Leave - empty to cancel all. - :param nodes: A comma-separated list of node IDs or names to limit the returned - information; use `_local` to return information from the node you're connecting - to, leave empty to get information from all nodes - :param parent_task_id: Cancel tasks with specified parent task id (node_id:task_number). - Set to -1 to cancel all. + :param task_id: ID of the task. + :param actions: Comma-separated list or wildcard expression of actions used to + limit the request. + :param nodes: Comma-separated list of node IDs or names used to limit the request. + :param parent_task_id: Parent task ID used to limit the tasks. :param wait_for_completion: Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false """ @@ -103,10 +100,11 @@ async def get( ``_ - :param task_id: Return the task with specified id (node_id:task_number) - :param timeout: Explicit operation timeout - :param wait_for_completion: Wait for the matching tasks to complete (default: - false) + :param task_id: ID of the task. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_completion: If `true`, the request blocks until the task has + completed. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index fbaa03bb0..621ebc89a 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -61,6 +61,7 @@ from .ml import MlClient from .monitoring import MonitoringClient from .nodes import NodesClient +from .query_ruleset import QueryRulesetClient from .rollup import RollupClient from .search_application import SearchApplicationClient from .searchable_snapshots import SearchableSnapshotsClient @@ -70,6 +71,7 @@ from .snapshot import SnapshotClient from .sql import SqlClient from .ssl import SslClient +from .synonyms import SynonymsClient from .tasks import TasksClient from .text_structure import TextStructureClient from .transform import TransformClient @@ -449,6 +451,7 @@ def __init__( self.migration = MigrationClient(self) self.ml = MlClient(self) self.monitoring = MonitoringClient(self) + self.query_ruleset = QueryRulesetClient(self) self.rollup = RollupClient(self) self.search_application = SearchApplicationClient(self) self.searchable_snapshots = SearchableSnapshotsClient(self) @@ -457,6 +460,7 @@ def __init__( self.shutdown = ShutdownClient(self) self.sql = SqlClient(self) self.ssl = SslClient(self) + self.synonyms = SynonymsClient(self) self.text_structure = TextStructureClient(self) self.transform = TransformClient(self) self.watcher = WatcherClient(self) @@ -642,26 +646,30 @@ def bulk( ``_ :param operations: - :param index: Default index for items which don't provide one - :param pipeline: The pipeline id to preprocess incoming documents with - :param refresh: If `true` 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` (the default) then do nothing with refreshes. - :param require_alias: Sets require_alias for all incoming documents. Defaults - to unset (false) - :param routing: Specific routing value - :param source: True or false to return the _source field or not, or default list - of fields to return, can be overridden on each sub-request - :param source_excludes: Default list of fields to exclude from the returned _source - field, can be overridden on each sub-request - :param source_includes: Default list of fields to extract and return from the - _source field, can be overridden on each sub-request - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the bulk operation. Defaults to 1, meaning the primary - shard only. Set to `all` for all shard copies, otherwise set to any non-negative - value less than or equal to the total number of copies for the shard (number - of replicas + 1) + :param index: Name of the data stream, index, or index alias to perform bulk + actions on. + :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 + 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 require_alias: If `true`, the request’s actions must target an index alias. + :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 + of fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. + :param source_includes: A comma-separated list of source fields to include in + the response. + :param timeout: Period each action waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. + :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`). """ if operations is None: raise ValueError("Empty value passed for parameter 'operations'") @@ -726,7 +734,7 @@ def clear_scroll( ``_ - :param scroll_id: + :param scroll_id: Scroll IDs to clear. To clear all scroll IDs, use `_all`. """ __path = "/_search/scroll" __query: t.Dict[str, t.Any] = {} @@ -769,7 +777,7 @@ def close_point_in_time( ``_ - :param id: + :param id: The ID of the point-in-time. """ if id is None: raise ValueError("Empty value passed for parameter 'id'") @@ -846,34 +854,42 @@ def count( ``_ - :param index: A comma-separated list of indices to restrict the results - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_throttled: Whether specified concrete, expanded or aliased indices - should be ignored when throttled - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param min_score: Include only documents with a specific `_score` value in the - result - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param q: Query in the Lucene query string syntax - :param query: - :param routing: A comma-separated list of specific routing values - :param terminate_after: The maximum count for each shard, upon reaching which - the query execution will terminate early + :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 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. + :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 default_operator: The default operator for query string query: `AND` or + `OR`. This parameter can only be used when the `q` query string parameter + is specified. + :param df: Field to use as default where no field prefix is given in the query + string. This parameter can only be used when the `q` query string parameter + is specified. + :param 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 ignore_throttled: If `true`, concrete, expanded or aliased indices are + ignored when frozen. + :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. + :param min_score: Sets the minimum `_score` value that documents must have to + be included in the result. + :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: Defines the search definition using the Query DSL. + :param routing: Custom value used to route operations to a specific shard. + :param terminate_after: Maximum number of documents to collect for each shard. + If a query reaches this limit, Elasticsearch terminates the query early. + Elasticsearch collects documents before sorting. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_count" @@ -963,22 +979,32 @@ def create( ``_ - :param index: The name of the index - :param id: Document ID + :param index: 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. + :param id: Unique identifier for the document. :param document: - :param pipeline: The pipeline id to preprocess incoming documents with - :param refresh: If `true` 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` (the default) then do nothing with refreshes. - :param routing: Specific routing value - :param timeout: Explicit operation timeout - :param version: Explicit version number for concurrency control - :param version_type: Specific version type - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the index operation. Defaults to 1, meaning the primary - shard only. Set to `all` for all shard copies, otherwise set to any non-negative - value less than or equal to the total number of copies for the shard (number - of replicas + 1) + :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 + 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`. + :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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1048,24 +1074,25 @@ def delete( ``_ - :param index: The name of the index - :param id: The document ID - :param if_primary_term: only perform the delete operation if the last operation - that has changed the document has the specified primary term - :param if_seq_no: only perform the delete operation if the last operation that - has changed the document has the specified sequence number - :param refresh: If `true` 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` (the default) then do nothing with refreshes. - :param routing: Specific routing value - :param timeout: Explicit operation timeout - :param version: Explicit version number for concurrency control - :param version_type: Specific version type - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the delete operation. Defaults to 1, meaning the primary - shard only. Set to `all` for all shard copies, otherwise set to any non-negative - value less than or equal to the total number of copies for the shard (number - of replicas + 1) + :param index: Name of the target index. + :param id: 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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1176,60 +1203,68 @@ def delete_by_query( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string - :param conflicts: What to do when the delete by query hits version conflicts? - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :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 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 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`. :param from_: Starting offset (default: 0) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param max_docs: - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param q: Query in the Lucene query string syntax - :param query: - :param refresh: Should the affected indexes be refreshed? - :param request_cache: Specify if request cache should be used for this request - or not, defaults to index level setting + :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. + :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 refresh: If `true`, Elasticsearch refreshes all shards involved in the + delete by query after the request completes. + :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. -1 means no throttle. - :param routing: A comma-separated list of specific routing values - :param scroll: Specify how long a consistent view of the index should be maintained - for scrolled search - :param scroll_size: Size on the scroll request powering the delete by query + 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: Search operation type - :param slice: - :param slices: The number of slices this task should be divided into. Defaults - to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. - :param sort: A comma-separated list of : pairs - :param stats: Specific 'tag' of the request for logging and statistical purposes - :param terminate_after: The maximum number of documents to collect for each shard, - upon reaching which the query execution will terminate early. - :param timeout: Time each individual bulk request should wait for shards that - are unavailable. - :param version: Specify whether to return document version as part of a hit - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the delete by query operation. Defaults to 1, meaning - the primary shard only. Set to `all` for all shard copies, otherwise set - to any non-negative value less than or equal to the total number of copies - for the shard (number of replicas + 1) - :param wait_for_completion: Should the request should block until the delete - by query is complete. + :param search_type: The type of the search operation. Available options: `query_then_fetch`, + `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. + 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 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`). + :param wait_for_completion: If `true`, the request blocks until the operation + is complete. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1340,9 +1375,9 @@ def delete_by_query_rethrottle( ``_ - :param task_id: The task id to rethrottle - :param requests_per_second: The throttle to set on this request in floating sub-requests - per second. -1 means set no throttle. + :param task_id: The ID for the task. + :param requests_per_second: The throttle for this request in sub-requests per + second. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -1384,9 +1419,12 @@ def delete_script( ``_ - :param id: Script ID - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :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. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -1453,25 +1491,28 @@ def exists( ``_ - :param index: The name of the index - :param id: The document ID - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param realtime: Specify whether to perform the operation in realtime or search - mode - :param refresh: Refresh the shard containing the document before performing the - operation - :param routing: Specific routing value - :param source: True or false to return the _source field or not, or a list of - fields to return - :param source_excludes: A list of fields to exclude from the returned _source - field - :param source_includes: A list of fields to extract and return from the _source - field - :param stored_fields: A comma-separated list of stored fields to return in the - response - :param version: Explicit version number for concurrency control - :param version_type: Specific version type + :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 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: 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`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1553,23 +1594,25 @@ def exists_source( ``_ - :param index: The name of the index - :param id: The document ID - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param realtime: Specify whether to perform the operation in realtime or search - mode - :param refresh: Refresh the shard containing the document before performing the - operation - :param routing: Specific routing value - :param source: True or false to return the _source field or not, or a list of - fields to return - :param source_excludes: A list of fields to exclude from the returned _source - field - :param source_includes: A list of fields to extract and return from the _source - field - :param version: Explicit version number for concurrency control - :param version_type: Specific version type + :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 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`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1654,29 +1697,31 @@ def explain( ``_ - :param index: The name of the index - :param id: The document ID - :param analyze_wildcard: Specify whether wildcards and prefix queries in the - query string query should be analyzed (default: false) - :param analyzer: The analyzer for the query string query - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The default field for query string query (default: _all) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param q: Query in the Lucene query string syntax - :param query: - :param routing: Specific routing value - :param source: True or false to return the _source field or not, or a list of - fields to return - :param source_excludes: A list of fields to exclude from the returned _source - field - :param source_includes: A list of fields to extract and return from the _source - field + :param 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 analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. + :param analyzer: Analyzer to use for the query string. This parameter can only + be used when the `q` query string parameter is specified. + :param default_operator: The default operator for query string query: `AND` or + `OR`. + :param df: Field to use as default where no field prefix is given in the query + string. + :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. + :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 + of fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. + :param source_includes: A comma-separated list of source fields to include in + the response. :param stored_fields: A comma-separated list of stored fields to return in the - response + response. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1891,7 +1936,7 @@ def get( :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 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. @@ -1901,8 +1946,9 @@ def get( the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param stored_fields: A comma-separated list of stored fields to return 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. @@ -1967,7 +2013,7 @@ def get_script( ``_ - :param id: Script ID + :param id: Identifier for the stored script or search template. :param master_timeout: Specify timeout for connection to master """ if id in SKIP_IN_PATH: @@ -2244,31 +2290,38 @@ def index( ``_ - :param index: The name of the index + :param index: Name of the data stream or index to target. :param document: - :param id: Document ID - :param if_primary_term: only perform the index operation if the last operation - that has changed the document has the specified primary term - :param if_seq_no: only perform the index operation if the last operation that - has changed the document has the specified sequence number - :param op_type: Explicit operation type. Defaults to `index` for requests with - an explicit document ID, and to `create`for requests without an explicit - document ID - :param pipeline: The pipeline id to preprocess incoming documents with - :param refresh: If `true` 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` (the default) then do nothing with refreshes. - :param require_alias: When true, requires destination to be an alias. Default - is false - :param routing: Specific routing value - :param timeout: Explicit operation timeout - :param version: Explicit version number for concurrency control - :param version_type: Specific version type - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the index operation. Defaults to 1, meaning the primary - shard only. Set to `all` for all shard copies, otherwise set to any non-negative - value less than or equal to the total number of copies for the shard (number - of replicas + 1) + :param id: 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 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. + 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`. + :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 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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2724,16 +2777,19 @@ def msearch_template( ``_ :param search_templates: - :param index: A comma-separated list of index names to use as default - :param ccs_minimize_roundtrips: Indicates whether network round-trips should - be minimized as part of cross-cluster search requests execution - :param max_concurrent_searches: Controls the maximum number of concurrent searches - the multi search api will execute - :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 search_type: Search operation type - :param typed_keys: Specify whether aggregation and suggester names should be - prefixed by their respective types in the response + :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 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 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 typed_keys: If `true`, the response prefixes aggregation and suggester + names with their respective types. """ if search_templates is None: raise ValueError("Empty value passed for parameter 'search_templates'") @@ -2807,32 +2863,26 @@ def mtermvectors( ``_ - :param index: The index in which the document resides. - :param docs: - :param field_statistics: Specifies if document count, sum of document frequencies - and sum of total term frequencies should be returned. Applies to all returned - documents unless otherwise specified in body "params" or "docs". - :param fields: A comma-separated list of fields to return. Applies to all returned - documents unless otherwise specified in body "params" or "docs". - :param ids: - :param offsets: Specifies if term offsets should be returned. Applies to all - returned documents unless otherwise specified in body "params" or "docs". - :param payloads: Specifies if term payloads should be returned. Applies to all - returned documents unless otherwise specified in body "params" or "docs". - :param positions: Specifies if term positions should be returned. Applies to - all returned documents unless otherwise specified in body "params" or "docs". - :param preference: Specify the node or shard the operation should be performed - on (default: random) .Applies to all returned documents unless otherwise - specified in body "params" or "docs". - :param realtime: Specifies if requests are real-time as opposed to near-real-time - (default: true). - :param routing: Specific routing value. Applies to all returned documents unless - otherwise specified in body "params" or "docs". - :param term_statistics: Specifies if total term frequency and document frequency - should be returned. Applies to all returned documents unless otherwise specified - in body "params" or "docs". - :param version: Explicit version number for concurrency control - :param version_type: Specific version type + :param index: Name of the index that contains the documents. + :param docs: 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 + 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 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 version: If `true`, returns the document version as part of a hit. + :param version_type: Specific version type. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_mtermvectors" @@ -2924,14 +2974,16 @@ def open_point_in_time( :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: Specific the time to live for the point in time - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param routing: Specific routing value + :param keep_alive: Extends the time to live of the corresponding point in time. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :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. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2987,11 +3039,18 @@ def put_script( ``_ - :param id: Script ID - :param script: - :param context: Script context - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :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. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -3156,27 +3215,28 @@ def reindex( ``_ - :param dest: - :param source: - :param conflicts: - :param max_docs: - :param refresh: Should the affected indexes be refreshed? - :param requests_per_second: The throttle to set on this request in sub-requests - per second. -1 means no throttle. - :param require_alias: - :param script: - :param scroll: Control how long to keep the search context alive + :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 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. + :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 size: :param slices: The number of slices this task should be divided into. Defaults - to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. - :param timeout: Time each individual bulk request should wait for shards that - are unavailable. - :param wait_for_active_shards: Sets the number of shard copies that must be active - before proceeding with the reindex operation. Defaults to 1, meaning the - primary shard only. Set to `all` for all shard copies, otherwise set to any - non-negative value less than or equal to the total number of copies for the - shard (number of replicas + 1) - :param wait_for_completion: Should the request should block until the reindex + 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 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`). + :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ if dest is None: @@ -3245,9 +3305,9 @@ def reindex_rethrottle( ``_ - :param task_id: The task id to rethrottle - :param requests_per_second: The throttle to set on this request in floating sub-requests - per second. -1 means set no throttle. + :param task_id: Identifier for the task. + :param requests_per_second: The throttle for this request in sub-requests per + second. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -3291,10 +3351,14 @@ def render_search_template( ``_ - :param id: The id of the stored search template + :param id: 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: - :param source: + :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. + If no `id` or `` is specified, this parameter is required. """ if id not in SKIP_IN_PATH: __path = f"/_render/template/{_quote(id)}" @@ -3346,9 +3410,9 @@ def scripts_painless_execute( ``_ - :param context: - :param context_setup: - :param script: + :param context: The context that the script should run in. + :param context_setup: Additional parameters for the `context`. + :param script: The Painless script to execute. """ __path = "/_scripts/painless/_execute" __body: t.Dict[str, t.Any] = {} @@ -4124,20 +4188,24 @@ def search_shards( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param routing: Specific routing value + :param index: Returns the indices and shards that a search request would be executed + against. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. 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 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. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_search_shards" @@ -4226,24 +4294,30 @@ def search_template( :param index: Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*). - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param ccs_minimize_roundtrips: Indicates whether network round-trips should - be minimized as part of cross-cluster search requests execution - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param explain: + :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 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 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. - :param ignore_throttled: Whether specified concrete, expanded or aliased indices - should be ignored when throttled - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param params: - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param profile: + :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 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. @@ -4253,8 +4327,8 @@ def search_template( :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. - :param typed_keys: Specify whether aggregation and suggester names should be - prefixed by their respective types in the response + :param typed_keys: If `true`, the response prefixes aggregation and suggester + names with their respective types. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_search/template" @@ -4429,26 +4503,28 @@ def termvectors( ``_ - :param index: The index in which the document resides. - :param id: The id of the document, when not specified a doc param should be supplied. - :param doc: - :param field_statistics: Specifies if document count, sum of document frequencies - and sum of total term frequencies should be returned. - :param fields: A comma-separated list of fields to return. - :param filter: - :param offsets: Specifies if term offsets should be returned. - :param payloads: Specifies if term payloads should be returned. - :param per_field_analyzer: - :param positions: Specifies if term positions should be returned. - :param preference: Specify the node or shard the operation should be performed - on (default: random). - :param realtime: Specifies if request is real-time as opposed to near-real-time - (default: true). - :param routing: Specific routing value. - :param term_statistics: Specifies if total term frequency and document frequency - should be returned. - :param version: Explicit version number for concurrency control - :param version_type: Specific version type + :param index: Name of the index that contains the document. + :param id: Unique identifier of 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 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 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 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 version: If `true`, returns the document version as part of a hit. + :param version_type: Specific version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4725,64 +4801,75 @@ def update_by_query( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string - :param conflicts: - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :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 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`. + :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`. :param from_: Starting offset (default: 0) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param max_docs: - :param pipeline: Ingest pipeline to set on index requests made by this action. - (default: none) - :param preference: Specify the node or shard the operation should be performed - on (default: random) - :param query: - :param refresh: Should the affected indexes be refreshed? - :param request_cache: Specify if request cache should be used for this request - or not, defaults to index level setting - :param requests_per_second: The throttle to set on this request in sub-requests - per second. -1 means no throttle. - :param routing: A comma-separated list of specific routing values - :param script: - :param scroll: Specify how long a consistent view of the index should be maintained - for scrolled search - :param scroll_size: Size on the scroll request powering the update by query - :param search_timeout: Explicit timeout for each search request. Defaults to - no timeout. - :param search_type: Search operation type - :param slice: - :param slices: The number of slices this task should be divided into. Defaults - to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. - :param sort: A comma-separated list of : pairs - :param stats: Specific 'tag' of the request for logging and statistical purposes - :param terminate_after: The maximum number of documents to collect for each shard, - upon reaching which the query execution will terminate early. - :param timeout: Time each individual bulk request should wait for shards that - are unavailable. - :param version: Specify whether to return document version as part of a hit + :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. + :param max_docs: The maximum number of documents to update. + :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 + parameter. + :param preference: Specifies the node or shard the operation should be performed + on. Random by default. + :param query: Specifies the documents to update using the Query DSL. + :param refresh: If `true`, Elasticsearch refreshes affected shards to make the + operation visible to search. + :param request_cache: If `true`, the request cache is used for this request. + :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 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 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. + 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. + :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: Sets the number of shard copies that must be active - before proceeding with the update by query operation. Defaults to 1, meaning - the primary shard only. Set to `all` for all shard copies, otherwise set - to any non-negative value less than or equal to the total number of copies - for the shard (number of replicas + 1) - :param wait_for_completion: Should the request should block until the update - by query operation is complete. + :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`). + :param wait_for_completion: If `true`, the request blocks until the operation + is complete. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4901,9 +4988,9 @@ def update_by_query_rethrottle( ``_ - :param task_id: The task id to rethrottle - :param requests_per_second: The throttle to set on this request in floating sub-requests - per second. -1 means set no throttle. + :param task_id: The ID for the task. + :param requests_per_second: The throttle for this request in sub-requests per + second. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") diff --git a/elasticsearch/_sync/client/enrich.py b/elasticsearch/_sync/client/enrich.py index 0702daa0d..337f2e89b 100644 --- a/elasticsearch/_sync/client/enrich.py +++ b/elasticsearch/_sync/client/enrich.py @@ -41,7 +41,7 @@ def delete_policy( ``_ - :param name: The name of the enrich policy + :param name: Enrich policy to delete. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -78,9 +78,9 @@ def execute_policy( ``_ - :param name: The name of the enrich policy - :param wait_for_completion: Should the request should block until the execution - is complete. + :param name: Enrich policy to execute. + :param wait_for_completion: If `true`, the request blocks other enrich policy + execution requests until complete. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -118,7 +118,8 @@ def get_policy( ``_ - :param name: A comma-separated list of enrich policy names + :param name: Comma-separated list of enrich policy names used to limit the request. + To return information for all enrich policies, omit this parameter. """ if name not in SKIP_IN_PATH: __path = f"/_enrich/policy/{_quote(name)}" @@ -160,10 +161,12 @@ def put_policy( ``_ - :param name: The name of the enrich policy - :param geo_match: - :param match: - :param range: + :param name: Name of the enrich policy to create or update. + :param geo_match: Matches enrich data to incoming documents based on a `geo_shape` + query. + :param match: Matches enrich data to incoming documents based on a `term` query. + :param range: Matches a number, date, or IP address in incoming documents to + a range in the enrich index based on a `term` query. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") diff --git a/elasticsearch/_sync/client/eql.py b/elasticsearch/_sync/client/eql.py index e299f4ec9..c6b314b0b 100644 --- a/elasticsearch/_sync/client/eql.py +++ b/elasticsearch/_sync/client/eql.py @@ -42,7 +42,9 @@ def delete( ``_ - :param id: Identifier for the search to delete. + :param id: Identifier for the search to delete. A search ID is provided in the + EQL search API's response for an async search. A search ID is also provided + if the request’s `keep_on_completion` parameter is `true`. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -80,7 +82,7 @@ def get( """ Returns async results from previously executed Event Query Language (EQL) search - ``_ + `< https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-eql-search-api.html>`_ :param id: Identifier for the search. :param keep_alive: Period for which the search and its results are stored on @@ -127,7 +129,7 @@ def get_status( Returns the status of a previously submitted async or stored Event Query Language (EQL) search - ``_ + `< https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-eql-status-api.html>`_ :param id: Identifier for the search. """ diff --git a/elasticsearch/_sync/client/graph.py b/elasticsearch/_sync/client/graph.py index faec2c57c..b36206995 100644 --- a/elasticsearch/_sync/client/graph.py +++ b/elasticsearch/_sync/client/graph.py @@ -52,14 +52,18 @@ def explore( ``_ - :param index: A comma-separated list of index names to search; use `_all` or - empty string to perform the operation on all indices - :param connections: - :param controls: - :param query: - :param routing: Specific routing value - :param timeout: Explicit operation timeout - :param vertices: + :param index: Name of the index. + :param connections: Specifies or more fields from which you want to extract terms + that are associated with the specified vertices. + :param controls: Direct the Graph API how to build the graph. + :param query: A seed query that identifies the documents of interest. Can be + any valid Elasticsearch query. + :param routing: Custom value used to route operations to a specific shard. + :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 vertices: Specifies one or more fields that contain the terms you want + to include in the graph as vertices. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index 70a982ec3..a175f33fd 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -146,16 +146,26 @@ def analyze( ``_ - :param index: The name of the index to scope the operation - :param analyzer: - :param attributes: - :param char_filter: - :param explain: - :param field: - :param filter: - :param normalizer: - :param text: - :param tokenizer: + :param index: Index used to derive the analyzer. If specified, the `analyzer` + or field parameter overrides this value. If no index is specified or the + index does not have a default analyzer, the analyze API uses the standard + analyzer. + :param analyzer: The name of the analyzer that should be applied to the provided + `text`. This could be a built-in analyzer, or an analyzer that’s been configured + in the index. + :param attributes: Array of token attributes used to filter the output of the + `explain` parameter. + :param char_filter: Array of character filters used to preprocess characters + before the tokenizer. + :param explain: If `true`, the response includes token attributes and additional + details. + :param field: Field used to derive the analyzer. To use this parameter, you must + specify an index. If specified, the `analyzer` parameter overrides this value. + :param filter: Array of token filters used to apply after the tokenizer. + :param normalizer: Normalizer to use to convert text into a single token. + :param text: Text to analyze. If an array of strings is provided, it is analyzed + as a multi-value field. + :param tokenizer: Tokenizer to use to convert text into tokens. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_analyze" @@ -241,19 +251,24 @@ def clear_cache( ``_ - :param index: A comma-separated list of index name to limit the operation - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param fielddata: Clear field data - :param fields: A comma-separated list of fields to clear when using the `fielddata` - parameter (default: all) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param query: Clear query caches - :param request: Clear request cache + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :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 fielddata: If `true`, clears the fields cache. Use the `fields` parameter + to clear the cache of specific fields only. + :param fields: Comma-separated list of field names used to limit the `fielddata` + parameter. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param query: If `true`, clears the query cache. + :param request: If `true`, clears the request cache. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_cache/clear" @@ -316,14 +331,18 @@ def clone( ``_ - :param index: The name of the source index to clone - :param target: The name of the target index to clone into - :param aliases: - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for on - the cloned index before the operation returns. + :param index: Name of the source index to clone. + :param target: Name of the target index to create. + :param aliases: Aliases for the resulting index. + :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 settings: Configuration options for the target index. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -401,20 +420,27 @@ def close( """ Closes an index. - ``_ + ``_ - :param index: A comma separated list of indices to close - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Sets the number of active shards to wait for before - the operation returns. + :param index: Comma-separated list or wildcard expression of index names used + to limit the request. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -474,15 +500,19 @@ def create( ``_ - :param index: The name of the index - :param aliases: + :param index: Name of the index you wish to create. + :param aliases: Aliases for the index. :param mappings: Mapping for fields in the index. If specified, this mapping can include: - Field names - Field data types - Mapping parameters - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for before - the operation returns. + :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 settings: Configuration options for the index. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -660,15 +690,24 @@ def delete( ``_ - :param index: A comma-separated list of indices to delete; use `_all` or `*` - string to delete all indices - :param allow_no_indices: Ignore if a wildcard expression resolves to no concrete - indices (default: false) - :param expand_wildcards: Whether wildcard expressions should get expanded to - open, closed, or hidden indices - :param ignore_unavailable: Ignore unavailable indexes (default: false) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :param index: Comma-separated list of indices to delete. You cannot specify index + aliases. By default, this parameter does not support wildcards (`*`) or `_all`. + To use wildcards or `_all`, set the `action.destructive_requires_name` cluster + setting to `false`. + :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. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -719,12 +758,15 @@ def delete_alias( ``_ - :param index: A comma-separated list of index names (supports wildcards); use - `_all` for all indices - :param name: A comma-separated list of aliases to delete (supports wildcards); - use `_all` to delete all aliases for the specified indices. - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit timestamp for the document + :param index: Comma-separated list of data streams or indices used to limit the + request. Supports wildcards (`*`). + :param name: Comma-separated list of aliases to remove. Supports wildcards (`*`). + To remove all aliases, use `*` or `_all`. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -784,12 +826,12 @@ def delete_data_lifecycle( timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes the data lifecycle of the selected data streams. + Deletes the data stream lifecycle of the selected data streams. - ``_ + ``_ - :param name: A comma-separated list of data streams of which the data lifecycle - will be deleted; use `*` to get all data streams + :param name: A comma-separated list of data streams of which the data stream + lifecycle will be deleted; use `*` to get all data streams :param expand_wildcards: Whether wildcard expressions should get expanded to open or closed indices (default: open) :param master_timeout: Specify timeout for connection to master @@ -948,9 +990,13 @@ def delete_template( ``_ - :param name: The name of the template - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout + :param name: The name of the legacy index template to delete. Wildcard (`*`) + expressions are supported. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -1017,20 +1063,20 @@ def disk_usage( index (or the latest backing index of a data stream) as the API consumes resources significantly. :param allow_no_indices: If false, the request returns an error if any wildcard - expression, index alias, or _all value targets only missing or closed indices. + expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For - example, a request targeting foo*,bar* returns an error if an index starts - with foo but no index starts with bar. + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. :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 flush: If true, the API performs a flush before analysis. If false, the - response may not include uncommitted data. - :param ignore_unavailable: If true, missing or closed indices are not included + as `open,hidden`. + :param flush: If `true`, the API performs a flush before analysis. If `false`, + the response may not include uncommitted data. + :param ignore_unavailable: If `true`, missing or closed indices are not included in the response. :param run_expensive_tasks: Analyzing field disk usage is resource-intensive. - To use the API, this parameter must be set to true. + To use the API, this parameter must be set to `true`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1078,10 +1124,10 @@ def downsample( """ Downsample an index - ``_ + ``_ - :param index: The index to downsample - :param target_index: The name of the target index to store downsampled data + :param index: Name of the time series index to downsample. + :param target_index: Name of the index to create. :param config: """ if index in SKIP_IN_PATH: @@ -1146,17 +1192,21 @@ def exists( ``_ - :param index: A comma-separated list of index names - :param allow_no_indices: Ignore if a wildcard expression resolves to no concrete - indices (default: false) - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) - :param flat_settings: Return settings in flat format (default: false) - :param ignore_unavailable: Ignore unavailable indexes (default: false) - :param include_defaults: Whether to return all default setting for each of the - indices. - :param local: Return local information, do not retrieve the state from master - node (default: false) + :param index: Comma-separated list of data streams, indices, and aliases. 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. + :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 flat_settings: If `true`, returns settings in flat format. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param include_defaults: If `true`, return all default settings in the response. + :param local: If `true`, the request retrieves information from the local node + only. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1226,17 +1276,21 @@ def exists_alias( ``_ - :param name: A comma-separated list of alias names to return - :param index: A comma-separated list of index names to filter aliases - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param local: Return local information, do not retrieve the state from master - node (default: false) + :param name: Comma-separated list of aliases to check. Supports wildcards (`*`). + :param index: Comma-separated list of data streams or indices used to limit the + request. Supports wildcards (`*`). To target all data streams and indices, + omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, requests that include a missing data stream + or index in the target indices or data streams return an error. + :param local: If `true`, the request retrieves information from the local node + only. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -1381,10 +1435,10 @@ def explain_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the index's current DLM lifecycle, such as any potential - encountered error, time since creation etc. + Retrieves information about the index's current data stream lifecycle, such as + any potential encountered error, time since creation etc. - ``_ + ``_ :param index: The name of the index to explain :param include_defaults: indicates if the API should return the default values @@ -1461,8 +1515,8 @@ def field_usage_stats( :param index: Comma-separated list or wildcard expression of index names used to limit the request. - :param allow_no_indices: If false, the request returns an error if any wildcard - expression, index alias, or _all value targets only missing or closed indices. + :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`. @@ -1472,7 +1526,7 @@ def field_usage_stats( as `open,hidden`. :param fields: Comma-separated list or wildcard expressions of fields to include in the statistics. - :param ignore_unavailable: If true, missing or closed indices are not included + :param ignore_unavailable: If `true`, missing or closed indices are not included in the response. :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 @@ -1553,23 +1607,23 @@ def flush( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - for all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param force: Whether a flush should be forced even if it is not necessarily - needed ie. if no changes will be committed to the index. This is useful if - transaction log IDs should be incremented even if no uncommitted changes - are present. (This setting can be considered as internal) - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param wait_if_ongoing: If set to true the flush operation will block until the - flush can be executed if another flush operation is already executing. The - default is true. If set to false the flush will be skipped iff if another - flush operation is already running. + :param index: Comma-separated list of data streams, indices, and aliases to flush. + Supports wildcards (`*`). To flush 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. + :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 force: If `true`, the request forces a flush even if there are no changes + to commit to the index. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param wait_if_ongoing: If `true`, the flush operation blocks until execution + when another flush operation is running. If `false`, Elasticsearch returns + an error if you request a flush when another flush operation is running. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_flush" @@ -1842,17 +1896,22 @@ def get_alias( ``_ - :param index: A comma-separated list of index names to filter aliases - :param name: A comma-separated list of alias names to return - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param local: Return local information, do not retrieve the state from master - node (default: false) + :param index: Comma-separated list of data streams or indices used to limit the + request. Supports wildcards (`*`). To target all data streams and indices, + omit this parameter or use `*` or `_all`. + :param name: Comma-separated list of aliases to retrieve. Supports wildcards + (`*`). To retrieve all aliases, 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. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param local: If `true`, the request retrieves information from the local node + only. """ if index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_alias/{_quote(name)}" @@ -1916,16 +1975,17 @@ def get_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the data lifecycle of the selected data streams. + Returns the data stream lifecycle of the selected data streams. - ``_ + ``_ - :param name: A comma-separated list of data streams to get; use `*` to get all - data streams - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) - :param include_defaults: Return all relevant default configurations for the data - stream (default: false) + :param name: Comma-separated list of data streams to limit the request. Supports + wildcards (`*`). To target all data streams, omit this parameter or use `*` + or `_all`. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values, such as `open,hidden`. Valid values are: + `all`, `open`, `closed`, `hidden`, `none`. + :param include_defaults: If `true`, return all default settings in the response. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -2054,19 +2114,23 @@ def get_field_mapping( ``_ - :param fields: A comma-separated list of fields - :param index: A comma-separated list of index names - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param include_defaults: Whether the default mapping values should be returned - as well - :param local: Return local information, do not retrieve the state from master - node (default: false) + :param fields: Comma-separated list or wildcard expression of fields used to + limit returned information. + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param include_defaults: If `true`, return all default settings in the response. + :param local: If `true`, the request retrieves information from the local node + only. """ if fields in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'fields'") @@ -2202,17 +2266,23 @@ def get_mapping( ``_ - :param index: A comma-separated list of index names - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Specify timeout for connection to master + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param 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. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param local: If `true`, the request retrieves information from the local node + only. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_mapping" @@ -2367,11 +2437,15 @@ def get_template( ``_ - :param name: The comma separated names of the index templates - :param flat_settings: Return settings in flat format (default: false) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Explicit operation timeout for connection to master node + :param name: Comma-separated list of index template names used to limit the request. + Wildcard (`*`) expressions are supported. To return all index templates, + omit this parameter or use a value of `_all` or `*`. + :param flat_settings: If `true`, returns settings in flat format. + :param local: If `true`, the request retrieves information from the local node + only. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. """ if name not in SKIP_IN_PATH: __path = f"/_template/{_quote(name)}" @@ -2520,18 +2594,29 @@ def open( ``_ - :param index: A comma separated list of indices to open - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Sets the number of active shards to wait for before - the operation returns. + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). By default, you must explicitly + name the indices you using to limit the request. To limit a request using + `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` + setting to false. You can update this setting in the `elasticsearch.yml` + file or using the cluster update settings API. + :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. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2628,16 +2713,31 @@ def put_alias( ``_ - :param index: A comma-separated list of index names the alias should point to - (supports wildcards); use `_all` to perform the operation on all indices. - :param name: The name of the alias to be created or updated - :param filter: - :param index_routing: - :param is_write_index: - :param master_timeout: Specify timeout for connection to master - :param routing: - :param search_routing: - :param timeout: Explicit timestamp for the document + :param index: Comma-separated list of data streams or indices to add. Supports + wildcards (`*`). Wildcard patterns that match both data streams and indices + return an error. + :param name: Alias to update. If the alias doesn’t exist, the request creates + it. Index alias names support date math. + :param filter: Query used to limit documents the alias can access. + :param index_routing: Value used to route indexing operations to a specific shard. + If specified, this overwrites the `routing` value for indexing operations. + Data stream aliases don’t support this parameter. + :param is_write_index: If `true`, sets the write index or data stream for the + alias. If an alias points to multiple indices or data streams and `is_write_index` + isn’t set, the alias rejects write requests. If an index alias points to + one index and `is_write_index` isn’t set, the index automatically acts as + the write index. Data stream aliases don’t automatically set a write data + stream, even if the alias points to one data stream. + :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 routing: Value used to route indexing and search operations to a specific + shard. Data stream aliases don’t support this parameter. + :param search_routing: Value used to route search operations to a specific shard. + If specified, this overwrites the `routing` value for search operations. + Data stream aliases don’t support this parameter. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2687,6 +2787,7 @@ def put_data_lifecycle( data_retention: t.Optional[ t.Union["t.Literal[-1]", "t.Literal[0]", str] ] = None, + downsampling: t.Optional[t.Mapping[str, t.Any]] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ t.Union[ @@ -2717,17 +2818,27 @@ def put_data_lifecycle( timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the data lifecycle of the selected data streams. + Updates the data stream lifecycle of the selected data streams. - ``_ + ``_ - :param name: A comma-separated list of data streams whose lifecycle will be updated; - use `*` to set the lifecycle to all data streams - :param data_retention: - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit timestamp for the document + :param name: Comma-separated list of data streams used to limit the request. + Supports wildcards (`*`). To target all data streams use `*` or `_all`. + :param data_retention: If defined, every document added to this data stream will + be stored at least for this time frame. Any time after this duration the + document could be deleted. When empty, every document in this data stream + will be stored indefinitely. + :param downsampling: If defined, every backing index will execute the configured + downsampling configuration after the backing index is not the data stream + write index anymore. + :param expand_wildcards: Type of data stream that wildcard patterns can match. + Supports comma-separated values, such as `open,hidden`. Valid values are: + `all`, `hidden`, `open`, `closed`, `none`. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -2736,6 +2847,8 @@ def put_data_lifecycle( __query: t.Dict[str, t.Any] = {} if data_retention is not None: __body["data_retention"] = data_retention + if downsampling is not None: + __body["downsampling"] = downsampling if error_trace is not None: __query["error_trace"] = error_trace if expand_wildcards is not None: @@ -2790,15 +2903,26 @@ def put_index_template( ``_ :param name: Index or template name - :param composed_of: - :param create: Whether the index template should only be added if new or can - also replace an existing one - :param data_stream: - :param index_patterns: - :param meta: - :param priority: - :param template: - :param version: + :param composed_of: An ordered list of component template names. Component templates + are merged in the order specified, meaning that the last component template + specified has the highest precedence. + :param create: If `true`, this request cannot replace or update existing index + templates. + :param data_stream: If this object is included, the template is used to create + data streams and their backing indices. Supports an empty object. Data streams + require a matching index template with a `data_stream` object. + :param index_patterns: Name of the index template to create. + :param meta: Optional user metadata about the index template. May have any contents. + This map is not automatically generated by Elasticsearch. + :param priority: Priority to determine index template precedence when a new data + stream or index is created. The index template with the highest priority + is chosen. If no priority is specified the template is treated as though + it is of priority 0 (lowest priority). This number is not automatically generated + by Elasticsearch. + :param template: Template to be applied. It may optionally include an `aliases`, + `mappings`, or `settings` configuration. + :param version: Version number used to manage index templates externally. This + number is not automatically generated by Elasticsearch. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -2909,21 +3033,25 @@ def put_mapping( :param index: A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) + :param 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. :param date_detection: Controls whether dynamic date detection is enabled. :param dynamic: Controls whether new fields are added dynamically. :param dynamic_date_formats: If date detection is enabled then new string fields are checked against 'dynamic_date_formats' and if the value matches then a new date field is added instead of string. :param dynamic_templates: Specify dynamic templates for the mapping. - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. :param field_names: Control whether field names are enabled for the index. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. :param meta: A mapping type can have custom meta data associated with it. These are not used at all by Elasticsearch, but can be used to store application-specific metadata. @@ -2934,9 +3062,10 @@ def put_mapping( :param routing: Enable making a routing value required on indexed documents. :param runtime: Mapping of runtime fields for the index. :param source: Control whether the _source field is enabled on the index. - :param timeout: Explicit operation timeout - :param write_index_only: When true, applies mappings only to the write index - of an alias or data stream + :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 write_index_only: If `true`, the mappings are applied only to the current + write index for the target. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3130,7 +3259,7 @@ def put_template( :param aliases: Aliases for the index. :param create: If true, this request cannot replace or update existing index templates. - :param flat_settings: + :param flat_settings: If `true`, returns settings in flat format. :param index_patterns: Array of wildcard expressions used to match the names of indices during creation. :param mappings: Mapping for fields in the index. @@ -3142,7 +3271,8 @@ def put_template( Templates with higher 'order' values are merged later, overriding templates with lower values. :param settings: Configuration options for the index. - :param timeout: + :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 version: Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. """ @@ -3203,10 +3333,12 @@ def recovery( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param active_only: Display only those recoveries that are currently on-going - :param detailed: Whether to display detailed information about shard recovery + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param active_only: If `true`, the response only includes ongoing shard recoveries. + :param detailed: If `true`, the response includes detailed information about + shard recoveries. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_recovery" @@ -3267,15 +3399,18 @@ def refresh( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_refresh" @@ -3405,9 +3540,13 @@ def resolve_index( ``_ - :param name: A comma-separated list of names or wildcard expressions - :param expand_wildcards: Whether wildcard expressions should get expanded to - open or closed indices (default: open) + :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, + and data streams to resolve. Resources on remote clusters can be specified + using the ``:`` syntax. + :param 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`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3461,18 +3600,31 @@ def rollover( ``_ - :param alias: The name of the alias to rollover - :param new_index: The name of the rollover index - :param aliases: - :param conditions: - :param dry_run: If set to true the rollover action will only be validated but - not actually performed even if a condition matches. The default is false - :param mappings: - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for on - the newly created rollover index before the operation returns. + :param alias: Name of the data stream or index alias to roll over. + :param new_index: Name of the index to create. Supports date math. Data streams + do not support this parameter. + :param aliases: Aliases for the target index. Data streams do not support this + parameter. + :param conditions: Conditions for the rollover. If specified, Elasticsearch only + performs the rollover if the current index satisfies these conditions. If + this parameter is not specified, Elasticsearch performs the rollover unconditionally. + If conditions are specified, at least one of them must be a `max_*` condition. + The index will rollover if any `max_*` condition is satisfied and all `min_*` + conditions are satisfied. + :param dry_run: If `true`, checks whether the current index satisfies the specified + conditions but does not perform a rollover. + :param mappings: Mapping for fields in the index. If specified, this mapping + can include field names, field data types, and mapping paramaters. + :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 settings: Configuration options for the index. Data streams do not support + this parameter. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if alias in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'alias'") @@ -3555,16 +3707,19 @@ def segments( ``_ - :param index: A comma-separated list of index names; use `_all` or empty string - to perform the operation on all indices - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param verbose: Includes detailed memory usage by Lucene. + :param index: Comma-separated list of data streams, indices, and aliases used + to limit the request. Supports wildcards (`*`). To target all data streams + and indices, omit this parameter or use `*` or `_all`. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param verbose: If `true`, the request returns a verbose response. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_segments" @@ -3706,14 +3861,18 @@ def shrink( ``_ - :param index: The name of the source index to shrink - :param target: The name of the target index to shrink into - :param aliases: - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for on - the shrunken index before the operation returns. + :param index: Name of the source index to shrink. + :param target: Name of the target index to create. + :param aliases: The key is the alias name. Index alias names support date math. + :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 settings: Configuration options for the target index. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3785,23 +3944,40 @@ def simulate_index_template( ``_ :param name: Index or template name to simulate - :param allow_auto_create: - :param composed_of: + :param allow_auto_create: This setting overrides the value of the `action.auto_create_index` + cluster setting. If set to `true` in a template, then indices can be automatically + created using that template even if auto-creation of indices is disabled + via `actions.auto_create_index`. If set to `false`, then indices or data + streams matching the template must always be explicitly created, and may + never be automatically created. + :param composed_of: An ordered list of component template names. Component templates + are merged in the order specified, meaning that the last component template + specified has the highest precedence. :param create: If `true`, the template passed in the body is only used if no existing templates match the same index patterns. If `false`, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. - :param data_stream: + :param data_stream: If this object is included, the template is used to create + data streams and their backing indices. Supports an empty object. Data streams + require a matching index template with a `data_stream` object. :param include_defaults: If true, returns all relevant default configurations for the index template. - :param index_patterns: + :param index_patterns: Array of wildcard (`*`) expressions used to match the + names of data streams and indices during creation. :param master_timeout: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - :param meta: - :param priority: - :param template: - :param version: + :param meta: Optional user metadata about the index template. May have any contents. + This map is not automatically generated by Elasticsearch. + :param priority: Priority to determine index template precedence when a new data + stream or index is created. The index template with the highest priority + is chosen. If no priority is specified the template is treated as though + it is of priority 0 (lowest priority). This number is not automatically generated + by Elasticsearch. + :param template: Template to be applied. It may optionally include an `aliases`, + `mappings`, or `settings` configuration. + :param version: Version number used to manage index templates externally. This + number is not automatically generated by Elasticsearch. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3944,14 +4120,18 @@ def split( ``_ - :param index: The name of the source index to split - :param target: The name of the target index to split into - :param aliases: - :param master_timeout: Specify timeout for connection to master - :param settings: - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Set the number of active shards to wait for on - the shrunken index before the operation returns. + :param index: Name of the source index to split. + :param target: Name of the target index to create. + :param aliases: Aliases for the resulting index. + :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 settings: Configuration options for the target index. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4151,18 +4331,24 @@ def unfreeze( ``_ - :param index: The name of the index to unfreeze - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param master_timeout: Specify timeout for connection to master - :param timeout: Explicit operation timeout - :param wait_for_active_shards: Sets the number of active shards to wait for before - the operation returns. + :param index: Identifier for the index. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values, such + as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_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`). """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4218,9 +4404,12 @@ def update_aliases( ``_ - :param actions: - :param master_timeout: Specify timeout for connection to master - :param timeout: Request timeout + :param actions: Actions to perform. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ __path = "/_aliases" __body: t.Dict[str, t.Any] = {} @@ -4293,31 +4482,36 @@ def validate_query( ``_ - :param index: A comma-separated list of index names to restrict the operation; - use `_all` or empty string to perform the operation on all indices - :param all_shards: Execute validation on all shards instead of one random shard - per index - :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves - into no concrete indices. (This includes `_all` string or when no indices - have been specified) - :param analyze_wildcard: Specify whether wildcard and prefix queries should be - analyzed (default: false) - :param analyzer: The analyzer to use for the query string - :param default_operator: The default operator for query string query (AND or - OR) - :param df: The field to use as default where no field prefix is given in the - query string - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. - :param explain: Return detailed information about the error - :param ignore_unavailable: Whether specified concrete indices should be ignored - when unavailable (missing or closed) - :param lenient: Specify whether format-based query failures (such as providing - text to a numeric field) should be ignored - :param q: Query in the Lucene query string syntax - :param query: - :param rewrite: Provide a more detailed explanation showing the actual Lucene - query that will be executed. + :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 all_shards: If `true`, the validation is executed on all shards instead + of one random shard per index. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. + :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. + :param analyzer: Analyzer to use for the query string. This parameter can only + be used when the `q` query string parameter is specified. + :param default_operator: The default operator for query string query: `AND` or + `OR`. + :param df: Field to use as default where no field prefix is given in the query + string. This parameter can only be used when the `q` query string parameter + is specified. + :param 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 explain: If `true`, the response returns detailed information if an error + has occurred. + :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. + :param q: Query in the Lucene query string syntax. + :param query: Query in the Lucene query string syntax. + :param rewrite: If `true`, returns a more detailed explanation showing the actual + Lucene query that will be executed. """ if index not in SKIP_IN_PATH: __path = f"/{_quote(index)}/_validate/query" diff --git a/elasticsearch/_sync/client/ingest.py b/elasticsearch/_sync/client/ingest.py index b6ef297dd..43bf83f39 100644 --- a/elasticsearch/_sync/client/ingest.py +++ b/elasticsearch/_sync/client/ingest.py @@ -45,9 +45,13 @@ def delete_pipeline( ``_ - :param id: Pipeline ID - :param master_timeout: Explicit operation timeout for connection to master node - :param timeout: Explicit operation timeout + :param id: Pipeline ID or wildcard expression of pipeline IDs used to limit the + request. To delete all ingest pipelines in a cluster, use a value of `*`. + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -84,7 +88,7 @@ def geo_ip_stats( """ Returns statistical information about geoip databases - ``_ + ``_ """ __path = "/_ingest/geoip/stats" __query: t.Dict[str, t.Any] = {} @@ -122,8 +126,11 @@ def get_pipeline( ``_ - :param id: Comma separated list of pipeline ids. Wildcards supported - :param master_timeout: Explicit operation timeout for connection to master node + :param id: Comma-separated list of pipeline IDs to retrieve. Wildcard (`*`) expressions + are supported. To get all ingest pipelines, omit this parameter or use `*`. + :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 summary: Return pipelines without their definitions (default: false) """ if id not in SKIP_IN_PATH: @@ -162,7 +169,7 @@ def processor_grok( """ Returns a list of the built-in patterns. - ``_ + ``_ """ __path = "/_ingest/processor/grok" __query: t.Dict[str, t.Any] = {} @@ -211,7 +218,7 @@ def put_pipeline( """ Creates or updates a pipeline. - ``_ + ``_ :param id: ID of the ingest pipeline to create or update. :param description: Description of the ingest pipeline. @@ -294,11 +301,14 @@ def simulate( ``_ - :param id: Pipeline ID - :param docs: - :param pipeline: - :param verbose: Verbose mode. Display data output for each processor in executed - pipeline + :param id: Pipeline to test. If you don’t specify a `pipeline` in the request + body, this parameter is required. + :param docs: Sample documents to test in the pipeline. + :param pipeline: Pipeline to test. If you don’t specify the `pipeline` request + path parameter, this parameter is required. If you specify both this and + the request path parameter, the API only uses the request path parameter. + :param verbose: If `true`, the response includes output data for each processor + in the executed pipeline. """ if id not in SKIP_IN_PATH: __path = f"/_ingest/pipeline/{_quote(id)}/_simulate" diff --git a/elasticsearch/_sync/client/logstash.py b/elasticsearch/_sync/client/logstash.py index 6b4017b6f..5726c1f1b 100644 --- a/elasticsearch/_sync/client/logstash.py +++ b/elasticsearch/_sync/client/logstash.py @@ -41,7 +41,7 @@ def delete_pipeline( ``_ - :param id: The ID of the Pipeline + :param id: Identifier for the pipeline. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -77,7 +77,7 @@ def get_pipeline( ``_ - :param id: A comma-separated list of Pipeline IDs + :param id: Comma-separated list of pipeline identifiers. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -119,7 +119,7 @@ def put_pipeline( ``_ - :param id: The ID of the Pipeline + :param id: Identifier for the pipeline. :param pipeline: """ if id in SKIP_IN_PATH: diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index 6602090a5..54b984e79 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -175,8 +175,9 @@ def delete_calendar_event( ``_ - :param calendar_id: The ID of the calendar to modify - :param event_id: The ID of the event to remove from the calendar + :param calendar_id: A string that uniquely identifies a calendar. + :param event_id: Identifier for the scheduled event. You can obtain this identifier + by using the get calendar events API. """ if calendar_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'calendar_id'") @@ -1223,7 +1224,8 @@ def get_categories( API returns information about all categories. If you specify only the partition_field_value, it returns information about all categories for the specified partition. :param from_: Skips the specified number of categories. - :param page: + :param page: Configures pagination. This parameter has the `from` and `size` + properties. :param partition_field_value: Only return categories for the specified partition. :param size: Specifies the maximum number of categories to obtain. """ @@ -1587,7 +1589,8 @@ def get_influencers( :param from_: Skips the specified number of influencers. :param influencer_score: Returns influencers with anomaly scores greater than or equal to this value. - :param page: + :param page: Configures pagination. This parameter has the `from` and `size` + properties. :param size: Specifies the maximum number of influencers to obtain. :param sort: Specifies the sort field for the requested influencers. By default, the influencers are sorted by the `influencer_score` value. diff --git a/elasticsearch/_sync/client/nodes.py b/elasticsearch/_sync/client/nodes.py index ac77c9aff..310435ce7 100644 --- a/elasticsearch/_sync/client/nodes.py +++ b/elasticsearch/_sync/client/nodes.py @@ -273,10 +273,10 @@ def reload_secure_settings( ``_ - :param node_id: A comma-separated list of node IDs to span the reload/reinit - call. Should stay empty because reloading usually involves all cluster nodes. - :param secure_settings_password: - :param timeout: Explicit operation timeout + :param node_id: The names of particular nodes in the cluster to target. + :param secure_settings_password: The password for the Elasticsearch keystore. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if node_id not in SKIP_IN_PATH: __path = f"/_nodes/{_quote(node_id)}/reload_secure_settings" @@ -367,8 +367,8 @@ def stats( :param include_segment_file_sizes: If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). - :param include_unloaded_segments: If set to true segment stats will include stats - for segments that are not currently loaded into memory + :param include_unloaded_segments: If `true`, the response includes information + from segments that are not loaded into memory. :param level: Indicates whether statistics are aggregated at the cluster, index, or shard level. :param master_timeout: Period to wait for a connection to the master node. If @@ -455,8 +455,10 @@ def usage( :param node_id: A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - :param metric: Limit the information returned to the specified metrics - :param timeout: Explicit operation timeout + :param metric: Limits the information returned to the specific metrics. A comma-separated + list of the following options: `_all`, `rest_actions`. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: __path = f"/_nodes/{_quote(node_id)}/usage/{_quote(metric)}" diff --git a/elasticsearch/_sync/client/query_ruleset.py b/elasticsearch/_sync/client/query_ruleset.py new file mode 100644 index 000000000..66800288d --- /dev/null +++ b/elasticsearch/_sync/client/query_ruleset.py @@ -0,0 +1,187 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import typing as t + +from elastic_transport import ObjectApiResponse + +from ._base import NamespacedClient +from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters + + +class QueryRulesetClient(NamespacedClient): + @_rewrite_parameters() + def delete( + self, + *, + ruleset_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Deletes a query ruleset. + + ``_ + + :param ruleset_id: The unique identifier of the query ruleset to delete + """ + if ruleset_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'ruleset_id'") + __path = f"/_query_rules/{_quote(ruleset_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 + ) + + @_rewrite_parameters() + def get( + self, + *, + ruleset_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Returns the details about a query ruleset. + + ``_ + + :param ruleset_id: The unique identifier of the query ruleset + """ + if ruleset_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'ruleset_id'") + __path = f"/_query_rules/{_quote(ruleset_id)}" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters( + parameter_aliases={"from": "from_"}, + ) + def list( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + from_: t.Optional[int] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + size: t.Optional[int] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Lists query rulesets. + + ``_ + + :param from_: Starting offset (default: 0) + :param size: specifies a max number of results to get + """ + __path = "/_query_rules" + __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 from_ is not None: + __query["from"] = from_ + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if size is not None: + __query["size"] = size + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters( + body_fields=True, + ) + def put( + self, + *, + ruleset_id: str, + rules: t.Union[ + t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...] + ], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Creates or updates a query ruleset. + + ``_ + + :param ruleset_id: The unique identifier of the query ruleset to be created or + updated + :param rules: + """ + if ruleset_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'ruleset_id'") + if rules is None: + raise ValueError("Empty value passed for parameter 'rules'") + __path = f"/_query_rules/{_quote(ruleset_id)}" + __body: t.Dict[str, t.Any] = {} + __query: t.Dict[str, t.Any] = {} + if rules is not None: + __body["rules"] = rules + 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", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", __path, params=__query, headers=__headers, body=__body + ) diff --git a/elasticsearch/_sync/client/rollup.py b/elasticsearch/_sync/client/rollup.py index ec7b0e8bc..16ddc29e6 100644 --- a/elasticsearch/_sync/client/rollup.py +++ b/elasticsearch/_sync/client/rollup.py @@ -41,7 +41,7 @@ def delete_job( ``_ - :param id: The ID of the job to delete + :param id: Identifier for the job. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -77,8 +77,8 @@ def get_jobs( ``_ - :param id: The ID of the job(s) to fetch. Accepts glob patterns, or left blank - for all jobs + :param id: Identifier for the rollup job. If it is `_all` or omitted, the API + returns all rollup jobs. """ if id not in SKIP_IN_PATH: __path = f"/_rollup/job/{_quote(id)}" @@ -116,8 +116,8 @@ def get_rollup_caps( ``_ - :param id: The ID of the index to check rollup capabilities on, or left blank - for all jobs + :param id: Index, indices or index-pattern to return rollup capabilities for. + `_all` may be used to fetch rollup capabilities from all jobs. """ if id not in SKIP_IN_PATH: __path = f"/_rollup/data/{_quote(id)}" @@ -155,8 +155,8 @@ def get_rollup_index_caps( ``_ - :param index: The rollup index or index pattern to obtain rollup capabilities - from. + :param index: Data stream or index to check for rollup capabilities. Wildcard + (`*`) expressions are supported. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -316,14 +316,13 @@ def rollup_search( ``_ - :param index: The indices or index-pattern(s) (containing rollup or regular data) - that should be searched - :param aggregations: - :param aggs: - :param query: + :param index: Enables searching rolled-up data using the standard Query DSL. + :param aggregations: Specifies aggregations. + :param aggs: Specifies aggregations. + :param query: Specifies a DSL query. :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 size: Must be zero if set, as rollups work on pre-aggregated data + :param size: Must be zero if set, as rollups work on pre-aggregated data. :param typed_keys: Specify whether aggregation and suggester names should be prefixed by their respective types in the response """ @@ -374,7 +373,7 @@ def start_job( ``_ - :param id: The ID of the job to start + :param id: Identifier for the rollup job. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -412,11 +411,13 @@ def stop_job( ``_ - :param id: The ID of the job to stop - :param timeout: Block for (at maximum) the specified duration while waiting for - the job to stop. Defaults to 30s. - :param wait_for_completion: True if the API should block until the job has fully - stopped, false if should be executed async. Defaults to false. + :param id: Identifier for the rollup job. + :param timeout: If `wait_for_completion` is `true`, the API blocks for (at maximum) + the specified duration while waiting for the job to stop. If more than `timeout` + time has passed, the API throws a timeout exception. + :param wait_for_completion: If set to `true`, causes the API to block until the + indexer state completely stops. If set to `false`, the API returns immediately + and the indexer is stopped asynchronously in the background. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") diff --git a/elasticsearch/_sync/client/search_application.py b/elasticsearch/_sync/client/search_application.py index 103519409..17bfd3bbe 100644 --- a/elasticsearch/_sync/client/search_application.py +++ b/elasticsearch/_sync/client/search_application.py @@ -190,9 +190,9 @@ def list( ``_ - :param from_: Starting offset (default: 0) - :param q: Query in the Lucene query string syntax" - :param size: specifies a max number of results to get + :param from_: Starting offset. + :param q: Query in the Lucene query string syntax. + :param size: Specifies a max number of results to get. """ __path = "/_application/search_application" __query: t.Dict[str, t.Any] = {} @@ -236,10 +236,10 @@ def put( ``_ - :param name: The name of the search application to be created or updated + :param name: The name of the search application to be created or updated. :param search_application: - :param create: If true, requires that a search application with the specified - resource_id does not already exist. (default: false) + :param create: If `true`, this request cannot replace or update existing Search + Applications. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -280,7 +280,7 @@ def put_behavioral_analytics( ``_ - :param name: The name of the analytics collection to be created or updated + :param name: The name of the analytics collection to be created or updated. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -320,8 +320,9 @@ def search( ``_ - :param name: The name of the search application to be searched - :param params: + :param name: The name of the search application to be searched. + :param params: Query parameters specific to this request, which will override + any defaults specified in the template. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") diff --git a/elasticsearch/_sync/client/sql.py b/elasticsearch/_sync/client/sql.py index e65aa4403..4f8b37e3a 100644 --- a/elasticsearch/_sync/client/sql.py +++ b/elasticsearch/_sync/client/sql.py @@ -43,7 +43,7 @@ def clear_cursor( ``_ - :param cursor: + :param cursor: Cursor to clear. """ if cursor is None: raise ValueError("Empty value passed for parameter 'cursor'") @@ -83,7 +83,7 @@ def delete_async( ``_ - :param id: The async search ID + :param id: Identifier for the search. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -126,7 +126,7 @@ def get_async( ``_ - :param id: The async search ID + :param id: Identifier for the search. :param delimiter: Separator for CSV results. The API only supports this parameter for CSV responses. :param format: Format for the response. You must specify a format using this @@ -180,7 +180,7 @@ def get_async_status( ``_ - :param id: The async search ID + :param id: Identifier for the search. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -243,14 +243,16 @@ def query( execute on the data in the local cluster only. :param columnar: If true, the results in a columnar fashion: one row represents all the values of a certain column from the current page of results. - :param cursor: + :param cursor: Cursor used to retrieve a set of paginated results. If you specify + a cursor, the API only uses the `columnar` and `time_zone` request body parameters. + It ignores other request body parameters. :param fetch_size: The maximum number of rows (or entries) to return in one response :param field_multi_value_leniency: Throw an exception when encountering multiple values for a field (default) or be lenient and return the first value from the list (without any guarantees of what that will be - typically the first in natural ascending order). - :param filter: Optional Elasticsearch query DSL for additional filtering. - :param format: a short version of the Accept header, e.g. json, yaml + :param filter: Elasticsearch query DSL for additional filtering. + :param format: Format for the response. :param index_using_frozen: If true, the search can run on frozen indices. Defaults to false. :param keep_alive: Retention period for an async or saved synchronous search. @@ -259,12 +261,11 @@ def query( Elasticsearch only stores async searches that don’t finish before the wait_for_completion_timeout. :param page_timeout: The timeout before a pagination request fails. :param params: Values for parameters in the query. - :param query: SQL query to execute + :param query: SQL query to run. :param request_timeout: The timeout before the request fails. :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 time_zone: Time-zone in ISO 8601 used for executing the query on the server. - More information available here. + :param time_zone: ISO-8601 time zone ID for the search. :param wait_for_completion_timeout: Period to wait for complete results. Defaults to no timeout, meaning the request waits for complete search results. If the search doesn’t finish within this period, the search becomes async. @@ -341,10 +342,10 @@ def translate( ``_ - :param query: - :param fetch_size: - :param filter: - :param time_zone: + :param query: SQL query to run. + :param fetch_size: The maximum number of rows (or entries) to return in one response. + :param filter: Elasticsearch query DSL for additional filtering. + :param time_zone: ISO-8601 time zone ID for the search. """ if query is None: raise ValueError("Empty value passed for parameter 'query'") diff --git a/elasticsearch/_sync/client/synonyms.py b/elasticsearch/_sync/client/synonyms.py new file mode 100644 index 000000000..6fcec2e70 --- /dev/null +++ b/elasticsearch/_sync/client/synonyms.py @@ -0,0 +1,325 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import typing as t + +from elastic_transport import ObjectApiResponse + +from ._base import NamespacedClient +from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters + + +class SynonymsClient(NamespacedClient): + @_rewrite_parameters() + def delete_synonym( + self, + *, + id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Deletes a synonym set + + ``_ + + :param id: The id of the synonyms set to be deleted + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path = f"/_synonyms/{_quote(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 + ) + + @_rewrite_parameters() + def delete_synonym_rule( + self, + *, + set_id: str, + rule_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Deletes a synonym rule in a synonym set + + ``_ + + :param set_id: The id of the synonym set to be updated + :param rule_id: The id of the synonym rule to be deleted + """ + if set_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'set_id'") + if rule_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'rule_id'") + __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_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 + ) + + @_rewrite_parameters( + parameter_aliases={"from": "from_"}, + ) + def get_synonym( + self, + *, + id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + from_: t.Optional[int] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + size: t.Optional[int] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Retrieves a synonym set + + ``_ + + :param id: "The id of the synonyms set to be retrieved + :param from_: Starting offset for query rules to be retrieved + :param size: specifies a max number of query rules to retrieve + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path = f"/_synonyms/{_quote(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 from_ is not None: + __query["from"] = from_ + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if size is not None: + __query["size"] = size + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters() + def get_synonym_rule( + self, + *, + set_id: str, + rule_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Retrieves a synonym rule from a synonym set + + ``_ + + :param set_id: The id of the synonym set to retrieve the synonym rule from + :param rule_id: The id of the synonym rule to retrieve + """ + if set_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'set_id'") + if rule_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'rule_id'") + __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters( + parameter_aliases={"from": "from_"}, + ) + def get_synonyms_sets( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + from_: t.Optional[int] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + size: t.Optional[int] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Retrieves a summary of all defined synonym sets + + ``_ + + :param from_: Starting offset + :param size: specifies a max number of results to get + """ + __path = "/_synonyms" + __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 from_ is not None: + __query["from"] = from_ + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if size is not None: + __query["size"] = size + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", __path, params=__query, headers=__headers + ) + + @_rewrite_parameters( + body_fields=True, + ) + def put_synonym( + self, + *, + id: str, + synonyms_set: t.Union[ + t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...] + ], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Creates or updates a synonyms set + + ``_ + + :param id: The id of the synonyms set to be created or updated + :param synonyms_set: The synonym set information to update + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if synonyms_set is None: + raise ValueError("Empty value passed for parameter 'synonyms_set'") + __path = f"/_synonyms/{_quote(id)}" + __body: t.Dict[str, t.Any] = {} + __query: t.Dict[str, t.Any] = {} + if synonyms_set is not None: + __body["synonyms_set"] = synonyms_set + 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", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", __path, params=__query, headers=__headers, body=__body + ) + + @_rewrite_parameters( + body_fields=True, + ) + def put_synonym_rule( + self, + *, + set_id: str, + rule_id: str, + synonyms: t.Union[t.List[str], t.Tuple[str, ...]], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[ + t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]] + ] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Creates or updates a synonym rule in a synonym set + + ``_ + + :param set_id: The id of the synonym set to be updated with the synonym rule + :param rule_id: The id of the synonym rule to be updated or created + :param synonyms: + """ + if set_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'set_id'") + if rule_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'rule_id'") + if synonyms is None: + raise ValueError("Empty value passed for parameter 'synonyms'") + __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __body: t.Dict[str, t.Any] = {} + __query: t.Dict[str, t.Any] = {} + if synonyms is not None: + __body["synonyms"] = synonyms + 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", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", __path, params=__query, headers=__headers, body=__body + ) diff --git a/elasticsearch/_sync/client/tasks.py b/elasticsearch/_sync/client/tasks.py index c15ef6b7b..569489b5d 100644 --- a/elasticsearch/_sync/client/tasks.py +++ b/elasticsearch/_sync/client/tasks.py @@ -47,14 +47,11 @@ def cancel( ``_ - :param task_id: Cancel the task with specified task id (node_id:task_number) - :param actions: A comma-separated list of actions that should be cancelled. Leave - empty to cancel all. - :param nodes: A comma-separated list of node IDs or names to limit the returned - information; use `_local` to return information from the node you're connecting - to, leave empty to get information from all nodes - :param parent_task_id: Cancel tasks with specified parent task id (node_id:task_number). - Set to -1 to cancel all. + :param task_id: ID of the task. + :param actions: Comma-separated list or wildcard expression of actions used to + limit the request. + :param nodes: Comma-separated list of node IDs or names used to limit the request. + :param parent_task_id: Parent task ID used to limit the tasks. :param wait_for_completion: Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false """ @@ -103,10 +100,11 @@ def get( ``_ - :param task_id: Return the task with specified id (node_id:task_number) - :param timeout: Explicit operation timeout - :param wait_for_completion: Wait for the matching tasks to complete (default: - false) + :param task_id: ID of the task. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + :param wait_for_completion: If `true`, the request blocks until the task has + completed. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") diff --git a/elasticsearch/client.py b/elasticsearch/client.py index 06c49ba7c..d4436f480 100644 --- a/elasticsearch/client.py +++ b/elasticsearch/client.py @@ -44,6 +44,9 @@ from ._sync.client.ml import MlClient as MlClient # noqa: F401 from ._sync.client.monitoring import MonitoringClient as MonitoringClient # noqa: F401 from ._sync.client.nodes import NodesClient as NodesClient # noqa: F401 +from ._sync.client.query_ruleset import ( # noqa: F401 + QueryRulesetClient as QueryRulesetClient, +) from ._sync.client.rollup import RollupClient as RollupClient # noqa: F401 from ._sync.client.search_application import ( # noqa: F401 SearchApplicationClient as SearchApplicationClient, @@ -57,6 +60,7 @@ from ._sync.client.snapshot import SnapshotClient as SnapshotClient # noqa: F401 from ._sync.client.sql import SqlClient as SqlClient # noqa: F401 from ._sync.client.ssl import SslClient as SslClient # noqa: F401 +from ._sync.client.synonyms import SynonymsClient as SynonymsClient # noqa: F401 from ._sync.client.tasks import TasksClient as TasksClient # noqa: F401 from ._sync.client.text_structure import ( # noqa: F401 TextStructureClient as TextStructureClient,