diff --git a/CHANGELOG.md b/CHANGELOG.md index f62a9669..ff1a232a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added option to pass custom headers to 'AWSV4SignerAsyncAuth' ([863](https://github.com/opensearch-project/opensearch-py/pull/863)) - Added sync and async sample that uses `search_after` parameter ([859](https://github.com/opensearch-project/opensearch-py/pull/859)) ### Updated APIs +- Updated opensearch-py APIs to reflect [opensearch-api-specification@a3849b4](https://github.com/opensearch-project/opensearch-api-specification/commit/a3849b4d74417137d07aeb75580d09e14859aeab) ### Changed - Small refactor of AWS Signer classes for both sync and async clients ([866](https://github.com/opensearch-project/opensearch-py/pull/866)) - Small refactor to fix overwriting the module files when generating apis ([874](https://github.com/opensearch-project/opensearch-py/pull/874)) diff --git a/opensearchpy/_async/client/__init__.py b/opensearchpy/_async/client/__init__.py index 5c1fa04f..9adafb29 100644 --- a/opensearchpy/_async/client/__init__.py +++ b/opensearchpy/_async/client/__init__.py @@ -667,7 +667,7 @@ async def count( specified. :arg 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. Valid choices are and, or. + string parameter is specified. Valid choices are and, AND, or, OR. :arg 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. @@ -855,7 +855,7 @@ async def delete_by_query( :arg conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. Valid choices are abort, proceed. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. :arg error_trace: Whether to include the stack trace of returned @@ -1225,7 +1225,7 @@ async def explain( parameter can only be used when the `q` query string parameter is specified. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. Default is _all. :arg error_trace: Whether to include the stack trace of returned @@ -2020,7 +2020,7 @@ async def reindex_rethrottle( headers: Any = None, ) -> Any: """ - Changes the number of requests per second for a particular Reindex operation. + Changes the number of requests per second for a particular reindex operation. :arg task_id: Identifier for the task. @@ -2138,8 +2138,6 @@ async def scroll( Allows to retrieve a large numbers of results from a single search request. - :arg body: The scroll ID if not passed by URL or query - parameter. :arg scroll_id: The scroll ID for scrolled search :arg error_trace: Whether to include the stack trace of returned errors. Default is false. @@ -2281,7 +2279,7 @@ async def search( executing cross-cluster search (CCS) requests. Default is True. :arg 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. Valid choices are and, or. + string parameter is specified. Valid choices are and, AND, or, OR. :arg 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. @@ -2451,6 +2449,7 @@ async def search( ) async def search_shards( self, + body: Any = None, index: Any = None, params: Any = None, headers: Any = None, @@ -2460,6 +2459,9 @@ async def search_shards( executed against. + :arg body: Defines the parameters that can be used in the + `search_shards` endpoint request. See documentation for supported query + syntax. :arg index: Returns the indexes and shards that a search request would be executed against. :arg allow_no_indices: If `false`, the request returns an error @@ -2495,7 +2497,11 @@ async def search_shards( libraries that do not accept a request body for non-POST requests. """ return await self.transport.perform_request( - "GET", _make_path(index, "_search_shards"), params=params, headers=headers + "POST", + _make_path(index, "_search_shards"), + params=params, + headers=headers, + body=body, ) @query_params( @@ -2834,7 +2840,7 @@ async def update_by_query( :arg conflicts: What to do if update by query hits version conflicts: `abort` or `proceed`. Valid choices are abort, proceed. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. :arg error_trace: Whether to include the stack trace of returned diff --git a/opensearchpy/_async/client/cat.py b/opensearchpy/_async/client/cat.py index 3b38803d..9e057b73 100644 --- a/opensearchpy/_async/client/cat.py +++ b/opensearchpy/_async/client/cat.py @@ -61,8 +61,8 @@ async def aliases( headers: Any = None, ) -> Any: """ - Shows information about currently configured aliases to indexes including - filter and routing info. + Shows information about aliases currently configured to indexes, including + filter and routing information. :arg name: A comma-separated list of aliases to retrieve. @@ -70,27 +70,29 @@ async def aliases( or use `*` or `_all`. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indexes that are open, closed or both. + :arg expand_wildcards: Expands wildcard expressions to concrete + indexes. Combine multiple values with commas. Supported values are + `all`, `open`, `closed`, `hidden`, and `none`. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Whether to return information from the local node + only instead of from the cluster manager node. Default is false. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", _make_path("_cat", "aliases", name), params=params, headers=headers @@ -115,30 +117,31 @@ async def all_pit_segments( headers: Any = None, ) -> Any: """ - Lists all active point-in-time segments. + Lists all active CAT point-in-time segments. - :arg bytes: The unit in which to display byte values. Valid - choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. + :arg bytes: The units used to display byte values. Valid choices + are b, g, gb, k, kb, m, mb, p, pb, t, tb. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/pit_segments/_all", params=params, headers=headers @@ -171,36 +174,37 @@ async def allocation( much disk space they are using. - :arg node_id: Comma-separated list of node identifiers or names - used to limit the returned information. - :arg bytes: The unit used to display byte values. Valid choices + :arg node_id: A comma-separated list of node IDs or names used + to limit the returned information. + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the HTTP `Accept` header, such + as `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from cluster-manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): A timeout for connection to the + cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", @@ -233,32 +237,33 @@ async def cluster_manager( Returns information about the cluster-manager node. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the HTTP `Accept` header, such + as `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): A timeout for connection to the + cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/cluster_manager", params=params, headers=headers @@ -283,8 +288,8 @@ async def count( headers: Any = None, ) -> Any: """ - Provides quick access to the document count of the entire cluster, or - individual indexes. + Provides quick access to the document count of the entire cluster or of an + individual index. :arg index: Comma-separated list of data streams, indexes, and @@ -296,19 +301,20 @@ async def count( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", _make_path("_cat", "count", index), params=params, headers=headers @@ -338,9 +344,9 @@ async def fielddata( node in the cluster. - :arg fields: Comma-separated list of fields used to limit - returned information. - :arg bytes: The unit used to display byte values. Valid choices + :arg fields: A comma-separated list of fields used to limit the + amount of returned information. + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. @@ -348,19 +354,20 @@ async def fielddata( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", @@ -398,23 +405,24 @@ async def health( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. :arg time: The unit used to display time values. Valid choices are d, h, m, micros, ms, nanos, s. - :arg ts: If `true`, returns `HH:MM:SS` and Unix epoch + :arg ts: When `true`, returns `HH:MM:SS` and Unix epoch timestamps. Default is True. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/health", params=params, headers=headers @@ -475,17 +483,17 @@ async def indices( headers: Any = None, ) -> Any: """ - Returns information about indexes: number of primaries and replicas, document - counts, disk size, ... + Lists information related to indexes, that is, how much disk space they are + using, how many shards they have, their health status, and so on. - :arg index: Comma-separated list of data streams, indexes, and + :arg index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg expand_wildcards: The type of index that wildcard patterns @@ -494,34 +502,33 @@ async def indices( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg health: The health status used to limit returned indexes. - By default, the response includes indexes of any health status. Valid - choices are green, red, yellow. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg health: Limits indexes based on their health status. + Supported values are `green`, `yellow`, and `red`. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg include_unloaded_segments: If `true`, the response includes - information from segments that are not loaded into memory. Default is - false. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg include_unloaded_segments: Whether to include information + from segments not loaded into memory. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg pri: If `true`, the response only includes information from - primary shards. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg pri: When `true`, returns information only from the primary + shards. Default is false. + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit used to display time values. Valid choices - are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg time: Specifies the time units. Valid choices are d, h, m, + micros, ms, nanos, s. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", _make_path("_cat", "indices", index), params=params, headers=headers @@ -551,32 +558,33 @@ async def master( Returns information about the cluster-manager node. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ from warnings import warn @@ -611,32 +619,33 @@ async def nodeattrs( Returns information about custom node attributes. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/nodeattrs", params=params, headers=headers @@ -666,42 +675,45 @@ async def nodes( headers: Any = None, ) -> Any: """ - Returns basic statistics about performance of cluster nodes. + Returns basic statistics about the performance of cluster nodes. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg full_id: If `true`, return the full node ID. If `false`, - return the shortened node ID. Default is false. - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg full_id: When `true`, returns the full node ID. When + `false`, returns the shortened node ID. Default is false. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg local (Deprecated: This parameter does not cause this API - to act locally.): Return local information, do not retrieve the state - from cluster-manager node. Default is false. + to act locally.): Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/nodes", params=params, headers=headers @@ -729,37 +741,40 @@ async def pending_tasks( headers: Any = None, ) -> Any: """ - Returns a concise representation of the cluster pending tasks. + Returns a concise representation of the cluster's pending tasks. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/pending_tasks", params=params, headers=headers @@ -785,30 +800,31 @@ async def pit_segments( headers: Any = None, ) -> Any: """ - List segments for one or several PITs. + Lists one or several CAT point-in-time segments. - :arg bytes: The unit in which to display byte values. Valid - choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. + :arg bytes: The units used to display byte values. Valid choices + are b, g, gb, k, kb, m, mb, p, pb, t, tb. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/pit_segments", params=params, headers=headers, body=body @@ -835,35 +851,37 @@ async def plugins( headers: Any = None, ) -> Any: """ - Returns information about installed plugins across nodes node. + Returns information about the names, components, and versions of the installed + plugins. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/plugins", params=params, headers=headers @@ -892,38 +910,42 @@ async def recovery( headers: Any = None, ) -> Any: """ - Returns information about index shard recoveries, both on-going completed. + Returns all completed and ongoing index and shard recoveries. - :arg index: Comma-separated list or wildcard expression of index - names to limit the returned information. + :arg index: A comma-separated list of data streams, indexes, and + aliases used to limit the request. Supports wildcards (`*`). To target + all data streams and indexes, omit this parameter or use `*` or `_all`. :arg active_only: If `true`, the response only includes ongoing shard recoveries. Default is false. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg detailed: If `true`, the response includes detailed - information about shard recoveries. Default is false. + :arg detailed: When `true`, includes detailed information about + shard recoveries. Default is false. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", _make_path("_cat", "recovery", index), params=params, headers=headers @@ -950,35 +972,36 @@ async def repositories( headers: Any = None, ) -> Any: """ - Returns information about snapshot repositories registered in the cluster. + Returns information about all snapshot repositories for a cluster. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/repositories", params=params, headers=headers @@ -1014,52 +1037,58 @@ async def segment_replication( headers: Any = None, ) -> Any: """ - Returns information about both on-going and latest completed Segment - Replication events. + Returns information about active and last-completed segment replication events + on each replica shard, including related shard-level metrics. These metrics + provide information about how far behind the primary shard the replicas are + lagging. - :arg index: Comma-separated list or wildcard expression of index - names to limit the returned information. - :arg active_only: If `true`, the response only includes ongoing - segment replication events. Default is false. - :arg allow_no_indices: Whether to ignore if a wildcard indexes - expression resolves into no concrete indexes. (This includes `_all` - string or when no indexes have been specified). - :arg bytes: The unit in which to display byte values. Valid - choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg completed_only: If `true`, the response only includes - latest completed segment replication events. Default is false. - :arg detailed: If `true`, the response includes detailed - information about segment replications. Default is false. + :arg index: A comma-separated list of data streams, indexes, and + aliases used to limit the request. Supports wildcards (`*`). To target + all data streams and indexes, omit this parameter or use `*` or `_all`. + :arg active_only: When `true`, the response only includes + ongoing segment replication events. Default is false. + :arg allow_no_indices: Whether to ignore the index if a wildcard + index expression resolves to no concrete indexes. This includes the + `_all` string or when no indexes have been specified. + :arg bytes: The units used to display byte values. Valid choices + are b, g, gb, k, kb, m, mb, p, pb, t, tb. + :arg completed_only: When `true`, the response only includes the + last-completed segment replication events. Default is false. + :arg detailed: When `true`, the response includes additional + metrics for each stage of a segment replication event. Default is false. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indexes that are open, closed or both. + :arg expand_wildcards: Whether to expand the wildcard expression + to include concrete indexes that are open, closed, or both. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg ignore_throttled: Whether specified concrete, expanded or + :arg ignore_throttled: Whether specified concrete, expanded, or aliased indexes should be ignored when throttled. - :arg ignore_unavailable: Whether specified concrete indexes - should be ignored when unavailable (missing or closed). + :arg ignore_unavailable: Whether the specified concrete indexes + should be ignored when missing or closed. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. - :arg shards: Comma-separated list of shards to display. + :arg shards: A comma-separated list of shards to display. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg timeout: Operation timeout. - :arg v: Verbose mode. Display column headers. Default is false. + :arg timeout: The operation timeout. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", @@ -1096,32 +1125,33 @@ async def segments( :arg index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", _make_path("_cat", "segments", index), params=params, headers=headers @@ -1151,42 +1181,46 @@ async def shards( headers: Any = None, ) -> Any: """ - Provides a detailed view of shard allocation on nodes. + Lists the states of all primary and replica shards and how they are + distributed. :arg index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", _make_path("_cat", "shards", index), params=params, headers=headers @@ -1216,38 +1250,39 @@ async def thread_pool( ) -> Any: """ Returns cluster-wide thread pool statistics per node. By default the active, - queue and rejected statistics are returned for all thread pools. + queued, and rejected statistics are returned for all thread pools. :arg thread_pool_patterns: A comma-separated list of thread pool names used to limit the request. Accepts wildcard expressions. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg size: The multiplier in which to display values. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", @@ -1279,41 +1314,44 @@ async def snapshots( headers: Any = None, ) -> Any: """ - Returns all snapshots in a specific repository. + Lists all of the snapshots stored in a specific repository. :arg repository: A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. If any repository fails during the request, OpenSearch returns an error. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg ignore_unavailable: If `true`, the response does not + :arg ignore_unavailable: When `true`, the response does not include information from unavailable snapshots. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", @@ -1345,12 +1383,10 @@ async def tasks( headers: Any = None, ) -> Any: """ - Returns information about the tasks currently executing on one or more nodes in - the cluster. + Lists the progress of all tasks currently running on the cluster. - :arg actions: The task action names, which are used to limit the - response. + :arg actions: The task action names used to limit the response. :arg detailed: If `true`, the response includes detailed information about shard recoveries. Default is false. :arg error_trace: Whether to include the stack trace of returned @@ -1359,27 +1395,31 @@ async def tasks( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg nodes: 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. + :arg nodes: A comma-separated list of node IDs or names used to + limit the returned information. Use `_local` to return information from + the node to which you're connecting, specify a specific node from which + to get information, or keep the parameter empty to get information from + all nodes. :arg parent_task_id: The parent task identifier, which is used to limit the response. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/tasks", params=params, headers=headers @@ -1407,37 +1447,39 @@ async def templates( headers: Any = None, ) -> Any: """ - Returns information about existing templates. + Lists the names, patterns, order numbers, and version numbers of index + templates. :arg name: The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", _make_path("_cat", "templates", name), params=params, headers=headers diff --git a/opensearchpy/_async/client/cluster.py b/opensearchpy/_async/client/cluster.py index 8a6b881d..3e9c79ba 100644 --- a/opensearchpy/_async/client/cluster.py +++ b/opensearchpy/_async/client/cluster.py @@ -127,7 +127,7 @@ async def health( :arg wait_for_status: One of green, yellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided or better, i.e. green > yellow > red. By default, will - not wait for any status. Valid choices are green, red, yellow. + not wait for any status. """ return await self.transport.perform_request( "GET", @@ -609,6 +609,7 @@ async def delete_component_template( "cluster_manager_timeout", "error_trace", "filter_path", + "flat_settings", "human", "local", "master_timeout", @@ -635,6 +636,8 @@ async def get_component_template( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". + :arg flat_settings: If `true`, returns settings in flat format. + Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg local: If `true`, the request retrieves information from diff --git a/opensearchpy/_async/client/indices.py b/opensearchpy/_async/client/indices.py index 99603830..52f6dda3 100644 --- a/opensearchpy/_async/client/indices.py +++ b/opensearchpy/_async/client/indices.py @@ -1638,7 +1638,7 @@ async def validate_query( parameter can only be used when the `q` query string parameter is specified. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. diff --git a/opensearchpy/_async/client/list.py b/opensearchpy/_async/client/list.py index 8a38d00d..8ba4925b 100644 --- a/opensearchpy/_async/client/list.py +++ b/opensearchpy/_async/client/list.py @@ -103,8 +103,7 @@ async def indices( `JSON`, `YAML`. :arg h: Comma-separated list of column names to display. :arg health: The health status used to limit returned indexes. - By default, the response includes indexes of any health status. Valid - choices are green, red, yellow. + By default, the response includes indexes of any health status. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. diff --git a/opensearchpy/_async/client/plugins.py b/opensearchpy/_async/client/plugins.py index d625f838..985839cd 100644 --- a/opensearchpy/_async/client/plugins.py +++ b/opensearchpy/_async/client/plugins.py @@ -22,6 +22,7 @@ from ..plugins.query import QueryClient from ..plugins.replication import ReplicationClient from ..plugins.rollups import RollupsClient +from ..plugins.sm import SmClient from ..plugins.sql import SqlClient from ..plugins.transforms import TransformsClient from .client import Client @@ -29,6 +30,7 @@ class PluginsClient(NamespacedClient): + sm: Any asynchronous_search: Any alerting: Any index_management: Any @@ -45,6 +47,7 @@ class PluginsClient(NamespacedClient): def __init__(self, client: Client) -> None: super().__init__(client) + self.sm = SmClient(client) self.replication = ReplicationClient(client) self.flow_framework = FlowFrameworkClient(client) self.asynchronous_search = AsynchronousSearchClient(client) @@ -66,6 +69,7 @@ def _dynamic_lookup(self, client: Any) -> None: # Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742 plugins = [ + "sm", "replication", "flow_framework", "asynchronous_search", diff --git a/opensearchpy/_async/plugins/knn.py b/opensearchpy/_async/plugins/knn.py index 8cf7fa42..fd5e2e31 100644 --- a/opensearchpy/_async/plugins/knn.py +++ b/opensearchpy/_async/plugins/knn.py @@ -310,7 +310,7 @@ async def stats( ) async def train_model( self, - body: Any, + body: Any = None, model_id: Any = None, params: Any = None, headers: Any = None, @@ -335,9 +335,6 @@ async def train_model( :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ - if body in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'body'.") - return await self.transport.perform_request( "POST", _make_path("_plugins", "_knn", "models", model_id, "_train"), diff --git a/opensearchpy/_async/plugins/ml.py b/opensearchpy/_async/plugins/ml.py index d4c10f54..fc5ad955 100644 --- a/opensearchpy/_async/plugins/ml.py +++ b/opensearchpy/_async/plugins/ml.py @@ -493,3 +493,117 @@ async def register_agents( headers=headers, body=body, ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def predict( + self, + algorithm_name: Any, + model_id: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Predicts new data with trained model. + + + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + for param in (algorithm_name, model_id): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") + + return await self.transport.perform_request( + "POST", + _make_path("_plugins", "_ml", "_predict", algorithm_name, model_id), + params=params, + headers=headers, + body=body, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def train( + self, + algorithm_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Trains a model synchronously. + + + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if algorithm_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'algorithm_name'." + ) + + return await self.transport.perform_request( + "POST", + _make_path("_plugins", "_ml", "_train", algorithm_name), + params=params, + headers=headers, + body=body, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def train_predict( + self, + algorithm_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Trains a model and predicts against the same training dataset. + + + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if algorithm_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'algorithm_name'." + ) + + return await self.transport.perform_request( + "POST", + _make_path("_plugins", "_ml", "_train_predict", algorithm_name), + params=params, + headers=headers, + body=body, + ) diff --git a/opensearchpy/_async/plugins/observability.py b/opensearchpy/_async/plugins/observability.py index 1242171d..3894a611 100644 --- a/opensearchpy/_async/plugins/observability.py +++ b/opensearchpy/_async/plugins/observability.py @@ -135,7 +135,7 @@ async def get_localstats( headers: Any = None, ) -> Any: """ - Retrieves Local Stats of all observability objects. + Retrieves local stats of all observability objects. :arg error_trace: Whether to include the stack trace of returned diff --git a/opensearchpy/_async/plugins/sm.py b/opensearchpy/_async/plugins/sm.py new file mode 100644 index 00000000..4ea3a1d9 --- /dev/null +++ b/opensearchpy/_async/plugins/sm.py @@ -0,0 +1,346 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. +# +# Modifications Copyright OpenSearch Contributors. See +# GitHub history for details. + +# ------------------------------------------------------------------------------------------ +# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST +# +# To contribute, kindly make modifications in the opensearch-py client generator +# or in the OpenSearch API specification, and run `nox -rs generate`. See DEVELOPER_GUIDE.md +# and https://github.com/opensearch-project/opensearch-api-specification for details. +# -----------------------------------------------------------------------------------------+ + + +from typing import Any + +from ..client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params + + +class SmClient(NamespacedClient): + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def create_policy( + self, + policy_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Creates a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + body=body, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def delete_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Deletes a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "DELETE", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def explain_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Explains the state of the snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "GET", + _make_path("_plugins", "_sm", "policies", policy_name, "_explain"), + params=params, + headers=headers, + ) + + @query_params( + "error_trace", + "filter_path", + "from_", + "human", + "pretty", + "queryString", + "size", + "sortField", + "sortOrder", + "source", + ) + async def get_policies( + self, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Retrieves all snapshot management policies with optional pagination and + filtering. + + + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg from_: The starting index (default: 0) + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg queryString: A query string to filter policies. + :arg size: The number of policies to return. + :arg sortField: The field to sort on. + :arg sortOrder: The order of sorting. Valid choices are asc, + desc.Default is asc. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + # from is a reserved word so it cannot be used, use from_ instead + if "from_" in params: + params["from"] = params.pop("from_") + + return await self.transport.perform_request( + "GET", "/_plugins/_sm/policies", params=params, headers=headers + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def get_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Retrieves a specific snapshot management policy by name. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "GET", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def start_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Starts a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name, "_start"), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def stop_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Stops a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name, "_stop"), + params=params, + headers=headers, + ) + + @query_params( + "error_trace", + "filter_path", + "human", + "if_primary_term", + "if_seq_no", + "pretty", + "source", + ) + async def update_policy( + self, + policy_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Updates an existing snapshot management policy. Requires `if_seq_no` and + `if_primary_term`. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg if_primary_term: The primary term of the policy to update. + :arg if_seq_no: The sequence number of the policy to update. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "PUT", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + body=body, + ) diff --git a/opensearchpy/client/__init__.py b/opensearchpy/client/__init__.py index 118cfa7a..67b3a275 100644 --- a/opensearchpy/client/__init__.py +++ b/opensearchpy/client/__init__.py @@ -667,7 +667,7 @@ def count( specified. :arg 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. Valid choices are and, or. + string parameter is specified. Valid choices are and, AND, or, OR. :arg 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. @@ -855,7 +855,7 @@ def delete_by_query( :arg conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. Valid choices are abort, proceed. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. :arg error_trace: Whether to include the stack trace of returned @@ -1225,7 +1225,7 @@ def explain( parameter can only be used when the `q` query string parameter is specified. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. Default is _all. :arg error_trace: Whether to include the stack trace of returned @@ -2020,7 +2020,7 @@ def reindex_rethrottle( headers: Any = None, ) -> Any: """ - Changes the number of requests per second for a particular Reindex operation. + Changes the number of requests per second for a particular reindex operation. :arg task_id: Identifier for the task. @@ -2138,8 +2138,6 @@ def scroll( Allows to retrieve a large numbers of results from a single search request. - :arg body: The scroll ID if not passed by URL or query - parameter. :arg scroll_id: The scroll ID for scrolled search :arg error_trace: Whether to include the stack trace of returned errors. Default is false. @@ -2281,7 +2279,7 @@ def search( executing cross-cluster search (CCS) requests. Default is True. :arg 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. Valid choices are and, or. + string parameter is specified. Valid choices are and, AND, or, OR. :arg 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. @@ -2451,6 +2449,7 @@ def search( ) def search_shards( self, + body: Any = None, index: Any = None, params: Any = None, headers: Any = None, @@ -2460,6 +2459,9 @@ def search_shards( executed against. + :arg body: Defines the parameters that can be used in the + `search_shards` endpoint request. See documentation for supported query + syntax. :arg index: Returns the indexes and shards that a search request would be executed against. :arg allow_no_indices: If `false`, the request returns an error @@ -2495,7 +2497,11 @@ def search_shards( libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( - "GET", _make_path(index, "_search_shards"), params=params, headers=headers + "POST", + _make_path(index, "_search_shards"), + params=params, + headers=headers, + body=body, ) @query_params( @@ -2834,7 +2840,7 @@ def update_by_query( :arg conflicts: What to do if update by query hits version conflicts: `abort` or `proceed`. Valid choices are abort, proceed. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. :arg error_trace: Whether to include the stack trace of returned diff --git a/opensearchpy/client/cat.py b/opensearchpy/client/cat.py index ce668e7f..2b2d2760 100644 --- a/opensearchpy/client/cat.py +++ b/opensearchpy/client/cat.py @@ -61,8 +61,8 @@ def aliases( headers: Any = None, ) -> Any: """ - Shows information about currently configured aliases to indexes including - filter and routing info. + Shows information about aliases currently configured to indexes, including + filter and routing information. :arg name: A comma-separated list of aliases to retrieve. @@ -70,27 +70,29 @@ def aliases( or use `*` or `_all`. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indexes that are open, closed or both. + :arg expand_wildcards: Expands wildcard expressions to concrete + indexes. Combine multiple values with commas. Supported values are + `all`, `open`, `closed`, `hidden`, and `none`. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Whether to return information from the local node + only instead of from the cluster manager node. Default is false. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", _make_path("_cat", "aliases", name), params=params, headers=headers @@ -115,30 +117,31 @@ def all_pit_segments( headers: Any = None, ) -> Any: """ - Lists all active point-in-time segments. + Lists all active CAT point-in-time segments. - :arg bytes: The unit in which to display byte values. Valid - choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. + :arg bytes: The units used to display byte values. Valid choices + are b, g, gb, k, kb, m, mb, p, pb, t, tb. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/pit_segments/_all", params=params, headers=headers @@ -171,36 +174,37 @@ def allocation( much disk space they are using. - :arg node_id: Comma-separated list of node identifiers or names - used to limit the returned information. - :arg bytes: The unit used to display byte values. Valid choices + :arg node_id: A comma-separated list of node IDs or names used + to limit the returned information. + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the HTTP `Accept` header, such + as `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from cluster-manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): A timeout for connection to the + cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", @@ -233,32 +237,33 @@ def cluster_manager( Returns information about the cluster-manager node. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the HTTP `Accept` header, such + as `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): A timeout for connection to the + cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/cluster_manager", params=params, headers=headers @@ -283,8 +288,8 @@ def count( headers: Any = None, ) -> Any: """ - Provides quick access to the document count of the entire cluster, or - individual indexes. + Provides quick access to the document count of the entire cluster or of an + individual index. :arg index: Comma-separated list of data streams, indexes, and @@ -296,19 +301,20 @@ def count( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", _make_path("_cat", "count", index), params=params, headers=headers @@ -338,9 +344,9 @@ def fielddata( node in the cluster. - :arg fields: Comma-separated list of fields used to limit - returned information. - :arg bytes: The unit used to display byte values. Valid choices + :arg fields: A comma-separated list of fields used to limit the + amount of returned information. + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. @@ -348,19 +354,20 @@ def fielddata( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", @@ -398,23 +405,24 @@ def health( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. :arg time: The unit used to display time values. Valid choices are d, h, m, micros, ms, nanos, s. - :arg ts: If `true`, returns `HH:MM:SS` and Unix epoch + :arg ts: When `true`, returns `HH:MM:SS` and Unix epoch timestamps. Default is True. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/health", params=params, headers=headers @@ -475,17 +483,17 @@ def indices( headers: Any = None, ) -> Any: """ - Returns information about indexes: number of primaries and replicas, document - counts, disk size, ... + Lists information related to indexes, that is, how much disk space they are + using, how many shards they have, their health status, and so on. - :arg index: Comma-separated list of data streams, indexes, and + :arg index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg expand_wildcards: The type of index that wildcard patterns @@ -494,34 +502,33 @@ def indices( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg health: The health status used to limit returned indexes. - By default, the response includes indexes of any health status. Valid - choices are green, red, yellow. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg health: Limits indexes based on their health status. + Supported values are `green`, `yellow`, and `red`. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg include_unloaded_segments: If `true`, the response includes - information from segments that are not loaded into memory. Default is - false. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg include_unloaded_segments: Whether to include information + from segments not loaded into memory. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg pri: If `true`, the response only includes information from - primary shards. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg pri: When `true`, returns information only from the primary + shards. Default is false. + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit used to display time values. Valid choices - are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg time: Specifies the time units. Valid choices are d, h, m, + micros, ms, nanos, s. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", _make_path("_cat", "indices", index), params=params, headers=headers @@ -551,32 +558,33 @@ def master( Returns information about the cluster-manager node. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ from warnings import warn @@ -611,32 +619,33 @@ def nodeattrs( Returns information about custom node attributes. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/nodeattrs", params=params, headers=headers @@ -666,42 +675,45 @@ def nodes( headers: Any = None, ) -> Any: """ - Returns basic statistics about performance of cluster nodes. + Returns basic statistics about the performance of cluster nodes. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg full_id: If `true`, return the full node ID. If `false`, - return the shortened node ID. Default is false. - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg full_id: When `true`, returns the full node ID. When + `false`, returns the shortened node ID. Default is false. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg local (Deprecated: This parameter does not cause this API - to act locally.): Return local information, do not retrieve the state - from cluster-manager node. Default is false. + to act locally.): Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/nodes", params=params, headers=headers @@ -729,37 +741,40 @@ def pending_tasks( headers: Any = None, ) -> Any: """ - Returns a concise representation of the cluster pending tasks. + Returns a concise representation of the cluster's pending tasks. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/pending_tasks", params=params, headers=headers @@ -785,30 +800,31 @@ def pit_segments( headers: Any = None, ) -> Any: """ - List segments for one or several PITs. + Lists one or several CAT point-in-time segments. - :arg bytes: The unit in which to display byte values. Valid - choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. + :arg bytes: The units used to display byte values. Valid choices + are b, g, gb, k, kb, m, mb, p, pb, t, tb. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/pit_segments", params=params, headers=headers, body=body @@ -835,35 +851,37 @@ def plugins( headers: Any = None, ) -> Any: """ - Returns information about installed plugins across nodes node. + Returns information about the names, components, and versions of the installed + plugins. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/plugins", params=params, headers=headers @@ -892,38 +910,42 @@ def recovery( headers: Any = None, ) -> Any: """ - Returns information about index shard recoveries, both on-going completed. + Returns all completed and ongoing index and shard recoveries. - :arg index: Comma-separated list or wildcard expression of index - names to limit the returned information. + :arg index: A comma-separated list of data streams, indexes, and + aliases used to limit the request. Supports wildcards (`*`). To target + all data streams and indexes, omit this parameter or use `*` or `_all`. :arg active_only: If `true`, the response only includes ongoing shard recoveries. Default is false. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg detailed: If `true`, the response includes detailed - information about shard recoveries. Default is false. + :arg detailed: When `true`, includes detailed information about + shard recoveries. Default is false. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", _make_path("_cat", "recovery", index), params=params, headers=headers @@ -950,35 +972,36 @@ def repositories( headers: Any = None, ) -> Any: """ - Returns information about snapshot repositories registered in the cluster. + Returns information about all snapshot repositories for a cluster. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/repositories", params=params, headers=headers @@ -1014,52 +1037,58 @@ def segment_replication( headers: Any = None, ) -> Any: """ - Returns information about both on-going and latest completed Segment - Replication events. + Returns information about active and last-completed segment replication events + on each replica shard, including related shard-level metrics. These metrics + provide information about how far behind the primary shard the replicas are + lagging. - :arg index: Comma-separated list or wildcard expression of index - names to limit the returned information. - :arg active_only: If `true`, the response only includes ongoing - segment replication events. Default is false. - :arg allow_no_indices: Whether to ignore if a wildcard indexes - expression resolves into no concrete indexes. (This includes `_all` - string or when no indexes have been specified). - :arg bytes: The unit in which to display byte values. Valid - choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg completed_only: If `true`, the response only includes - latest completed segment replication events. Default is false. - :arg detailed: If `true`, the response includes detailed - information about segment replications. Default is false. + :arg index: A comma-separated list of data streams, indexes, and + aliases used to limit the request. Supports wildcards (`*`). To target + all data streams and indexes, omit this parameter or use `*` or `_all`. + :arg active_only: When `true`, the response only includes + ongoing segment replication events. Default is false. + :arg allow_no_indices: Whether to ignore the index if a wildcard + index expression resolves to no concrete indexes. This includes the + `_all` string or when no indexes have been specified. + :arg bytes: The units used to display byte values. Valid choices + are b, g, gb, k, kb, m, mb, p, pb, t, tb. + :arg completed_only: When `true`, the response only includes the + last-completed segment replication events. Default is false. + :arg detailed: When `true`, the response includes additional + metrics for each stage of a segment replication event. Default is false. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indexes that are open, closed or both. + :arg expand_wildcards: Whether to expand the wildcard expression + to include concrete indexes that are open, closed, or both. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg ignore_throttled: Whether specified concrete, expanded or + :arg ignore_throttled: Whether specified concrete, expanded, or aliased indexes should be ignored when throttled. - :arg ignore_unavailable: Whether specified concrete indexes - should be ignored when unavailable (missing or closed). + :arg ignore_unavailable: Whether the specified concrete indexes + should be ignored when missing or closed. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. - :arg shards: Comma-separated list of shards to display. + :arg shards: A comma-separated list of shards to display. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg timeout: Operation timeout. - :arg v: Verbose mode. Display column headers. Default is false. + :arg timeout: The operation timeout. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", @@ -1096,32 +1125,33 @@ def segments( :arg index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", _make_path("_cat", "segments", index), params=params, headers=headers @@ -1151,42 +1181,46 @@ def shards( headers: Any = None, ) -> Any: """ - Provides a detailed view of shard allocation on nodes. + Lists the states of all primary and replica shards and how they are + distributed. :arg index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. - :arg bytes: The unit used to display byte values. Valid choices + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", _make_path("_cat", "shards", index), params=params, headers=headers @@ -1216,38 +1250,39 @@ def thread_pool( ) -> Any: """ Returns cluster-wide thread pool statistics per node. By default the active, - queue and rejected statistics are returned for all thread pools. + queued, and rejected statistics are returned for all thread pools. :arg thread_pool_patterns: A comma-separated list of thread pool names used to limit the request. Accepts wildcard expressions. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg size: The multiplier in which to display values. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", @@ -1279,41 +1314,44 @@ def snapshots( headers: Any = None, ) -> Any: """ - Returns all snapshots in a specific repository. + Lists all of the snapshots stored in a specific repository. :arg repository: A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. If any repository fails during the request, OpenSearch returns an error. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg ignore_unavailable: If `true`, the response does not + :arg ignore_unavailable: When `true`, the response does not include information from unavailable snapshots. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", @@ -1345,12 +1383,10 @@ def tasks( headers: Any = None, ) -> Any: """ - Returns information about the tasks currently executing on one or more nodes in - the cluster. + Lists the progress of all tasks currently running on the cluster. - :arg actions: The task action names, which are used to limit the - response. + :arg actions: The task action names used to limit the response. :arg detailed: If `true`, the response includes detailed information about shard recoveries. Default is false. :arg error_trace: Whether to include the stack trace of returned @@ -1359,27 +1395,31 @@ def tasks( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg nodes: 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. + :arg nodes: A comma-separated list of node IDs or names used to + limit the returned information. Use `_local` to return information from + the node to which you're connecting, specify a specific node from which + to get information, or keep the parameter empty to get information from + all nodes. :arg parent_task_id: The parent task identifier, which is used to limit the response. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg time: The unit in which to display time values. Valid + :arg time: Specifies the time units, for example, `5d` or `7h`. + For more information, see [Supported + units](https://opensearch.org/docs/latest/api-reference/units/). Valid choices are d, h, m, micros, ms, nanos, s. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/tasks", params=params, headers=headers @@ -1407,37 +1447,39 @@ def templates( headers: Any = None, ) -> Any: """ - Returns information about existing templates. + Lists the names, patterns, order numbers, and version numbers of index + templates. :arg name: The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: The amount of time allowed to + establish a connection to the cluster manager node. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from the cluster manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): The amount of time allowed to + establish a connection to the cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", _make_path("_cat", "templates", name), params=params, headers=headers diff --git a/opensearchpy/client/cluster.py b/opensearchpy/client/cluster.py index 7dc19976..422e1fb1 100644 --- a/opensearchpy/client/cluster.py +++ b/opensearchpy/client/cluster.py @@ -127,7 +127,7 @@ def health( :arg wait_for_status: One of green, yellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided or better, i.e. green > yellow > red. By default, will - not wait for any status. Valid choices are green, red, yellow. + not wait for any status. """ return self.transport.perform_request( "GET", @@ -609,6 +609,7 @@ def delete_component_template( "cluster_manager_timeout", "error_trace", "filter_path", + "flat_settings", "human", "local", "master_timeout", @@ -635,6 +636,8 @@ def get_component_template( takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". + :arg flat_settings: If `true`, returns settings in flat format. + Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg local: If `true`, the request retrieves information from diff --git a/opensearchpy/client/indices.py b/opensearchpy/client/indices.py index c4b2405c..b4b8a7bc 100644 --- a/opensearchpy/client/indices.py +++ b/opensearchpy/client/indices.py @@ -1638,7 +1638,7 @@ def validate_query( parameter can only be used when the `q` query string parameter is specified. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. diff --git a/opensearchpy/client/list.py b/opensearchpy/client/list.py index cbf6d5d9..e171754c 100644 --- a/opensearchpy/client/list.py +++ b/opensearchpy/client/list.py @@ -103,8 +103,7 @@ def indices( `JSON`, `YAML`. :arg h: Comma-separated list of column names to display. :arg health: The health status used to limit returned indexes. - By default, the response includes indexes of any health status. Valid - choices are green, red, yellow. + By default, the response includes indexes of any health status. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. diff --git a/opensearchpy/client/plugins.py b/opensearchpy/client/plugins.py index d625f838..985839cd 100644 --- a/opensearchpy/client/plugins.py +++ b/opensearchpy/client/plugins.py @@ -22,6 +22,7 @@ from ..plugins.query import QueryClient from ..plugins.replication import ReplicationClient from ..plugins.rollups import RollupsClient +from ..plugins.sm import SmClient from ..plugins.sql import SqlClient from ..plugins.transforms import TransformsClient from .client import Client @@ -29,6 +30,7 @@ class PluginsClient(NamespacedClient): + sm: Any asynchronous_search: Any alerting: Any index_management: Any @@ -45,6 +47,7 @@ class PluginsClient(NamespacedClient): def __init__(self, client: Client) -> None: super().__init__(client) + self.sm = SmClient(client) self.replication = ReplicationClient(client) self.flow_framework = FlowFrameworkClient(client) self.asynchronous_search = AsynchronousSearchClient(client) @@ -66,6 +69,7 @@ def _dynamic_lookup(self, client: Any) -> None: # Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742 plugins = [ + "sm", "replication", "flow_framework", "asynchronous_search", diff --git a/opensearchpy/plugins/knn.py b/opensearchpy/plugins/knn.py index 191bfb5f..c5b2e065 100644 --- a/opensearchpy/plugins/knn.py +++ b/opensearchpy/plugins/knn.py @@ -310,7 +310,7 @@ def stats( ) def train_model( self, - body: Any, + body: Any = None, model_id: Any = None, params: Any = None, headers: Any = None, @@ -335,9 +335,6 @@ def train_model( :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ - if body in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'body'.") - return self.transport.perform_request( "POST", _make_path("_plugins", "_knn", "models", model_id, "_train"), diff --git a/opensearchpy/plugins/ml.py b/opensearchpy/plugins/ml.py index cfb58405..6a53aab1 100644 --- a/opensearchpy/plugins/ml.py +++ b/opensearchpy/plugins/ml.py @@ -493,3 +493,117 @@ def register_agents( headers=headers, body=body, ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def predict( + self, + algorithm_name: Any, + model_id: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Predicts new data with trained model. + + + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + for param in (algorithm_name, model_id): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") + + return self.transport.perform_request( + "POST", + _make_path("_plugins", "_ml", "_predict", algorithm_name, model_id), + params=params, + headers=headers, + body=body, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def train( + self, + algorithm_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Trains a model synchronously. + + + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if algorithm_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'algorithm_name'." + ) + + return self.transport.perform_request( + "POST", + _make_path("_plugins", "_ml", "_train", algorithm_name), + params=params, + headers=headers, + body=body, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def train_predict( + self, + algorithm_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Trains a model and predicts against the same training dataset. + + + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if algorithm_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'algorithm_name'." + ) + + return self.transport.perform_request( + "POST", + _make_path("_plugins", "_ml", "_train_predict", algorithm_name), + params=params, + headers=headers, + body=body, + ) diff --git a/opensearchpy/plugins/observability.py b/opensearchpy/plugins/observability.py index 2bf9e03f..af1d68ba 100644 --- a/opensearchpy/plugins/observability.py +++ b/opensearchpy/plugins/observability.py @@ -135,7 +135,7 @@ def get_localstats( headers: Any = None, ) -> Any: """ - Retrieves Local Stats of all observability objects. + Retrieves local stats of all observability objects. :arg error_trace: Whether to include the stack trace of returned diff --git a/opensearchpy/plugins/sm.py b/opensearchpy/plugins/sm.py new file mode 100644 index 00000000..7c5cb208 --- /dev/null +++ b/opensearchpy/plugins/sm.py @@ -0,0 +1,346 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. +# +# Modifications Copyright OpenSearch Contributors. See +# GitHub history for details. + +# ------------------------------------------------------------------------------------------ +# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST +# +# To contribute, kindly make modifications in the opensearch-py client generator +# or in the OpenSearch API specification, and run `nox -rs generate`. See DEVELOPER_GUIDE.md +# and https://github.com/opensearch-project/opensearch-api-specification for details. +# -----------------------------------------------------------------------------------------+ + + +from typing import Any + +from ..client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params + + +class SmClient(NamespacedClient): + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def create_policy( + self, + policy_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Creates a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + body=body, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def delete_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Deletes a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "DELETE", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def explain_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Explains the state of the snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "GET", + _make_path("_plugins", "_sm", "policies", policy_name, "_explain"), + params=params, + headers=headers, + ) + + @query_params( + "error_trace", + "filter_path", + "from_", + "human", + "pretty", + "queryString", + "size", + "sortField", + "sortOrder", + "source", + ) + def get_policies( + self, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Retrieves all snapshot management policies with optional pagination and + filtering. + + + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg from_: The starting index (default: 0) + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg queryString: A query string to filter policies. + :arg size: The number of policies to return. + :arg sortField: The field to sort on. + :arg sortOrder: The order of sorting. Valid choices are asc, + desc.Default is asc. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + # from is a reserved word so it cannot be used, use from_ instead + if "from_" in params: + params["from"] = params.pop("from_") + + return self.transport.perform_request( + "GET", "/_plugins/_sm/policies", params=params, headers=headers + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def get_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Retrieves a specific snapshot management policy by name. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "GET", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def start_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Starts a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name, "_start"), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def stop_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Stops a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name, "_stop"), + params=params, + headers=headers, + ) + + @query_params( + "error_trace", + "filter_path", + "human", + "if_primary_term", + "if_seq_no", + "pretty", + "source", + ) + def update_policy( + self, + policy_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Updates an existing snapshot management policy. Requires `if_seq_no` and + `if_primary_term`. + + + :arg policy_name: The name of the snapshot management policy. + :arg error_trace: Whether to include the stack trace of returned + errors. Default is false. + :arg filter_path: Used to reduce the response. This parameter + takes a comma-separated list of filters. It supports using wildcards to + match any field or part of a field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg if_primary_term: The primary term of the policy to update. + :arg if_seq_no: The sequence number of the policy to update. + :arg pretty: Whether to pretty format the returned JSON + response. Default is false. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + if policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "PUT", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + body=body, + )