Deletes documents with the given ids, index, type from the index.
public deleteIds ( array $ids, string | |
||
$ids | array | Document ids |
$index | string | |
Index name |
$type | string | |
Type of documents |
$routing | string | boolean | Optional routing key for all ids |
return | Response object |
/** * 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); } }