private readonly EventDispatcherInterface
$eventDispatcher,
private readonly string
$timeout = '5s'
) { } public function aggregate(EntityDefinition
$definition, Criteria
$criteria, Context
$context): AggregationResultCollection
{ if (!
$this->helper->
allowSearch($definition,
$context,
$criteria)) { return $this->decorated->
aggregate($definition,
$criteria,
$context);
} $search =
$this->
createSearch($definition,
$criteria,
$context);
$this->eventDispatcher->
dispatch( new ElasticsearchEntityAggregatorSearchEvent($search,
$definition,
$criteria,
$context) );
$searchArray =
$search->
toArray();
$searchArray['timeout'
] =
$this->timeout;
try { $result =
$this->client->
search([ 'index' =>
$this->helper->
getIndexName($definition,
$this->helper->
enabledMultilingualIndex() ? null :
$context->
getLanguageId()),