Switch the alias to the installed index and delete the old index.
public installIndex ( Smile\ElasticsuiteCore\Api\Index\IndexInterface $index, integer | string | Magento\Store\Api\Data\StoreInterface $store ) : Smile\ElasticsuiteCore\Api\Index\IndexInterface | ||
$index | Smile\ElasticsuiteCore\Api\Index\IndexInterface | Installed index. |
$store | integer | string | Magento\Store\Api\Data\StoreInterface | Store (id, identifier or object). |
Результат | Smile\ElasticsuiteCore\Api\Index\IndexInterface |
/** * {@inheritDoc} */ public function saveIndex($dimensions, \Traversable $documents) { foreach ($dimensions as $dimension) { $storeId = $dimension->getValue(); $index = $this->indexOperation->getIndexByName($this->indexName, $storeId); $type = $index->getType($this->typeName); foreach ($this->batch->getItems($documents, $this->batchSize) as $batchDocuments) { foreach ($type->getDatasources() as $datasource) { $batchDocuments = $datasource->addData($storeId, $batchDocuments); } $bulk = $this->indexOperation->createBulk()->addDocuments($index, $type, $batchDocuments); $this->indexOperation->executeBulk($bulk); } $this->indexOperation->refreshIndex($index); $this->indexOperation->installIndex($index, $storeId); $this->cacheHelper->cleanIndexCache($this->indexName, $storeId); } return $this; }