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