# How to implement useful facet aggregations?

**URL:** <https://discuss.elastic.co/t/how-to-implement-useful-facet-aggregations/20153>\
**Category:** Elasticsearch\
**Created:** [October 9, 2014, 3:40am UTC](https://discuss.elastic.co/t/how-to-implement-useful-facet-aggregations/20153 "2014-10-09T03:40:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey\_Sharov](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@Alexey\_Sharov](https://discuss.elastic.co/u/Alexey_Sharov)\
**Post date:** [October 9, 2014, 3:40am UTC](https://discuss.elastic.co/t/how-to-implement-useful-facet-aggregations/20153/1 "2014-10-09T03:40:42Z")

</div>

I have filtered query with 3 filters - "query": "iphone", color:5,  
category:10, brand:25

How can i get amount of products in each brand which have color:5 and  
category:10?

In Solr i did it like: facet.field={!ex=tag\_facet\_brand}facet\_brand

How can i exclude 1 filter from aggregation context? (i can't use global,  
because i loose query:iphone, i can't use post\_filter - because of  
performance)

--  
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/ee675913-282a-42a8-9448-9c4853336ee4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ee675913-282a-42a8-9448-9c4853336ee4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Alexey\_Sharov](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@Alexey\_Sharov](https://discuss.elastic.co/u/Alexey_Sharov)\
**Post date:** [October 9, 2014, 3:49am UTC](https://discuss.elastic.co/t/how-to-implement-useful-facet-aggregations/20153/2 "2014-10-09T03:49:48Z")

</div>

In Solr i did it like:  
fq={!tag=tag\_facet\_brand}facet\_brand:"564"&facet.field={!ex=tag\_facet\_brand}facet\_brand

--  
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/e62d38c2-9f83-49a9-aaec-63c0e5a78024%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e62d38c2-9f83-49a9-aaec-63c0e5a78024%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, 12:57am UTC](https://discuss.elastic.co/t/how-to-implement-useful-facet-aggregations/20153/3 "2017-07-06T00:57:24Z")

</div>


