ElasticsearchEntityAggregatorSearchEvent example



    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()),
                'body' => $searchArray,
            ]);
        } catch (\Throwable $e) {
            
Home | Imprint | This part of the site doesn't use cookies.