1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * Copyright OpenSearch Contributors
7: * SPDX-License-Identifier: Apache-2.0
8: *
9: * OpenSearch PHP client
10: *
11: * @link https://github.com/opensearch-project/opensearch-php/
12: * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
13: * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
14: * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
15: *
16: * Licensed to Elasticsearch B.V under one or more agreements.
17: * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
18: * the GNU Lesser General Public License, Version 2.1, at your option.
19: * See the LICENSE file in the project root for more information.
20: */
21:
22: namespace OpenSearch\Namespaces;
23:
24: use OpenSearch\Namespaces\AbstractNamespace;
25:
26: /**
27: * Class NodesNamespace
28: *
29: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
30: */
31: class NodesNamespace extends AbstractNamespace
32: {
33: /**
34: * Returns information about hot threads on each node in the cluster.
35: *
36: * $params['node_id'] = (array) 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.
37: * $params['ignore_idle_threads'] = (boolean) 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)
38: * $params['interval'] = (string) The interval for the second sampling of threads.
39: * $params['snapshots'] = (integer) Number of samples of thread stacktrace. (Default = 10)
40: * $params['threads'] = (integer) Specify the number of threads to provide information for. (Default = 3)
41: * $params['timeout'] = (string) Operation timeout.
42: * $params['type'] = (enum) The type to sample. (Options = block,cpu,wait)
43: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
44: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
45: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
46: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
47: * $params['filter_path'] = (any) 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 "-".
48: *
49: * @param array $params Associative array of parameters
50: * @return array
51: */
52: public function hotThreads(array $params = [])
53: {
54: $node_id = $this->extractArgument($params, 'node_id');
55:
56: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\HotThreads::class);
57: $endpoint->setParams($params);
58: $endpoint->setNodeId($node_id);
59:
60: return $this->performRequest($endpoint);
61: }
62:
63: /**
64: * Returns information about nodes in the cluster.
65: *
66: * $params['node_id_or_metric'] = (any) Limits the information returned to a list of node IDs or specific metrics. Supports a comma-separated list, such as node1,node2 or http,ingest.
67: * $params['metric'] = (array) Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest.
68: * $params['node_id'] = (array) Comma-separated list of node IDs or names used to limit returned information.
69: * $params['flat_settings'] = (boolean) If true, returns settings in flat format. (Default = false)
70: * $params['timeout'] = (string) Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
71: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
72: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
73: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
74: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
75: * $params['filter_path'] = (any) 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 "-".
76: *
77: * @param array $params Associative array of parameters
78: * @return array
79: */
80: public function info(array $params = [])
81: {
82: $node_id_or_metric = $this->extractArgument($params, 'node_id_or_metric');
83: $metric = $this->extractArgument($params, 'metric');
84: $node_id = $this->extractArgument($params, 'node_id');
85:
86: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\Info::class);
87: $endpoint->setParams($params);
88: $endpoint->setNodeIdOrMetric($node_id_or_metric);
89: $endpoint->setMetric($metric);
90: $endpoint->setNodeId($node_id);
91:
92: return $this->performRequest($endpoint);
93: }
94:
95: /**
96: * Reloads secure settings.
97: *
98: * $params['node_id'] = (array) The names of particular nodes in the cluster to target.
99: * $params['timeout'] = (string) Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error.
100: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
101: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
102: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
103: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
104: * $params['filter_path'] = (any) 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 "-".
105: * $params['body'] = (array) An object containing the password for the opensearch keystore
106: *
107: * @param array $params Associative array of parameters
108: * @return array
109: */
110: public function reloadSecureSettings(array $params = [])
111: {
112: $node_id = $this->extractArgument($params, 'node_id');
113: $body = $this->extractArgument($params, 'body');
114:
115: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\ReloadSecureSettings::class);
116: $endpoint->setParams($params);
117: $endpoint->setNodeId($node_id);
118: $endpoint->setBody($body);
119:
120: return $this->performRequest($endpoint);
121: }
122:
123: /**
124: * Returns statistical information about nodes in the cluster.
125: *
126: * $params['node_id'] = (array) Comma-separated list of node IDs or names used to limit returned information.
127: * $params['metric'] = (array) Limit the information returned to the specified metrics
128: * $params['index_metric'] = (array) Limit the information returned for indexes metric to the specific index metrics. It can be used only if indexes (or all) metric is specified.
129: * $params['completion_fields'] = (any) Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.
130: * $params['fielddata_fields'] = (any) Comma-separated list or wildcard expressions of fields to include in fielddata statistics.
131: * $params['fields'] = (any) Comma-separated list or wildcard expressions of fields to include in the statistics.
132: * $params['groups'] = (array) Comma-separated list of search groups to include in the search statistics.
133: * $params['include_segment_file_sizes'] = (boolean) If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). (Default = false)
134: * $params['level'] = (enum) Indicates whether statistics are aggregated at the cluster, index, or shard level. (Options = cluster,indices,shards)
135: * $params['timeout'] = (string) Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
136: * $params['types'] = (array) A comma-separated list of document types for the indexing index metric.
137: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
138: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
139: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
140: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
141: * $params['filter_path'] = (any) 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 "-".
142: *
143: * @param array $params Associative array of parameters
144: * @return array
145: */
146: public function stats(array $params = [])
147: {
148: $node_id = $this->extractArgument($params, 'node_id');
149: $metric = $this->extractArgument($params, 'metric');
150: $index_metric = $this->extractArgument($params, 'index_metric');
151:
152: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\Stats::class);
153: $endpoint->setParams($params);
154: $endpoint->setNodeId($node_id);
155: $endpoint->setMetric($metric);
156: $endpoint->setIndexMetric($index_metric);
157:
158: return $this->performRequest($endpoint);
159: }
160:
161: /**
162: * Returns low-level information about REST actions usage on nodes.
163: *
164: * $params['node_id'] = (array) 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
165: * $params['metric'] = (array) Limits the information returned to the specific metrics. A comma-separated list of the following options: `_all`, `rest_actions`.
166: * $params['timeout'] = (string) Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error.
167: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
168: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
169: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
170: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
171: * $params['filter_path'] = (any) 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 "-".
172: *
173: * @param array $params Associative array of parameters
174: * @return array
175: */
176: public function usage(array $params = [])
177: {
178: $node_id = $this->extractArgument($params, 'node_id');
179: $metric = $this->extractArgument($params, 'metric');
180:
181: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\Usage::class);
182: $endpoint->setParams($params);
183: $endpoint->setNodeId($node_id);
184: $endpoint->setMetric($metric);
185:
186: return $this->performRequest($endpoint);
187: }
188:
189: }
190: