2_0/Direct/Cluster.pm untested

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