# Facet Performance

**URL:** https://discuss.elastic.co/t/facet-performance/8493
**Category:** Elasticsearch
**Created:** [July 23, 2012, 5:08pm UTC](https://discuss.elastic.co/t/facet-performance/8493 "2012-07-23T17:08:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Kartavya](https://avatars.discourse-cdn.com/v4/letter/k/65b543/32.png) [@Kartavya](https://discuss.elastic.co/u/Kartavya)
#### Post date: [July 23, 2012, 5:08pm UTC](https://discuss.elastic.co/t/facet-performance/8493/1 "2012-07-23T17:08:58Z")

</div>

Hi

Now, I have two facet queries

Query 1:  
curl -XGET '[http://localhost:9200/new\_index/new\_indext/\_search](http://localhost:9200/new_index/new_indext/_search)' -d '{  
"query": {  
"filtered": {  
"query": {  
"bool": {  
"should": [  
{  
"field": {  
"MsgData": "google"  
}  
}  
],  
"minimum\_number\_should\_match": 1  
}  
},  
"filter": {  
"range": {  
"CreatedAt": {  
"from": "2012-6-12T00:00:00",  
"to": "2012-7-23T23:59:59"  
}  
}  
}  
}  
},  
"facets": {  
"MsgData": {  
"terms": {  
"field": "MsgData",  
"size": 100  
}  
}  
}  
}'

Query 2:

curl -XGET '[http://localhost:9200/new\_index/new\_indext/\_search](http://localhost:9200/new_index/new_indext/_search)' -d  
'{"query": {"bool": {"should": [  
{  
"field": {  
"MsgData": "google"  
}  
}  
],  
"minimum\_number\_should\_match": 1  
}},  
"facets": {  
"MsgData": {  
"terms": {  
"field": "MsgData",  
"size": 20  
},  
"facet\_filter": {"range": {"CreatedAt": {"from":  
"2012-6-12T00:00:00","to": "2012-7-23T23:59:59"}}}  
}  
}

}'

Are they differ in performance and memory usage? Which one would be  
fast and using less heap space?

Thanks,  
Pulkit Agrawal

---

<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, 3:19am UTC](https://discuss.elastic.co/t/facet-performance/8493/2 "2017-07-06T03:19:25Z")

</div>


