private function SearchApiElasticsearchBackend::deleteItemsIds in Elasticsearch Connector 8
Helper function for bulk delete operation.
Parameters
array $ids:
IndexInterface $index:
TODO: Test function if working.
1 call to SearchApiElasticsearchBackend::deleteItemsIds()
- SearchApiElasticsearchBackend::deleteItems in src/
Plugin/ search_api/ backend/ SearchApiElasticsearchBackend.php - Overrides deleteItems().
File
- src/
Plugin/ search_api/ backend/ SearchApiElasticsearchBackend.php, line 588 - 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
private function deleteItemsIds($ids, IndexInterface $index = NULL) {
$this
->connect();
$params = $this
->getIndexParam($index, TRUE);
foreach ($ids as $id) {
$params['body'][] = array(
'delete' => array(
'_index' => $params['index'],
'_type' => $params['type'],
'_id' => $id,
),
);
}
try {
$this->elasticsearchClient
->bulk($params);
} catch (\Exception $e) {
drupal_set_message($e
->getMessage(), 'error');
}
}