# Bitsets memory allocation

**URL:** <https://discuss.elastic.co/t/bitsets-memory-allocation/96909>\
**Category:** Elasticsearch\
**Created:** [August 14, 2017, 6:18am UTC](https://discuss.elastic.co/t/bitsets-memory-allocation/96909 "2017-08-14T06:18:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eli\_Revach](https://avatars.discourse-cdn.com/v4/letter/e/e9c0ed/32.png) [@Eli\_Revach](https://discuss.elastic.co/u/Eli_Revach)\
**Post date:** [August 14, 2017, 6:18am UTC](https://discuss.elastic.co/t/bitsets-memory-allocation/96909/1 "2017-08-14T06:18:35Z")

</div>

Hi ,  
ES version – 1.7.5 .

I would like to get some clarifications about bitsets memory allocation .  
Assuming my dataset is 100K documents and I have the below filters in my query and my index had 10 Segments  
**Filter #1**  
"range": { - this filter cover 10% of my data  
"\_cache": true,  
"execution": "fielddata",  
"created": {  
"lt": 1501459472000,  
"gt": 1501286731000  
}  
}  
**Filter #2**  
"bool": {  This filter cover 0.01% of my data  
"must": [  
{  
"term": {  
"tenantId": 123456  
}  
}  
]

In term of memory allocation on the filter cache , both bitsets will allocation the same memory , or ES has some kind of optimization to compress it and filter #2 will required much less memory then #1

Thanks

---

<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:** [September 11, 2017, 6:18am UTC](https://discuss.elastic.co/t/bitsets-memory-allocation/96909/2 "2017-09-11T06:18:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
