Updated opensearch-py to reflect the latest OpenSearch API spec (2024-04-19) (#725)
Signed-off-by: GitHub <[email protected]> Co-authored-by: saimedhi <[email protected]>
This commit is contained in:
co-authored by
saimedhi
parent
b47edf906e
commit
3082d92f7d
@@ -13,6 +13,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Updated code generator to use native OpenAPI specification ([#721](https://github.com/opensearch-project/opensearch-py/pull/721))
|
- Updated code generator to use native OpenAPI specification ([#721](https://github.com/opensearch-project/opensearch-py/pull/721))
|
||||||
### Updated APIs
|
### Updated APIs
|
||||||
|
- Updated opensearch-py APIs to reflect [opensearch-api-specification@fe6f977](https://github.com/opensearch-project/opensearch-api-specification/commit/fe6f977bcae4e27a2b261fb9599884df5606c0bc)
|
||||||
- Updated opensearch-py APIs to reflect [opensearch-api-specification@29faff0](https://github.com/opensearch-project/opensearch-api-specification/commit/29faff0709b2557acfd4c3c7e053a2c313413633)
|
- Updated opensearch-py APIs to reflect [opensearch-api-specification@29faff0](https://github.com/opensearch-project/opensearch-api-specification/commit/29faff0709b2557acfd4c3c7e053a2c313413633)
|
||||||
### Security
|
### Security
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|||||||
@@ -22,10 +22,99 @@ from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
|
|||||||
|
|
||||||
|
|
||||||
class SearchPipelineClient(NamespacedClient):
|
class SearchPipelineClient(NamespacedClient):
|
||||||
@query_params("error_trace", "filter_path", "human", "pretty", "source")
|
@query_params(
|
||||||
async def create(
|
"cluster_manager_timeout",
|
||||||
|
"error_trace",
|
||||||
|
"filter_path",
|
||||||
|
"human",
|
||||||
|
"pretty",
|
||||||
|
"source",
|
||||||
|
)
|
||||||
|
async def get(
|
||||||
self,
|
self,
|
||||||
pipeline: Any,
|
id: Any = None,
|
||||||
|
params: Any = None,
|
||||||
|
headers: Any = None,
|
||||||
|
) -> Any:
|
||||||
|
"""
|
||||||
|
Retrieves information about a specified search pipeline.
|
||||||
|
|
||||||
|
|
||||||
|
:arg id: Comma-separated list of search pipeline ids. Wildcards
|
||||||
|
supported.
|
||||||
|
:arg cluster_manager_timeout: operation timeout for connection
|
||||||
|
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 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", _make_path("_search", "pipeline", id), params=params, headers=headers
|
||||||
|
)
|
||||||
|
|
||||||
|
@query_params(
|
||||||
|
"cluster_manager_timeout",
|
||||||
|
"error_trace",
|
||||||
|
"filter_path",
|
||||||
|
"human",
|
||||||
|
"pretty",
|
||||||
|
"source",
|
||||||
|
"timeout",
|
||||||
|
)
|
||||||
|
async def delete(
|
||||||
|
self,
|
||||||
|
id: Any,
|
||||||
|
params: Any = None,
|
||||||
|
headers: Any = None,
|
||||||
|
) -> Any:
|
||||||
|
"""
|
||||||
|
Deletes the specified search pipeline.
|
||||||
|
|
||||||
|
|
||||||
|
:arg id: Pipeline ID.
|
||||||
|
:arg cluster_manager_timeout: Operation timeout for connection
|
||||||
|
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 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.
|
||||||
|
:arg timeout: Operation timeout.
|
||||||
|
"""
|
||||||
|
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("_search", "pipeline", id),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
|
||||||
|
@query_params(
|
||||||
|
"cluster_manager_timeout",
|
||||||
|
"error_trace",
|
||||||
|
"filter_path",
|
||||||
|
"human",
|
||||||
|
"pretty",
|
||||||
|
"source",
|
||||||
|
"timeout",
|
||||||
|
)
|
||||||
|
async def put(
|
||||||
|
self,
|
||||||
|
id: Any,
|
||||||
body: Any,
|
body: Any,
|
||||||
params: Any = None,
|
params: Any = None,
|
||||||
headers: Any = None,
|
headers: Any = None,
|
||||||
@@ -34,6 +123,9 @@ class SearchPipelineClient(NamespacedClient):
|
|||||||
Creates or replaces the specified search pipeline.
|
Creates or replaces the specified search pipeline.
|
||||||
|
|
||||||
|
|
||||||
|
:arg id: Pipeline ID.
|
||||||
|
:arg cluster_manager_timeout: operation timeout for connection
|
||||||
|
to cluster-manager node.
|
||||||
:arg error_trace: Whether to include the stack trace of returned
|
:arg error_trace: Whether to include the stack trace of returned
|
||||||
errors.
|
errors.
|
||||||
:arg filter_path: Comma-separated list of filters used to reduce
|
:arg filter_path: Comma-separated list of filters used to reduce
|
||||||
@@ -44,47 +136,16 @@ class SearchPipelineClient(NamespacedClient):
|
|||||||
response.
|
response.
|
||||||
:arg source: The URL-encoded request definition. Useful for
|
:arg source: The URL-encoded request definition. Useful for
|
||||||
libraries that do not accept a request body for non-POST requests.
|
libraries that do not accept a request body for non-POST requests.
|
||||||
|
:arg timeout: Operation timeout.
|
||||||
"""
|
"""
|
||||||
for param in (pipeline, body):
|
for param in (id, body):
|
||||||
if param in SKIP_IN_PATH:
|
if param in SKIP_IN_PATH:
|
||||||
raise ValueError("Empty value passed for a required argument.")
|
raise ValueError("Empty value passed for a required argument.")
|
||||||
|
|
||||||
return await self.transport.perform_request(
|
return await self.transport.perform_request(
|
||||||
"PUT",
|
"PUT",
|
||||||
_make_path("_search", "pipeline", pipeline),
|
_make_path("_search", "pipeline", id),
|
||||||
params=params,
|
params=params,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
body=body,
|
body=body,
|
||||||
)
|
)
|
||||||
|
|
||||||
@query_params("error_trace", "filter_path", "human", "pretty", "source")
|
|
||||||
async def get(
|
|
||||||
self,
|
|
||||||
pipeline: Any,
|
|
||||||
params: Any = None,
|
|
||||||
headers: Any = None,
|
|
||||||
) -> Any:
|
|
||||||
"""
|
|
||||||
Retrieves information about a specified search pipeline.
|
|
||||||
|
|
||||||
|
|
||||||
: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 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.
|
|
||||||
"""
|
|
||||||
if pipeline in SKIP_IN_PATH:
|
|
||||||
raise ValueError("Empty value passed for a required argument 'pipeline'.")
|
|
||||||
|
|
||||||
return await self.transport.perform_request(
|
|
||||||
"GET",
|
|
||||||
_make_path("_search", "pipeline", pipeline),
|
|
||||||
params=params,
|
|
||||||
headers=headers,
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -22,10 +22,99 @@ from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
|
|||||||
|
|
||||||
|
|
||||||
class SearchPipelineClient(NamespacedClient):
|
class SearchPipelineClient(NamespacedClient):
|
||||||
@query_params("error_trace", "filter_path", "human", "pretty", "source")
|
@query_params(
|
||||||
def create(
|
"cluster_manager_timeout",
|
||||||
|
"error_trace",
|
||||||
|
"filter_path",
|
||||||
|
"human",
|
||||||
|
"pretty",
|
||||||
|
"source",
|
||||||
|
)
|
||||||
|
def get(
|
||||||
self,
|
self,
|
||||||
pipeline: Any,
|
id: Any = None,
|
||||||
|
params: Any = None,
|
||||||
|
headers: Any = None,
|
||||||
|
) -> Any:
|
||||||
|
"""
|
||||||
|
Retrieves information about a specified search pipeline.
|
||||||
|
|
||||||
|
|
||||||
|
:arg id: Comma-separated list of search pipeline ids. Wildcards
|
||||||
|
supported.
|
||||||
|
:arg cluster_manager_timeout: operation timeout for connection
|
||||||
|
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 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 self.transport.perform_request(
|
||||||
|
"GET", _make_path("_search", "pipeline", id), params=params, headers=headers
|
||||||
|
)
|
||||||
|
|
||||||
|
@query_params(
|
||||||
|
"cluster_manager_timeout",
|
||||||
|
"error_trace",
|
||||||
|
"filter_path",
|
||||||
|
"human",
|
||||||
|
"pretty",
|
||||||
|
"source",
|
||||||
|
"timeout",
|
||||||
|
)
|
||||||
|
def delete(
|
||||||
|
self,
|
||||||
|
id: Any,
|
||||||
|
params: Any = None,
|
||||||
|
headers: Any = None,
|
||||||
|
) -> Any:
|
||||||
|
"""
|
||||||
|
Deletes the specified search pipeline.
|
||||||
|
|
||||||
|
|
||||||
|
:arg id: Pipeline ID.
|
||||||
|
:arg cluster_manager_timeout: Operation timeout for connection
|
||||||
|
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 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.
|
||||||
|
:arg timeout: Operation timeout.
|
||||||
|
"""
|
||||||
|
if id in SKIP_IN_PATH:
|
||||||
|
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||||
|
|
||||||
|
return self.transport.perform_request(
|
||||||
|
"DELETE",
|
||||||
|
_make_path("_search", "pipeline", id),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
|
||||||
|
@query_params(
|
||||||
|
"cluster_manager_timeout",
|
||||||
|
"error_trace",
|
||||||
|
"filter_path",
|
||||||
|
"human",
|
||||||
|
"pretty",
|
||||||
|
"source",
|
||||||
|
"timeout",
|
||||||
|
)
|
||||||
|
def put(
|
||||||
|
self,
|
||||||
|
id: Any,
|
||||||
body: Any,
|
body: Any,
|
||||||
params: Any = None,
|
params: Any = None,
|
||||||
headers: Any = None,
|
headers: Any = None,
|
||||||
@@ -34,6 +123,9 @@ class SearchPipelineClient(NamespacedClient):
|
|||||||
Creates or replaces the specified search pipeline.
|
Creates or replaces the specified search pipeline.
|
||||||
|
|
||||||
|
|
||||||
|
:arg id: Pipeline ID.
|
||||||
|
:arg cluster_manager_timeout: operation timeout for connection
|
||||||
|
to cluster-manager node.
|
||||||
:arg error_trace: Whether to include the stack trace of returned
|
:arg error_trace: Whether to include the stack trace of returned
|
||||||
errors.
|
errors.
|
||||||
:arg filter_path: Comma-separated list of filters used to reduce
|
:arg filter_path: Comma-separated list of filters used to reduce
|
||||||
@@ -44,47 +136,16 @@ class SearchPipelineClient(NamespacedClient):
|
|||||||
response.
|
response.
|
||||||
:arg source: The URL-encoded request definition. Useful for
|
:arg source: The URL-encoded request definition. Useful for
|
||||||
libraries that do not accept a request body for non-POST requests.
|
libraries that do not accept a request body for non-POST requests.
|
||||||
|
:arg timeout: Operation timeout.
|
||||||
"""
|
"""
|
||||||
for param in (pipeline, body):
|
for param in (id, body):
|
||||||
if param in SKIP_IN_PATH:
|
if param in SKIP_IN_PATH:
|
||||||
raise ValueError("Empty value passed for a required argument.")
|
raise ValueError("Empty value passed for a required argument.")
|
||||||
|
|
||||||
return self.transport.perform_request(
|
return self.transport.perform_request(
|
||||||
"PUT",
|
"PUT",
|
||||||
_make_path("_search", "pipeline", pipeline),
|
_make_path("_search", "pipeline", id),
|
||||||
params=params,
|
params=params,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
body=body,
|
body=body,
|
||||||
)
|
)
|
||||||
|
|
||||||
@query_params("error_trace", "filter_path", "human", "pretty", "source")
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
pipeline: Any,
|
|
||||||
params: Any = None,
|
|
||||||
headers: Any = None,
|
|
||||||
) -> Any:
|
|
||||||
"""
|
|
||||||
Retrieves information about a specified search pipeline.
|
|
||||||
|
|
||||||
|
|
||||||
: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 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.
|
|
||||||
"""
|
|
||||||
if pipeline in SKIP_IN_PATH:
|
|
||||||
raise ValueError("Empty value passed for a required argument 'pipeline'.")
|
|
||||||
|
|
||||||
return self.transport.perform_request(
|
|
||||||
"GET",
|
|
||||||
_make_path("_search", "pipeline", pipeline),
|
|
||||||
params=params,
|
|
||||||
headers=headers,
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user