Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrated generated 'nodes' client APIs into the existing module #514

Merged
merged 3 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Changed
- Integrated generated `tasks client` APIs into the existing module, ensuring alignment with the server and maintaining backward compatibility ([#508](https://github.com/opensearch-project/opensearch-py/pull/508))
- Integrated generated `ingest client` APIs into the existing module, ensuring alignment with the server and maintaining backward compatibility ([#513](https://github.com/opensearch-project/opensearch-py/pull/513))
- Integrated generated `nodes client` APIs into the existing module, ensuring alignment with the server and maintaining backward compatibility ([#514](https://github.com/opensearch-project/opensearch-py/pull/514))
### Deprecated
- Deprecated point-in-time APIs (list_all_point_in_time, create_point_in_time, delete_point_in_time) and Security Client APIs (health_check and update_audit_config) ([#502](https://github.com/opensearch-project/opensearch-py/pull/502))
### Removed
Expand Down
118 changes: 62 additions & 56 deletions opensearchpy/_async/client/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
# under the License.


# ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
#
# To contribute, kindly make essential modifications through either the "opensearch-py client generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or the "OpenSearch API specification" available at:
# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json
# -----------------------------------------------------


from .utils import NamespacedClient, _make_path, query_params


Expand All @@ -37,12 +47,12 @@ async def reload_secure_settings(
Reloads secure settings.


:arg body: An object containing the password for the
opensearch keystore
:arg node_id: A comma-separated list of node IDs to span the
:arg body: An object containing the password for the opensearch
keystore
:arg node_id: Comma-separated list of node IDs to span the
reload/reinit call. Should stay empty because reloading usually involves
all cluster nodes.
:arg timeout: Explicit operation timeout
:arg timeout: Operation timeout.
"""
return await self.transport.perform_request(
"POST",
Expand All @@ -58,16 +68,16 @@ async def info(self, node_id=None, metric=None, params=None, headers=None):
Returns information about nodes in the cluster.


:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg metric: A comma-separated list of metrics you wish
returned. Leave empty to return all. Valid choices: settings, os,
process, jvm, thread_pool, transport, http, plugins, ingest
:arg flat_settings: Return settings in flat format (default:
:arg node_id: Comma-separated list of node IDs or names to limit
the returned information; use `_local` to return information from the
node you're connecting to, leave empty to get information from all
nodes.
:arg metric: Comma-separated list of metrics you wish returned.
Leave empty to return all. Valid choices: settings, os, process, jvm,
thread_pool, transport, http, plugins, ingest
:arg flat_settings: Return settings in flat format. (default:
false)
:arg timeout: Explicit operation timeout
:arg timeout: Operation timeout.
"""
return await self.transport.perform_request(
"GET", _make_path("_nodes", node_id, metric), params=params, headers=headers
Expand All @@ -79,7 +89,6 @@ async def info(self, node_id=None, metric=None, params=None, headers=None):
"fields",
"groups",
"include_segment_file_sizes",
"include_unloaded_segments",
"level",
"timeout",
"types",
Expand All @@ -91,37 +100,34 @@ async def stats(
Returns statistical information about nodes in the cluster.


:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg node_id: Comma-separated list of node IDs or names to limit
the returned information; use `_local` to return information from the
node you're connecting to, leave empty to get information from all
nodes.
:arg metric: Limit the information returned to the specified
metrics Valid choices: _all, breaker, fs, http, indices, jvm, os,
metrics. Valid choices: _all, breaker, fs, http, indices, jvm, os,
process, thread_pool, transport, discovery, indexing_pressure
:arg index_metric: Limit the information returned for `indices`
metric to the specific index metrics. Isn't used if `indices` (or `all`)
metric isn't specified. Valid choices: _all, completion, docs,
fielddata, query_cache, flush, get, indexing, merge, request_cache,
refresh, search, segments, store, warmer, suggest
:arg completion_fields: A comma-separated list of fields for
`fielddata` and `suggest` index metric (supports wildcards)
:arg fielddata_fields: A comma-separated list of fields for
`fielddata` index metric (supports wildcards)
:arg fields: A comma-separated list of fields for `fielddata`
and `completion` index metric (supports wildcards)
:arg groups: A comma-separated list of search groups for
`search` index metric
metric isn't specified. Valid choices: _all, store, indexing, get,
search, merge, flush, refresh, query_cache, fielddata, docs, warmer,
completion, segments, translog, suggest, request_cache, recovery
:arg completion_fields: Comma-separated list of fields for
`fielddata` and `suggest` index metric (supports wildcards).
:arg fielddata_fields: Comma-separated list of fields for
`fielddata` index metric (supports wildcards).
:arg fields: Comma-separated list of fields for `fielddata` and
`completion` index metric (supports wildcards).
:arg groups: Comma-separated list of search groups for `search`
index metric.
:arg include_segment_file_sizes: Whether to report the
aggregated disk usage of each one of the Lucene index files (only
applies if segment stats are requested)
:arg include_unloaded_segments: If set to true segment stats
will include stats for segments that are not currently loaded into
memory
applies if segment stats are requested). (default: false)
:arg level: Return indices stats aggregated at index, node or
shard level Valid choices: indices, node, shards Default: node
:arg timeout: Explicit operation timeout
:arg types: A comma-separated list of document types for the
`indexing` index metric
shard level. Valid choices: indices, node, shards
:arg timeout: Operation timeout.
:arg types: Comma-separated list of document types for the
`indexing` index metric.
"""
return await self.transport.perform_request(
"GET",
Expand All @@ -138,21 +144,21 @@ async def hot_threads(self, node_id=None, params=None, headers=None):
Returns information about hot threads on each node in the cluster.


:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg doc_type: The type to sample (default: cpu) Valid choices:
cpu, wait, block
:arg node_id: Comma-separated list of node IDs or names to limit
the returned information; use `_local` to return information from the
node you're connecting to, leave empty to get information from all
nodes.
:arg doc_type: The type to sample. Valid choices: cpu, wait,
block
:arg ignore_idle_threads: Don't show threads that are in known-
idle places, such as waiting on a socket select or pulling from an empty
task queue (default: true)
:arg interval: The interval for the second sampling of threads
:arg snapshots: Number of samples of thread stacktrace (default:
10)
task queue. (default: True)
:arg interval: The interval for the second sampling of threads.
:arg snapshots: Number of samples of thread stacktrace.
(default: 10)
:arg threads: Specify the number of threads to provide
information for (default: 3)
:arg timeout: Explicit operation timeout
information for. (default: 3)
:arg timeout: Operation timeout.
"""
# type is a reserved word so it cannot be used, use doc_type instead
if "doc_type" in params:
Expand All @@ -171,13 +177,13 @@ async def usage(self, node_id=None, metric=None, params=None, headers=None):
Returns low-level information about REST actions usage on nodes.


:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg node_id: Comma-separated list of node IDs or names to limit
the returned information; use `_local` to return information from the
node you're connecting to, leave empty to get information from all
nodes.
:arg metric: Limit the information returned to the specified
metrics Valid choices: _all, rest_actions
:arg timeout: Explicit operation timeout
metrics. Valid choices: _all, rest_actions
:arg timeout: Operation timeout.
"""
return await self.transport.perform_request(
"GET",
Expand Down
10 changes: 9 additions & 1 deletion opensearchpy/_async/client/nodes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
# specific language governing permissions and limitations
# under the License.

# ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
#
# To contribute, kindly make essential modifications through either the "opensearch-py client generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or the "OpenSearch API specification" available at:
# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json
# -----------------------------------------------------

from typing import Any, Collection, MutableMapping, Optional, Tuple, Union

from .utils import NamespacedClient
Expand Down Expand Up @@ -79,7 +88,6 @@ class NodesClient(NamespacedClient):
fields: Optional[Any] = ...,
groups: Optional[Any] = ...,
include_segment_file_sizes: Optional[Any] = ...,
include_unloaded_segments: Optional[Any] = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we breaking users by removing this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not breaking users because the parameter is throwing error


{
"type": "illegal_argument_exception",
"reason": "request [/_nodes/stats] contains unrecognized parameter: [include_unloaded_segments]"
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

@saimedhi saimedhi Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not certain, Vacha. I'm not very familiar with the OpenSearch server code. Do we need to examine this file or action instead of the above file?

https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestNodesStatsAction.java#L63

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you are absolutely right! For nodes stats it does not exist.

level: Optional[Any] = ...,
timeout: Optional[Any] = ...,
types: Optional[Any] = ...,
Expand Down
Loading
Loading