public function SearchApiElasticsearchBackend::deleteItems in Elasticsearch Connector 8.6
Same name and namespace in other branches
- 8.7 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::deleteItems()
- 8 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::deleteItems()
- 8.2 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::deleteItems()
- 8.5 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::deleteItems()
Deletes the specified items from the index.
Parameters
\Drupal\search_api\IndexInterface $index: The index from which items should be deleted.
string[] $item_ids: The IDs of the deleted items.
Throws
\Drupal\search_api\SearchApiException Thrown if an error occurred while trying to delete the items.
Overrides BackendSpecificInterface::deleteItems
File
- src/
Plugin/ search_api/ backend/ SearchApiElasticsearchBackend.php, line 529
Class
- SearchApiElasticsearchBackend
- Elasticsearch Search API Backend definition.
Namespace
Drupal\elasticsearch_connector\Plugin\search_api\backendCode
public function deleteItems(IndexInterface $index = NULL, array $ids) {
if (!count($ids)) {
return;
}
try {
$this->client
->bulk($this->indexFactory
->bulkDelete($index, $ids));
} catch (ElasticsearchException $e) {
drupal_set_message($e
->getMessage(), 'error');
}
}