Closed kwisatz closed 11 years ago
Never mind... I suppose I needed a break to figure out that I could just as easily:
$delete = $app['sherlock']
->deleteDocument()
->index('fde')
->type('booth');
foreach($response->hits as $hit) {
$delete->document($hit['id']);
}
$resp = $delete->execute();
Yep, that's how you do it. The Batch stuff is really only exposed if you have a very large batch of documents that you need deleted (or indexed, which is where the notation concept originally came from). It allows you to write a custom BatchCommand class that streams from your data source rather than loading it entirely into memory.
As with most places, I'm not overly happy with the syntax. Check out some discussions that Mopster and I had about the document interface (index/delete/get/update) on issue #34
I have a question on the DeleteDocumentRequest class.
There's the documents() method that allows deleting multiple documents in a single go. However, the method expects its argument to be either an instance of BatchCommand or an array of Command instances.
Now, I haven't figured out how to create such a Batch using the DeleteDocumentRequest object itself. Am I missing something?
I've been solving my issue like this for the moment:
However, if I've really missing something, shouldn't there be another method in DeleteDocumentRequest, such as:
Thanks for shedding some lights onto this.