protected function SearchApiElasticsearchBackend::doesTypeExists in Elasticsearch Connector 8.5
Same name and namespace in other branches
- 8.2 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::doesTypeExists()
- 8.6 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::doesTypeExists()
Helper function, check if the given index and type exists.
Parameters
\Drupal\search_api\IndexInterface $index: Index object.
Return value
bool TRUE if the given index exists in Elasticsearch, otherwise FALSE.
1 call to SearchApiElasticsearchBackend::doesTypeExists()
- SearchApiElasticsearchBackend::indexItems in src/
Plugin/ search_api/ backend/ SearchApiElasticsearchBackend.php - Indexes the specified items.
File
- src/
Plugin/ search_api/ backend/ SearchApiElasticsearchBackend.php, line 750
Class
- SearchApiElasticsearchBackend
- Elasticsearch Search API Backend definition.
Namespace
Drupal\elasticsearch_connector\Plugin\search_api\backendCode
protected function doesTypeExists(IndexInterface $index) {
$params = $this->indexFactory
->index($index, TRUE);
try {
return $this->client
->indices()
->existsType($params);
} catch (ElasticsearchException $e) {
drupal_set_message($e
->getMessage(), 'error');
return FALSE;
}
}