# Delete from all indexes using the Bulk API

**URL:** <https://discuss.elastic.co/t/delete-from-all-indexes-using-the-bulk-api/6177>\
**Category:** Elasticsearch\
**Created:** [December 16, 2011, 1:33pm UTC](https://discuss.elastic.co/t/delete-from-all-indexes-using-the-bulk-api/6177 "2011-12-16T13:33:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Hutchinson](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@Simon\_Hutchinson](https://discuss.elastic.co/u/Simon_Hutchinson)\
**Post date:** [December 16, 2011, 1:33pm UTC](https://discuss.elastic.co/t/delete-from-all-indexes-using-the-bulk-api/6177/1 "2011-12-16T13:33:14Z")

</div>

Hi All,

My name is Si and I am new to Elastic Search, so please be patient with my  
naivety.  
Firstly, congratulations to Shay and the ES community. So far the product  
looks fantastic. We evaluated SolrCloud before ES and ES simply destroyed  
Solr for the multi-tennant, EC2 deployment we are building.

Anyway, enough flattery and on to my issue.

I am using the rabbit-mq-river along with some custom code which tails the  
oplog to index our MongoDB data in ES via RabbitMQ.

Each document in our Mongo db contains the information required (index,  
type and id) to allow us to build the bulk API format used by the river:

e.g.

{ "index" : { "\_index" : "someco", "\_type" : "product", "\_id" : "1" } }

However in the case of a Delete from Mongo, I only have access to the \_id.  
We have ensured that our \_ids are universally unique and therefore I was  
hoping to be able to simply delete from all indexes in a similar way to the  
REST Delete by Query API:

e.g

curl -XDELETE '[http://localhost:9200/\_all/\_query?q=id:1](http://localhost:9200/_all/_query?q=id:1)

However a brief look at the source of  
org.elasticsearch.action.delete.DeleteRequest suggests that this isn't  
possible using the bulk API.

I therefore have 1 or 2 questions.

1. Am I correct that the bulk API format doesn't support deletion from all  
indexes?

If the answer to 1. is true.

1. Could someone give me some hints on where to look in the source for some  
hints on how to develop this functionality (delete by id from all indexes)  
with a customized version of the rabbit-mq-river.

Best regards

Si

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 16, 2011, 5:07pm UTC](https://discuss.elastic.co/t/delete-from-all-indexes-using-the-bulk-api/6177/2 "2011-12-16T17:07:35Z")

</div>

You can use the delete\_by\_query API, but thats not exposed in the bulk API  
format. I suggest you use direct API calls to ES and not use the rabbitmq  
river, or you tail rabbitmq yourself and call ES.

On Fri, Dec 16, 2011 at 3:33 PM, Simon Hutchinson [si@springyweb.com](mailto:si@springyweb.com) wrote:

> Hi All,
> 
> My name is Si and I am new to Elastic Search, so please be patient with my  
> naivety.  
> Firstly, congratulations to Shay and the ES community. So far the product  
> looks fantastic. We evaluated SolrCloud before ES and ES simply destroyed  
> Solr for the multi-tennant, EC2 deployment we are building.
> 
> Anyway, enough flattery and on to my issue.
> 
> I am using the rabbit-mq-river along with some custom code which tails the  
> oplog to index our MongoDB data in ES via RabbitMQ.
> 
> Each document in our Mongo db contains the information required (index,  
> type and id) to allow us to build the bulk API format used by the river:
> 
> e.g.
> 
> { "index" : { "\_index" : "someco", "\_type" : "product", "\_id" : "1" } }
> 
> However in the case of a Delete from Mongo, I only have access to the \_id.  
> We have ensured that our \_ids are universally unique and therefore I was  
> hoping to be able to simply delete from all indexes in a similar way to the  
> REST Delete by Query API:
> 
> e.g
> 
> curl -XDELETE '[http://localhost:9200/\_all/\_query?q=id:1](http://localhost:9200/_all/_query?q=id:1)
> 
> However a brief look at the source of  
> org.elasticsearch.action.delete.DeleteRequest suggests that this isn't  
> possible using the bulk API.
> 
> I therefore have 1 or 2 questions.
> 
> 1. Am I correct that the bulk API format doesn't support deletion from all  
> indexes?
> 
> If the answer to 1. is true.
> 
> 1. Could someone give me some hints on where to look in the source for  
> some hints on how to develop this functionality (delete by id from all  
> indexes) with a customized version of the rabbit-mq-river.
> 
> Best regards
> 
> Si

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:45am UTC](https://discuss.elastic.co/t/delete-from-all-indexes-using-the-bulk-api/6177/3 "2017-07-06T03:45:10Z")

</div>


