# Don't improve performances with BitSet filters

**URL:** <https://discuss.elastic.co/t/dont-improve-performances-with-bitset-filters/15361>\
**Category:** Elasticsearch\
**Created:** [January 22, 2014, 2:58pm UTC](https://discuss.elastic.co/t/dont-improve-performances-with-bitset-filters/15361 "2014-01-22T14:58:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Camilo\_Sierra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/camilo_sierra/32/14397_2.png) [@Camilo\_Sierra](https://discuss.elastic.co/u/Camilo_Sierra)\
**Post date:** [January 22, 2014, 2:58pm UTC](https://discuss.elastic.co/t/dont-improve-performances-with-bitset-filters/15361/1 "2014-01-22T14:58:30Z")

</div>

Hi  
in the past i have all the filters in the query like this :

{  
"from": 0,  
"size": 10,  
"query": {  
"bool": {  
"must": [  
{  
"nested": {  
"path": "readableSpaces",  
"query": {  
"terms": {  
"readableSpaces.id": [  
43  
]  
}  
}  
}  
},  
{  
"terms": {  
"postTypes": [  
3,  
4  
]  
}  
},  
{  
"nested": {  
"path": "folders",  
"query": {  
"terms": {  
"folders.id": [  
0,  
23,  
22  
]  
}  
}  
}  
}  
],  
"mustNot": [  
{  
"terms": {  
"status": [  
2,  
0  
]  
}  
}  
]  
}  
},  
"fields": [  
"title"  
]  
}

after i read the  
post [http://www.elasticsearch.org/blog/all-about-elasticsearch-filter-bitsets/](http://www.elasticsearch.org/blog/all-about-elasticsearch-filter-bitsets/)  
i change all the filter to have better performances but unfortunately no  
improve of performace in the jmeter test so i dont know if i do someting  
wrong ?

{  
"from": 0,  
"size": 10,  
"query": {  
"filtered": {  
"filter": {  
"bool": {  
"must": [  
{  
"nested": {  
"path": "readableSpaces",  
"filter": {  
"term": {  
"readableSpaces.id": 43  
}  
}  
}  
},  
{  
"terms": {  
"postTypes": [  
3,  
4  
]  
}  
},  
{  
"nested": {  
"path": "folders",  
"filter": {  
"terms": {  
"folders.id": [  
0,  
23,  
22  
]  
}  
}  
}  
}  
],  
"mustNot": [  
{  
"terms": {  
"status": [  
2,  
0  
]  
}  
}  
],  
"\_cache": true  
}  
}  
}  
},  
"fields": [  
"title"  
]  
}

--  
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/c3381fdf-6db6-43d3-b878-9bd41ca62406%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c3381fdf-6db6-43d3-b878-9bd41ca62406%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [January 22, 2014, 5:36pm UTC](https://discuss.elastic.co/t/dont-improve-performances-with-bitset-filters/15361/2 "2014-01-22T17:36:18Z")

</div>

Camilo,

I didn't look in detail at your query, but you should be able to see a  
performance improvement on a larger index (i.e. millions of docs). If you  
only have a couple hundred/thousand docs, you may or may not see a  
difference (depending on your data and queries of course). Also the  
performance improvement will come after the filter is cached and you run  
the queries again, i.e., not when you execute your filtered query for the  
first time and ES was building the initial cache for your filter condition.

--  
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/a0aa420e-adef-4f52-a3cb-644570c481e8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0aa420e-adef-4f52-a3cb-644570c481e8%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Camilo\_Sierra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/camilo_sierra/32/14397_2.png) [@Camilo\_Sierra](https://discuss.elastic.co/u/Camilo_Sierra)\
**Post date:** [January 23, 2014, 9:25am UTC](https://discuss.elastic.co/t/dont-improve-performances-with-bitset-filters/15361/3 "2014-01-23T09:25:32Z")

</div>

ok thank you Binh

On Wednesday, January 22, 2014 6:36:18 PM UTC+1, Binh Ly wrote:

> Camilo,
> 
> I didn't look in detail at your query, but you should be able to see a  
> performance improvement on a larger index (i.e. millions of docs). If you  
> only have a couple hundred/thousand docs, you may or may not see a  
> difference (depending on your data and queries of course). Also the  
> performance improvement will come after the filter is cached and you run  
> the queries again, i.e., not when you execute your filtered query for the  
> first time and ES was building the initial cache for your filter condition.

--  
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/f556788e-d6b2-4a04-95c6-05b4eab42d8a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f556788e-d6b2-4a04-95c6-05b4eab42d8a%40googlegroups.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, 1:55am UTC](https://discuss.elastic.co/t/dont-improve-performances-with-bitset-filters/15361/4 "2017-07-06T01:55:11Z")

</div>


