# Filter bitsets

**URL:** https://discuss.elastic.co/t/filter-bitsets/17453
**Category:** Elasticsearch
**Created:** [May 12, 2014, 6:14am UTC](https://discuss.elastic.co/t/filter-bitsets/17453 "2014-05-12T06:14:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![slushi](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@slushi](https://discuss.elastic.co/u/slushi)
#### Post date: [May 12, 2014, 6:14am UTC](https://discuss.elastic.co/t/filter-bitsets/17453/1 "2014-05-12T06:14:16Z")

</div>

I was reading this blog post about filter bitsets

> **[All About Elasticsearch Filter BitSets
	  	 | Elastic](https://www.elastic.co/blog/all-about-elasticsearch-filter-bitsets)**
>
> WARNING: This article contains outdated information. We no longer recommend taking its advice. When building queries in Elasticsearch, you’ll often find yourself composing sets of filters. Say you nee...

At the end, the conclusion is that the bool filter should be used for  
everything but geo, numeric range and custom script. However the example  
query at the end seems to include a range in the bool filter. Is this a  
typo or am I missing something? Also what about query filters? I would  
assume those wouldn't go in the bool filter either?

{  
"and" : [  
{  
"bool" : {  
"must" : [  
{ "term" : {} },  
{ "range" : {} },  
{ "term" : {} }  
]  
}  
},  
{ "custom\_script" : {} },  
{ "geo\_distance" : {} }  
]  
}

--  
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/4c50efe8-dce3-4cfc-a78f-ab0417884201%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4c50efe8-dce3-4cfc-a78f-ab0417884201%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![slushi](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@slushi](https://discuss.elastic.co/u/slushi)
#### Post date: [May 12, 2014, 6:46am UTC](https://discuss.elastic.co/t/filter-bitsets/17453/2 "2014-05-12T06:46:56Z")

</div>

also one followup question. if i do a terms filter and then a query filter,  
should put the terms filter in a bool with a single clause? It seems  
strange to do so, but he following passage leads made me wonder if this is  
the case:

"It matters because the Bool filter utilizes BitSets while the And/Or/Not

> filters do not. If you put a Terms Filter inside of an And…no BitSet will  
> be used, even though it exists."

On Monday, May 12, 2014 2:14:16 AM UTC-4, slushi wrote:

> I was reading this blog post about filter bitsets  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/blog/all-about-elasticsearch-filter-bitsets/)
> 
> At the end, the conclusion is that the bool filter should be used for  
> everything but geo, numeric range and custom script. However the example  
> query at the end seems to include a range in the bool filter. Is this a  
> typo or am I missing something? Also what about query filters? I would  
> assume those wouldn't go in the bool filter either?
> 
> {  
> "and" : [  
> {  
> "bool" : {  
> "must" : [  
> { "term" : {} },  
> { "range" : {} },  
> { "term" : {} }  
> ]  
> }  
> },  
> { "custom\_script" : {} },  
> { "geo\_distance" : {} }  
> ]  
> }

--  
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/71c46a63-8608-4c78-9176-8ef430ada278%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/71c46a63-8608-4c78-9176-8ef430ada278%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:30am UTC](https://discuss.elastic.co/t/filter-bitsets/17453/3 "2017-07-06T01:30:13Z")

</div>


