| 1 | package Search::Elasticsearch::Client::5_0::Direct::Cluster; | ||
| 2 | $Search::Elasticsearch::Client::5_0::Direct::Cluster::VERSION = '6.81'; | ||
| 3 | use Moo; | ||
| 4 | with 'Search::Elasticsearch::Client::5_0::Role::API'; | ||
| 5 | with 'Search::Elasticsearch::Role::Client::Direct'; | ||
| 6 | __PACKAGE__->_install_api('cluster'); | ||
| 7 | |||
| 8 | 1; | ||
| 9 | |||
| 10 | =pod | ||
| 11 | |||
| 12 | =encoding UTF-8 | ||
| 13 | |||
| 14 | =head1 NAME | ||
| 15 | |||
| 16 | Search::Elasticsearch::Client::5_0::Direct::Cluster - A client for running cluster-level requests | ||
| 17 | |||
| 18 | =head1 VERSION | ||
| 19 | |||
| 20 | version 6.81 | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | This module provides methods to make cluster-level requests, such as | ||
| 25 | getting and setting cluster-level settings, manually rerouting shards, | ||
| 26 | and retrieving for monitoring purposes. | ||
| 27 | |||
| 28 | It does L<Search::Elasticsearch::Role::Client::Direct>. | ||
| 29 | |||
| 30 | =head1 METHODS | ||
| 31 | |||
| 32 | =head2 C<health()> | ||
| 33 | |||
| 34 | $response = $e->cluster->health( | ||
| 35 | index => 'index' | \@indices # optional | ||
| 36 | ); | ||
| 37 | |||
| 38 | The C<health()> method is used to retrieve information about the cluster | ||
| 39 | health, returning C<red>, C<yellow> or C<green> to indicate the state | ||
| 40 | of the cluster, indices or shards. | ||
| 41 | |||
| 42 | Query string parameters: | ||
| 43 | C<error_trace>, | ||
| 44 | C<human>, | ||
| 45 | C<level>, | ||
| 46 | C<local>, | ||
| 47 | C<master_timeout>, | ||
| 48 | C<timeout>, | ||
| 49 | C<wait_for_active_shards>, | ||
| 50 | C<wait_for_events>, | ||
| 51 | C<wait_for_no_relocating_shards>, | ||
| 52 | C<wait_for_nodes>, | ||
| 53 | C<wait_for_status> | ||
| 54 | |||
| 55 | See the L<cluster health docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html> | ||
| 56 | for more information. | ||
| 57 | |||
| 58 | =head2 C<stats()> | ||
| 59 | |||
| 60 | $response = $e->cluster->stats( | ||
| 61 | node_id => 'node' | \@nodes # optional | ||
| 62 | ); | ||
| 63 | |||
| 64 | Returns high-level cluster stats, optionally limited to the listed nodes. | ||
| 65 | |||
| 66 | Query string parameters: | ||
| 67 | C<error_trace>, | ||
| 68 | C<flat_settings>, | ||
| 69 | C<human>, | ||
| 70 | C<timeout> | ||
| 71 | |||
| 72 | See the L<cluster stats docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-stats.html> | ||
| 73 | for more information. | ||
| 74 | |||
| 75 | =head2 C<get_settings()> | ||
| 76 | |||
| 77 | $response = $e->cluster->get_settings() | ||
| 78 | |||
| 79 | The C<get_settings()> method is used to retrieve cluster-wide settings that | ||
| 80 | have been set with the L</put_settings()> method. | ||
| 81 | |||
| 82 | Query string parameters: | ||
| 83 | C<error_trace>, | ||
| 84 | C<flat_settings>, | ||
| 85 | C<human>, | ||
| 86 | C<include_defaults>, | ||
| 87 | C<master_timeout>, | ||
| 88 | C<timeout> | ||
| 89 | |||
| 90 | See the L<cluster settings docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html> | ||
| 91 | for more information. | ||
| 92 | |||
| 93 | =head2 C<put_settings()> | ||
| 94 | |||
| 95 | $response = $e->cluster->put_settings( %settings ); | ||
| 96 | |||
| 97 | The C<put_settings()> method is used to set cluster-wide settings, either | ||
| 98 | transiently (which don't survive restarts) or permanently (which do survive | ||
| 99 | restarts). | ||
| 100 | |||
| 101 | For instance: | ||
| 102 | |||
| 103 | $response = $e->cluster->put_settings( | ||
| 104 | body => { | ||
| 105 | transient => { "discovery.zen.minimum_master_nodes" => 5 } | ||
| 106 | } | ||
| 107 | ); | ||
| 108 | |||
| 109 | Query string parameters: | ||
| 110 | C<error_trace>, | ||
| 111 | C<flat_settings>, | ||
| 112 | C<human> | ||
| 113 | |||
| 114 | See the L<cluster settings docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html> | ||
| 115 | for more information. | ||
| 116 | |||
| 117 | =head2 C<state()> | ||
| 118 | |||
| 119 | $response = $e->cluster->state( | ||
| 120 | metric => $metric | \@metrics # optional | ||
| 121 | index => $index | \@indices # optional | ||
| 122 | ); | ||
| 123 | |||
| 124 | The C<state()> method returns the current cluster state from the master node, | ||
| 125 | or from the responding node if C<local> is set to C<true>. | ||
| 126 | |||
| 127 | It returns all metrics by default, but these can be limited to any of: | ||
| 128 | C<_all>, | ||
| 129 | C<blocks>, | ||
| 130 | C<metadata>, | ||
| 131 | C<nodes>, | ||
| 132 | C<routing_table> | ||
| 133 | |||
| 134 | Metrics for indices can be limited to particular indices with the C<index> | ||
| 135 | parameter. | ||
| 136 | |||
| 137 | Query string parameters: | ||
| 138 | C<allow_no_indices>, | ||
| 139 | C<error_trace>, | ||
| 140 | C<expand_wildcards>, | ||
| 141 | C<flat_settings>, | ||
| 142 | C<human>, | ||
| 143 | C<ignore_unavailable>, | ||
| 144 | C<local>, | ||
| 145 | C<master_timeout> | ||
| 146 | |||
| 147 | See the L<cluster state docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html> | ||
| 148 | for more information. | ||
| 149 | |||
| 150 | =head2 C<allocation_explain()> | ||
| 151 | |||
| 152 | $response = $e->cluster->allocation_explain( | ||
| 153 | body => { ... shard selectors ...} # optional | ||
| 154 | ); | ||
| 155 | |||
| 156 | Returns information about why a shard is allocated or unallocated or why. | ||
| 157 | |||
| 158 | Query string parameters: | ||
| 159 | C<error_trace>, | ||
| 160 | C<human>, | ||
| 161 | C<include_disk_info>, | ||
| 162 | C<include_yes_decisions> | ||
| 163 | |||
| 164 | See the L<cluster allocation explain docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-allocation-explain.html> | ||
| 165 | for more information. | ||
| 166 | |||
| 167 | =head2 C<pending_tasks()> | ||
| 168 | |||
| 169 | $response = $e->cluster->pending_tasks(); | ||
| 170 | |||
| 171 | Returns a list of cluster-level tasks still pending on the master node. | ||
| 172 | |||
| 173 | Query string parameters: | ||
| 174 | C<error_trace>, | ||
| 175 | C<human>, | ||
| 176 | C<local>, | ||
| 177 | C<master_timeout> | ||
| 178 | |||
| 179 | See the L<pending tasks docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-pending.html> | ||
| 180 | for more information. | ||
| 181 | |||
| 182 | =head2 C<reroute()> | ||
| 183 | |||
| 184 | $e->cluster->reroute( | ||
| 185 | body => { commands } | ||
| 186 | ); | ||
| 187 | |||
| 188 | The C<reroute()> method is used to manually reallocate shards from one | ||
| 189 | node to another. The C<body> should contain the C<commands> indicating | ||
| 190 | which changes should be made. For instance: | ||
| 191 | |||
| 192 | $e->cluster->reroute( | ||
| 193 | body => { | ||
| 194 | commands => [ | ||
| 195 | { move => { | ||
| 196 | index => 'test', | ||
| 197 | shard => 0, | ||
| 198 | from_node => 'node_1', | ||
| 199 | to_node => 'node_2 | ||
| 200 | }}, | ||
| 201 | { allocate => { | ||
| 202 | index => 'test', | ||
| 203 | shard => 1, | ||
| 204 | node => 'node_3' | ||
| 205 | }} | ||
| 206 | ] | ||
| 207 | } | ||
| 208 | ); | ||
| 209 | |||
| 210 | Query string parameters: | ||
| 211 | C<dry_run>, | ||
| 212 | C<error_trace>, | ||
| 213 | C<explain>, | ||
| 214 | C<human>, | ||
| 215 | C<master_timeout>, | ||
| 216 | C<metric>, | ||
| 217 | C<retry_failed>, | ||
| 218 | C<timeout> | ||
| 219 | |||
| 220 | See the L<reroute docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-reroute.html> | ||
| 221 | for more information. | ||
| 222 | |||
| 223 | =head2 C<remote_info()> | ||
| 224 | |||
| 225 | $response = $e->cluster->remote_info(); | ||
| 226 | |||
| 227 | The C<remote_info()> API retrieves all of the configured remote cluster information. | ||
| 228 | |||
| 229 | Query string parameters: | ||
| 230 | C<error_trace>, | ||
| 231 | C<human> | ||
| 232 | |||
| 233 | See the L<remote_info docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-remote-info.html> | ||
| 234 | for more information. | ||
| 235 | |||
| 236 | =head1 AUTHOR | ||
| 237 | |||
| 238 | Enrico Zimuel <enrico.zimuel@elastic.co> | ||
| 239 | |||
| 240 | =head1 COPYRIGHT AND LICENSE | ||
| 241 | |||
| 242 | This software is Copyright (c) 2020 by Elasticsearch BV. | ||
| 243 | |||
| 244 | This is free software, licensed under: | ||
| 245 | |||
| 246 | The Apache License, Version 2.0, January 2004 | ||
| 247 | |||
| 248 | =cut | ||
| 249 | |||
| 250 | __END__ |