How to do bulk delete in PHP ElasticSearch API? I know that there are issues with delete by query princip, so I want to try the bulk delete function, but I don't know how to use it. So, I want to know how to use the $client -> bulk method of the ElasticSearch PHP API. Anyone?
1 Answer
Turns out it is very simple:
for ($i = 303; $i < 310; $i++) {
$params ['body'][] = array(
'delete' => array(
'_index' => 'er',
'_type' => 'state',
'_id' => $i
)
);
}
$response = $client -> bulk($params);
2 Comments
Rabb-bit
still works, i'm using elasticsearch 2.3! thank you!
The Outstanding Question Asker
Thanks, feel free to upvote the question and all that.