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\Endpoints\Nodes\HotThreads;
25: use OpenSearch\Endpoints\Nodes\Info;
26: use OpenSearch\Endpoints\Nodes\ReloadSecureSettings;
27: use OpenSearch\Endpoints\Nodes\Stats;
28: use OpenSearch\Endpoints\Nodes\Usage;
29:
30: /**
31: * Class NodesNamespace
32: *
33: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
34: */
35: class NodesNamespace extends AbstractNamespace
36: {
37: /**
38: * Returns information about hot threads on each node in the cluster.
39: *
40: * $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.
41: * $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)
42: * $params['interval'] = (string) The interval for the second sampling of threads.
43: * $params['snapshots'] = (integer) Number of samples of thread stack trace. (Default = 10)
44: * $params['threads'] = (integer) Specify the number of threads to provide information for. (Default = 3)
45: * $params['timeout'] = (string) Operation timeout.
46: * $params['type'] = (enum) The type to sample. (Options = block,cpu,wait)
47: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
48: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
49: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
50: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
51: * $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 "-".
52: *
53: * @param array $params Associative array of parameters
54: * @return array
55: */
56: public function hotThreads(array $params = [])
57: {
58: $node_id = $this->extractArgument($params, 'node_id');
59:
60: $endpoint = $this->endpointFactory->getEndpoint(HotThreads::class);
61: $endpoint->setParams($params);
62: $endpoint->setNodeId($node_id);
63:
64: return $this->performRequest($endpoint);
65: }
66:
67: /**
68: * Returns information about nodes in the cluster.
69: *
70: * $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`.
71: * $params['metric'] = (array) Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest.
72: * $params['node_id'] = (array) Comma-separated list of node IDs or names used to limit returned information.
73: * $params['flat_settings'] = (boolean) If `true`, returns settings in flat format. (Default = false)
74: * $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.
75: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
76: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
77: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
78: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
79: * $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 "-".
80: *
81: * @param array $params Associative array of parameters
82: * @return array
83: */
84: public function info(array $params = [])
85: {
86: $node_id_or_metric = $this->extractArgument($params, 'node_id_or_metric');
87: $metric = $this->extractArgument($params, 'metric');
88: $node_id = $this->extractArgument($params, 'node_id');
89:
90: $endpoint = $this->endpointFactory->getEndpoint(Info::class);
91: $endpoint->setParams($params);
92: $endpoint->setNodeIdOrMetric($node_id_or_metric);
93: $endpoint->setMetric($metric);
94: $endpoint->setNodeId($node_id);
95:
96: return $this->performRequest($endpoint);
97: }
98:
99: /**
100: * Reloads secure settings.
101: *
102: * $params['node_id'] = (array) The names of particular nodes in the cluster to target.
103: * $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.
104: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
105: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
106: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
107: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
108: * $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 "-".
109: * $params['body'] = (array) An object containing the password for the OpenSearch keystore.
110: *
111: * @param array $params Associative array of parameters
112: * @return array
113: */
114: public function reloadSecureSettings(array $params = [])
115: {
116: $node_id = $this->extractArgument($params, 'node_id');
117: $body = $this->extractArgument($params, 'body');
118:
119: $endpoint = $this->endpointFactory->getEndpoint(ReloadSecureSettings::class);
120: $endpoint->setParams($params);
121: $endpoint->setNodeId($node_id);
122: $endpoint->setBody($body);
123:
124: return $this->performRequest($endpoint);
125: }
126:
127: /**
128: * Returns statistical information about nodes in the cluster.
129: *
130: * $params['node_id'] = (array) Comma-separated list of node IDs or names used to limit returned information.
131: * $params['metric'] = (array) Limit the information returned to the specified metrics
132: * $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.
133: * $params['completion_fields'] = (any) Comma-separated list or wildcard expressions of fields to include in field data and suggest statistics.
134: * $params['fielddata_fields'] = (any) Comma-separated list or wildcard expressions of fields to include in field data statistics.
135: * $params['fields'] = (any) Comma-separated list or wildcard expressions of fields to include in the statistics.
136: * $params['groups'] = (array) Comma-separated list of search groups to include in the search statistics.
137: * $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)
138: * $params['level'] = (enum) Indicates whether statistics are aggregated at the cluster, index, or shard level. (Options = cluster,indices,shards)
139: * $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.
140: * $params['types'] = (array) A comma-separated list of document types for the indexing index metric.
141: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
142: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
143: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
144: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
145: * $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 "-".
146: *
147: * @param array $params Associative array of parameters
148: * @return array
149: */
150: public function stats(array $params = [])
151: {
152: $node_id = $this->extractArgument($params, 'node_id');
153: $metric = $this->extractArgument($params, 'metric');
154: $index_metric = $this->extractArgument($params, 'index_metric');
155:
156: $endpoint = $this->endpointFactory->getEndpoint(Stats::class);
157: $endpoint->setParams($params);
158: $endpoint->setNodeId($node_id);
159: $endpoint->setMetric($metric);
160: $endpoint->setIndexMetric($index_metric);
161:
162: return $this->performRequest($endpoint);
163: }
164:
165: /**
166: * Returns low-level information about REST actions usage on nodes.
167: *
168: * $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
169: * $params['metric'] = (array) Limits the information returned to the specific metrics. A comma-separated list of the following options: `_all`, `rest_actions`.
170: * $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.
171: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
172: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
173: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
174: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
175: * $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 "-".
176: *
177: * @param array $params Associative array of parameters
178: * @return array
179: */
180: public function usage(array $params = [])
181: {
182: $node_id = $this->extractArgument($params, 'node_id');
183: $metric = $this->extractArgument($params, 'metric');
184:
185: $endpoint = $this->endpointFactory->getEndpoint(Usage::class);
186: $endpoint->setParams($params);
187: $endpoint->setNodeId($node_id);
188: $endpoint->setMetric($metric);
189:
190: return $this->performRequest($endpoint);
191: }
192:
193: }
194: