From 1921d3adf7c3fb332b42dcdf3ad209660fcdd8df Mon Sep 17 00:00:00 2001 From: Tim Groeneveld Date: Fri, 23 Mar 2018 11:18:11 +1100 Subject: [PATCH] Bump ElasticSearch version to ~6.0 (#159) * Removed invalid 'fields' parameter * Bumped ElasticSearch version to ~6.0 Thanks @coffeeburrito! --- composer.json | 2 +- src/ElasticquentTrait.php | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index a5840c7..2c0ad92 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "illuminate/database": "~4.2|^5", "illuminate/config": "~4.2|^5", "nesbot/carbon": "~1.0", - "elasticsearch/elasticsearch": ">1.0 <2.2" + "elasticsearch/elasticsearch": "~6.0" }, "require-dev": { "phpunit/phpunit": "~4.2|~5.0", diff --git a/src/ElasticquentTrait.php b/src/ElasticquentTrait.php index 6b1e10d..de56e32 100644 --- a/src/ElasticquentTrait.php +++ b/src/ElasticquentTrait.php @@ -225,7 +225,7 @@ public static function searchByQuery($query = null, $aggregations = null, $sourc { $instance = new static; - $params = $instance->getBasicEsParams(true, true, true, $limit, $offset); + $params = $instance->getBasicEsParams(true, $limit, $offset); if (!empty($sourceFields)) { $params['body']['_source']['include'] = $sourceFields; @@ -366,7 +366,7 @@ public function getIndexedDocument() * * @return array */ - public function getBasicEsParams($getIdIfPossible = true, $getSourceIfPossible = false, $getTimestampIfPossible = false, $limit = null, $offset = null) + public function getBasicEsParams($getIdIfPossible = true, $limit = null, $offset = null) { $params = array( 'index' => $this->getIndexName(), @@ -377,11 +377,6 @@ public function getBasicEsParams($getIdIfPossible = true, $getSourceIfPossible = $params['id'] = $this->getKey(); } - $fields = $this->buildFieldsParameter($getSourceIfPossible, $getTimestampIfPossible); - if (!empty($fields)) { - $params['fields'] = implode(',', $fields); - } - if (is_numeric($limit)) { $params['size'] = $limit; }