# Overlap facets/aggregation

**URL:** <https://discuss.elastic.co/t/overlap-facets-aggregation/18462>\
**Category:** Elasticsearch\
**Created:** [July 3, 2014, 2:00pm UTC](https://discuss.elastic.co/t/overlap-facets-aggregation/18462 "2014-07-03T14:00:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Armand\_paghent](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Armand\_paghent](https://discuss.elastic.co/u/Armand_paghent)\
**Post date:** [July 3, 2014, 2:00pm UTC](https://discuss.elastic.co/t/overlap-facets-aggregation/18462/1 "2014-07-03T14:00:15Z")

</div>

Hello everyone,

I need to calculate a term aggregation with keys that can be included in  
another one.

for example, il need to have a facet which gives results like :  
"my\_facet": {  
"buckets": [  
{  
"key": -1,  
"key\_as\_string": "-1",  
"doc\_count": 190,  
"article\_count": {  
"doc\_count": ...  
}  
},  
{  
"key": _6 OR -1_,  
"key\_as\_string": "5 OR -1",  
"doc\_count": 109,  
"article\_count": {  
"doc\_count": ...  
}  
},  
{  
"key": _5 OR -1_,  
"key\_as\_string": "5 OR -1",  
"doc\_count": 74,  
"article\_count": {  
"doc\_count": ...  
}  
}  
]  
}

Is it possible ?

(I know that I can do it, if I already know the distinct values of my  
buckets, and use differents filtered aggregations for each value but this  
is not what I want.)

Thanks for your help  
Regards  
Armand

--  
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/d300b05d-d6f2-4d21-b732-f558c26e51df%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d300b05d-d6f2-4d21-b732-f558c26e51df%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:18am UTC](https://discuss.elastic.co/t/overlap-facets-aggregation/18462/2 "2017-07-06T01:18:07Z")

</div>


