File tree Expand file tree Collapse file tree 2 files changed +84
-0
lines changed Expand file tree Collapse file tree 2 files changed +84
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Elasticsearch \Endpoints \Cluster ;
4
+
5
+ use Elasticsearch \Endpoints \AbstractEndpoint ;
6
+
7
+ /**
8
+ * Class AllocationExplain
9
+ *
10
+ * @category Elasticsearch
11
+ * @package Elasticsearch\Endpoints\Cluster
12
+ * @author Zachary Tong <zachary.tong@elasticsearch.com>
13
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
14
+ * @link http://elasticsearch.org
15
+ */
16
+ class AllocationExplain extends AbstractEndpoint
17
+ {
18
+
19
+ /**
20
+ * @param array $body
21
+ *
22
+ * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException
23
+ * @return $this
24
+ */
25
+ public function setBody ($ body )
26
+ {
27
+ if (isset ($ body ) !== true ) {
28
+ return $ this ;
29
+ }
30
+
31
+ $ this ->body = $ body ;
32
+
33
+ return $ this ;
34
+ }
35
+
36
+ /**
37
+ * @return string
38
+ */
39
+ protected function getURI ()
40
+ {
41
+ return "/_cluster/allocation/explain " ;
42
+ }
43
+
44
+ /**
45
+ * @return string[]
46
+ */
47
+ protected function getParamWhitelist ()
48
+ {
49
+ return array (
50
+ 'include_yes_decisions '
51
+ );
52
+ }
53
+
54
+ /**
55
+ * @return string
56
+ */
57
+ protected function getMethod ()
58
+ {
59
+ return 'GET ' ;
60
+ }
61
+ }
Original file line number Diff line number Diff line change @@ -187,4 +187,27 @@ public function pendingTasks($params = array())
187
187
188
188
return $ endpoint ->resultOrFuture ($ response );
189
189
}
190
+
191
+ /**
192
+ * $params['include_yes_decisions'] = (bool) Return 'YES' decisions in explanation (default: false)
193
+ *
194
+ * @param $params array Associative array of parameters
195
+ *
196
+ * @return array
197
+ */
198
+ public function allocationExplain ($ params = array ())
199
+ {
200
+ $ body = $ this ->extractArgument ($ params , 'body ' );
201
+
202
+ /** @var callback $endpointBuilder */
203
+ $ endpointBuilder = $ this ->endpoints ;
204
+
205
+ /** @var \Elasticsearch\Endpoints\Cluster\AllocationExplain $endpoint */
206
+ $ endpoint = $ endpointBuilder ('Cluster\AllocationExplain ' );
207
+ $ endpoint ->setBody ($ body )
208
+ ->setParams ($ params );
209
+ $ response = $ endpoint ->performRequest ();
210
+
211
+ return $ endpoint ->resultOrFuture ($ response );
212
+ }
190
213
}
You can’t perform that action at this time.
0 commit comments