From 9f3776a224ef4c65e75df7d004ee37361f64567f Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Wed, 6 Jul 2016 13:40:55 -0400 Subject: [PATCH] [BWC Break] Remove DeleteByQuery endpoint --- src/Elasticsearch/Client.php | 33 ------- src/Elasticsearch/Endpoints/DeleteByQuery.php | 87 ------------------- 2 files changed, 120 deletions(-) delete mode 100644 src/Elasticsearch/Endpoints/DeleteByQuery.php diff --git a/src/Elasticsearch/Client.php b/src/Elasticsearch/Client.php index e4b834257..a2a1b4231 100644 --- a/src/Elasticsearch/Client.php +++ b/src/Elasticsearch/Client.php @@ -252,39 +252,6 @@ public function delete($params) return $endpoint->resultOrFuture($response); } - /** - * - * $params[''] @todo finish the rest of these params - * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. - * - * @param array $params - * - * @return array - */ - public function deleteByQuery($params = array()) - { - $index = $this->extractArgument($params, 'index'); - - $type = $this->extractArgument($params, 'type'); - - $body = $this->extractArgument($params, 'body'); - - /** @var callback $endpointBuilder */ - $endpointBuilder = $this->endpoints; - - /** @var \Elasticsearch\Endpoints\DeleteByQuery $endpoint */ - $endpoint = $endpointBuilder('DeleteByQuery'); - $endpoint->setIndex($index) - ->setType($type) - ->setBody($body); - $endpoint->setParams($params); - $response = $endpoint->performRequest(); - - return $endpoint->resultOrFuture($response); - } - /** * $params['index'] = (list) A comma-separated list of indices to restrict the results * ['type'] = (list) A comma-separated list of types to restrict the results diff --git a/src/Elasticsearch/Endpoints/DeleteByQuery.php b/src/Elasticsearch/Endpoints/DeleteByQuery.php deleted file mode 100644 index 20d86d719..000000000 --- a/src/Elasticsearch/Endpoints/DeleteByQuery.php +++ /dev/null @@ -1,87 +0,0 @@ - - * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 - * @link http://elastic.co - */ -class DeleteByQuery extends AbstractEndpoint -{ - /** - * @param array $body - * - * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException - * @return $this - */ - public function setBody($body) - { - if (isset($body) !== true) { - return $this; - } - - $this->body = $body; - - return $this; - } - - /** - * @throws \Elasticsearch\Common\Exceptions\RuntimeException - * @return string - */ - protected function getURI() - { - if (isset($this->index) !== true) { - throw new Exceptions\RuntimeException( - 'index is required for Deletebyquery' - ); - } - $index = $this->index; - $type = $this->type; - $uri = "/$index/_query"; - - if (isset($index) === true && isset($type) === true) { - $uri = "/$index/$type/_query"; - } elseif (isset($index) === true) { - $uri = "/$index/_query"; - } - - return $uri; - } - - /** - * @return string[] - */ - protected function getParamWhitelist() - { - return array( - 'analyzer', - 'consistency', - 'default_operator', - 'df', - 'ignore_unavailable', - 'allow_no_indices', - 'expand_wildcards', - 'replication', - 'q', - 'routing', - 'source', - 'timeout', - ); - } - - /** - * @return string - */ - protected function getMethod() - { - return 'DELETE'; - } -}