1<?php
2/**
3 * Elasticsearch PHP client
4 *
5 * @link      https://github.com/elastic/elasticsearch-php/
6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
7 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
8 * @license   https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
9 *
10 * Licensed to Elasticsearch B.V under one or more agreements.
11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
12 * the GNU Lesser General Public License, Version 2.1, at your option.
13 * See the LICENSE file in the project root for more information.
14 */
15declare(strict_types = 1);
16
17namespace Elasticsearch\Namespaces;
18
19use Elasticsearch\Namespaces\AbstractNamespace;
20
21/**
22 * Class NodesNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class NodesNamespace extends AbstractNamespace
28{
29
30    /**
31     * Removes the archived repositories metering information present in the cluster.
32     *
33     * $params['node_id']             = (list) Comma-separated list of node IDs or names used to limit returned information.
34     * $params['max_archive_version'] = (long) Specifies the maximum archive_version to be cleared from the archive.
35     *
36     * @param array $params Associative array of parameters
37     * @return array
38     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-repositories-metering-archive-api.html
39     *
40     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
41     *
42     */
43    public function clearRepositoriesMeteringArchive(array $params = [])
44    {
45        $node_id = $this->extractArgument($params, 'node_id');
46        $max_archive_version = $this->extractArgument($params, 'max_archive_version');
47
48        $endpointBuilder = $this->endpoints;
49        $endpoint = $endpointBuilder('Nodes\ClearRepositoriesMeteringArchive');
50        $endpoint->setParams($params);
51        $endpoint->setNodeId($node_id);
52        $endpoint->setMaxArchiveVersion($max_archive_version);
53
54        return $this->performRequest($endpoint);
55    }
56    /**
57     * Returns cluster repositories metering information.
58     *
59     * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information.
60     *
61     * @param array $params Associative array of parameters
62     * @return array
63     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-repositories-metering-api.html
64     *
65     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
66     *
67     */
68    public function getRepositoriesMeteringInfo(array $params = [])
69    {
70        $node_id = $this->extractArgument($params, 'node_id');
71
72        $endpointBuilder = $this->endpoints;
73        $endpoint = $endpointBuilder('Nodes\GetRepositoriesMeteringInfo');
74        $endpoint->setParams($params);
75        $endpoint->setNodeId($node_id);
76
77        return $this->performRequest($endpoint);
78    }
79    /**
80     * Returns information about hot threads on each node in the cluster.
81     *
82     * $params['node_id']             = (list) 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
83     * $params['interval']            = (time) The interval for the second sampling of threads
84     * $params['snapshots']           = (number) Number of samples of thread stacktrace (default: 10)
85     * $params['threads']             = (number) Specify the number of threads to provide information for (default: 3)
86     * $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)
87     * $params['type']                = (enum) The type to sample (default: cpu) (Options = cpu,wait,block)
88     * $params['timeout']             = (time) Explicit operation timeout
89     *
90     * @param array $params Associative array of parameters
91     * @return array
92     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html
93     */
94    public function hotThreads(array $params = [])
95    {
96        $node_id = $this->extractArgument($params, 'node_id');
97
98        $endpointBuilder = $this->endpoints;
99        $endpoint = $endpointBuilder('Nodes\HotThreads');
100        $endpoint->setParams($params);
101        $endpoint->setNodeId($node_id);
102
103        return $this->performRequest($endpoint);
104    }
105    /**
106     * Returns information about nodes in the cluster.
107     *
108     * $params['node_id']       = (list) 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
109     * $params['metric']        = (list) A comma-separated list of metrics you wish returned. Leave empty to return all.
110     * $params['flat_settings'] = (boolean) Return settings in flat format (default: false)
111     * $params['timeout']       = (time) Explicit operation timeout
112     *
113     * @param array $params Associative array of parameters
114     * @return array
115     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html
116     */
117    public function info(array $params = [])
118    {
119        $node_id = $this->extractArgument($params, 'node_id');
120        $metric = $this->extractArgument($params, 'metric');
121
122        $endpointBuilder = $this->endpoints;
123        $endpoint = $endpointBuilder('Nodes\Info');
124        $endpoint->setParams($params);
125        $endpoint->setNodeId($node_id);
126        $endpoint->setMetric($metric);
127
128        return $this->performRequest($endpoint);
129    }
130    /**
131     * Reloads secure settings.
132     *
133     * $params['node_id'] = (list) A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes.
134     * $params['timeout'] = (time) Explicit operation timeout
135     * $params['body']    = (array) An object containing the password for the elasticsearch keystore
136     *
137     * @param array $params Associative array of parameters
138     * @return array
139     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings
140     */
141    public function reloadSecureSettings(array $params = [])
142    {
143        $node_id = $this->extractArgument($params, 'node_id');
144        $body = $this->extractArgument($params, 'body');
145
146        $endpointBuilder = $this->endpoints;
147        $endpoint = $endpointBuilder('Nodes\ReloadSecureSettings');
148        $endpoint->setParams($params);
149        $endpoint->setNodeId($node_id);
150        $endpoint->setBody($body);
151
152        return $this->performRequest($endpoint);
153    }
154    /**
155     * Returns statistical information about nodes in the cluster.
156     *
157     * $params['node_id']                    = (list) 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
158     * $params['metric']                     = (list) Limit the information returned to the specified metrics
159     * $params['index_metric']               = (list) Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified.
160     * $params['completion_fields']          = (list) A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards)
161     * $params['fielddata_fields']           = (list) A comma-separated list of fields for `fielddata` index metric (supports wildcards)
162     * $params['fields']                     = (list) A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards)
163     * $params['groups']                     = (boolean) A comma-separated list of search groups for `search` index metric
164     * $params['level']                      = (enum) Return indices stats aggregated at index, node or shard level (Options = indices,node,shards) (Default = node)
165     * $params['types']                      = (list) A comma-separated list of document types for the `indexing` index metric
166     * $params['timeout']                    = (time) Explicit operation timeout
167     * $params['include_segment_file_sizes'] = (boolean) Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) (Default = false)
168     * $params['include_unloaded_segments']  = (boolean) If set to true segment stats will include stats for segments that are not currently loaded into memory (Default = false)
169     *
170     * @param array $params Associative array of parameters
171     * @return array
172     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html
173     */
174    public function stats(array $params = [])
175    {
176        $node_id = $this->extractArgument($params, 'node_id');
177        $metric = $this->extractArgument($params, 'metric');
178        $index_metric = $this->extractArgument($params, 'index_metric');
179
180        $endpointBuilder = $this->endpoints;
181        $endpoint = $endpointBuilder('Nodes\Stats');
182        $endpoint->setParams($params);
183        $endpoint->setNodeId($node_id);
184        $endpoint->setMetric($metric);
185        $endpoint->setIndexMetric($index_metric);
186
187        return $this->performRequest($endpoint);
188    }
189    /**
190     * Returns low-level information about REST actions usage on nodes.
191     *
192     * $params['node_id'] = (list) 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
193     * $params['metric']  = (list) Limit the information returned to the specified metrics
194     * $params['timeout'] = (time) Explicit operation timeout
195     *
196     * @param array $params Associative array of parameters
197     * @return array
198     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html
199     */
200    public function usage(array $params = [])
201    {
202        $node_id = $this->extractArgument($params, 'node_id');
203        $metric = $this->extractArgument($params, 'metric');
204
205        $endpointBuilder = $this->endpoints;
206        $endpoint = $endpointBuilder('Nodes\Usage');
207        $endpoint->setParams($params);
208        $endpoint->setNodeId($node_id);
209        $endpoint->setMetric($metric);
210
211        return $this->performRequest($endpoint);
212    }
213}
214