How to do bulk removal in PHP ElasticSearch API

How to do bulk removal in PHP ElasticSearch API? I know that there are problems with deletion on the basis of a request, so I want to try the bulk delete function, but I do not know how to use it. So, I want to know how to use the $ client → bulk API ElasticSearch API method. Is anyone

+9
source share
2 answers

It 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); 
+13
source

Vladimir's answer still works in 2019 on version 6.0.1, if anyone is interested.

0
source

All Articles