# Most efficient way to delete

**URL:** <https://discuss.elastic.co/t/most-efficient-way-to-delete/16861>\
**Category:** Elasticsearch\
**Created:** [April 8, 2014, 1:16am UTC](https://discuss.elastic.co/t/most-efficient-way-to-delete/16861 "2014-04-08T01:16:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robbie](https://avatars.discourse-cdn.com/v4/letter/r/2acd7d/32.png) [@Robbie](https://discuss.elastic.co/u/Robbie)\
**Post date:** [April 8, 2014, 1:16am UTC](https://discuss.elastic.co/t/most-efficient-way-to-delete/16861/1 "2014-04-08T01:16:35Z")

</div>

Hi,  
I was wondering what is the most efficient way to use the deleteByQuery  
API if I have to remove all documents which match the condition field1=  
value1 AND field2 = value2 AND field3 = value3? Should I be using a  
FilterBuilder to prepare a filter for this?

Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b412a25b-86ae-4496-9e74-66c1ccfb3caf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b412a25b-86ae-4496-9e74-66c1ccfb3caf%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [April 9, 2014, 6:14pm UTC](https://discuss.elastic.co/t/most-efficient-way-to-delete/16861/2 "2014-04-09T18:14:09Z")

</div>

Sure a bool filter with multiple must term filters should do it.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7c4c8dff-553d-485e-8b57-71de023387a6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7c4c8dff-553d-485e-8b57-71de023387a6%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:37am UTC](https://discuss.elastic.co/t/most-efficient-way-to-delete/16861/3 "2017-07-06T01:37:08Z")

</div>

Closed on July 6, 2017, 1:37am UTC


