diff --git a/src/Elasticsearch/Endpoints/Indices/Recovery.php b/src/Elasticsearch/Endpoints/Indices/Recovery.php new file mode 100644 index 000000000..64a7348a6 --- /dev/null +++ b/src/Elasticsearch/Endpoints/Indices/Recovery.php @@ -0,0 +1,61 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ + +class Recovery extends AbstractEndpoint +{ + /** + * @return string + */ + protected function getURI() + { + $index = $this->index; + $uri = "/_recovery"; + + if (isset($index) === true) { + $uri = "/$index/_recovery"; + } + + return $uri; + } + + + /** + * @return string[] + */ + protected function getParamWhitelist() + { + return array( + 'detailed', + 'active_only', + 'human' + ); + } + + + /** + * @return string + */ + protected function getMethod() + { + return 'GET'; + } +} \ No newline at end of file diff --git a/src/Elasticsearch/Namespaces/IndicesNamespace.php b/src/Elasticsearch/Namespaces/IndicesNamespace.php index 43b8a7a2f..74dd69af5 100644 --- a/src/Elasticsearch/Namespaces/IndicesNamespace.php +++ b/src/Elasticsearch/Namespaces/IndicesNamespace.php @@ -398,6 +398,31 @@ public function refresh($params = array()) return $response['data']; } + /** + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for all indices + * ['detailed'] = (bool) Whether to display detailed information about shard recovery + * ['active_only'] = (bool) Display only those recoveries that are currently on-going + * ['human'] = (bool) Whether to return time and byte values in human-readable format. + * + * @param $params array Associative array of parameters + * + * @return array + */ + public function recovery($params = array()) + { + $index = $this->extractArgument($params, 'index'); + + /** @var callback $endpointBuilder */ + $endpointBuilder = $this->dicEndpoints; + + /** @var \Elasticsearch\Endpoints\Indices\Flush $endpoint */ + $endpoint = $endpointBuilder('Indices\Recovery'); + $endpoint->setIndex($index); + $endpoint->setParams($params); + $response = $endpoint->performRequest(); + return $response['data']; + } + /** * $params['index'] = (list) A comma-separated list of index names; use `_all` to check the types across all indices (Required)