Delete using scroll/scan API and Bulk request Example

Since "Delete by Query" has been deprecated as a method to delete documents, I want to implement the work around to use scan/scroll API and Bulk Delete request.

Can Someone help me with an example, as I am not sure how to use scroll_id, returned by my search, in bulk delete request (or) there will be multiple bulk delete requests.

Hi @wajahat_Javaid

We have reimplemented delete-by-query using scan/scroll/bulk for you in a plugin, that you will be able to install with Elasticsearch 2.0. See https://github.com/elastic/elasticsearch/blob/master/docs/plugins/delete-by-query.asciidoc

Thanks for the reply, The plugin would indeed come in very handy, but I am in need for this operation at present and the plugin would be compatible with elasticsearch 2.0,for now, I would need help in executing delete requests using scan/scroll API.

Does this need to be installed on every master only nodes as well as data nodes?

Reviving this old thread. The plugin seems to not be available anymore. I want to delete all documents of a type and would like to implement it using scroll API and bulk delete. Could someone please help me with an example of how I could achieve this? Is there is a better alternative to do the same?

The plugin seems to not be available anymore.

What makes you say that? Which version of ES are you using?

My bad! I am using version 2.3 of ES and I could install and use the plugin. Just the link mentioned in the previous post was incorrect. Here is the right link :


OR
https://www.elastic.co/guide/en/elasticsearch/plugins/current/delete-by-query-usage.html