From f7cbc6b8cc227fc7be8c941e01f427b6ece4fca5 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 24 Oct 2023 11:21:32 -0400 Subject: [PATCH] Use jsonmerge instead. Signed-off-by: dblock --- dev-requirements.txt | 2 +- opensearchpy/_async/client/indices.py | 1170 ++++++++++++------------ opensearchpy/_async/client/indices.pyi | 386 ++++---- opensearchpy/client/indices.py | 1170 ++++++++++++------------ opensearchpy/client/indices.pyi | 386 ++++---- utils/generate-api.py | 4 +- 6 files changed, 1561 insertions(+), 1557 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index a79a1a0b..0013adf3 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -7,7 +7,7 @@ sphinx<7.3 sphinx_rtd_theme jinja2 pytz -deepmerge +jsonmerge # No wheels for Python 3.10 yet! numpy; python_version<"3.10" diff --git a/opensearchpy/_async/client/indices.py b/opensearchpy/_async/client/indices.py index cfc48db4..dc3bdc48 100644 --- a/opensearchpy/_async/client/indices.py +++ b/opensearchpy/_async/client/indices.py @@ -37,6 +37,8 @@ from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params +# replace_token# + class IndicesClient(NamespacedClient): @query_params() @@ -379,16 +381,15 @@ async def exists(self, index, params=None, headers=None): "ignore_unavailable", "master_timeout", "timeout", - "write_index_only", ) - async def put_mapping(self, body, index=None, params=None, headers=None): + async def add_block(self, index, block, params=None, headers=None): """ - Updates the index mappings. + Adds a block to an index. - :arg body: The mapping definition - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. + :arg index: Comma-separated list of indices to add a block to. + :arg block: The block to add (one of read, write, read_only or + metadata). :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). @@ -403,106 +404,95 @@ async def put_mapping(self, body, index=None, params=None, headers=None): use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. :arg timeout: Operation timeout. - :arg write_index_only: When true, applies mappings only to the - write index of an alias or data stream. Default is false. """ - if body in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'body'.") - - if index in SKIP_IN_PATH: - index = "_all" + for param in (index, block): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") return await self.transport.perform_request( - "PUT", - _make_path(index, "_mapping"), - params=params, - headers=headers, - body=body, + "PUT", _make_path(index, "_block", block), params=params, headers=headers ) @query_params( "allow_no_indices", - "cluster_manager_timeout", "expand_wildcards", + "fielddata", + "fields", "ignore_unavailable", - "local", - "master_timeout", + "query", + "request", ) - async def get_mapping(self, index=None, params=None, headers=None): + async def clear_cache(self, index=None, params=None, headers=None): """ - Returns mappings for one or more indices. + Clears all or specific caches for one or more indices. - :arg index: Comma-separated list of indices. + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. + :arg fielddata: Clear field data. + :arg fields: Comma-separated list of fields to clear when using + the `fielddata` parameter (default: all). :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg local (Deprecated: This parameter is a no-op and field - mappings are always retrieved locally.): Return local information, do - 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 master node. + :arg query: Clear query caches. + :arg request: Clear request cache. """ return await self.transport.perform_request( - "GET", _make_path(index, "_mapping"), params=params, headers=headers + "POST", _make_path(index, "_cache", "clear"), params=params, headers=headers ) - @query_params( - "allow_no_indices", - "expand_wildcards", - "ignore_unavailable", - "include_defaults", - "local", - ) - async def get_field_mapping(self, fields, index=None, params=None, headers=None): + @query_params() + async def create_data_stream(self, name, body=None, params=None, headers=None): """ - Returns mapping for one or more fields. + Creates or updates a data stream. - :arg fields: Comma-separated list of fields. - :arg index: Comma-separated list of indices. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg include_defaults: Whether the default mapping values should - be returned as well. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg name: The name of the data stream. + :arg body: The data stream definition """ - if fields in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'fields'.") + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") + + return await self.transport.perform_request( + "PUT", + _make_path("_data_stream", name), + params=params, + headers=headers, + body=body, + ) + + @query_params() + async def data_streams_stats(self, name=None, params=None, headers=None): + """ + Provides statistics on operations happening in a data stream. + + :arg name: Comma-separated list of data streams; use `_all` or + empty string to perform the operation on all data streams. + """ return await self.transport.perform_request( "GET", - _make_path(index, "_mapping", "field", fields), + _make_path("_data_stream", name, "_stats"), params=params, headers=headers, ) @query_params("cluster_manager_timeout", "master_timeout", "timeout") - async def put_alias(self, index, name, body=None, params=None, headers=None): + async def delete_alias(self, index, name, params=None, headers=None): """ - Creates or updates an alias. + Deletes an alias. :arg index: Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices. - :arg name: The name of the alias to be created or updated. - :arg body: The settings for the alias, such as `routing` or - `filter` + :arg name: Comma-separated list of aliases to delete (supports + wildcards); use `_all` to delete all aliases for the specified indices. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. :arg master_timeout (Deprecated: To promote inclusive language, @@ -515,69 +505,32 @@ async def put_alias(self, index, name, body=None, params=None, headers=None): raise ValueError("Empty value passed for a required argument.") return await self.transport.perform_request( - "PUT", - _make_path(index, "_alias", name), - params=params, - headers=headers, - body=body, + "DELETE", _make_path(index, "_alias", name), params=params, headers=headers ) - @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") - async def exists_alias(self, name, index=None, params=None, headers=None): + @query_params() + async def delete_data_stream(self, name, params=None, headers=None): """ - Returns information about whether a particular alias exists. + Deletes a data stream. - :arg name: Comma-separated list of alias names. - :arg index: Comma-separated list of indices to filter aliases. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg name: Comma-separated list of data streams; use `_all` or + empty string to perform the operation on all data streams. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'name'.") return await self.transport.perform_request( - "HEAD", _make_path(index, "_alias", name), params=params, headers=headers - ) - - @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") - async def get_alias(self, index=None, name=None, params=None, headers=None): - """ - Returns an alias. - - - :arg index: Comma-separated list of indices to filter aliases. - :arg name: Comma-separated list of alias names. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. - """ - return await self.transport.perform_request( - "GET", _make_path(index, "_alias", name), params=params, headers=headers + "DELETE", _make_path("_data_stream", name), params=params, headers=headers ) @query_params("cluster_manager_timeout", "master_timeout", "timeout") - async def update_aliases(self, body, params=None, headers=None): + async def delete_index_template(self, name, params=None, headers=None): """ - Updates index aliases. + Deletes an index template. - :arg body: The definition of `actions` to perform + :arg name: The name of the template. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. :arg master_timeout (Deprecated: To promote inclusive language, @@ -585,23 +538,23 @@ async def update_aliases(self, body, params=None, headers=None): connection to master node. :arg timeout: Operation timeout. """ - if body in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'body'.") + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") return await self.transport.perform_request( - "POST", "/_aliases", params=params, headers=headers, body=body + "DELETE", + _make_path("_index_template", name), + params=params, + headers=headers, ) @query_params("cluster_manager_timeout", "master_timeout", "timeout") - async def delete_alias(self, index, name, params=None, headers=None): + async def delete_template(self, name, params=None, headers=None): """ - Deletes an alias. + Deletes an index template. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg name: Comma-separated list of aliases to delete (supports - wildcards); use `_all` to delete all aliases for the specified indices. + :arg name: The name of the template. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. :arg master_timeout (Deprecated: To promote inclusive language, @@ -609,52 +562,46 @@ async def delete_alias(self, index, name, params=None, headers=None): connection to master node. :arg timeout: Operation timeout. """ - for param in (index, name): - if param in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument.") + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") return await self.transport.perform_request( - "DELETE", _make_path(index, "_alias", name), params=params, headers=headers + "DELETE", _make_path("_template", name), params=params, headers=headers ) - @query_params("cluster_manager_timeout", "create", "master_timeout", "order") - async def put_template(self, name, body, params=None, headers=None): + @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") + async def exists_alias(self, name, index=None, params=None, headers=None): """ - Creates or updates an index template. + Returns information about whether a particular alias exists. - :arg name: The name of the template. - :arg body: The template definition - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. - :arg create: Whether the index template should only be added if - new or can also replace an existing one. Default is false. - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg order: The order for this template when merging multiple - matching ones (higher numbers are merged later, overriding the lower - numbers). + :arg name: Comma-separated list of alias names. + :arg index: Comma-separated list of indices to filter aliases. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). + :arg local: Return local information, do not retrieve the state + from cluster-manager node. Default is false. """ - for param in (name, body): - if param in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument.") + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") return await self.transport.perform_request( - "PUT", - _make_path("_template", name), - params=params, - headers=headers, - body=body, + "HEAD", _make_path(index, "_alias", name), params=params, headers=headers ) @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") - async def exists_template(self, name, params=None, headers=None): + async def exists_index_template(self, name, params=None, headers=None): """ Returns information about whether a particular index template exists. - :arg name: Comma-separated names of the index templates. + :arg name: The name of the template. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. :arg flat_settings: Return settings in flat format. Default is @@ -669,13 +616,13 @@ async def exists_template(self, name, params=None, headers=None): raise ValueError("Empty value passed for a required argument 'name'.") return await self.transport.perform_request( - "HEAD", _make_path("_template", name), params=params, headers=headers + "HEAD", _make_path("_index_template", name), params=params, headers=headers ) @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") - async def get_template(self, name=None, params=None, headers=None): + async def exists_template(self, name, params=None, headers=None): """ - Returns an index template. + Returns information about whether a particular index template exists. :arg name: Comma-separated names of the index templates. @@ -689,181 +636,97 @@ async def get_template(self, name=None, params=None, headers=None): use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. """ + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") + return await self.transport.perform_request( - "GET", _make_path("_template", name), params=params, headers=headers - ) - - @query_params("cluster_manager_timeout", "master_timeout", "timeout") - async def delete_template(self, name, params=None, headers=None): - """ - Deletes an index template. - - - :arg name: The name of the template. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg timeout: Operation timeout. - """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") - - return await self.transport.perform_request( - "DELETE", _make_path("_template", name), params=params, headers=headers + "HEAD", _make_path("_template", name), params=params, headers=headers ) @query_params( "allow_no_indices", - "cluster_manager_timeout", "expand_wildcards", - "flat_settings", + "flush", "ignore_unavailable", - "include_defaults", - "local", - "master_timeout", + "max_num_segments", + "only_expunge_deletes", ) - async def get_settings(self, index=None, name=None, params=None, headers=None): + async def forcemerge(self, index=None, params=None, headers=None): """ - Returns settings for one or more indices. + Performs the force merge operation on one or more indices. :arg index: Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices. - :arg name: Comma-separated list of settings. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. - :arg flat_settings: Return settings in flat format. Default is - false. + :arg flush: Specify whether the index should be flushed after + performing the operation. Default is True. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg include_defaults: Whether to return all default setting for - each of the indices. Default is false. - :arg local: Return local information, do 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 master node. + :arg max_num_segments: The number of segments the index should + be merged into (default: dynamic). + :arg only_expunge_deletes: Specify whether the operation should + only expunge deleted documents. """ return await self.transport.perform_request( - "GET", _make_path(index, "_settings", name), params=params, headers=headers + "POST", _make_path(index, "_forcemerge"), params=params, headers=headers ) - @query_params( - "allow_no_indices", - "cluster_manager_timeout", - "expand_wildcards", - "flat_settings", - "ignore_unavailable", - "master_timeout", - "preserve_existing", - "timeout", - ) - async def put_settings(self, body, index=None, params=None, headers=None): + @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") + async def get_alias(self, index=None, name=None, params=None, headers=None): """ - Updates the index settings. + Returns an alias. - :arg body: The index settings to be updated - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. + :arg index: Comma-separated list of indices to filter aliases. + :arg name: Comma-separated list of alias names. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. - :arg flat_settings: Return settings in flat format. Default is - false. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg preserve_existing: Whether to update existing settings. If - set to `true` existing settings on an index remain unchanged. Default is - false. - :arg timeout: Operation timeout. + :arg local: Return local information, do not retrieve the state + from cluster-manager node. Default is false. """ - if body in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'body'.") - return await self.transport.perform_request( - "PUT", - _make_path(index, "_settings"), - params=params, - headers=headers, - body=body, + "GET", _make_path(index, "_alias", name), params=params, headers=headers ) - @query_params( - "completion_fields", - "expand_wildcards", - "fielddata_fields", - "fields", - "forbid_closed_indices", - "groups", - "include_segment_file_sizes", - "include_unloaded_segments", - "level", - ) - async def stats(self, index=None, metric=None, params=None, headers=None): + @query_params() + async def get_data_stream(self, name=None, params=None, headers=None): """ - Provides statistics on operations happening in an index. + Returns data streams. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg metric: Limit the information returned the specific - metrics. Valid choices are _all, store, indexing, get, search, merge, - flush, refresh, query_cache, fielddata, docs, warmer, completion, - segments, translog, suggest, request_cache, recovery. - :arg completion_fields: Comma-separated list of fields for - `fielddata` and `suggest` index metric (supports wildcards). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg fielddata_fields: Comma-separated list of fields for - `fielddata` index metric (supports wildcards). - :arg fields: Comma-separated list of fields for `fielddata` and - `completion` index metric (supports wildcards). - :arg forbid_closed_indices: If set to false stats will also - collected from closed indices if explicitly specified or if - expand_wildcards expands to closed indices. Default is True. - :arg groups: Comma-separated list of search groups for `search` - index metric. - :arg include_segment_file_sizes: Whether to report the - aggregated disk usage of each one of the Lucene index files (only - applies if segment stats are requested). Default is false. - :arg include_unloaded_segments: If set to true segment stats - will include stats for segments that are not currently loaded into - memory. Default is false. - :arg level: Return stats aggregated at cluster, index or shard - level. Valid choices are cluster, indices, shards. + :arg name: Comma-separated list of data streams; use `_all` or + empty string to perform the operation on all data streams. """ return await self.transport.perform_request( - "GET", _make_path(index, "_stats", metric), params=params, headers=headers + "GET", _make_path("_data_stream", name), params=params, headers=headers ) @query_params( - "allow_no_indices", "expand_wildcards", "ignore_unavailable", "verbose" + "allow_no_indices", + "expand_wildcards", + "ignore_unavailable", + "include_defaults", + "local", ) - async def segments(self, index=None, params=None, headers=None): + async def get_field_mapping(self, fields, index=None, params=None, headers=None): """ - Provides low-level information about segments in a Lucene index. + Returns mapping for one or more fields. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. + :arg fields: Comma-separated list of fields. + :arg index: Comma-separated list of indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). @@ -872,176 +735,144 @@ async def segments(self, index=None, params=None, headers=None): open, closed, hidden, none. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg verbose: Includes detailed memory usage by Lucene. Default - is false. + :arg include_defaults: Whether the default mapping values should + be returned as well. + :arg local: Return local information, do not retrieve the state + from cluster-manager node. Default is false. """ + if fields in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'fields'.") + return await self.transport.perform_request( - "GET", _make_path(index, "_segments"), params=params, headers=headers + "GET", + _make_path(index, "_mapping", "field", fields), + params=params, + headers=headers, ) - @query_params( - "all_shards", - "allow_no_indices", - "analyze_wildcard", - "analyzer", - "default_operator", - "df", - "expand_wildcards", - "explain", - "ignore_unavailable", - "lenient", - "q", - "rewrite", - ) - async def validate_query(self, body=None, index=None, params=None, headers=None): + @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") + async def get_index_template(self, name=None, params=None, headers=None): """ - Allows a user to validate a potentially expensive query without executing it. + Returns an index template. - :arg body: The query definition specified with the Query DSL - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg all_shards: Execute validation on all shards instead of one - random shard per index. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed. Default is false. - :arg analyzer: The analyzer to use for the query string. - :arg default_operator: The default operator for query string - query (AND or OR). Valid choices are AND, OR. - :arg df: The field to use as default where no field prefix is - given in the query string. - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg explain: Return detailed information about the error. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored. - :arg q: Query in the Lucene query string syntax. - :arg rewrite: Provide a more detailed explanation showing the - actual Lucene query that will be executed. + :arg name: Comma-separated names of the index templates. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg flat_settings: Return settings in flat format. Default is + false. + :arg local: Return local information, do 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 master node. """ return await self.transport.perform_request( - "POST", - _make_path(index, "_validate", "query"), - params=params, - headers=headers, - body=body, + "GET", _make_path("_index_template", name), params=params, headers=headers ) @query_params( "allow_no_indices", + "cluster_manager_timeout", "expand_wildcards", - "fielddata", - "fields", "ignore_unavailable", - "query", - "request", + "local", + "master_timeout", ) - async def clear_cache(self, index=None, params=None, headers=None): + async def get_mapping(self, index=None, params=None, headers=None): """ - Clears all or specific caches for one or more indices. + Returns mappings for one or more indices. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. + :arg index: Comma-separated list of indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. - :arg fielddata: Clear field data. - :arg fields: Comma-separated list of fields to clear when using - the `fielddata` parameter (default: all). :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg query: Clear query caches. - :arg request: Clear request cache. - """ - return await self.transport.perform_request( - "POST", _make_path(index, "_cache", "clear"), params=params, headers=headers - ) - - @query_params("active_only", "detailed") - async def recovery(self, index=None, params=None, headers=None): - """ - Returns information about ongoing index shard recoveries. - - - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg active_only: Display only those recoveries that are - currently on-going. Default is false. - :arg detailed: Whether to display detailed information about - shard recovery. Default is false. + :arg local (Deprecated: This parameter is a no-op and field + mappings are always retrieved locally.): Return local information, do + 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 master node. """ return await self.transport.perform_request( - "GET", _make_path(index, "_recovery"), params=params, headers=headers + "GET", _make_path(index, "_mapping"), params=params, headers=headers ) @query_params( "allow_no_indices", + "cluster_manager_timeout", "expand_wildcards", + "flat_settings", "ignore_unavailable", - "only_ancient_segments", - "wait_for_completion", + "include_defaults", + "local", + "master_timeout", ) - async def upgrade(self, index=None, params=None, headers=None): + async def get_settings(self, index=None, name=None, params=None, headers=None): """ - The _upgrade API is no longer useful and will be removed. + Returns settings for one or more indices. :arg index: Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices. + :arg name: Comma-separated list of settings. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. + :arg flat_settings: Return settings in flat format. Default is + false. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg only_ancient_segments: If true, only ancient (an older - Lucene major release) segments will be upgraded. - :arg wait_for_completion: Should this request wait until the - operation has completed before returning. Default is false. + :arg include_defaults: Whether to return all default setting for + each of the indices. Default is false. + :arg local: Return local information, do 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 master node. """ return await self.transport.perform_request( - "POST", _make_path(index, "_upgrade"), params=params, headers=headers + "GET", _make_path(index, "_settings", name), params=params, headers=headers ) - @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable") - async def get_upgrade(self, index=None, params=None, headers=None): + @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") + async def get_template(self, name=None, params=None, headers=None): """ - The _upgrade API is no longer useful and will be removed. + Returns an index template. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). + :arg name: Comma-separated names of the index templates. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg flat_settings: Return settings in flat format. Default is + false. + :arg local: Return local information, do 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 master node. """ return await self.transport.perform_request( - "GET", _make_path(index, "_upgrade"), params=params, headers=headers + "GET", _make_path("_template", name), params=params, headers=headers ) - @query_params( - "allow_no_indices", "expand_wildcards", "ignore_unavailable", "status" - ) - async def shard_stores(self, index=None, params=None, headers=None): + @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable") + async def get_upgrade(self, index=None, params=None, headers=None): """ - Provides store information for shard copies of indices. + The _upgrade API is no longer useful and will be removed. :arg index: Comma-separated list of indices; use `_all` or empty @@ -1054,299 +885,362 @@ async def shard_stores(self, index=None, params=None, headers=None): open, closed, hidden, none. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg status: Comma-separated list of statuses used to filter on - shards to get store information for. """ return await self.transport.perform_request( - "GET", _make_path(index, "_shard_stores"), params=params, headers=headers + "GET", _make_path(index, "_upgrade"), params=params, headers=headers ) - @query_params( - "allow_no_indices", - "expand_wildcards", - "flush", - "ignore_unavailable", - "max_num_segments", - "only_expunge_deletes", - ) - async def forcemerge(self, index=None, params=None, headers=None): + @query_params("cluster_manager_timeout", "master_timeout", "timeout") + async def put_alias(self, index, name, body=None, params=None, headers=None): """ - Performs the force merge operation on one or more indices. + Creates or updates an alias. :arg index: Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg flush: Specify whether the index should be flushed after - performing the operation. Default is True. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg max_num_segments: The number of segments the index should - be merged into (default: dynamic). - :arg only_expunge_deletes: Specify whether the operation should - only expunge deleted documents. + :arg name: The name of the alias to be created or updated. + :arg body: The settings for the alias, such as `routing` or + `filter` + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead.): Operation timeout for + connection to master node. + :arg timeout: Operation timeout. """ + for param in (index, name): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") + return await self.transport.perform_request( - "POST", _make_path(index, "_forcemerge"), params=params, headers=headers + "PUT", + _make_path(index, "_alias", name), + params=params, + headers=headers, + body=body, ) - @query_params( - "cluster_manager_timeout", - "copy_settings", - "master_timeout", - "timeout", - "wait_for_active_shards", - ) - async def shrink(self, index, target, body=None, params=None, headers=None): + @query_params("cause", "cluster_manager_timeout", "create", "master_timeout") + async def put_index_template(self, name, body, params=None, headers=None): """ - Allow to shrink an existing index into a new index with fewer primary shards. + Creates or updates an index template. - :arg index: The name of the source index to shrink. - :arg target: The name of the target index. - :arg body: The configuration for the target index (`settings` - and `aliases`) + :arg name: The name of the template. + :arg body: The template definition + :arg cause: User defined reason for creating/updating the index + template. Default is false. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg copy_settings: whether or not to copy settings from the - source index. Default is false. + :arg create: Whether the index template should only be added if + new or can also replace an existing one. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. - :arg timeout: Operation timeout. - :arg wait_for_active_shards: Set the number of active shards to - wait for on the shrunken index before the operation returns. """ - for param in (index, target): + for param in (name, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return await self.transport.perform_request( "PUT", - _make_path(index, "_shrink", target), + _make_path("_index_template", name), params=params, headers=headers, body=body, ) @query_params( + "allow_no_indices", "cluster_manager_timeout", - "copy_settings", + "expand_wildcards", + "ignore_unavailable", "master_timeout", "timeout", - "wait_for_active_shards", + "write_index_only", ) - async def split(self, index, target, body=None, params=None, headers=None): + async def put_mapping(self, body, index=None, params=None, headers=None): """ - Allows you to split an existing index into a new index with more primary - shards. + Updates the index mappings. - :arg index: The name of the source index to split. - :arg target: The name of the target index. - :arg body: The configuration for the target index (`settings` - and `aliases`) + :arg body: The mapping definition + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg copy_settings: whether or not to copy settings from the - source index. Default is false. + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. :arg timeout: Operation timeout. - :arg wait_for_active_shards: Set the number of active shards to - wait for on the shrunken index before the operation returns. + :arg write_index_only: When true, applies mappings only to the + write index of an alias or data stream. Default is false. """ - for param in (index, target): - if param in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument.") + if body in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'body'.") + + if index in SKIP_IN_PATH: + index = "_all" return await self.transport.perform_request( "PUT", - _make_path(index, "_split", target), + _make_path(index, "_mapping"), params=params, headers=headers, body=body, ) @query_params( + "allow_no_indices", "cluster_manager_timeout", - "dry_run", + "expand_wildcards", + "flat_settings", + "ignore_unavailable", "master_timeout", + "preserve_existing", "timeout", - "wait_for_active_shards", ) - async def rollover( - self, alias, body=None, new_index=None, params=None, headers=None - ): + async def put_settings(self, body, index=None, params=None, headers=None): """ - Updates an alias to point to a new index when the existing index is considered - to be too large or too old. + Updates the index settings. - :arg alias: The name of the alias to rollover. - :arg body: The conditions that needs to be met for executing - rollover - :arg new_index: The name of the rollover index. + :arg body: The index settings to be updated + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg dry_run: If set to true the rollover action will only be - validated but not actually performed even if a condition matches. - Default is false. + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg flat_settings: Return settings in flat format. Default is + false. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. + :arg preserve_existing: Whether to update existing settings. If + set to `true` existing settings on an index remain unchanged. Default is + false. :arg timeout: Operation timeout. - :arg wait_for_active_shards: Set the number of active shards to - wait for on the newly created rollover index before the operation - returns. """ - if alias in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'alias'.") + 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(alias, "_rollover", new_index), + "PUT", + _make_path(index, "_settings"), params=params, headers=headers, body=body, ) - @query_params() - async def create_data_stream(self, name, body=None, params=None, headers=None): + @query_params("cluster_manager_timeout", "create", "master_timeout", "order") + async def put_template(self, name, body, params=None, headers=None): """ - Creates or updates a data stream. + Creates or updates an index template. - :arg name: The name of the data stream. - :arg body: The data stream definition + :arg name: The name of the template. + :arg body: The template definition + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg create: Whether the index template should only be added if + new or can also replace an existing one. Default is false. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead.): Operation timeout for + connection to master node. + :arg order: The order for this template when merging multiple + matching ones (higher numbers are merged later, overriding the lower + numbers). """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") + for param in (name, body): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") return await self.transport.perform_request( "PUT", - _make_path("_data_stream", name), + _make_path("_template", name), params=params, headers=headers, body=body, ) - @query_params() - async def delete_data_stream(self, name, params=None, headers=None): + @query_params("active_only", "detailed") + async def recovery(self, index=None, params=None, headers=None): """ - Deletes a data stream. + Returns information about ongoing index shard recoveries. - :arg name: Comma-separated list of data streams; use `_all` or - empty string to perform the operation on all data streams. + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg active_only: Display only those recoveries that are + currently on-going. Default is false. + :arg detailed: Whether to display detailed information about + shard recovery. Default is false. """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") - return await self.transport.perform_request( - "DELETE", _make_path("_data_stream", name), params=params, headers=headers + "GET", _make_path(index, "_recovery"), params=params, headers=headers ) - @query_params("cluster_manager_timeout", "master_timeout", "timeout") - async def delete_index_template(self, name, params=None, headers=None): + @query_params("expand_wildcards") + async def resolve_index(self, name, params=None, headers=None): """ - Deletes an index template. + Returns information about any matching indices, aliases, and data streams. - :arg name: The name of the template. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg timeout: Operation timeout. + :arg name: Comma-separated list of names or wildcard + expressions. + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'name'.") return await self.transport.perform_request( - "DELETE", - _make_path("_index_template", name), - params=params, - headers=headers, + "GET", _make_path("_resolve", "index", name), params=params, headers=headers ) - @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") - async def exists_index_template(self, name, params=None, headers=None): + @query_params( + "cluster_manager_timeout", + "dry_run", + "master_timeout", + "timeout", + "wait_for_active_shards", + ) + async def rollover( + self, alias, body=None, new_index=None, params=None, headers=None + ): """ - Returns information about whether a particular index template exists. + Updates an alias to point to a new index when the existing index is considered + to be too large or too old. - :arg name: The name of the template. + :arg alias: The name of the alias to rollover. + :arg body: The conditions that needs to be met for executing + rollover + :arg new_index: The name of the rollover index. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg flat_settings: Return settings in flat format. Default is - false. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg dry_run: If set to true the rollover action will only be + validated but not actually performed even if a condition matches. + Default is false. :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. + :arg timeout: Operation timeout. + :arg wait_for_active_shards: Set the number of active shards to + wait for on the newly created rollover index before the operation + returns. """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") + if alias in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'alias'.") return await self.transport.perform_request( - "HEAD", _make_path("_index_template", name), params=params, headers=headers + "POST", + _make_path(alias, "_rollover", new_index), + params=params, + headers=headers, + body=body, ) - @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") - async def get_index_template(self, name=None, params=None, headers=None): + @query_params( + "allow_no_indices", "expand_wildcards", "ignore_unavailable", "verbose" + ) + async def segments(self, index=None, params=None, headers=None): """ - Returns an index template. + Provides low-level information about segments in a Lucene index. - :arg name: Comma-separated names of the index templates. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. - :arg flat_settings: Return settings in flat format. Default is - false. - :arg local: Return local information, do 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 master node. + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). + :arg verbose: Includes detailed memory usage by Lucene. Default + is false. + """ + return await self.transport.perform_request( + "GET", _make_path(index, "_segments"), params=params, headers=headers + ) + + @query_params( + "allow_no_indices", "expand_wildcards", "ignore_unavailable", "status" + ) + async def shard_stores(self, index=None, params=None, headers=None): + """ + Provides store information for shard copies of indices. + + + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). + :arg status: Comma-separated list of statuses used to filter on + shards to get store information for. """ return await self.transport.perform_request( - "GET", _make_path("_index_template", name), params=params, headers=headers + "GET", _make_path(index, "_shard_stores"), params=params, headers=headers ) - @query_params("cause", "cluster_manager_timeout", "create", "master_timeout") - async def put_index_template(self, name, body, params=None, headers=None): + @query_params( + "cluster_manager_timeout", + "copy_settings", + "master_timeout", + "timeout", + "wait_for_active_shards", + ) + async def shrink(self, index, target, body=None, params=None, headers=None): """ - Creates or updates an index template. + Allow to shrink an existing index into a new index with fewer primary shards. - :arg name: The name of the template. - :arg body: The template definition - :arg cause: User defined reason for creating/updating the index - template. Default is false. + :arg index: The name of the source index to shrink. + :arg target: The name of the target index. + :arg body: The configuration for the target index (`settings` + and `aliases`) :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg create: Whether the index template should only be added if - new or can also replace an existing one. Default is false. + :arg copy_settings: whether or not to copy settings from the + source index. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. + :arg timeout: Operation timeout. + :arg wait_for_active_shards: Set the number of active shards to + wait for on the shrunken index before the operation returns. """ - for param in (name, body): + for param in (index, target): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return await self.transport.perform_request( "PUT", - _make_path("_index_template", name), + _make_path(index, "_shrink", target), params=params, headers=headers, body=body, @@ -1385,19 +1279,6 @@ async def simulate_index_template(self, name, body=None, params=None, headers=No body=body, ) - @query_params() - async def get_data_stream(self, name=None, params=None, headers=None): - """ - Returns data streams. - - - :arg name: Comma-separated list of data streams; use `_all` or - empty string to perform the operation on all data streams. - """ - return await self.transport.perform_request( - "GET", _make_path("_data_stream", name), params=params, headers=headers - ) - @query_params("cause", "cluster_manager_timeout", "create", "master_timeout") async def simulate_template(self, body=None, name=None, params=None, headers=None): """ @@ -1426,76 +1307,197 @@ async def simulate_template(self, body=None, name=None, params=None, headers=Non body=body, ) - @query_params("expand_wildcards") - async def resolve_index(self, name, params=None, headers=None): + @query_params( + "cluster_manager_timeout", + "copy_settings", + "master_timeout", + "timeout", + "wait_for_active_shards", + ) + async def split(self, index, target, body=None, params=None, headers=None): """ - Returns information about any matching indices, aliases, and data streams. + Allows you to split an existing index into a new index with more primary + shards. - :arg name: Comma-separated list of names or wildcard - expressions. + :arg index: The name of the source index to split. + :arg target: The name of the target index. + :arg body: The configuration for the target index (`settings` + and `aliases`) + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg copy_settings: whether or not to copy settings from the + source index. Default is false. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead.): Operation timeout for + connection to master node. + :arg timeout: Operation timeout. + :arg wait_for_active_shards: Set the number of active shards to + wait for on the shrunken index before the operation returns. + """ + for param in (index, target): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") + + return await self.transport.perform_request( + "PUT", + _make_path(index, "_split", target), + params=params, + headers=headers, + body=body, + ) + + @query_params( + "completion_fields", + "expand_wildcards", + "fielddata_fields", + "fields", + "forbid_closed_indices", + "groups", + "include_segment_file_sizes", + "include_unloaded_segments", + "level", + ) + async def stats(self, index=None, metric=None, params=None, headers=None): + """ + Provides statistics on operations happening in an index. + + + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg metric: Limit the information returned the specific + metrics. Valid choices are _all, store, indexing, get, search, merge, + flush, refresh, query_cache, fielddata, docs, warmer, completion, + segments, translog, suggest, request_cache, recovery. + :arg completion_fields: Comma-separated list of fields for + `fielddata` and `suggest` index metric (supports wildcards). :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. + :arg fielddata_fields: Comma-separated list of fields for + `fielddata` index metric (supports wildcards). + :arg fields: Comma-separated list of fields for `fielddata` and + `completion` index metric (supports wildcards). + :arg forbid_closed_indices: If set to false stats will also + collected from closed indices if explicitly specified or if + expand_wildcards expands to closed indices. Default is True. + :arg groups: Comma-separated list of search groups for `search` + index metric. + :arg include_segment_file_sizes: Whether to report the + aggregated disk usage of each one of the Lucene index files (only + applies if segment stats are requested). Default is false. + :arg include_unloaded_segments: If set to true segment stats + will include stats for segments that are not currently loaded into + memory. Default is false. + :arg level: Return stats aggregated at cluster, index or shard + level. Valid choices are cluster, indices, shards. """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") + return await self.transport.perform_request( + "GET", _make_path(index, "_stats", metric), params=params, headers=headers + ) + + @query_params("cluster_manager_timeout", "master_timeout", "timeout") + async def update_aliases(self, body, params=None, headers=None): + """ + Updates index aliases. + + + :arg body: The definition of `actions` to perform + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead.): Operation timeout for + connection to master node. + :arg timeout: Operation timeout. + """ + if body in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'body'.") return await self.transport.perform_request( - "GET", _make_path("_resolve", "index", name), params=params, headers=headers + "POST", "/_aliases", params=params, headers=headers, body=body ) @query_params( "allow_no_indices", - "cluster_manager_timeout", "expand_wildcards", "ignore_unavailable", - "master_timeout", - "timeout", + "only_ancient_segments", + "wait_for_completion", ) - async def add_block(self, index, block, params=None, headers=None): + async def upgrade(self, index=None, params=None, headers=None): """ - Adds a block to an index. + The _upgrade API is no longer useful and will be removed. - :arg index: Comma-separated list of indices to add a block to. - :arg block: The block to add (one of read, write, read_only or - metadata). + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg timeout: Operation timeout. + :arg only_ancient_segments: If true, only ancient (an older + Lucene major release) segments will be upgraded. + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. Default is false. """ - for param in (index, block): - if param in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument.") - return await self.transport.perform_request( - "PUT", _make_path(index, "_block", block), params=params, headers=headers + "POST", _make_path(index, "_upgrade"), params=params, headers=headers ) - @query_params() - async def data_streams_stats(self, name=None, params=None, headers=None): + @query_params( + "all_shards", + "allow_no_indices", + "analyze_wildcard", + "analyzer", + "default_operator", + "df", + "expand_wildcards", + "explain", + "ignore_unavailable", + "lenient", + "q", + "rewrite", + ) + async def validate_query(self, body=None, index=None, params=None, headers=None): """ - Provides statistics on operations happening in a data stream. + Allows a user to validate a potentially expensive query without executing it. - :arg name: Comma-separated list of data streams; use `_all` or - empty string to perform the operation on all data streams. + :arg body: The query definition specified with the Query DSL + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg all_shards: Execute validation on all shards instead of one + random shard per index. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). + :arg analyze_wildcard: Specify whether wildcard and prefix + queries should be analyzed. Default is false. + :arg analyzer: The analyzer to use for the query string. + :arg default_operator: The default operator for query string + query (AND or OR). Valid choices are AND, OR. + :arg df: The field to use as default where no field prefix is + given in the query string. + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg explain: Return detailed information about the error. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). + :arg lenient: Specify whether format-based query failures (such + as providing text to a numeric field) should be ignored. + :arg q: Query in the Lucene query string syntax. + :arg rewrite: Provide a more detailed explanation showing the + actual Lucene query that will be executed. """ return await self.transport.perform_request( - "GET", - _make_path("_data_stream", name, "_stats"), + "POST", + _make_path(index, "_validate", "query"), params=params, headers=headers, + body=body, ) diff --git a/opensearchpy/_async/client/indices.pyi b/opensearchpy/_async/client/indices.pyi index 0d9b5953..b00dd785 100644 --- a/opensearchpy/_async/client/indices.pyi +++ b/opensearchpy/_async/client/indices.pyi @@ -262,18 +262,17 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> bool: ... - async def put_mapping( + async def add_block( self, + index: Any, + block: Any, *, - body: Any, - index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., - write_index_only: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -287,16 +286,17 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def get_mapping( + async def clear_cache( self, *, index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., + fielddata: Optional[Any] = ..., + fields: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - local: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., + query: Optional[Any] = ..., + request: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -310,16 +310,11 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def get_field_mapping( + async def create_data_stream( self, - fields: Any, + name: Any, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - include_defaults: Optional[Any] = ..., - local: Optional[Any] = ..., + body: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -333,15 +328,10 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def put_alias( + async def data_streams_stats( self, - index: Any, - name: Any, *, - body: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., + name: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -355,15 +345,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def exists_alias( + async def delete_alias( self, + index: Any, name: Any, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - local: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -376,16 +365,11 @@ class IndicesClient(NamespacedClient): api_key: Optional[Union[str, Tuple[str, str]]] = ..., params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., - ) -> bool: ... - async def get_alias( + ) -> Any: ... + async def delete_data_stream( self, + name: Any, *, - index: Optional[Any] = ..., - name: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - local: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -399,10 +383,10 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def update_aliases( + async def delete_index_template( self, + name: Any, *, - body: Any, cluster_manager_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., @@ -419,9 +403,8 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def delete_alias( + async def delete_template( self, - index: Any, name: Any, *, cluster_manager_timeout: Optional[Any] = ..., @@ -440,15 +423,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def put_template( + async def exists_alias( self, name: Any, *, - body: Any, - cluster_manager_timeout: Optional[Any] = ..., - create: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - order: Optional[Any] = ..., + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + local: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -461,8 +444,8 @@ class IndicesClient(NamespacedClient): api_key: Optional[Union[str, Tuple[str, str]]] = ..., params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., - ) -> Any: ... - async def exists_template( + ) -> bool: ... + async def exists_index_template( self, name: Any, *, @@ -483,10 +466,10 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> bool: ... - async def get_template( + async def exists_template( self, + name: Any, *, - name: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., flat_settings: Optional[Any] = ..., local: Optional[Any] = ..., @@ -503,14 +486,17 @@ class IndicesClient(NamespacedClient): api_key: Optional[Union[str, Tuple[str, str]]] = ..., params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., - ) -> Any: ... - async def delete_template( + ) -> bool: ... + async def forcemerge( self, - name: Any, *, - cluster_manager_timeout: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + flush: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + max_num_segments: Optional[Any] = ..., + only_expunge_deletes: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -524,19 +510,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def get_settings( + async def get_alias( self, *, index: Optional[Any] = ..., name: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - flat_settings: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - include_defaults: Optional[Any] = ..., local: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -550,19 +532,10 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def put_settings( + async def get_data_stream( self, *, - body: Any, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - flat_settings: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - preserve_existing: Optional[Any] = ..., - timeout: Optional[Any] = ..., + name: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -576,20 +549,16 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def stats( + async def get_field_mapping( self, + fields: Any, *, index: Optional[Any] = ..., - metric: Optional[Any] = ..., - completion_fields: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - fielddata_fields: Optional[Any] = ..., - fields: Optional[Any] = ..., - forbid_closed_indices: Optional[Any] = ..., - groups: Optional[Any] = ..., - include_segment_file_sizes: Optional[Any] = ..., - include_unloaded_segments: Optional[Any] = ..., - level: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + include_defaults: Optional[Any] = ..., + local: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -603,14 +572,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def segments( + async def get_index_template( self, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - verbose: Optional[Any] = ..., + name: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + flat_settings: Optional[Any] = ..., + local: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -624,23 +593,16 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def validate_query( + async def get_mapping( self, *, - body: Optional[Any] = ..., index: Optional[Any] = ..., - all_shards: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., - analyze_wildcard: Optional[Any] = ..., - analyzer: Optional[Any] = ..., - default_operator: Optional[Any] = ..., - df: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - explain: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - lenient: Optional[Any] = ..., - q: Optional[Any] = ..., - rewrite: Optional[Any] = ..., + local: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -654,17 +616,19 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def clear_cache( + async def get_settings( self, *, index: Optional[Any] = ..., + name: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - fielddata: Optional[Any] = ..., - fields: Optional[Any] = ..., + flat_settings: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - query: Optional[Any] = ..., - request: Optional[Any] = ..., + include_defaults: Optional[Any] = ..., + local: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -678,12 +642,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def recovery( + async def get_template( self, *, - index: Optional[Any] = ..., - active_only: Optional[Any] = ..., - detailed: Optional[Any] = ..., + name: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + flat_settings: Optional[Any] = ..., + local: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -697,15 +663,13 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def upgrade( + async def get_upgrade( self, *, index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - only_ancient_segments: Optional[Any] = ..., - wait_for_completion: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -719,13 +683,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def get_upgrade( + async def put_alias( self, + index: Any, + name: Any, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., + body: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -739,14 +705,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def shard_stores( + async def put_index_template( self, + name: Any, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - status: Optional[Any] = ..., + body: Any, + cause: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + create: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -760,16 +727,18 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def forcemerge( + async def put_mapping( self, *, + body: Any, index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - flush: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - max_num_segments: Optional[Any] = ..., - only_expunge_deletes: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., + write_index_only: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -783,17 +752,19 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def shrink( + async def put_settings( self, - index: Any, - target: Any, *, - body: Optional[Any] = ..., + body: Any, + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., - copy_settings: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + flat_settings: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., master_timeout: Optional[Any] = ..., + preserve_existing: Optional[Any] = ..., timeout: Optional[Any] = ..., - wait_for_active_shards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -807,17 +778,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def split( + async def put_template( self, - index: Any, - target: Any, + name: Any, *, - body: Optional[Any] = ..., + body: Any, cluster_manager_timeout: Optional[Any] = ..., - copy_settings: Optional[Any] = ..., + create: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., - wait_for_active_shards: Optional[Any] = ..., + order: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -831,17 +800,12 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def rollover( + async def recovery( self, - alias: Any, *, - body: Optional[Any] = ..., - new_index: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - dry_run: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., - wait_for_active_shards: Optional[Any] = ..., + index: Optional[Any] = ..., + active_only: Optional[Any] = ..., + detailed: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -855,11 +819,11 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def create_data_stream( + async def resolve_index( self, name: Any, *, - body: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -873,10 +837,17 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def delete_data_stream( + async def rollover( self, - name: Any, + alias: Any, *, + body: Optional[Any] = ..., + new_index: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + dry_run: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., + wait_for_active_shards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -890,13 +861,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def delete_index_template( + async def segments( self, - name: Any, *, - cluster_manager_timeout: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + verbose: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -910,14 +882,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def exists_index_template( + async def shard_stores( self, - name: Any, *, - cluster_manager_timeout: Optional[Any] = ..., - flat_settings: Optional[Any] = ..., - local: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + status: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -930,15 +902,18 @@ class IndicesClient(NamespacedClient): api_key: Optional[Union[str, Tuple[str, str]]] = ..., params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., - ) -> bool: ... - async def get_index_template( + ) -> Any: ... + async def shrink( self, + index: Any, + target: Any, *, - name: Optional[Any] = ..., + body: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., - flat_settings: Optional[Any] = ..., - local: Optional[Any] = ..., + copy_settings: Optional[Any] = ..., master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., + wait_for_active_shards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -952,11 +927,11 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def put_index_template( + async def simulate_index_template( self, name: Any, *, - body: Any, + body: Optional[Any] = ..., cause: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., create: Optional[Any] = ..., @@ -974,11 +949,11 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def simulate_index_template( + async def simulate_template( self, - name: Any, *, body: Optional[Any] = ..., + name: Optional[Any] = ..., cause: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., create: Optional[Any] = ..., @@ -996,10 +971,17 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def get_data_stream( + async def split( self, + index: Any, + target: Any, *, - name: Optional[Any] = ..., + body: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + copy_settings: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., + wait_for_active_shards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -1013,15 +995,20 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def simulate_template( + async def stats( self, *, - body: Optional[Any] = ..., - name: Optional[Any] = ..., - cause: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - create: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., + index: Optional[Any] = ..., + metric: Optional[Any] = ..., + completion_fields: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + fielddata_fields: Optional[Any] = ..., + fields: Optional[Any] = ..., + forbid_closed_indices: Optional[Any] = ..., + groups: Optional[Any] = ..., + include_segment_file_sizes: Optional[Any] = ..., + include_unloaded_segments: Optional[Any] = ..., + level: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -1035,11 +1022,13 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def resolve_index( + async def update_aliases( self, - name: Any, *, - expand_wildcards: Optional[Any] = ..., + body: Any, + cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -1053,17 +1042,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def add_block( + async def upgrade( self, - index: Any, - block: Any, *, + index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., + only_ancient_segments: Optional[Any] = ..., + wait_for_completion: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -1077,10 +1064,23 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - async def data_streams_stats( + async def validate_query( self, *, - name: Optional[Any] = ..., + body: Optional[Any] = ..., + index: Optional[Any] = ..., + all_shards: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + analyze_wildcard: Optional[Any] = ..., + analyzer: Optional[Any] = ..., + default_operator: Optional[Any] = ..., + df: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + explain: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + lenient: Optional[Any] = ..., + q: Optional[Any] = ..., + rewrite: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., diff --git a/opensearchpy/client/indices.py b/opensearchpy/client/indices.py index 9db06dd6..7f289079 100644 --- a/opensearchpy/client/indices.py +++ b/opensearchpy/client/indices.py @@ -37,6 +37,8 @@ from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params +# replace_token# + class IndicesClient(NamespacedClient): @query_params() @@ -379,16 +381,15 @@ def exists(self, index, params=None, headers=None): "ignore_unavailable", "master_timeout", "timeout", - "write_index_only", ) - def put_mapping(self, body, index=None, params=None, headers=None): + def add_block(self, index, block, params=None, headers=None): """ - Updates the index mappings. + Adds a block to an index. - :arg body: The mapping definition - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. + :arg index: Comma-separated list of indices to add a block to. + :arg block: The block to add (one of read, write, read_only or + metadata). :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). @@ -403,106 +404,95 @@ def put_mapping(self, body, index=None, params=None, headers=None): use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. :arg timeout: Operation timeout. - :arg write_index_only: When true, applies mappings only to the - write index of an alias or data stream. Default is false. """ - if body in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'body'.") - - if index in SKIP_IN_PATH: - index = "_all" + for param in (index, block): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( - "PUT", - _make_path(index, "_mapping"), - params=params, - headers=headers, - body=body, + "PUT", _make_path(index, "_block", block), params=params, headers=headers ) @query_params( "allow_no_indices", - "cluster_manager_timeout", "expand_wildcards", + "fielddata", + "fields", "ignore_unavailable", - "local", - "master_timeout", + "query", + "request", ) - def get_mapping(self, index=None, params=None, headers=None): + def clear_cache(self, index=None, params=None, headers=None): """ - Returns mappings for one or more indices. + Clears all or specific caches for one or more indices. - :arg index: Comma-separated list of indices. + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. + :arg fielddata: Clear field data. + :arg fields: Comma-separated list of fields to clear when using + the `fielddata` parameter (default: all). :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg local (Deprecated: This parameter is a no-op and field - mappings are always retrieved locally.): Return local information, do - 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 master node. + :arg query: Clear query caches. + :arg request: Clear request cache. """ return self.transport.perform_request( - "GET", _make_path(index, "_mapping"), params=params, headers=headers + "POST", _make_path(index, "_cache", "clear"), params=params, headers=headers ) - @query_params( - "allow_no_indices", - "expand_wildcards", - "ignore_unavailable", - "include_defaults", - "local", - ) - def get_field_mapping(self, fields, index=None, params=None, headers=None): + @query_params() + def create_data_stream(self, name, body=None, params=None, headers=None): """ - Returns mapping for one or more fields. + Creates or updates a data stream. - :arg fields: Comma-separated list of fields. - :arg index: Comma-separated list of indices. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg include_defaults: Whether the default mapping values should - be returned as well. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg name: The name of the data stream. + :arg body: The data stream definition """ - if fields in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'fields'.") + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") + + return self.transport.perform_request( + "PUT", + _make_path("_data_stream", name), + params=params, + headers=headers, + body=body, + ) + + @query_params() + def data_streams_stats(self, name=None, params=None, headers=None): + """ + Provides statistics on operations happening in a data stream. + + :arg name: Comma-separated list of data streams; use `_all` or + empty string to perform the operation on all data streams. + """ return self.transport.perform_request( "GET", - _make_path(index, "_mapping", "field", fields), + _make_path("_data_stream", name, "_stats"), params=params, headers=headers, ) @query_params("cluster_manager_timeout", "master_timeout", "timeout") - def put_alias(self, index, name, body=None, params=None, headers=None): + def delete_alias(self, index, name, params=None, headers=None): """ - Creates or updates an alias. + Deletes an alias. :arg index: Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices. - :arg name: The name of the alias to be created or updated. - :arg body: The settings for the alias, such as `routing` or - `filter` + :arg name: Comma-separated list of aliases to delete (supports + wildcards); use `_all` to delete all aliases for the specified indices. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. :arg master_timeout (Deprecated: To promote inclusive language, @@ -515,69 +505,32 @@ def put_alias(self, index, name, body=None, params=None, headers=None): raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( - "PUT", - _make_path(index, "_alias", name), - params=params, - headers=headers, - body=body, + "DELETE", _make_path(index, "_alias", name), params=params, headers=headers ) - @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") - def exists_alias(self, name, index=None, params=None, headers=None): + @query_params() + def delete_data_stream(self, name, params=None, headers=None): """ - Returns information about whether a particular alias exists. + Deletes a data stream. - :arg name: Comma-separated list of alias names. - :arg index: Comma-separated list of indices to filter aliases. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg name: Comma-separated list of data streams; use `_all` or + empty string to perform the operation on all data streams. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'name'.") return self.transport.perform_request( - "HEAD", _make_path(index, "_alias", name), params=params, headers=headers - ) - - @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") - def get_alias(self, index=None, name=None, params=None, headers=None): - """ - Returns an alias. - - - :arg index: Comma-separated list of indices to filter aliases. - :arg name: Comma-separated list of alias names. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. - """ - return self.transport.perform_request( - "GET", _make_path(index, "_alias", name), params=params, headers=headers + "DELETE", _make_path("_data_stream", name), params=params, headers=headers ) @query_params("cluster_manager_timeout", "master_timeout", "timeout") - def update_aliases(self, body, params=None, headers=None): + def delete_index_template(self, name, params=None, headers=None): """ - Updates index aliases. + Deletes an index template. - :arg body: The definition of `actions` to perform + :arg name: The name of the template. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. :arg master_timeout (Deprecated: To promote inclusive language, @@ -585,23 +538,23 @@ def update_aliases(self, body, params=None, headers=None): connection to master node. :arg timeout: Operation timeout. """ - if body in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'body'.") + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") return self.transport.perform_request( - "POST", "/_aliases", params=params, headers=headers, body=body + "DELETE", + _make_path("_index_template", name), + params=params, + headers=headers, ) @query_params("cluster_manager_timeout", "master_timeout", "timeout") - def delete_alias(self, index, name, params=None, headers=None): + def delete_template(self, name, params=None, headers=None): """ - Deletes an alias. + Deletes an index template. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg name: Comma-separated list of aliases to delete (supports - wildcards); use `_all` to delete all aliases for the specified indices. + :arg name: The name of the template. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. :arg master_timeout (Deprecated: To promote inclusive language, @@ -609,52 +562,46 @@ def delete_alias(self, index, name, params=None, headers=None): connection to master node. :arg timeout: Operation timeout. """ - for param in (index, name): - if param in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument.") + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") return self.transport.perform_request( - "DELETE", _make_path(index, "_alias", name), params=params, headers=headers + "DELETE", _make_path("_template", name), params=params, headers=headers ) - @query_params("cluster_manager_timeout", "create", "master_timeout", "order") - def put_template(self, name, body, params=None, headers=None): + @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") + def exists_alias(self, name, index=None, params=None, headers=None): """ - Creates or updates an index template. + Returns information about whether a particular alias exists. - :arg name: The name of the template. - :arg body: The template definition - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. - :arg create: Whether the index template should only be added if - new or can also replace an existing one. Default is false. - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg order: The order for this template when merging multiple - matching ones (higher numbers are merged later, overriding the lower - numbers). + :arg name: Comma-separated list of alias names. + :arg index: Comma-separated list of indices to filter aliases. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). + :arg local: Return local information, do not retrieve the state + from cluster-manager node. Default is false. """ - for param in (name, body): - if param in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument.") + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") return self.transport.perform_request( - "PUT", - _make_path("_template", name), - params=params, - headers=headers, - body=body, + "HEAD", _make_path(index, "_alias", name), params=params, headers=headers ) @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") - def exists_template(self, name, params=None, headers=None): + def exists_index_template(self, name, params=None, headers=None): """ Returns information about whether a particular index template exists. - :arg name: Comma-separated names of the index templates. + :arg name: The name of the template. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. :arg flat_settings: Return settings in flat format. Default is @@ -669,13 +616,13 @@ def exists_template(self, name, params=None, headers=None): raise ValueError("Empty value passed for a required argument 'name'.") return self.transport.perform_request( - "HEAD", _make_path("_template", name), params=params, headers=headers + "HEAD", _make_path("_index_template", name), params=params, headers=headers ) @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") - def get_template(self, name=None, params=None, headers=None): + def exists_template(self, name, params=None, headers=None): """ - Returns an index template. + Returns information about whether a particular index template exists. :arg name: Comma-separated names of the index templates. @@ -689,181 +636,97 @@ def get_template(self, name=None, params=None, headers=None): use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. """ + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'name'.") + return self.transport.perform_request( - "GET", _make_path("_template", name), params=params, headers=headers - ) - - @query_params("cluster_manager_timeout", "master_timeout", "timeout") - def delete_template(self, name, params=None, headers=None): - """ - Deletes an index template. - - - :arg name: The name of the template. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg timeout: Operation timeout. - """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") - - return self.transport.perform_request( - "DELETE", _make_path("_template", name), params=params, headers=headers + "HEAD", _make_path("_template", name), params=params, headers=headers ) @query_params( "allow_no_indices", - "cluster_manager_timeout", "expand_wildcards", - "flat_settings", + "flush", "ignore_unavailable", - "include_defaults", - "local", - "master_timeout", + "max_num_segments", + "only_expunge_deletes", ) - def get_settings(self, index=None, name=None, params=None, headers=None): + def forcemerge(self, index=None, params=None, headers=None): """ - Returns settings for one or more indices. + Performs the force merge operation on one or more indices. :arg index: Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices. - :arg name: Comma-separated list of settings. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. - :arg flat_settings: Return settings in flat format. Default is - false. + :arg flush: Specify whether the index should be flushed after + performing the operation. Default is True. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg include_defaults: Whether to return all default setting for - each of the indices. Default is false. - :arg local: Return local information, do 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 master node. + :arg max_num_segments: The number of segments the index should + be merged into (default: dynamic). + :arg only_expunge_deletes: Specify whether the operation should + only expunge deleted documents. """ return self.transport.perform_request( - "GET", _make_path(index, "_settings", name), params=params, headers=headers + "POST", _make_path(index, "_forcemerge"), params=params, headers=headers ) - @query_params( - "allow_no_indices", - "cluster_manager_timeout", - "expand_wildcards", - "flat_settings", - "ignore_unavailable", - "master_timeout", - "preserve_existing", - "timeout", - ) - def put_settings(self, body, index=None, params=None, headers=None): + @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") + def get_alias(self, index=None, name=None, params=None, headers=None): """ - Updates the index settings. + Returns an alias. - :arg body: The index settings to be updated - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. + :arg index: Comma-separated list of indices to filter aliases. + :arg name: Comma-separated list of alias names. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. - :arg flat_settings: Return settings in flat format. Default is - false. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg preserve_existing: Whether to update existing settings. If - set to `true` existing settings on an index remain unchanged. Default is - false. - :arg timeout: Operation timeout. + :arg local: Return local information, do not retrieve the state + from cluster-manager node. Default is false. """ - if body in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'body'.") - return self.transport.perform_request( - "PUT", - _make_path(index, "_settings"), - params=params, - headers=headers, - body=body, + "GET", _make_path(index, "_alias", name), params=params, headers=headers ) - @query_params( - "completion_fields", - "expand_wildcards", - "fielddata_fields", - "fields", - "forbid_closed_indices", - "groups", - "include_segment_file_sizes", - "include_unloaded_segments", - "level", - ) - def stats(self, index=None, metric=None, params=None, headers=None): + @query_params() + def get_data_stream(self, name=None, params=None, headers=None): """ - Provides statistics on operations happening in an index. + Returns data streams. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg metric: Limit the information returned the specific - metrics. Valid choices are _all, store, indexing, get, search, merge, - flush, refresh, query_cache, fielddata, docs, warmer, completion, - segments, translog, suggest, request_cache, recovery. - :arg completion_fields: Comma-separated list of fields for - `fielddata` and `suggest` index metric (supports wildcards). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg fielddata_fields: Comma-separated list of fields for - `fielddata` index metric (supports wildcards). - :arg fields: Comma-separated list of fields for `fielddata` and - `completion` index metric (supports wildcards). - :arg forbid_closed_indices: If set to false stats will also - collected from closed indices if explicitly specified or if - expand_wildcards expands to closed indices. Default is True. - :arg groups: Comma-separated list of search groups for `search` - index metric. - :arg include_segment_file_sizes: Whether to report the - aggregated disk usage of each one of the Lucene index files (only - applies if segment stats are requested). Default is false. - :arg include_unloaded_segments: If set to true segment stats - will include stats for segments that are not currently loaded into - memory. Default is false. - :arg level: Return stats aggregated at cluster, index or shard - level. Valid choices are cluster, indices, shards. + :arg name: Comma-separated list of data streams; use `_all` or + empty string to perform the operation on all data streams. """ return self.transport.perform_request( - "GET", _make_path(index, "_stats", metric), params=params, headers=headers + "GET", _make_path("_data_stream", name), params=params, headers=headers ) @query_params( - "allow_no_indices", "expand_wildcards", "ignore_unavailable", "verbose" + "allow_no_indices", + "expand_wildcards", + "ignore_unavailable", + "include_defaults", + "local", ) - def segments(self, index=None, params=None, headers=None): + def get_field_mapping(self, fields, index=None, params=None, headers=None): """ - Provides low-level information about segments in a Lucene index. + Returns mapping for one or more fields. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. + :arg fields: Comma-separated list of fields. + :arg index: Comma-separated list of indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). @@ -872,176 +735,144 @@ def segments(self, index=None, params=None, headers=None): open, closed, hidden, none. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg verbose: Includes detailed memory usage by Lucene. Default - is false. + :arg include_defaults: Whether the default mapping values should + be returned as well. + :arg local: Return local information, do not retrieve the state + from cluster-manager node. Default is false. """ + if fields in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'fields'.") + return self.transport.perform_request( - "GET", _make_path(index, "_segments"), params=params, headers=headers + "GET", + _make_path(index, "_mapping", "field", fields), + params=params, + headers=headers, ) - @query_params( - "all_shards", - "allow_no_indices", - "analyze_wildcard", - "analyzer", - "default_operator", - "df", - "expand_wildcards", - "explain", - "ignore_unavailable", - "lenient", - "q", - "rewrite", - ) - def validate_query(self, body=None, index=None, params=None, headers=None): + @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") + def get_index_template(self, name=None, params=None, headers=None): """ - Allows a user to validate a potentially expensive query without executing it. + Returns an index template. - :arg body: The query definition specified with the Query DSL - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg all_shards: Execute validation on all shards instead of one - random shard per index. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg analyze_wildcard: Specify whether wildcard and prefix - queries should be analyzed. Default is false. - :arg analyzer: The analyzer to use for the query string. - :arg default_operator: The default operator for query string - query (AND or OR). Valid choices are AND, OR. - :arg df: The field to use as default where no field prefix is - given in the query string. - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg explain: Return detailed information about the error. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg lenient: Specify whether format-based query failures (such - as providing text to a numeric field) should be ignored. - :arg q: Query in the Lucene query string syntax. - :arg rewrite: Provide a more detailed explanation showing the - actual Lucene query that will be executed. + :arg name: Comma-separated names of the index templates. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg flat_settings: Return settings in flat format. Default is + false. + :arg local: Return local information, do 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 master node. """ return self.transport.perform_request( - "POST", - _make_path(index, "_validate", "query"), - params=params, - headers=headers, - body=body, + "GET", _make_path("_index_template", name), params=params, headers=headers ) @query_params( "allow_no_indices", + "cluster_manager_timeout", "expand_wildcards", - "fielddata", - "fields", "ignore_unavailable", - "query", - "request", + "local", + "master_timeout", ) - def clear_cache(self, index=None, params=None, headers=None): + def get_mapping(self, index=None, params=None, headers=None): """ - Clears all or specific caches for one or more indices. + Returns mappings for one or more indices. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. + :arg index: Comma-separated list of indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. - :arg fielddata: Clear field data. - :arg fields: Comma-separated list of fields to clear when using - the `fielddata` parameter (default: all). :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg query: Clear query caches. - :arg request: Clear request cache. - """ - return self.transport.perform_request( - "POST", _make_path(index, "_cache", "clear"), params=params, headers=headers - ) - - @query_params("active_only", "detailed") - def recovery(self, index=None, params=None, headers=None): - """ - Returns information about ongoing index shard recoveries. - - - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg active_only: Display only those recoveries that are - currently on-going. Default is false. - :arg detailed: Whether to display detailed information about - shard recovery. Default is false. + :arg local (Deprecated: This parameter is a no-op and field + mappings are always retrieved locally.): Return local information, do + 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 master node. """ return self.transport.perform_request( - "GET", _make_path(index, "_recovery"), params=params, headers=headers + "GET", _make_path(index, "_mapping"), params=params, headers=headers ) @query_params( "allow_no_indices", + "cluster_manager_timeout", "expand_wildcards", + "flat_settings", "ignore_unavailable", - "only_ancient_segments", - "wait_for_completion", + "include_defaults", + "local", + "master_timeout", ) - def upgrade(self, index=None, params=None, headers=None): + def get_settings(self, index=None, name=None, params=None, headers=None): """ - The _upgrade API is no longer useful and will be removed. + Returns settings for one or more indices. :arg index: Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices. + :arg name: Comma-separated list of settings. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. + :arg flat_settings: Return settings in flat format. Default is + false. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg only_ancient_segments: If true, only ancient (an older - Lucene major release) segments will be upgraded. - :arg wait_for_completion: Should this request wait until the - operation has completed before returning. Default is false. + :arg include_defaults: Whether to return all default setting for + each of the indices. Default is false. + :arg local: Return local information, do 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 master node. """ return self.transport.perform_request( - "POST", _make_path(index, "_upgrade"), params=params, headers=headers + "GET", _make_path(index, "_settings", name), params=params, headers=headers ) - @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable") - def get_upgrade(self, index=None, params=None, headers=None): + @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") + def get_template(self, name=None, params=None, headers=None): """ - The _upgrade API is no longer useful and will be removed. + Returns an index template. - :arg index: Comma-separated list of indices; use `_all` or empty - string to perform the operation on all indices. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). + :arg name: Comma-separated names of the index templates. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg flat_settings: Return settings in flat format. Default is + false. + :arg local: Return local information, do 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 master node. """ return self.transport.perform_request( - "GET", _make_path(index, "_upgrade"), params=params, headers=headers + "GET", _make_path("_template", name), params=params, headers=headers ) - @query_params( - "allow_no_indices", "expand_wildcards", "ignore_unavailable", "status" - ) - def shard_stores(self, index=None, params=None, headers=None): + @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable") + def get_upgrade(self, index=None, params=None, headers=None): """ - Provides store information for shard copies of indices. + The _upgrade API is no longer useful and will be removed. :arg index: Comma-separated list of indices; use `_all` or empty @@ -1054,297 +885,360 @@ def shard_stores(self, index=None, params=None, headers=None): open, closed, hidden, none. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg status: Comma-separated list of statuses used to filter on - shards to get store information for. """ return self.transport.perform_request( - "GET", _make_path(index, "_shard_stores"), params=params, headers=headers + "GET", _make_path(index, "_upgrade"), params=params, headers=headers ) - @query_params( - "allow_no_indices", - "expand_wildcards", - "flush", - "ignore_unavailable", - "max_num_segments", - "only_expunge_deletes", - ) - def forcemerge(self, index=None, params=None, headers=None): + @query_params("cluster_manager_timeout", "master_timeout", "timeout") + def put_alias(self, index, name, body=None, params=None, headers=None): """ - Performs the force merge operation on one or more indices. + Creates or updates an alias. :arg index: Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices. - :arg allow_no_indices: Whether to ignore if a wildcard indices - expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified). - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indices that are open, closed or both. Valid choices are all, - open, closed, hidden, none. - :arg flush: Specify whether the index should be flushed after - performing the operation. Default is True. - :arg ignore_unavailable: Whether specified concrete indices - should be ignored when unavailable (missing or closed). - :arg max_num_segments: The number of segments the index should - be merged into (default: dynamic). - :arg only_expunge_deletes: Specify whether the operation should - only expunge deleted documents. + :arg name: The name of the alias to be created or updated. + :arg body: The settings for the alias, such as `routing` or + `filter` + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead.): Operation timeout for + connection to master node. + :arg timeout: Operation timeout. """ - return self.transport.perform_request( - "POST", _make_path(index, "_forcemerge"), params=params, headers=headers - ) + for param in (index, name): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") - @query_params( - "cluster_manager_timeout", - "copy_settings", - "master_timeout", - "timeout", - "wait_for_active_shards", - ) - def shrink(self, index, target, body=None, params=None, headers=None): + return self.transport.perform_request( + "PUT", + _make_path(index, "_alias", name), + params=params, + headers=headers, + body=body, + ) + + @query_params("cause", "cluster_manager_timeout", "create", "master_timeout") + def put_index_template(self, name, body, params=None, headers=None): """ - Allow to shrink an existing index into a new index with fewer primary shards. + Creates or updates an index template. - :arg index: The name of the source index to shrink. - :arg target: The name of the target index. - :arg body: The configuration for the target index (`settings` - and `aliases`) + :arg name: The name of the template. + :arg body: The template definition + :arg cause: User defined reason for creating/updating the index + template. Default is false. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg copy_settings: whether or not to copy settings from the - source index. Default is false. + :arg create: Whether the index template should only be added if + new or can also replace an existing one. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. - :arg timeout: Operation timeout. - :arg wait_for_active_shards: Set the number of active shards to - wait for on the shrunken index before the operation returns. """ - for param in (index, target): + for param in (name, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", - _make_path(index, "_shrink", target), + _make_path("_index_template", name), params=params, headers=headers, body=body, ) @query_params( + "allow_no_indices", "cluster_manager_timeout", - "copy_settings", + "expand_wildcards", + "ignore_unavailable", "master_timeout", "timeout", - "wait_for_active_shards", + "write_index_only", ) - def split(self, index, target, body=None, params=None, headers=None): + def put_mapping(self, body, index=None, params=None, headers=None): """ - Allows you to split an existing index into a new index with more primary - shards. + Updates the index mappings. - :arg index: The name of the source index to split. - :arg target: The name of the target index. - :arg body: The configuration for the target index (`settings` - and `aliases`) + :arg body: The mapping definition + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg copy_settings: whether or not to copy settings from the - source index. Default is false. + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. :arg timeout: Operation timeout. - :arg wait_for_active_shards: Set the number of active shards to - wait for on the shrunken index before the operation returns. + :arg write_index_only: When true, applies mappings only to the + write index of an alias or data stream. Default is false. """ - for param in (index, target): - if param in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument.") + if body in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'body'.") + + if index in SKIP_IN_PATH: + index = "_all" return self.transport.perform_request( "PUT", - _make_path(index, "_split", target), + _make_path(index, "_mapping"), params=params, headers=headers, body=body, ) @query_params( + "allow_no_indices", "cluster_manager_timeout", - "dry_run", + "expand_wildcards", + "flat_settings", + "ignore_unavailable", "master_timeout", + "preserve_existing", "timeout", - "wait_for_active_shards", ) - def rollover(self, alias, body=None, new_index=None, params=None, headers=None): + def put_settings(self, body, index=None, params=None, headers=None): """ - Updates an alias to point to a new index when the existing index is considered - to be too large or too old. + Updates the index settings. - :arg alias: The name of the alias to rollover. - :arg body: The conditions that needs to be met for executing - rollover - :arg new_index: The name of the rollover index. + :arg body: The index settings to be updated + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg dry_run: If set to true the rollover action will only be - validated but not actually performed even if a condition matches. - Default is false. + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg flat_settings: Return settings in flat format. Default is + false. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. + :arg preserve_existing: Whether to update existing settings. If + set to `true` existing settings on an index remain unchanged. Default is + false. :arg timeout: Operation timeout. - :arg wait_for_active_shards: Set the number of active shards to - wait for on the newly created rollover index before the operation - returns. """ - if alias in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'alias'.") + if body in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( - "POST", - _make_path(alias, "_rollover", new_index), + "PUT", + _make_path(index, "_settings"), params=params, headers=headers, body=body, ) - @query_params() - def create_data_stream(self, name, body=None, params=None, headers=None): + @query_params("cluster_manager_timeout", "create", "master_timeout", "order") + def put_template(self, name, body, params=None, headers=None): """ - Creates or updates a data stream. + Creates or updates an index template. - :arg name: The name of the data stream. - :arg body: The data stream definition + :arg name: The name of the template. + :arg body: The template definition + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg create: Whether the index template should only be added if + new or can also replace an existing one. Default is false. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead.): Operation timeout for + connection to master node. + :arg order: The order for this template when merging multiple + matching ones (higher numbers are merged later, overriding the lower + numbers). """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") + for param in (name, body): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", - _make_path("_data_stream", name), + _make_path("_template", name), params=params, headers=headers, body=body, ) - @query_params() - def delete_data_stream(self, name, params=None, headers=None): + @query_params("active_only", "detailed") + def recovery(self, index=None, params=None, headers=None): """ - Deletes a data stream. + Returns information about ongoing index shard recoveries. - :arg name: Comma-separated list of data streams; use `_all` or - empty string to perform the operation on all data streams. + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg active_only: Display only those recoveries that are + currently on-going. Default is false. + :arg detailed: Whether to display detailed information about + shard recovery. Default is false. """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") - return self.transport.perform_request( - "DELETE", _make_path("_data_stream", name), params=params, headers=headers + "GET", _make_path(index, "_recovery"), params=params, headers=headers ) - @query_params("cluster_manager_timeout", "master_timeout", "timeout") - def delete_index_template(self, name, params=None, headers=None): + @query_params("expand_wildcards") + def resolve_index(self, name, params=None, headers=None): """ - Deletes an index template. + Returns information about any matching indices, aliases, and data streams. - :arg name: The name of the template. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg timeout: Operation timeout. + :arg name: Comma-separated list of names or wildcard + expressions. + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'name'.") return self.transport.perform_request( - "DELETE", - _make_path("_index_template", name), - params=params, - headers=headers, + "GET", _make_path("_resolve", "index", name), params=params, headers=headers ) - @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") - def exists_index_template(self, name, params=None, headers=None): + @query_params( + "cluster_manager_timeout", + "dry_run", + "master_timeout", + "timeout", + "wait_for_active_shards", + ) + def rollover(self, alias, body=None, new_index=None, params=None, headers=None): """ - Returns information about whether a particular index template exists. + Updates an alias to point to a new index when the existing index is considered + to be too large or too old. - :arg name: The name of the template. + :arg alias: The name of the alias to rollover. + :arg body: The conditions that needs to be met for executing + rollover + :arg new_index: The name of the rollover index. :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg flat_settings: Return settings in flat format. Default is - false. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg dry_run: If set to true the rollover action will only be + validated but not actually performed even if a condition matches. + Default is false. :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. + :arg timeout: Operation timeout. + :arg wait_for_active_shards: Set the number of active shards to + wait for on the newly created rollover index before the operation + returns. """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") + if alias in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'alias'.") return self.transport.perform_request( - "HEAD", _make_path("_index_template", name), params=params, headers=headers + "POST", + _make_path(alias, "_rollover", new_index), + params=params, + headers=headers, + body=body, ) - @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") - def get_index_template(self, name=None, params=None, headers=None): + @query_params( + "allow_no_indices", "expand_wildcards", "ignore_unavailable", "verbose" + ) + def segments(self, index=None, params=None, headers=None): """ - Returns an index template. + Provides low-level information about segments in a Lucene index. - :arg name: Comma-separated names of the index templates. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. - :arg flat_settings: Return settings in flat format. Default is - false. - :arg local: Return local information, do 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 master node. + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). + :arg verbose: Includes detailed memory usage by Lucene. Default + is false. + """ + return self.transport.perform_request( + "GET", _make_path(index, "_segments"), params=params, headers=headers + ) + + @query_params( + "allow_no_indices", "expand_wildcards", "ignore_unavailable", "status" + ) + def shard_stores(self, index=None, params=None, headers=None): + """ + Provides store information for shard copies of indices. + + + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). + :arg status: Comma-separated list of statuses used to filter on + shards to get store information for. """ return self.transport.perform_request( - "GET", _make_path("_index_template", name), params=params, headers=headers + "GET", _make_path(index, "_shard_stores"), params=params, headers=headers ) - @query_params("cause", "cluster_manager_timeout", "create", "master_timeout") - def put_index_template(self, name, body, params=None, headers=None): + @query_params( + "cluster_manager_timeout", + "copy_settings", + "master_timeout", + "timeout", + "wait_for_active_shards", + ) + def shrink(self, index, target, body=None, params=None, headers=None): """ - Creates or updates an index template. + Allow to shrink an existing index into a new index with fewer primary shards. - :arg name: The name of the template. - :arg body: The template definition - :arg cause: User defined reason for creating/updating the index - template. Default is false. + :arg index: The name of the source index to shrink. + :arg target: The name of the target index. + :arg body: The configuration for the target index (`settings` + and `aliases`) :arg cluster_manager_timeout: Operation timeout for connection to cluster-manager node. - :arg create: Whether the index template should only be added if - new or can also replace an existing one. Default is false. + :arg copy_settings: whether or not to copy settings from the + source index. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, use 'cluster_manager_timeout' instead.): Operation timeout for connection to master node. + :arg timeout: Operation timeout. + :arg wait_for_active_shards: Set the number of active shards to + wait for on the shrunken index before the operation returns. """ - for param in (name, body): + for param in (index, target): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", - _make_path("_index_template", name), + _make_path(index, "_shrink", target), params=params, headers=headers, body=body, @@ -1383,19 +1277,6 @@ def simulate_index_template(self, name, body=None, params=None, headers=None): body=body, ) - @query_params() - def get_data_stream(self, name=None, params=None, headers=None): - """ - Returns data streams. - - - :arg name: Comma-separated list of data streams; use `_all` or - empty string to perform the operation on all data streams. - """ - return self.transport.perform_request( - "GET", _make_path("_data_stream", name), params=params, headers=headers - ) - @query_params("cause", "cluster_manager_timeout", "create", "master_timeout") def simulate_template(self, body=None, name=None, params=None, headers=None): """ @@ -1424,76 +1305,197 @@ def simulate_template(self, body=None, name=None, params=None, headers=None): body=body, ) - @query_params("expand_wildcards") - def resolve_index(self, name, params=None, headers=None): + @query_params( + "cluster_manager_timeout", + "copy_settings", + "master_timeout", + "timeout", + "wait_for_active_shards", + ) + def split(self, index, target, body=None, params=None, headers=None): """ - Returns information about any matching indices, aliases, and data streams. + Allows you to split an existing index into a new index with more primary + shards. - :arg name: Comma-separated list of names or wildcard - expressions. + :arg index: The name of the source index to split. + :arg target: The name of the target index. + :arg body: The configuration for the target index (`settings` + and `aliases`) + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg copy_settings: whether or not to copy settings from the + source index. Default is false. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead.): Operation timeout for + connection to master node. + :arg timeout: Operation timeout. + :arg wait_for_active_shards: Set the number of active shards to + wait for on the shrunken index before the operation returns. + """ + for param in (index, target): + if param in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument.") + + return self.transport.perform_request( + "PUT", + _make_path(index, "_split", target), + params=params, + headers=headers, + body=body, + ) + + @query_params( + "completion_fields", + "expand_wildcards", + "fielddata_fields", + "fields", + "forbid_closed_indices", + "groups", + "include_segment_file_sizes", + "include_unloaded_segments", + "level", + ) + def stats(self, index=None, metric=None, params=None, headers=None): + """ + Provides statistics on operations happening in an index. + + + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg metric: Limit the information returned the specific + metrics. Valid choices are _all, store, indexing, get, search, merge, + flush, refresh, query_cache, fielddata, docs, warmer, completion, + segments, translog, suggest, request_cache, recovery. + :arg completion_fields: Comma-separated list of fields for + `fielddata` and `suggest` index metric (supports wildcards). :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. + :arg fielddata_fields: Comma-separated list of fields for + `fielddata` index metric (supports wildcards). + :arg fields: Comma-separated list of fields for `fielddata` and + `completion` index metric (supports wildcards). + :arg forbid_closed_indices: If set to false stats will also + collected from closed indices if explicitly specified or if + expand_wildcards expands to closed indices. Default is True. + :arg groups: Comma-separated list of search groups for `search` + index metric. + :arg include_segment_file_sizes: Whether to report the + aggregated disk usage of each one of the Lucene index files (only + applies if segment stats are requested). Default is false. + :arg include_unloaded_segments: If set to true segment stats + will include stats for segments that are not currently loaded into + memory. Default is false. + :arg level: Return stats aggregated at cluster, index or shard + level. Valid choices are cluster, indices, shards. """ - if name in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'name'.") + return self.transport.perform_request( + "GET", _make_path(index, "_stats", metric), params=params, headers=headers + ) + + @query_params("cluster_manager_timeout", "master_timeout", "timeout") + def update_aliases(self, body, params=None, headers=None): + """ + Updates index aliases. + + + :arg body: The definition of `actions` to perform + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead.): Operation timeout for + connection to master node. + :arg timeout: Operation timeout. + """ + if body in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( - "GET", _make_path("_resolve", "index", name), params=params, headers=headers + "POST", "/_aliases", params=params, headers=headers, body=body ) @query_params( "allow_no_indices", - "cluster_manager_timeout", "expand_wildcards", "ignore_unavailable", - "master_timeout", - "timeout", + "only_ancient_segments", + "wait_for_completion", ) - def add_block(self, index, block, params=None, headers=None): + def upgrade(self, index=None, params=None, headers=None): """ - Adds a block to an index. + The _upgrade API is no longer useful and will be removed. - :arg index: Comma-separated list of indices to add a block to. - :arg block: The block to add (one of read, write, read_only or - metadata). + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. :arg expand_wildcards: Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none. :arg ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed). - :arg master_timeout (Deprecated: To promote inclusive language, - use 'cluster_manager_timeout' instead.): Operation timeout for - connection to master node. - :arg timeout: Operation timeout. + :arg only_ancient_segments: If true, only ancient (an older + Lucene major release) segments will be upgraded. + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. Default is false. """ - for param in (index, block): - if param in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument.") - return self.transport.perform_request( - "PUT", _make_path(index, "_block", block), params=params, headers=headers + "POST", _make_path(index, "_upgrade"), params=params, headers=headers ) - @query_params() - def data_streams_stats(self, name=None, params=None, headers=None): + @query_params( + "all_shards", + "allow_no_indices", + "analyze_wildcard", + "analyzer", + "default_operator", + "df", + "expand_wildcards", + "explain", + "ignore_unavailable", + "lenient", + "q", + "rewrite", + ) + def validate_query(self, body=None, index=None, params=None, headers=None): """ - Provides statistics on operations happening in a data stream. + Allows a user to validate a potentially expensive query without executing it. - :arg name: Comma-separated list of data streams; use `_all` or - empty string to perform the operation on all data streams. + :arg body: The query definition specified with the Query DSL + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. + :arg all_shards: Execute validation on all shards instead of one + random shard per index. + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified). + :arg analyze_wildcard: Specify whether wildcard and prefix + queries should be analyzed. Default is false. + :arg analyzer: The analyzer to use for the query string. + :arg default_operator: The default operator for query string + query (AND or OR). Valid choices are AND, OR. + :arg df: The field to use as default where no field prefix is + given in the query string. + :arg expand_wildcards: Whether to expand wildcard expression to + concrete indices that are open, closed or both. Valid choices are all, + open, closed, hidden, none. + :arg explain: Return detailed information about the error. + :arg ignore_unavailable: Whether specified concrete indices + should be ignored when unavailable (missing or closed). + :arg lenient: Specify whether format-based query failures (such + as providing text to a numeric field) should be ignored. + :arg q: Query in the Lucene query string syntax. + :arg rewrite: Provide a more detailed explanation showing the + actual Lucene query that will be executed. """ return self.transport.perform_request( - "GET", - _make_path("_data_stream", name, "_stats"), + "POST", + _make_path(index, "_validate", "query"), params=params, headers=headers, + body=body, ) diff --git a/opensearchpy/client/indices.pyi b/opensearchpy/client/indices.pyi index 51751d53..9a160aec 100644 --- a/opensearchpy/client/indices.pyi +++ b/opensearchpy/client/indices.pyi @@ -262,18 +262,17 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> bool: ... - def put_mapping( + def add_block( self, + index: Any, + block: Any, *, - body: Any, - index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., - write_index_only: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -287,16 +286,17 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def get_mapping( + def clear_cache( self, *, index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., + fielddata: Optional[Any] = ..., + fields: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - local: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., + query: Optional[Any] = ..., + request: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -310,16 +310,11 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def get_field_mapping( + def create_data_stream( self, - fields: Any, + name: Any, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - include_defaults: Optional[Any] = ..., - local: Optional[Any] = ..., + body: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -333,15 +328,10 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def put_alias( + def data_streams_stats( self, - index: Any, - name: Any, *, - body: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., + name: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -355,15 +345,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def exists_alias( + def delete_alias( self, + index: Any, name: Any, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - local: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -376,16 +365,11 @@ class IndicesClient(NamespacedClient): api_key: Optional[Union[str, Tuple[str, str]]] = ..., params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., - ) -> bool: ... - def get_alias( + ) -> Any: ... + def delete_data_stream( self, + name: Any, *, - index: Optional[Any] = ..., - name: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - local: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -399,10 +383,10 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def update_aliases( + def delete_index_template( self, + name: Any, *, - body: Any, cluster_manager_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., @@ -419,9 +403,8 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def delete_alias( + def delete_template( self, - index: Any, name: Any, *, cluster_manager_timeout: Optional[Any] = ..., @@ -440,15 +423,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def put_template( + def exists_alias( self, name: Any, *, - body: Any, - cluster_manager_timeout: Optional[Any] = ..., - create: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - order: Optional[Any] = ..., + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + local: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -461,8 +444,8 @@ class IndicesClient(NamespacedClient): api_key: Optional[Union[str, Tuple[str, str]]] = ..., params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., - ) -> Any: ... - def exists_template( + ) -> bool: ... + def exists_index_template( self, name: Any, *, @@ -483,10 +466,10 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> bool: ... - def get_template( + def exists_template( self, + name: Any, *, - name: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., flat_settings: Optional[Any] = ..., local: Optional[Any] = ..., @@ -503,14 +486,17 @@ class IndicesClient(NamespacedClient): api_key: Optional[Union[str, Tuple[str, str]]] = ..., params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., - ) -> Any: ... - def delete_template( + ) -> bool: ... + def forcemerge( self, - name: Any, *, - cluster_manager_timeout: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + flush: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + max_num_segments: Optional[Any] = ..., + only_expunge_deletes: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -524,19 +510,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def get_settings( + def get_alias( self, *, index: Optional[Any] = ..., name: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - flat_settings: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - include_defaults: Optional[Any] = ..., local: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -550,19 +532,10 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def put_settings( + def get_data_stream( self, *, - body: Any, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - flat_settings: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - preserve_existing: Optional[Any] = ..., - timeout: Optional[Any] = ..., + name: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -576,20 +549,16 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def stats( + def get_field_mapping( self, + fields: Any, *, index: Optional[Any] = ..., - metric: Optional[Any] = ..., - completion_fields: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - fielddata_fields: Optional[Any] = ..., - fields: Optional[Any] = ..., - forbid_closed_indices: Optional[Any] = ..., - groups: Optional[Any] = ..., - include_segment_file_sizes: Optional[Any] = ..., - include_unloaded_segments: Optional[Any] = ..., - level: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + include_defaults: Optional[Any] = ..., + local: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -603,14 +572,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def segments( + def get_index_template( self, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - verbose: Optional[Any] = ..., + name: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + flat_settings: Optional[Any] = ..., + local: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -624,23 +593,16 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def validate_query( + def get_mapping( self, *, - body: Optional[Any] = ..., index: Optional[Any] = ..., - all_shards: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., - analyze_wildcard: Optional[Any] = ..., - analyzer: Optional[Any] = ..., - default_operator: Optional[Any] = ..., - df: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - explain: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - lenient: Optional[Any] = ..., - q: Optional[Any] = ..., - rewrite: Optional[Any] = ..., + local: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -654,17 +616,19 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def clear_cache( + def get_settings( self, *, index: Optional[Any] = ..., + name: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - fielddata: Optional[Any] = ..., - fields: Optional[Any] = ..., + flat_settings: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - query: Optional[Any] = ..., - request: Optional[Any] = ..., + include_defaults: Optional[Any] = ..., + local: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -678,12 +642,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def recovery( + def get_template( self, *, - index: Optional[Any] = ..., - active_only: Optional[Any] = ..., - detailed: Optional[Any] = ..., + name: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + flat_settings: Optional[Any] = ..., + local: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -697,15 +663,13 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def upgrade( + def get_upgrade( self, *, index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - only_ancient_segments: Optional[Any] = ..., - wait_for_completion: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -719,13 +683,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def get_upgrade( + def put_alias( self, + index: Any, + name: Any, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., + body: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -739,14 +705,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def shard_stores( + def put_index_template( self, + name: Any, *, - index: Optional[Any] = ..., - allow_no_indices: Optional[Any] = ..., - expand_wildcards: Optional[Any] = ..., - ignore_unavailable: Optional[Any] = ..., - status: Optional[Any] = ..., + body: Any, + cause: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + create: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -760,16 +727,18 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def forcemerge( + def put_mapping( self, *, + body: Any, index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., - flush: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - max_num_segments: Optional[Any] = ..., - only_expunge_deletes: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., + write_index_only: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -783,17 +752,19 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def shrink( + def put_settings( self, - index: Any, - target: Any, *, - body: Optional[Any] = ..., + body: Any, + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., - copy_settings: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + flat_settings: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., master_timeout: Optional[Any] = ..., + preserve_existing: Optional[Any] = ..., timeout: Optional[Any] = ..., - wait_for_active_shards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -807,17 +778,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def split( + def put_template( self, - index: Any, - target: Any, + name: Any, *, - body: Optional[Any] = ..., + body: Any, cluster_manager_timeout: Optional[Any] = ..., - copy_settings: Optional[Any] = ..., + create: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., - wait_for_active_shards: Optional[Any] = ..., + order: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -831,17 +800,12 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def rollover( + def recovery( self, - alias: Any, *, - body: Optional[Any] = ..., - new_index: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - dry_run: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., - wait_for_active_shards: Optional[Any] = ..., + index: Optional[Any] = ..., + active_only: Optional[Any] = ..., + detailed: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -855,11 +819,11 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def create_data_stream( + def resolve_index( self, name: Any, *, - body: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -873,10 +837,17 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def delete_data_stream( + def rollover( self, - name: Any, + alias: Any, *, + body: Optional[Any] = ..., + new_index: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + dry_run: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., + wait_for_active_shards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -890,13 +861,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def delete_index_template( + def segments( self, - name: Any, *, - cluster_manager_timeout: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + verbose: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -910,14 +882,14 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def exists_index_template( + def shard_stores( self, - name: Any, *, - cluster_manager_timeout: Optional[Any] = ..., - flat_settings: Optional[Any] = ..., - local: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., + index: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + status: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -930,15 +902,18 @@ class IndicesClient(NamespacedClient): api_key: Optional[Union[str, Tuple[str, str]]] = ..., params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., - ) -> bool: ... - def get_index_template( + ) -> Any: ... + def shrink( self, + index: Any, + target: Any, *, - name: Optional[Any] = ..., + body: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., - flat_settings: Optional[Any] = ..., - local: Optional[Any] = ..., + copy_settings: Optional[Any] = ..., master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., + wait_for_active_shards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -952,11 +927,11 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def put_index_template( + def simulate_index_template( self, name: Any, *, - body: Any, + body: Optional[Any] = ..., cause: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., create: Optional[Any] = ..., @@ -974,11 +949,11 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def simulate_index_template( + def simulate_template( self, - name: Any, *, body: Optional[Any] = ..., + name: Optional[Any] = ..., cause: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., create: Optional[Any] = ..., @@ -996,10 +971,17 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def get_data_stream( + def split( self, + index: Any, + target: Any, *, - name: Optional[Any] = ..., + body: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + copy_settings: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., + wait_for_active_shards: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -1013,15 +995,20 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def simulate_template( + def stats( self, *, - body: Optional[Any] = ..., - name: Optional[Any] = ..., - cause: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - create: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., + index: Optional[Any] = ..., + metric: Optional[Any] = ..., + completion_fields: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + fielddata_fields: Optional[Any] = ..., + fields: Optional[Any] = ..., + forbid_closed_indices: Optional[Any] = ..., + groups: Optional[Any] = ..., + include_segment_file_sizes: Optional[Any] = ..., + include_unloaded_segments: Optional[Any] = ..., + level: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -1035,11 +1022,13 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def resolve_index( + def update_aliases( self, - name: Any, *, - expand_wildcards: Optional[Any] = ..., + body: Any, + cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -1053,17 +1042,15 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def add_block( + def upgrade( self, - index: Any, - block: Any, *, + index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - timeout: Optional[Any] = ..., + only_ancient_segments: Optional[Any] = ..., + wait_for_completion: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -1077,10 +1064,23 @@ class IndicesClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... - def data_streams_stats( + def validate_query( self, *, - name: Optional[Any] = ..., + body: Optional[Any] = ..., + index: Optional[Any] = ..., + all_shards: Optional[Any] = ..., + allow_no_indices: Optional[Any] = ..., + analyze_wildcard: Optional[Any] = ..., + analyzer: Optional[Any] = ..., + default_operator: Optional[Any] = ..., + df: Optional[Any] = ..., + expand_wildcards: Optional[Any] = ..., + explain: Optional[Any] = ..., + ignore_unavailable: Optional[Any] = ..., + lenient: Optional[Any] = ..., + q: Optional[Any] = ..., + rewrite: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., diff --git a/utils/generate-api.py b/utils/generate-api.py index 07360ae6..10564922 100644 --- a/utils/generate-api.py +++ b/utils/generate-api.py @@ -34,7 +34,7 @@ from pathlib import Path import black -import deepmerge +import jsonmerge import requests import unasync import urllib3 @@ -648,7 +648,7 @@ def read_modules(): if os.path.exists(override_file_path): with open(override_file_path) as f: override_json = json.load(f) - api = deepmerge.always_merger.merge(api, override_json) + api = jsonmerge.merge(api, override_json) if namespace not in modules: modules[namespace] = Module(namespace)