You are here

public static function IndexFactory::bulkDelete in Elasticsearch Connector 8.2

Same name and namespace in other branches
  1. 8.7 src/ElasticSearch/Parameters/Factory/IndexFactory.php \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory::bulkDelete()
  2. 8.5 src/ElasticSearch/Parameters/Factory/IndexFactory.php \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory::bulkDelete()
  3. 8.6 src/ElasticSearch/Parameters/Factory/IndexFactory.php \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory::bulkDelete()

Build parameters to bulk delete indexes.

Parameters

\Drupal\search_api\IndexInterface $index:

array $ids:

Return value

array

1 call to IndexFactory::bulkDelete()
SearchApiElasticsearchBackend::deleteItems in src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php
Deletes the specified items from the index.

File

src/ElasticSearch/Parameters/Factory/IndexFactory.php, line 68

Class

IndexFactory
Class IndexFactory.

Namespace

Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory

Code

public static function bulkDelete(IndexInterface $index, array $ids) {
  $params = IndexFactory::index($index, TRUE);
  foreach ($ids as $id) {
    $params['body'][] = [
      'delete' => [
        '_index' => $params['index'],
        '_type' => $params['type'],
        '_id' => $id,
      ],
    ];
  }
  return $params;
}