# Bool filters vs and filters - more questions

**URL:** https://discuss.elastic.co/t/bool-filters-vs-and-filters-more-questions/14257
**Category:** Elasticsearch
**Created:** [November 5, 2013, 10:01am UTC](https://discuss.elastic.co/t/bool-filters-vs-and-filters-more-questions/14257 "2013-11-05T10:01:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![DH1](https://avatars.discourse-cdn.com/v4/letter/d/65b543/32.png) [@DH1](https://discuss.elastic.co/u/DH1)
#### Post date: [November 5, 2013, 10:01am UTC](https://discuss.elastic.co/t/bool-filters-vs-and-filters-more-questions/14257/1 "2013-11-05T10:01:49Z")

</div>

Hello, everyone.

I've read a few threads from various sources about de differences between a  
boolFilter (with several must clauses) and an andFilter.

The conclusions where that a boolFilter is prefered (due to the speed of  
bitwise operations), as long as you do not have numeric\_ranges filters,  
scripts filters and geo\_distance filters. (because those do not create  
bitsets).

However, with the andFilter, if a filter does not match a doc, subsequent  
filters will not be applied to this docs, wich seems highly interresting.  
Here, we are working with very complicated docs, containings hundreds of  
different fields, and I was wondering....  
If the queries we do here had lots of filters (7-10) and the fields used  
for those queries had a lot (and I mean a lot) of different values (wich  
would actually means that for a fair bit of the filters, the bitset would  
not yet be present, I assume) ... would it still be more efficient to use a  
boolFilter over an AndFilter? (even if none of the filters are of the three  
aforementionned types that does not build bitsets)  
Or would the "short-circuit effect" of the andFilter more than make up for  
the lack of bitwise operations?

Any insight on that matter would be of a tremendous help.  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:08am UTC](https://discuss.elastic.co/t/bool-filters-vs-and-filters-more-questions/14257/2 "2017-07-06T02:08:55Z")

</div>


