From ef913450c762d68f3126f853711a4adc36506195 Mon Sep 17 00:00:00 2001 From: Seth Michael Larson Date: Tue, 13 Jul 2021 19:57:03 -0500 Subject: [PATCH] Update to 7.x-SNAPSHOT --- elasticsearch/_async/client/__init__.py | 2 +- elasticsearch/_async/client/ilm.py | 5 +- elasticsearch/_async/client/ilm.pyi | 1 + elasticsearch/_async/client/rollup.py | 7 ++- elasticsearch/_async/client/snapshot.py | 10 +++- elasticsearch/_async/client/snapshot.pyi | 1 + elasticsearch/_async/client/sql.py | 65 +++++++++++++++++++++++- elasticsearch/_async/client/sql.pyi | 54 ++++++++++++++++++++ elasticsearch/client/__init__.py | 2 +- elasticsearch/client/ilm.py | 5 +- elasticsearch/client/ilm.pyi | 1 + elasticsearch/client/rollup.py | 7 ++- elasticsearch/client/snapshot.py | 10 +++- elasticsearch/client/snapshot.pyi | 1 + elasticsearch/client/sql.py | 65 +++++++++++++++++++++++- elasticsearch/client/sql.pyi | 54 ++++++++++++++++++++ 16 files changed, 280 insertions(+), 10 deletions(-) diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 62856cc4..89a6ed5b 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -1460,7 +1460,7 @@ class AsyncElasticsearch(object): """ Allows to use the Mustache language to pre-render a search definition. - ``_ + ``_ :arg body: The search definition template and its params :arg id: The id of the stored search template diff --git a/elasticsearch/_async/client/ilm.py b/elasticsearch/_async/client/ilm.py index 7274ecce..4a93d64e 100644 --- a/elasticsearch/_async/client/ilm.py +++ b/elasticsearch/_async/client/ilm.py @@ -184,7 +184,7 @@ class IlmClient(NamespacedClient): "POST", "/_ilm/stop", params=params, headers=headers ) - @query_params() + @query_params("dry_run") async def migrate_to_data_tiers(self, body=None, params=None, headers=None): """ Migrates the indices and ILM policies away from custom node attribute @@ -195,6 +195,9 @@ class IlmClient(NamespacedClient): :arg body: Optionally specify a legacy index template name to delete and optionally specify a node attribute name used for index shard routing (defaults to "data") + :arg dry_run: If set to true it will simulate the migration, + providing a way to retrieve the ILM policies and indices that need to be + migrated. The default is false """ return await self.transport.perform_request( "POST", diff --git a/elasticsearch/_async/client/ilm.pyi b/elasticsearch/_async/client/ilm.pyi index c7b22cad..0b623e36 100644 --- a/elasticsearch/_async/client/ilm.pyi +++ b/elasticsearch/_async/client/ilm.pyi @@ -195,6 +195,7 @@ class IlmClient(NamespacedClient): self, *, body: Optional[Any] = ..., + dry_run: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., diff --git a/elasticsearch/_async/client/rollup.py b/elasticsearch/_async/client/rollup.py index 72754d06..adf579fa 100644 --- a/elasticsearch/_async/client/rollup.py +++ b/elasticsearch/_async/client/rollup.py @@ -222,7 +222,12 @@ class RollupClient(NamespacedClient): """ Rollup an index - ``_ + ``_ + + .. warning:: + + This API is **experimental** so may include breaking changes + or be removed in a future version :arg index: The index to roll up :arg rollup_index: The name of the rollup index to create diff --git a/elasticsearch/_async/client/snapshot.py b/elasticsearch/_async/client/snapshot.py index c656a420..e01e5927 100644 --- a/elasticsearch/_async/client/snapshot.py +++ b/elasticsearch/_async/client/snapshot.py @@ -69,7 +69,13 @@ class SnapshotClient(NamespacedClient): headers=headers, ) - @query_params("ignore_unavailable", "index_details", "master_timeout", "verbose") + @query_params( + "ignore_unavailable", + "include_repository", + "index_details", + "master_timeout", + "verbose", + ) async def get(self, repository, snapshot, params=None, headers=None): """ Returns information about a snapshot. @@ -81,6 +87,8 @@ class SnapshotClient(NamespacedClient): :arg ignore_unavailable: Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + :arg include_repository: Whether to include the repository name + in the snapshot info. Defaults to true. :arg index_details: Whether to include details of each index in the snapshot, if those details are available. Defaults to false. :arg master_timeout: Explicit operation timeout for connection diff --git a/elasticsearch/_async/client/snapshot.pyi b/elasticsearch/_async/client/snapshot.pyi index 2ee4b6e7..c05b0fb8 100644 --- a/elasticsearch/_async/client/snapshot.pyi +++ b/elasticsearch/_async/client/snapshot.pyi @@ -66,6 +66,7 @@ class SnapshotClient(NamespacedClient): snapshot: Any, *, ignore_unavailable: Optional[Any] = ..., + include_repository: Optional[Any] = ..., index_details: Optional[Any] = ..., master_timeout: Optional[Any] = ..., verbose: Optional[Any] = ..., diff --git a/elasticsearch/_async/client/sql.py b/elasticsearch/_async/client/sql.py index 017258b1..ca8f0a52 100644 --- a/elasticsearch/_async/client/sql.py +++ b/elasticsearch/_async/client/sql.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -from .utils import SKIP_IN_PATH, NamespacedClient, query_params +from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params class SqlClient(NamespacedClient): @@ -70,3 +70,66 @@ class SqlClient(NamespacedClient): return await self.transport.perform_request( "POST", "/_sql/translate", params=params, headers=headers, body=body ) + + @query_params() + async def delete_async(self, id, params=None, headers=None): + """ + Deletes an async SQL search or a stored synchronous SQL search. If the search + is still running, the API cancels it. + + ``_ + + :arg id: The async search ID + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'id'.") + + return await self.transport.perform_request( + "DELETE", + _make_path("_sql", "async", "delete", id), + params=params, + headers=headers, + ) + + @query_params("delimiter", "format", "keep_alive", "wait_for_completion_timeout") + async def get_async(self, id, params=None, headers=None): + """ + Returns the current status and available results for an async SQL search or + stored synchronous SQL search + + ``_ + + :arg id: The async search ID + :arg delimiter: Separator for CSV results Default: , + :arg format: Short version of the Accept header, e.g. json, yaml + :arg keep_alive: Retention period for the search and its results + Default: 5d + :arg wait_for_completion_timeout: Duration to wait for complete + results + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'id'.") + + return await self.transport.perform_request( + "GET", _make_path("_sql", "async", id), params=params, headers=headers + ) + + @query_params() + async def get_async_status(self, id, params=None, headers=None): + """ + Returns the current status of an async SQL search or a stored synchronous SQL + search + + ``_ + + :arg id: The async search ID + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'id'.") + + return await self.transport.perform_request( + "GET", + _make_path("_sql", "async", "status", id), + params=params, + headers=headers, + ) diff --git a/elasticsearch/_async/client/sql.pyi b/elasticsearch/_async/client/sql.pyi index 2408a82f..7a2d0886 100644 --- a/elasticsearch/_async/client/sql.pyi +++ b/elasticsearch/_async/client/sql.pyi @@ -71,3 +71,57 @@ class SqlClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... + async def delete_async( + self, + id: Any, + *, + pretty: Optional[bool] = ..., + human: Optional[bool] = ..., + error_trace: Optional[bool] = ..., + format: Optional[str] = ..., + filter_path: Optional[Union[str, Collection[str]]] = ..., + request_timeout: Optional[Union[int, float]] = ..., + ignore: Optional[Union[int, Collection[int]]] = ..., + opaque_id: Optional[str] = ..., + http_auth: Optional[Union[str, Tuple[str, str]]] = ..., + api_key: Optional[Union[str, Tuple[str, str]]] = ..., + params: Optional[MutableMapping[str, Any]] = ..., + headers: Optional[MutableMapping[str, str]] = ..., + ) -> Any: ... + async def get_async( + self, + id: Any, + *, + delimiter: Optional[Any] = ..., + format: Optional[Any] = ..., + keep_alive: Optional[Any] = ..., + wait_for_completion_timeout: Optional[Any] = ..., + pretty: Optional[bool] = ..., + human: Optional[bool] = ..., + error_trace: Optional[bool] = ..., + filter_path: Optional[Union[str, Collection[str]]] = ..., + request_timeout: Optional[Union[int, float]] = ..., + ignore: Optional[Union[int, Collection[int]]] = ..., + opaque_id: Optional[str] = ..., + http_auth: Optional[Union[str, Tuple[str, str]]] = ..., + api_key: Optional[Union[str, Tuple[str, str]]] = ..., + params: Optional[MutableMapping[str, Any]] = ..., + headers: Optional[MutableMapping[str, str]] = ..., + ) -> Any: ... + async def get_async_status( + self, + id: Any, + *, + pretty: Optional[bool] = ..., + human: Optional[bool] = ..., + error_trace: Optional[bool] = ..., + format: Optional[str] = ..., + filter_path: Optional[Union[str, Collection[str]]] = ..., + request_timeout: Optional[Union[int, float]] = ..., + ignore: Optional[Union[int, Collection[int]]] = ..., + opaque_id: Optional[str] = ..., + http_auth: Optional[Union[str, Tuple[str, str]]] = ..., + api_key: Optional[Union[str, Tuple[str, str]]] = ..., + params: Optional[MutableMapping[str, Any]] = ..., + headers: Optional[MutableMapping[str, str]] = ..., + ) -> Any: ... diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index 4ba75db0..d4776c4e 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -1450,7 +1450,7 @@ class Elasticsearch(object): """ Allows to use the Mustache language to pre-render a search definition. - ``_ + ``_ :arg body: The search definition template and its params :arg id: The id of the stored search template diff --git a/elasticsearch/client/ilm.py b/elasticsearch/client/ilm.py index 9149c16a..c49cad98 100644 --- a/elasticsearch/client/ilm.py +++ b/elasticsearch/client/ilm.py @@ -184,7 +184,7 @@ class IlmClient(NamespacedClient): "POST", "/_ilm/stop", params=params, headers=headers ) - @query_params() + @query_params("dry_run") def migrate_to_data_tiers(self, body=None, params=None, headers=None): """ Migrates the indices and ILM policies away from custom node attribute @@ -195,6 +195,9 @@ class IlmClient(NamespacedClient): :arg body: Optionally specify a legacy index template name to delete and optionally specify a node attribute name used for index shard routing (defaults to "data") + :arg dry_run: If set to true it will simulate the migration, + providing a way to retrieve the ILM policies and indices that need to be + migrated. The default is false """ return self.transport.perform_request( "POST", diff --git a/elasticsearch/client/ilm.pyi b/elasticsearch/client/ilm.pyi index 6b37be52..1d993609 100644 --- a/elasticsearch/client/ilm.pyi +++ b/elasticsearch/client/ilm.pyi @@ -195,6 +195,7 @@ class IlmClient(NamespacedClient): self, *, body: Optional[Any] = ..., + dry_run: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., diff --git a/elasticsearch/client/rollup.py b/elasticsearch/client/rollup.py index ef120fcb..160b6d85 100644 --- a/elasticsearch/client/rollup.py +++ b/elasticsearch/client/rollup.py @@ -220,7 +220,12 @@ class RollupClient(NamespacedClient): """ Rollup an index - ``_ + ``_ + + .. warning:: + + This API is **experimental** so may include breaking changes + or be removed in a future version :arg index: The index to roll up :arg rollup_index: The name of the rollup index to create diff --git a/elasticsearch/client/snapshot.py b/elasticsearch/client/snapshot.py index 92f5a170..d2f0ebdc 100644 --- a/elasticsearch/client/snapshot.py +++ b/elasticsearch/client/snapshot.py @@ -69,7 +69,13 @@ class SnapshotClient(NamespacedClient): headers=headers, ) - @query_params("ignore_unavailable", "index_details", "master_timeout", "verbose") + @query_params( + "ignore_unavailable", + "include_repository", + "index_details", + "master_timeout", + "verbose", + ) def get(self, repository, snapshot, params=None, headers=None): """ Returns information about a snapshot. @@ -81,6 +87,8 @@ class SnapshotClient(NamespacedClient): :arg ignore_unavailable: Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + :arg include_repository: Whether to include the repository name + in the snapshot info. Defaults to true. :arg index_details: Whether to include details of each index in the snapshot, if those details are available. Defaults to false. :arg master_timeout: Explicit operation timeout for connection diff --git a/elasticsearch/client/snapshot.pyi b/elasticsearch/client/snapshot.pyi index efa685b0..f1327b35 100644 --- a/elasticsearch/client/snapshot.pyi +++ b/elasticsearch/client/snapshot.pyi @@ -66,6 +66,7 @@ class SnapshotClient(NamespacedClient): snapshot: Any, *, ignore_unavailable: Optional[Any] = ..., + include_repository: Optional[Any] = ..., index_details: Optional[Any] = ..., master_timeout: Optional[Any] = ..., verbose: Optional[Any] = ..., diff --git a/elasticsearch/client/sql.py b/elasticsearch/client/sql.py index 8a0def68..e8ddcdd3 100644 --- a/elasticsearch/client/sql.py +++ b/elasticsearch/client/sql.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -from .utils import SKIP_IN_PATH, NamespacedClient, query_params +from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params class SqlClient(NamespacedClient): @@ -70,3 +70,66 @@ class SqlClient(NamespacedClient): return self.transport.perform_request( "POST", "/_sql/translate", params=params, headers=headers, body=body ) + + @query_params() + def delete_async(self, id, params=None, headers=None): + """ + Deletes an async SQL search or a stored synchronous SQL search. If the search + is still running, the API cancels it. + + ``_ + + :arg id: The async search ID + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'id'.") + + return self.transport.perform_request( + "DELETE", + _make_path("_sql", "async", "delete", id), + params=params, + headers=headers, + ) + + @query_params("delimiter", "format", "keep_alive", "wait_for_completion_timeout") + def get_async(self, id, params=None, headers=None): + """ + Returns the current status and available results for an async SQL search or + stored synchronous SQL search + + ``_ + + :arg id: The async search ID + :arg delimiter: Separator for CSV results Default: , + :arg format: Short version of the Accept header, e.g. json, yaml + :arg keep_alive: Retention period for the search and its results + Default: 5d + :arg wait_for_completion_timeout: Duration to wait for complete + results + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'id'.") + + return self.transport.perform_request( + "GET", _make_path("_sql", "async", id), params=params, headers=headers + ) + + @query_params() + def get_async_status(self, id, params=None, headers=None): + """ + Returns the current status of an async SQL search or a stored synchronous SQL + search + + ``_ + + :arg id: The async search ID + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'id'.") + + return self.transport.perform_request( + "GET", + _make_path("_sql", "async", "status", id), + params=params, + headers=headers, + ) diff --git a/elasticsearch/client/sql.pyi b/elasticsearch/client/sql.pyi index 225fa2c7..87224ad8 100644 --- a/elasticsearch/client/sql.pyi +++ b/elasticsearch/client/sql.pyi @@ -71,3 +71,57 @@ class SqlClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... + def delete_async( + self, + id: Any, + *, + pretty: Optional[bool] = ..., + human: Optional[bool] = ..., + error_trace: Optional[bool] = ..., + format: Optional[str] = ..., + filter_path: Optional[Union[str, Collection[str]]] = ..., + request_timeout: Optional[Union[int, float]] = ..., + ignore: Optional[Union[int, Collection[int]]] = ..., + opaque_id: Optional[str] = ..., + http_auth: Optional[Union[str, Tuple[str, str]]] = ..., + api_key: Optional[Union[str, Tuple[str, str]]] = ..., + params: Optional[MutableMapping[str, Any]] = ..., + headers: Optional[MutableMapping[str, str]] = ..., + ) -> Any: ... + def get_async( + self, + id: Any, + *, + delimiter: Optional[Any] = ..., + format: Optional[Any] = ..., + keep_alive: Optional[Any] = ..., + wait_for_completion_timeout: Optional[Any] = ..., + pretty: Optional[bool] = ..., + human: Optional[bool] = ..., + error_trace: Optional[bool] = ..., + filter_path: Optional[Union[str, Collection[str]]] = ..., + request_timeout: Optional[Union[int, float]] = ..., + ignore: Optional[Union[int, Collection[int]]] = ..., + opaque_id: Optional[str] = ..., + http_auth: Optional[Union[str, Tuple[str, str]]] = ..., + api_key: Optional[Union[str, Tuple[str, str]]] = ..., + params: Optional[MutableMapping[str, Any]] = ..., + headers: Optional[MutableMapping[str, str]] = ..., + ) -> Any: ... + def get_async_status( + self, + id: Any, + *, + pretty: Optional[bool] = ..., + human: Optional[bool] = ..., + error_trace: Optional[bool] = ..., + format: Optional[str] = ..., + filter_path: Optional[Union[str, Collection[str]]] = ..., + request_timeout: Optional[Union[int, float]] = ..., + ignore: Optional[Union[int, Collection[int]]] = ..., + opaque_id: Optional[str] = ..., + http_auth: Optional[Union[str, Tuple[str, str]]] = ..., + api_key: Optional[Union[str, Tuple[str, str]]] = ..., + params: Optional[MutableMapping[str, Any]] = ..., + headers: Optional[MutableMapping[str, str]] = ..., + ) -> Any: ...