Skip to content

Commit

Permalink
Update APIs to 8.0.0-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Jul 21, 2021
1 parent 80c32a9 commit c36d31d
Show file tree
Hide file tree
Showing 20 changed files with 690 additions and 22 deletions.
2 changes: 1 addition & 1 deletion elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ async def render_search_template(
"""
Allows to use the Mustache language to pre-render a search definition.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-template.html#_validating_templates>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/render-search-template-api.html>`_
:arg body: The search definition template and its params
:arg id: The id of the stored search template
Expand Down
77 changes: 77 additions & 0 deletions elasticsearch/_async/client/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,3 +1516,80 @@ async def promote_data_stream(self, name, params=None, headers=None):
params=params,
headers=headers,
)

@query_params(
"allow_no_indices",
"expand_wildcards",
"flush",
"ignore_unavailable",
"run_expensive_tasks",
)
async def disk_usage(self, index, params=None, headers=None):
"""
Analyzes the disk usage of each field of an index or data stream
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-disk-usage.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg index: Comma-separated list of indices or data streams to
analyze the disk usage
: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: open,
closed, hidden, none, all Default: open
:arg flush: Whether flush or not before analyzing the index disk
usage. Defaults to true
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg run_expensive_tasks: Must be set to [true] in order for the
task to be performed. Defaults to false.
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")

return await self.transport.perform_request(
"POST", _make_path(index, "_disk_usage"), params=params, headers=headers
)

@query_params(
"allow_no_indices", "expand_wildcards", "fields", "ignore_unavailable"
)
async def field_usage_stats(self, index, params=None, headers=None):
"""
Returns the field usage stats for each field of an index
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/field-usage-stats.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg index: A comma-separated list of index names; 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: open,
closed, hidden, none, all Default: open
:arg fields: A comma-separated list of fields to include in the
stats if only a subset of fields should be returned (supports wildcards)
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")

return await self.transport.perform_request(
"GET",
_make_path(index, "_field_usage_stats"),
params=params,
headers=headers,
)
43 changes: 43 additions & 0 deletions elasticsearch/_async/client/indices.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1130,3 +1130,46 @@ class IndicesClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def disk_usage(
self,
index: Any,
*,
allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
flush: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
run_expensive_tasks: Optional[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 field_usage_stats(
self,
index: Any,
*,
allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
fields: Optional[Any] = ...,
ignore_unavailable: Optional[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: ...
6 changes: 3 additions & 3 deletions elasticsearch/_async/client/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,7 @@ async def infer_trained_model_deployment(self, model_id, params=None, headers=No
"""
Evaluate a trained model.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-infer-trained-model-deployment.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-df-analytics-apis.html>`_
.. warning::
Expand Down Expand Up @@ -1747,7 +1747,7 @@ async def start_trained_model_deployment(self, model_id, params=None, headers=No
"""
Start a trained model deployment.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-trained-model-deployment.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-df-analytics-apis.html>`_
.. warning::
Expand All @@ -1773,7 +1773,7 @@ async def stop_trained_model_deployment(self, model_id, params=None, headers=Non
"""
Stop a trained model deployment.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-trained-model-deployment.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-df-analytics-apis.html>`_
.. warning::
Expand Down
59 changes: 58 additions & 1 deletion elasticsearch/_async/client/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

from .utils import NamespacedClient, _make_path, query_params
from .utils import NamespacedClient, _make_path, query_params, SKIP_IN_PATH


class NodesClient(NamespacedClient):
Expand Down Expand Up @@ -180,3 +180,60 @@ async def stats(
params=params,
headers=headers,
)

@query_params()
async def clear_metering_archive(
self, node_id, max_archive_version, params=None, headers=None
):
"""
Removes the archived repositories metering information present in the cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/clear-repositories-metering-archive-api.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg node_id: Comma-separated list of node IDs or names used to
limit returned information.
:arg max_archive_version: Specifies the maximum archive_version
to be cleared from the archive.
"""
for param in (node_id, max_archive_version):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")

return await self.transport.perform_request(
"DELETE",
_make_path(
"_nodes", node_id, "_repositories_metering", max_archive_version
),
params=params,
headers=headers,
)

@query_params()
async def get_metering_info(self, node_id, params=None, headers=None):
"""
Returns cluster repositories metering information.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-repositories-metering-api.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg node_id: A comma-separated list of node IDs or names to
limit the returned information.
"""
if node_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'node_id'.")

return await self.transport.perform_request(
"GET",
_make_path("_nodes", node_id, "_repositories_metering"),
params=params,
headers=headers,
)
35 changes: 35 additions & 0 deletions elasticsearch/_async/client/nodes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,38 @@ class NodesClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def clear_metering_archive(
self,
node_id: Any,
max_archive_version: 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_metering_info(
self,
node_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: ...
7 changes: 6 additions & 1 deletion elasticsearch/_async/client/rollup.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,12 @@ async def rollup(self, index, rollup_index, body, params=None, headers=None):
"""
Rollup an index
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-api.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/xpack-rollup.html>`_
.. 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
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_async/client/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ async def enroll_kibana(self, params=None, headers=None):
Allows a kibana instance to configure itself to communicate with a secured
elasticsearch cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-enroll-kibana.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-kibana-enrollment.html>`_
"""
return await self.transport.perform_request(
"GET", "/_security/enroll/kibana", params=params, headers=headers
Expand Down
71 changes: 67 additions & 4 deletions elasticsearch/_async/client/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, query_params, _make_path


class SqlClient(NamespacedClient):
Expand All @@ -24,7 +24,7 @@ async def clear_cursor(self, body, params=None, headers=None):
"""
Clears the SQL cursor
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-pagination.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/clear-sql-cursor-api.html>`_
:arg body: Specify the cursor value in the `cursor` element to
clean the cursor.
Expand All @@ -41,7 +41,7 @@ async def query(self, body, params=None, headers=None):
"""
Executes a SQL request
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-rest-overview.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-search-api.html>`_
:arg body: Use the `query` element to start a query. Use the
`cursor` element to continue a query.
Expand All @@ -60,7 +60,7 @@ async def translate(self, body, params=None, headers=None):
"""
Translates SQL into Elasticsearch queries
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-translate.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-translate-api.html>`_
:arg body: Specify the query in the `query` element.
"""
Expand All @@ -70,3 +70,66 @@ async def translate(self, body, params=None, headers=None):
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.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-async-sql-search-api.html>`_
: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
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-sql-search-api.html>`_
: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
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-sql-search-status-api.html>`_
: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,
)

0 comments on commit c36d31d

Please sign in to comment.