deleteIds() public method

Deletes documents with the given ids, index, type from the index.
public deleteIds ( array $ids, string | Index $index, string | Type $type, string | boolean $routing = false ) : ResponseSet
$ids array Document ids
$index string | Index Index name
$type string | Type Type of documents
$routing string | boolean Optional routing key for all ids
return Elastica\Bulk\ResponseSet Response object
Example #1
0
 /**
  * Perform a scan and scroll through the results, bulk deleting by result ids
  *
  * @param ClassMetadata $class
  * @param object        $scanQuery
  * @param string        $index
  */
 private function deleteByScanScroll(ClassMetadata $class, $scanQuery, $index)
 {
     $type = $this->getIndex($index)->getType($class->type);
     $query = Query::create($scanQuery);
     $results = $this->scan($query, array($class));
     foreach ($results as $collection) {
         $resultIds = array();
         foreach ($collection->getResults() as $result) {
             $resultIds[] = $result->getId();
         }
         $this->client->deleteIds($resultIds, $index, $type);
     }
 }