1_0/Direct/Cluster.pm untested

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