Skip to content

Commit

Permalink
Updated opensearch-py to reflect the latest OpenSearch API spec (2024…
Browse files Browse the repository at this point in the history
…-10-26)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
saimedhi authored and github-actions[bot] committed Oct 26, 2024
1 parent 6fa54a7 commit 6d71623
Show file tree
Hide file tree
Showing 51 changed files with 4,327 additions and 1,299 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed the use of `minimum_should_match` with `Bool` to allow the use of string-based value (percent string, combination). ([#780](https://github.com/opensearch-project/opensearch-py/pull/780))
- Fixed incorrect `retry_on_conflict` type ([#795](https://github.com/opensearch-project/opensearch-py/pull/795))
### Updated APIs
- Updated opensearch-py APIs to reflect [opensearch-api-specification@931a61a](https://github.com/opensearch-project/opensearch-api-specification/commit/931a61ae023b453e3611f37a802ef27b9c4877a1)
- Updated opensearch-py APIs to reflect [opensearch-api-specification@9d3bc34](https://github.com/opensearch-project/opensearch-api-specification/commit/9d3bc340ccd7d049e7d6e14a4aff2293780cb446)
### Dependencies
- Bump `pytest-asyncio` from <=0.23.7 to <=0.23.8 ([#787](https://github.com/opensearch-project/opensearch-py/pull/787))
Expand Down
362 changes: 267 additions & 95 deletions opensearchpy/_async/client/__init__.py

Large diffs are not rendered by default.

152 changes: 99 additions & 53 deletions opensearchpy/_async/client/cat.py

Large diffs are not rendered by default.

136 changes: 90 additions & 46 deletions opensearchpy/_async/client/cluster.py

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions opensearchpy/_async/client/dangling_indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ async def delete_dangling_index(
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg master_timeout (Deprecated: To promote inclusive language,
Expand Down Expand Up @@ -119,8 +121,10 @@ async def import_dangling_index(
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg master_timeout (Deprecated: To promote inclusive language,
Expand Down Expand Up @@ -151,8 +155,10 @@ async def list_dangling_indices(
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
Expand Down
315 changes: 201 additions & 114 deletions opensearchpy/_async/client/indices.py

Large diffs are not rendered by default.

30 changes: 20 additions & 10 deletions opensearchpy/_async/client/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ async def get_pipeline(
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg master_timeout (Deprecated: To promote inclusive language,
Expand Down Expand Up @@ -110,8 +112,10 @@ async def put_pipeline(
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg master_timeout (Deprecated: To promote inclusive language,
Expand Down Expand Up @@ -165,8 +169,10 @@ async def delete_pipeline(
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg master_timeout (Deprecated: To promote inclusive language,
Expand Down Expand Up @@ -208,8 +214,10 @@ async def simulate(
the request body, this parameter is required.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
Expand Down Expand Up @@ -242,8 +250,10 @@ async def processor_grok(
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
Expand Down
51 changes: 51 additions & 0 deletions opensearchpy/_async/client/insights.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.

# ------------------------------------------------------------------------------------------
# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST
#
# To contribute, kindly make modifications in the opensearch-py client generator
# or in the OpenSearch API specification, and run `nox -rs generate`. See DEVELOPER_GUIDE.md
# and https://github.com/opensearch-project/opensearch-api-specification for details.
# -----------------------------------------------------------------------------------------+


from typing import Any

from .utils import NamespacedClient, query_params


class InsightsClient(NamespacedClient):
@query_params("error_trace", "filter_path", "human", "pretty", "source")
async def top_queries(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Retrieves the top queries based on the given metric type (latency, CPU, or
memory).
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
return await self.transport.perform_request(
"GET", "/_insights/top_queries", params=params, headers=headers
)
30 changes: 20 additions & 10 deletions opensearchpy/_async/client/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ async def reload_secure_settings(
target.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
Expand Down Expand Up @@ -104,8 +106,10 @@ async def info(
metrics. Supports a comma-separated list, such as http,ingest.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg flat_settings: If true, returns settings in flat format.
Default is false.
:arg human: Whether to return human readable values for
Expand Down Expand Up @@ -164,8 +168,10 @@ async def stats(
expressions of fields to include in fielddata statistics.
:arg fields: Comma-separated list or wildcard expressions of
fields to include in the statistics.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg groups: Comma-separated list of search groups to include in
the search statistics.
:arg human: Whether to return human readable values for
Expand Down Expand Up @@ -224,8 +230,10 @@ async def hot_threads(
wait.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg ignore_idle_threads: Don't show threads that are in known-
Expand Down Expand Up @@ -274,8 +282,10 @@ async def usage(
`rest_actions`.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
Expand Down
7 changes: 7 additions & 0 deletions opensearchpy/_async/client/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from typing import Any

from ..plugins.alerting import AlertingClient
from ..plugins.asynchronous_search import AsynchronousSearchClient
from ..plugins.flow_framework import FlowFrameworkClient
from ..plugins.index_management import IndexManagementClient
from ..plugins.knn import KnnClient
from ..plugins.ml import MlClient
Expand All @@ -26,6 +28,7 @@


class PluginsClient(NamespacedClient):
asynchronous_search: Any
alerting: Any
index_management: Any
knn: Any
Expand All @@ -41,6 +44,8 @@ class PluginsClient(NamespacedClient):
def __init__(self, client: Client) -> None:
super().__init__(client)

self.flow_framework = FlowFrameworkClient(client)
self.asynchronous_search = AsynchronousSearchClient(client)
self.alerting = AlertingClient(client)
self.index_management = IndexManagementClient(client)
self.knn = KnnClient(client)
Expand All @@ -59,6 +64,8 @@ def _dynamic_lookup(self, client: Any) -> None:
# Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742

plugins = [
"flow_framework",
"asynchronous_search",
"alerting",
"index_management",
"knn",
Expand Down
6 changes: 4 additions & 2 deletions opensearchpy/_async/client/remote_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ async def restore(
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
Expand Down
18 changes: 12 additions & 6 deletions opensearchpy/_async/client/search_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ async def get(
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
Expand Down Expand Up @@ -83,8 +85,10 @@ async def delete(
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
Expand Down Expand Up @@ -128,8 +132,10 @@ async def put(
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a field’s name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
Expand Down
Loading

0 comments on commit 6d71623

Please sign in to comment.