public function SearchApiElasticsearchBackend::deleteItems in Elasticsearch Connector 8.2
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.5 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::deleteItems()
- 8.6 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 389 - Contains the SearchApiElasticsearchBackend object.
Class
- SearchApiElasticsearchBackend
- Plugin annotation @SearchApiBackend( id = "elasticsearch", label = @Translation("Elasticsearch"), description = @Translation("Index items using an Elasticsearch server.") )
Namespace
Drupal\elasticsearch_connector\Plugin\search_api\backendCode
public function deleteItems(IndexInterface $index = NULL, array $ids) {
if (!count($ids)) {
return;
}
try {
$this->client
->bulk(IndexFactory::bulkDelete($index, $ids));
} catch (ElasticsearchException $e) {
drupal_set_message($e
->getMessage(), 'error');
}
}