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 ClusterNamespace 23 * 24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php 25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee) 26 */ 27class ClusterNamespace extends AbstractNamespace 28{ 29 30 /** 31 * Provides explanations for shard allocations in the cluster. 32 * 33 * $params['include_yes_decisions'] = (boolean) Return 'YES' decisions in explanation (default: false) 34 * $params['include_disk_info'] = (boolean) Return information about disk usage and shard sizes (default: false) 35 * $params['body'] = (array) The index, shard, and primary flag to explain. Empty means 'explain a randomly-chosen unassigned shard' 36 * 37 * @param array $params Associative array of parameters 38 * @return array 39 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html 40 */ 41 public function allocationExplain(array $params = []) 42 { 43 $body = $this->extractArgument($params, 'body'); 44 45 $endpointBuilder = $this->endpoints; 46 $endpoint = $endpointBuilder('Cluster\AllocationExplain'); 47 $endpoint->setParams($params); 48 $endpoint->setBody($body); 49 50 return $this->performRequest($endpoint); 51 } 52 /** 53 * Deletes a component template 54 * 55 * $params['name'] = (string) The name of the template 56 * $params['timeout'] = (time) Explicit operation timeout 57 * $params['master_timeout'] = (time) Specify timeout for connection to master 58 * 59 * @param array $params Associative array of parameters 60 * @return array 61 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html 62 */ 63 public function deleteComponentTemplate(array $params = []) 64 { 65 $name = $this->extractArgument($params, 'name'); 66 67 $endpointBuilder = $this->endpoints; 68 $endpoint = $endpointBuilder('Cluster\DeleteComponentTemplate'); 69 $endpoint->setParams($params); 70 $endpoint->setName($name); 71 72 return $this->performRequest($endpoint); 73 } 74 /** 75 * Clears cluster voting config exclusions. 76 * 77 * $params['wait_for_removal'] = (boolean) Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. (Default = true) 78 * 79 * @param array $params Associative array of parameters 80 * @return array 81 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html 82 */ 83 public function deleteVotingConfigExclusions(array $params = []) 84 { 85 86 $endpointBuilder = $this->endpoints; 87 $endpoint = $endpointBuilder('Cluster\DeleteVotingConfigExclusions'); 88 $endpoint->setParams($params); 89 90 return $this->performRequest($endpoint); 91 } 92 /** 93 * Returns information about whether a particular component template exist 94 * 95 * $params['name'] = (string) The name of the template 96 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 97 * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) 98 * 99 * @param array $params Associative array of parameters 100 * @return bool 101 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html 102 */ 103 public function existsComponentTemplate(array $params = []): bool 104 { 105 $name = $this->extractArgument($params, 'name'); 106 107 // manually make this verbose so we can check status code 108 $params['client']['verbose'] = true; 109 110 $endpointBuilder = $this->endpoints; 111 $endpoint = $endpointBuilder('Cluster\ExistsComponentTemplate'); 112 $endpoint->setParams($params); 113 $endpoint->setName($name); 114 115 return BooleanRequestWrapper::performRequest($endpoint, $this->transport); 116 } 117 /** 118 * Returns one or more component templates 119 * 120 * $params['name'] = (list) The comma separated names of the component templates 121 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 122 * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) 123 * 124 * @param array $params Associative array of parameters 125 * @return array 126 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html 127 */ 128 public function getComponentTemplate(array $params = []) 129 { 130 $name = $this->extractArgument($params, 'name'); 131 132 $endpointBuilder = $this->endpoints; 133 $endpoint = $endpointBuilder('Cluster\GetComponentTemplate'); 134 $endpoint->setParams($params); 135 $endpoint->setName($name); 136 137 return $this->performRequest($endpoint); 138 } 139 /** 140 * Returns cluster settings. 141 * 142 * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) 143 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 144 * $params['timeout'] = (time) Explicit operation timeout 145 * $params['include_defaults'] = (boolean) Whether to return all default clusters setting. (Default = false) 146 * 147 * @param array $params Associative array of parameters 148 * @return array 149 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html 150 */ 151 public function getSettings(array $params = []) 152 { 153 154 $endpointBuilder = $this->endpoints; 155 $endpoint = $endpointBuilder('Cluster\GetSettings'); 156 $endpoint->setParams($params); 157 158 return $this->performRequest($endpoint); 159 } 160 /** 161 * Returns basic information about the health of the cluster. 162 * 163 * $params['index'] = (list) Limit the information returned to a specific index 164 * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = all) 165 * $params['level'] = (enum) Specify the level of detail for returned information (Options = cluster,indices,shards) (Default = cluster) 166 * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) 167 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 168 * $params['timeout'] = (time) Explicit operation timeout 169 * $params['wait_for_active_shards'] = (string) Wait until the specified number of shards is active 170 * $params['wait_for_nodes'] = (string) Wait until the specified number of nodes is available 171 * $params['wait_for_events'] = (enum) Wait until all currently queued events with the given priority are processed (Options = immediate,urgent,high,normal,low,languid) 172 * $params['wait_for_no_relocating_shards'] = (boolean) Whether to wait until there are no relocating shards in the cluster 173 * $params['wait_for_no_initializing_shards'] = (boolean) Whether to wait until there are no initializing shards in the cluster 174 * $params['wait_for_status'] = (enum) Wait until cluster is in a specific state (Options = green,yellow,red) 175 * 176 * @param array $params Associative array of parameters 177 * @return array 178 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html 179 */ 180 public function health(array $params = []) 181 { 182 $index = $this->extractArgument($params, 'index'); 183 184 $endpointBuilder = $this->endpoints; 185 $endpoint = $endpointBuilder('Cluster\Health'); 186 $endpoint->setParams($params); 187 $endpoint->setIndex($index); 188 189 return $this->performRequest($endpoint); 190 } 191 /** 192 * Returns a list of any cluster-level changes (e.g. create index, update mapping,allocate or fail shard) which have not yet been executed. 193 * 194 * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) 195 * $params['master_timeout'] = (time) Specify timeout for connection to master 196 * 197 * @param array $params Associative array of parameters 198 * @return array 199 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html 200 */ 201 public function pendingTasks(array $params = []) 202 { 203 204 $endpointBuilder = $this->endpoints; 205 $endpoint = $endpointBuilder('Cluster\PendingTasks'); 206 $endpoint->setParams($params); 207 208 return $this->performRequest($endpoint); 209 } 210 /** 211 * Updates the cluster voting config exclusions by node ids or node names. 212 * 213 * $params['node_ids'] = (string) A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names. 214 * $params['node_names'] = (string) A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids. 215 * $params['timeout'] = (time) Explicit operation timeout (Default = 30s) 216 * 217 * @param array $params Associative array of parameters 218 * @return array 219 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html 220 */ 221 public function postVotingConfigExclusions(array $params = []) 222 { 223 224 $endpointBuilder = $this->endpoints; 225 $endpoint = $endpointBuilder('Cluster\PostVotingConfigExclusions'); 226 $endpoint->setParams($params); 227 228 return $this->performRequest($endpoint); 229 } 230 /** 231 * Creates or updates a component template 232 * 233 * $params['name'] = (string) The name of the template 234 * $params['create'] = (boolean) Whether the index template should only be added if new or can also replace an existing one (Default = false) 235 * $params['timeout'] = (time) Explicit operation timeout 236 * $params['master_timeout'] = (time) Specify timeout for connection to master 237 * $params['body'] = (array) The template definition (Required) 238 * 239 * @param array $params Associative array of parameters 240 * @return array 241 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html 242 */ 243 public function putComponentTemplate(array $params = []) 244 { 245 $name = $this->extractArgument($params, 'name'); 246 $body = $this->extractArgument($params, 'body'); 247 248 $endpointBuilder = $this->endpoints; 249 $endpoint = $endpointBuilder('Cluster\PutComponentTemplate'); 250 $endpoint->setParams($params); 251 $endpoint->setName($name); 252 $endpoint->setBody($body); 253 254 return $this->performRequest($endpoint); 255 } 256 /** 257 * Updates the cluster settings. 258 * 259 * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) 260 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 261 * $params['timeout'] = (time) Explicit operation timeout 262 * $params['body'] = (array) The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). (Required) 263 * 264 * @param array $params Associative array of parameters 265 * @return array 266 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html 267 */ 268 public function putSettings(array $params = []) 269 { 270 $body = $this->extractArgument($params, 'body'); 271 272 $endpointBuilder = $this->endpoints; 273 $endpoint = $endpointBuilder('Cluster\PutSettings'); 274 $endpoint->setParams($params); 275 $endpoint->setBody($body); 276 277 return $this->performRequest($endpoint); 278 } 279 /** 280 * Returns the information about configured remote clusters. 281 * 282 * 283 * @param array $params Associative array of parameters 284 * @return array 285 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html 286 */ 287 public function remoteInfo(array $params = []) 288 { 289 290 $endpointBuilder = $this->endpoints; 291 $endpoint = $endpointBuilder('Cluster\RemoteInfo'); 292 $endpoint->setParams($params); 293 294 return $this->performRequest($endpoint); 295 } 296 /** 297 * Allows to manually change the allocation of individual shards in the cluster. 298 * 299 * $params['dry_run'] = (boolean) Simulate the operation only and return the resulting state 300 * $params['explain'] = (boolean) Return an explanation of why the commands can or cannot be executed 301 * $params['retry_failed'] = (boolean) Retries allocation of shards that are blocked due to too many subsequent allocation failures 302 * $params['metric'] = (list) Limit the information returned to the specified metrics. Defaults to all but metadata (Options = _all,blocks,metadata,nodes,routing_table,master_node,version) 303 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 304 * $params['timeout'] = (time) Explicit operation timeout 305 * $params['body'] = (array) The definition of `commands` to perform (`move`, `cancel`, `allocate`) 306 * 307 * @param array $params Associative array of parameters 308 * @return array 309 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html 310 */ 311 public function reroute(array $params = []) 312 { 313 $body = $this->extractArgument($params, 'body'); 314 315 $endpointBuilder = $this->endpoints; 316 $endpoint = $endpointBuilder('Cluster\Reroute'); 317 $endpoint->setParams($params); 318 $endpoint->setBody($body); 319 320 return $this->performRequest($endpoint); 321 } 322 /** 323 * Returns a comprehensive information about the state of the cluster. 324 * 325 * $params['metric'] = (list) Limit the information returned to the specified metrics 326 * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices 327 * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) 328 * $params['master_timeout'] = (time) Specify timeout for connection to master 329 * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) 330 * $params['wait_for_metadata_version'] = (number) Wait for the metadata version to be equal or greater than the specified metadata version 331 * $params['wait_for_timeout'] = (time) The maximum time to wait for wait_for_metadata_version before timing out 332 * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) 333 * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) 334 * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open) 335 * 336 * @param array $params Associative array of parameters 337 * @return array 338 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html 339 */ 340 public function state(array $params = []) 341 { 342 $metric = $this->extractArgument($params, 'metric'); 343 $index = $this->extractArgument($params, 'index'); 344 345 $endpointBuilder = $this->endpoints; 346 $endpoint = $endpointBuilder('Cluster\State'); 347 $endpoint->setParams($params); 348 $endpoint->setMetric($metric); 349 $endpoint->setIndex($index); 350 351 return $this->performRequest($endpoint); 352 } 353 /** 354 * Returns high-level overview of cluster statistics. 355 * 356 * $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 357 * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) 358 * $params['timeout'] = (time) Explicit operation timeout 359 * 360 * @param array $params Associative array of parameters 361 * @return array 362 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html 363 */ 364 public function stats(array $params = []) 365 { 366 $node_id = $this->extractArgument($params, 'node_id'); 367 368 $endpointBuilder = $this->endpoints; 369 $endpoint = $endpointBuilder('Cluster\Stats'); 370 $endpoint->setParams($params); 371 $endpoint->setNodeId($node_id); 372 373 return $this->performRequest($endpoint); 374 } 375} 376