diff --git a/composer.json b/composer.json index 8484218..6b11705 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "license": "MIT", "require": { "php": "^7.1", - "elasticsearch/elasticsearch": "^5.2 || ^6.0", + "elasticsearch/elasticsearch": "^5.2 || ^6.0 || ^7.0", "ruflin/elastica": "^6.0 || ^7.0", "symfony/http-kernel": "^4.3 || >=5.1.5", "symfony/dependency-injection": "^4.2 || ^5.0", diff --git a/src/Elastica/Traits/SearchTrait.php b/src/Elastica/Traits/SearchTrait.php index 602fb5c..a8bee4c 100644 --- a/src/Elastica/Traits/SearchTrait.php +++ b/src/Elastica/Traits/SearchTrait.php @@ -8,6 +8,7 @@ use Elastica\Exception\ClientException; use Elastica\Exception\Connection\HttpException; use Elastica\Response; +use Elastica\Request; use Elastica\ResultSet; use Novaway\ElasticsearchBundle\Event\ExceptionEvent; use Novaway\ElasticsearchBundle\Event\SearchQuery; @@ -18,13 +19,12 @@ */ trait SearchTrait { - public function search($query = '', $options = null): ResultSet + public function search($query = '', $options = null, string $method = Request::POST): ResultSet { $timestamp = (string)microtime(); $this->dispatch(new SearchQuery([ 'body' => $this->getQuery()->toArray() + $this->getOptions(), - 'type' => $this->getTypes(), 'indices' => $this->getIndices(), ], $timestamp), SearchQuery::NAME); try { @@ -40,7 +40,6 @@ public function search($query = '', $options = null): ResultSet } catch (\Exception $e) { $this->dispatch(new ExceptionEvent([ 'body' => $this->getQuery()->toArray() + $this->getOptions(), - 'type' => $this->getTypes(), 'indices' => $this->getIndices(), ], $e), ExceptionEvent::NAME); switch (true) {