See More

versionProvider->provide() >= \Spameri\ElasticQuery\Response\Result\Version::ELASTIC_VERSION_ID_7) { $type = NULL; } try { if ($elasticQuery->options()->scrollId() === NULL) { $result = $this->clientProvider->client()->search( ( new \Spameri\ElasticQuery\Document( $index, new \Spameri\ElasticQuery\Document\Body\Plain($elasticQuery->toArray()), $type, NULL, [ 'scroll' => $elasticQuery->options()->scroll(), ], ) ) ->toArray(), )->asArray() ; if (isset($result['_scroll_id'])) { $elasticQuery->options()->scrollInitialized($result['_scroll_id']); } else { throw new \Spameri\Elastic\Exception\ScrollNotInitialized( 'ElasticSearch did not return scroll id.', ); } } else { $result = $this->clientProvider->client()->scroll( ( new \Spameri\ElasticQuery\Document( NULL, NULL, NULL, NULL, [ 'scroll' => $elasticQuery->options()->scroll(), 'scroll_id' => $elasticQuery->options()->scrollId(), ], ) ) ->toArray(), )->asArray() ; } } catch (\Elastic\Elasticsearch\Exception\ElasticsearchException $exception) { throw new \Spameri\Elastic\Exception\ElasticSearch($exception->getMessage()); } return $this->resultMapper->mapSearchResults($result); } public function closeScroll( \Spameri\ElasticQuery\ElasticQuery $elasticQuery, ): void { try { $this->clientProvider->client()->clearScroll( ( new \Spameri\ElasticQuery\Document( NULL, NULL, NULL, NULL, [ 'scroll_id' => $elasticQuery->options()->scrollId(), ], ) ) ->toArray(), ) ; } catch (\Elastic\Elasticsearch\Exception\ElasticsearchException $exception) { throw new \Spameri\Elastic\Exception\ElasticSearch($exception->getMessage()); } } }