Skip to content

Commit 6d71623

Browse files
saimedhigithub-actions[bot]
authored andcommitted
Updated opensearch-py to reflect the latest OpenSearch API spec (2024-10-26)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 6fa54a7 commit 6d71623

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4327
-1299
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
3434
- 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))
3535
- Fixed incorrect `retry_on_conflict` type ([#795](https://github.com/opensearch-project/opensearch-py/pull/795))
3636
### Updated APIs
37+
- Updated opensearch-py APIs to reflect [opensearch-api-specification@931a61a](https://github.com/opensearch-project/opensearch-api-specification/commit/931a61ae023b453e3611f37a802ef27b9c4877a1)
3738
- Updated opensearch-py APIs to reflect [opensearch-api-specification@9d3bc34](https://github.com/opensearch-project/opensearch-api-specification/commit/9d3bc340ccd7d049e7d6e14a4aff2293780cb446)
3839
### Dependencies
3940
- Bump `pytest-asyncio` from <=0.23.7 to <=0.23.8 ([#787](https://github.com/opensearch-project/opensearch-py/pull/787))

opensearchpy/_async/client/__init__.py

Lines changed: 267 additions & 95 deletions
Large diffs are not rendered by default.

opensearchpy/_async/client/cat.py

Lines changed: 99 additions & 53 deletions
Large diffs are not rendered by default.

opensearchpy/_async/client/cluster.py

Lines changed: 90 additions & 46 deletions
Large diffs are not rendered by default.

opensearchpy/_async/client/dangling_indices.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ async def delete_dangling_index(
6868
to cluster-manager node.
6969
:arg error_trace: Whether to include the stack trace of returned
7070
errors.
71-
:arg filter_path: Comma-separated list of filters used to reduce
72-
the response.
71+
:arg filter_path: Used to reduce the response. This parameter
72+
takes a comma-separated list of filters. It supports using wildcards to
73+
match any field or part of a field’s name. You can also exclude fields
74+
with "-".
7375
:arg human: Whether to return human readable values for
7476
statistics.
7577
:arg master_timeout (Deprecated: To promote inclusive language,
@@ -119,8 +121,10 @@ async def import_dangling_index(
119121
to cluster-manager node.
120122
:arg error_trace: Whether to include the stack trace of returned
121123
errors.
122-
:arg filter_path: Comma-separated list of filters used to reduce
123-
the response.
124+
:arg filter_path: Used to reduce the response. This parameter
125+
takes a comma-separated list of filters. It supports using wildcards to
126+
match any field or part of a field’s name. You can also exclude fields
127+
with "-".
124128
:arg human: Whether to return human readable values for
125129
statistics.
126130
:arg master_timeout (Deprecated: To promote inclusive language,
@@ -151,8 +155,10 @@ async def list_dangling_indices(
151155
152156
:arg error_trace: Whether to include the stack trace of returned
153157
errors.
154-
:arg filter_path: Comma-separated list of filters used to reduce
155-
the response.
158+
:arg filter_path: Used to reduce the response. This parameter
159+
takes a comma-separated list of filters. It supports using wildcards to
160+
match any field or part of a field’s name. You can also exclude fields
161+
with "-".
156162
:arg human: Whether to return human readable values for
157163
statistics.
158164
:arg pretty: Whether to pretty format the returned JSON

opensearchpy/_async/client/indices.py

Lines changed: 201 additions & 114 deletions
Large diffs are not rendered by default.

opensearchpy/_async/client/ingest.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ async def get_pipeline(
6666
to cluster-manager node.
6767
:arg error_trace: Whether to include the stack trace of returned
6868
errors.
69-
:arg filter_path: Comma-separated list of filters used to reduce
70-
the response.
69+
:arg filter_path: Used to reduce the response. This parameter
70+
takes a comma-separated list of filters. It supports using wildcards to
71+
match any field or part of a field’s name. You can also exclude fields
72+
with "-".
7173
:arg human: Whether to return human readable values for
7274
statistics.
7375
:arg master_timeout (Deprecated: To promote inclusive language,
@@ -110,8 +112,10 @@ async def put_pipeline(
110112
to cluster-manager node.
111113
:arg error_trace: Whether to include the stack trace of returned
112114
errors.
113-
:arg filter_path: Comma-separated list of filters used to reduce
114-
the response.
115+
:arg filter_path: Used to reduce the response. This parameter
116+
takes a comma-separated list of filters. It supports using wildcards to
117+
match any field or part of a field’s name. You can also exclude fields
118+
with "-".
115119
:arg human: Whether to return human readable values for
116120
statistics.
117121
:arg master_timeout (Deprecated: To promote inclusive language,
@@ -165,8 +169,10 @@ async def delete_pipeline(
165169
to cluster-manager node.
166170
:arg error_trace: Whether to include the stack trace of returned
167171
errors.
168-
:arg filter_path: Comma-separated list of filters used to reduce
169-
the response.
172+
:arg filter_path: Used to reduce the response. This parameter
173+
takes a comma-separated list of filters. It supports using wildcards to
174+
match any field or part of a field’s name. You can also exclude fields
175+
with "-".
170176
:arg human: Whether to return human readable values for
171177
statistics.
172178
:arg master_timeout (Deprecated: To promote inclusive language,
@@ -208,8 +214,10 @@ async def simulate(
208214
the request body, this parameter is required.
209215
:arg error_trace: Whether to include the stack trace of returned
210216
errors.
211-
:arg filter_path: Comma-separated list of filters used to reduce
212-
the response.
217+
:arg filter_path: Used to reduce the response. This parameter
218+
takes a comma-separated list of filters. It supports using wildcards to
219+
match any field or part of a field’s name. You can also exclude fields
220+
with "-".
213221
:arg human: Whether to return human readable values for
214222
statistics.
215223
:arg pretty: Whether to pretty format the returned JSON
@@ -242,8 +250,10 @@ async def processor_grok(
242250
243251
:arg error_trace: Whether to include the stack trace of returned
244252
errors.
245-
:arg filter_path: Comma-separated list of filters used to reduce
246-
the response.
253+
:arg filter_path: Used to reduce the response. This parameter
254+
takes a comma-separated list of filters. It supports using wildcards to
255+
match any field or part of a field’s name. You can also exclude fields
256+
with "-".
247257
:arg human: Whether to return human readable values for
248258
statistics.
249259
:arg pretty: Whether to pretty format the returned JSON
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# The OpenSearch Contributors require contributions made to
4+
# this file be licensed under the Apache-2.0 license or a
5+
# compatible open source license.
6+
#
7+
# Modifications Copyright OpenSearch Contributors. See
8+
# GitHub history for details.
9+
10+
# ------------------------------------------------------------------------------------------
11+
# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST
12+
#
13+
# To contribute, kindly make modifications in the opensearch-py client generator
14+
# or in the OpenSearch API specification, and run `nox -rs generate`. See DEVELOPER_GUIDE.md
15+
# and https://github.com/opensearch-project/opensearch-api-specification for details.
16+
# -----------------------------------------------------------------------------------------+
17+
18+
19+
from typing import Any
20+
21+
from .utils import NamespacedClient, query_params
22+
23+
24+
class InsightsClient(NamespacedClient):
25+
@query_params("error_trace", "filter_path", "human", "pretty", "source")
26+
async def top_queries(
27+
self,
28+
params: Any = None,
29+
headers: Any = None,
30+
) -> Any:
31+
"""
32+
Retrieves the top queries based on the given metric type (latency, CPU, or
33+
memory).
34+
35+
36+
:arg error_trace: Whether to include the stack trace of returned
37+
errors.
38+
:arg filter_path: Used to reduce the response. This parameter
39+
takes a comma-separated list of filters. It supports using wildcards to
40+
match any field or part of a field’s name. You can also exclude fields
41+
with "-".
42+
:arg human: Whether to return human readable values for
43+
statistics.
44+
:arg pretty: Whether to pretty format the returned JSON
45+
response.
46+
:arg source: The URL-encoded request definition. Useful for
47+
libraries that do not accept a request body for non-POST requests.
48+
"""
49+
return await self.transport.perform_request(
50+
"GET", "/_insights/top_queries", params=params, headers=headers
51+
)

opensearchpy/_async/client/nodes.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ async def reload_secure_settings(
5858
target.
5959
:arg error_trace: Whether to include the stack trace of returned
6060
errors.
61-
:arg filter_path: Comma-separated list of filters used to reduce
62-
the response.
61+
:arg filter_path: Used to reduce the response. This parameter
62+
takes a comma-separated list of filters. It supports using wildcards to
63+
match any field or part of a field’s name. You can also exclude fields
64+
with "-".
6365
:arg human: Whether to return human readable values for
6466
statistics.
6567
:arg pretty: Whether to pretty format the returned JSON
@@ -104,8 +106,10 @@ async def info(
104106
metrics. Supports a comma-separated list, such as http,ingest.
105107
:arg error_trace: Whether to include the stack trace of returned
106108
errors.
107-
:arg filter_path: Comma-separated list of filters used to reduce
108-
the response.
109+
:arg filter_path: Used to reduce the response. This parameter
110+
takes a comma-separated list of filters. It supports using wildcards to
111+
match any field or part of a field’s name. You can also exclude fields
112+
with "-".
109113
:arg flat_settings: If true, returns settings in flat format.
110114
Default is false.
111115
:arg human: Whether to return human readable values for
@@ -164,8 +168,10 @@ async def stats(
164168
expressions of fields to include in fielddata statistics.
165169
:arg fields: Comma-separated list or wildcard expressions of
166170
fields to include in the statistics.
167-
:arg filter_path: Comma-separated list of filters used to reduce
168-
the response.
171+
:arg filter_path: Used to reduce the response. This parameter
172+
takes a comma-separated list of filters. It supports using wildcards to
173+
match any field or part of a field’s name. You can also exclude fields
174+
with "-".
169175
:arg groups: Comma-separated list of search groups to include in
170176
the search statistics.
171177
:arg human: Whether to return human readable values for
@@ -224,8 +230,10 @@ async def hot_threads(
224230
wait.
225231
:arg error_trace: Whether to include the stack trace of returned
226232
errors.
227-
:arg filter_path: Comma-separated list of filters used to reduce
228-
the response.
233+
:arg filter_path: Used to reduce the response. This parameter
234+
takes a comma-separated list of filters. It supports using wildcards to
235+
match any field or part of a field’s name. You can also exclude fields
236+
with "-".
229237
:arg human: Whether to return human readable values for
230238
statistics.
231239
:arg ignore_idle_threads: Don't show threads that are in known-
@@ -274,8 +282,10 @@ async def usage(
274282
`rest_actions`.
275283
:arg error_trace: Whether to include the stack trace of returned
276284
errors.
277-
:arg filter_path: Comma-separated list of filters used to reduce
278-
the response.
285+
:arg filter_path: Used to reduce the response. This parameter
286+
takes a comma-separated list of filters. It supports using wildcards to
287+
match any field or part of a field’s name. You can also exclude fields
288+
with "-".
279289
:arg human: Whether to return human readable values for
280290
statistics.
281291
:arg pretty: Whether to pretty format the returned JSON

opensearchpy/_async/client/plugins.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from typing import Any
1212

1313
from ..plugins.alerting import AlertingClient
14+
from ..plugins.asynchronous_search import AsynchronousSearchClient
15+
from ..plugins.flow_framework import FlowFrameworkClient
1416
from ..plugins.index_management import IndexManagementClient
1517
from ..plugins.knn import KnnClient
1618
from ..plugins.ml import MlClient
@@ -26,6 +28,7 @@
2628

2729

2830
class PluginsClient(NamespacedClient):
31+
asynchronous_search: Any
2932
alerting: Any
3033
index_management: Any
3134
knn: Any
@@ -41,6 +44,8 @@ class PluginsClient(NamespacedClient):
4144
def __init__(self, client: Client) -> None:
4245
super().__init__(client)
4346

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

6166
plugins = [
67+
"flow_framework",
68+
"asynchronous_search",
6269
"alerting",
6370
"index_management",
6471
"knn",

0 commit comments

Comments
 (0)