From 38c05da18db0e8fd0446d7f013d013d9815febb8 Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Wed, 6 Jul 2016 13:41:26 -0400 Subject: [PATCH] [BWC Break] Remove MLT endpoint --- src/Elasticsearch/Client.php | 54 --------------- src/Elasticsearch/Endpoints/Mlt.php | 103 ---------------------------- 2 files changed, 157 deletions(-) delete mode 100644 src/Elasticsearch/Endpoints/Mlt.php diff --git a/src/Elasticsearch/Client.php b/src/Elasticsearch/Client.php index a2a1b4231..8b4fa7309 100644 --- a/src/Elasticsearch/Client.php +++ b/src/Elasticsearch/Client.php @@ -517,60 +517,6 @@ public function exists($params) return BooleanRequestWrapper::performRequest($endpoint); } - /** - * $params['id'] = (string) The document ID (Required) - * ['index'] = (string) The name of the index (Required) - * ['type'] = (string) The type of the document (use `_all` to fetch the first document matching the ID across all types) (Required) - * ['boost_terms'] = (number) The boost factor - * ['max_doc_freq'] = (number) The word occurrence frequency as count: words with higher occurrence in the corpus will be ignored - * ['max_query_terms'] = (number) The maximum query terms to be included in the generated query - * ['max_word_len'] = (number) The minimum length of the word: longer words will be ignored - * ['min_doc_freq'] = (number) The word occurrence frequency as count: words with lower occurrence in the corpus will be ignored - * ['min_term_freq'] = (number) The term frequency as percent: terms with lower occurrence in the source document will be ignored - * ['min_word_len'] = (number) The minimum length of the word: shorter words will be ignored - * ['mlt_fields'] = (list) Specific fields to perform the query against - * ['percent_terms_to_match'] = (number) How many terms have to match in order to consider the document a match (default: 0.3) - * ['routing'] = (string) Specific routing value - * ['search_from'] = (number) The offset from which to return results - * ['search_indices'] = (list) A comma-separated list of indices to perform the query against (default: the index containing the document) - * ['search_query_hint'] = (string) The search query hint - * ['search_scroll'] = (string) A scroll search request definition - * ['search_size'] = (number) The number of documents to return (default: 10) - * ['search_source'] = (string) A specific search request definition (instead of using the request body) - * ['search_type'] = (string) Specific search type (eg. `dfs_then_fetch`, `count`, etc) - * ['search_types'] = (list) A comma-separated list of types to perform the query against (default: the same type as the document) - * ['stop_words'] = (list) A list of stop words to be ignored - * ['body'] = (array) A specific search request definition - * - * @param $params array Associative array of parameters - * - * @return array - */ - public function mlt($params) - { - $id = $this->extractArgument($params, 'id'); - - $index = $this->extractArgument($params, 'index'); - - $type = $this->extractArgument($params, 'type'); - - $body = $this->extractArgument($params, 'body'); - - /** @var callback $endpointBuilder */ - $endpointBuilder = $this->endpoints; - - /** @var \Elasticsearch\Endpoints\Mlt $endpoint */ - $endpoint = $endpointBuilder('Mlt'); - $endpoint->setID($id) - ->setIndex($index) - ->setType($type) - ->setBody($body); - $endpoint->setParams($params); - $response = $endpoint->performRequest(); - - return $endpoint->resultOrFuture($response); - } - /** * $params['index'] = (string) The name of the index * ['type'] = (string) The type of the document diff --git a/src/Elasticsearch/Endpoints/Mlt.php b/src/Elasticsearch/Endpoints/Mlt.php deleted file mode 100644 index e5f8bfbcb..000000000 --- a/src/Elasticsearch/Endpoints/Mlt.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 - * @link http://elastic.co - */ -class Mlt 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->id) !== true) { - throw new Exceptions\RuntimeException( - 'id is required for Mlt' - ); - } - if (isset($this->index) !== true) { - throw new Exceptions\RuntimeException( - 'index is required for Mlt' - ); - } - if (isset($this->type) !== true) { - throw new Exceptions\RuntimeException( - 'type is required for Mlt' - ); - } - $id = $this->id; - $index = $this->index; - $type = $this->type; - $uri = "/$index/$type/$id/_mlt"; - - if (isset($index) === true && isset($type) === true && isset($id) === true) { - $uri = "/$index/$type/$id/_mlt"; - } - - return $uri; - } - - /** - * @return string[] - */ - protected function getParamWhitelist() - { - return array( - 'boost_terms', - 'max_doc_freq', - 'max_query_terms', - 'max_word_length', - 'min_doc_freq', - 'min_term_freq', - 'min_word_length', - 'mlt_fields', - 'percent_terms_to_match', - 'routing', - 'search_from', - 'search_indices', - 'search_query_hint', - 'search_scroll', - 'search_size', - 'search_source', - 'search_type', - 'search_types', - 'stop_words', - ); - } - - /** - * @return string - */ - protected function getMethod() - { - return 'GET'; - } -}