vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/ClusterNamespace.php line 189

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