createIndexConfiguration example


    public function index(Shop $shop, ProgressHelperInterface $helper, ?array $indexNames = null)
    {
        $lastBacklogId = $this->backlogReader->getLastBacklogId();

        foreach ($this->mappings as $mapping) {
            if (!empty($indexNames) && !\in_array($mapping->getType()$indexNames)) {
                continue;
            }

            $configuration = $this->indexFactory->createIndexConfiguration($shop$mapping->getType());
            $shopIndex = new ShopIndex($configuration->getName()$shop$mapping->getType());

            $this->createIndex($configuration$shopIndex);
            $this->updateMapping($shopIndex$mapping);
            $this->populate($shopIndex$helper);
            $this->applyBacklog($shopIndex$lastBacklogId);
            $this->createAlias($configuration);
        }
    }

    /** * Removes unused indices */

        if (!empty($criteria->sortings)) {
            $this->addSortings($criteria$search);
        }

        return $search;
    }

    protected function fetch(Search $search)
    {
        $arguments = [
            'index' => $this->indexFactory->createIndexConfiguration($this->domainName)->getAlias(),
            'type' => $this->domainName,
            'body' => $search->toArray(),
            'rest_total_hits_as_int' => true,
            'track_total_hits' => true,
        ];

        return $this->client->search($arguments);
    }

    /** * @return SearcherResult */
$index = $this->getIndexName($repository->getDomainName());

        while ($numbers = $query->fetch()) {
            $indexer->indexEntities($index$repository$numbers);
        }
    }

    private function getIndexName($domainName)
    {
        $client = $this->container->get(\Elasticsearch\Client::class);
        $indexConfig = $this->indexFactory->createIndexConfiguration($domainName);

        $exist = $client->indices()->getAlias(['name' => $indexConfig->getAlias()]);

        $index = array_keys($exist);

        return array_shift($index);
    }
}
$this->repositories = $repositories;
        $this->evaluation = $evaluation;
        $this->indexFactory = $indexFactory;
    }

    /** * @return void */
    public function index(ProgressHelperInterface $helper)
    {
        foreach ($this->repositories as $repository) {
            $index = $this->indexFactory->createIndexConfiguration($repository->getDomainName());

            $this->createIndex($index);
            $this->createMapping($repository$index->getName());
            $this->populateEntity($index->getName()$repository$helper);
            $this->createAlias($index->getName()$index->getAlias());
        }
    }

    /** * @param string $index * @param array<int> $ids * * @return void */
Home | Imprint | This part of the site doesn't use cookies.