If the index does not exists into ES a \LogicalException is thrown.
public getIndexByName ( string $indexIdentifier, integer | string | Magento\Store\Api\Data\StoreInterface $store ) : Smile\ElasticsuiteCore\Api\Index\IndexInterface | ||
$indexIdentifier | string | Index identifier. |
$store | integer | string | Magento\Store\Api\Data\StoreInterface | Store (id, identifier or object). |
return | Smile\ElasticsuiteCore\Api\Index\IndexInterface |
/** * Retrieve the search engine mapping. * * @return MappingInterface */ private function getMapping() { if ($this->mapping === null) { $defaultStore = $this->storeManager->getDefaultStoreView(); $index = $this->indexManager->getIndexByName($this->indexName, $defaultStore); $this->mapping = $index->getType($this->typeName)->getMapping(); } return $this->mapping; }
/** * {@inheritDoc} */ public function deleteIndex($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) { $bulk = $this->indexOperation->createBulk()->deleteDocuments($index, $type, $batchDocuments); $this->indexOperation->executeBulk($bulk); } $this->indexOperation->refreshIndex($index); } return $this; }
/** * Retrieve the index associated with the currrent search request container. * * @return IndexInterface */ private function getIndex() { $indexName = $this->readBaseConfigParam('index'); return $this->indexManager->getIndexByName($indexName, $this->storeId); }