# Group by facets

**URL:** <https://discuss.elastic.co/t/group-by-facets/5611>\
**Category:** Elasticsearch\
**Created:** [October 17, 2011, 8:46am UTC](https://discuss.elastic.co/t/group-by-facets/5611 "2011-10-17T08:46:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [October 17, 2011, 8:46am UTC](https://discuss.elastic.co/t/group-by-facets/5611/1 "2011-10-17T08:46:57Z")

</div>

Hi ,

Is there a group by facets feature in elasticSearch.

What i want is if my search returns 10 results and there are 4 facets  
present - I want to know which all document have which all facets.

So the result which have the facet name and number of documents matching  
facets , will also have which all documents matches each facets !!!!

Thanks  
Vineeth

---

<div class="post-metadata">

**Author:** ![Enrique\_Medina\_Monte](https://avatars.discourse-cdn.com/v4/letter/e/4491bb/32.png) [@Enrique\_Medina\_Monte](https://discuss.elastic.co/u/Enrique_Medina_Monte)\
**Post date:** [October 17, 2011, 9:27am UTC](https://discuss.elastic.co/t/group-by-facets/5611/2 "2011-10-17T09:27:02Z")

</div>

[http://tinyurl.com/4364h2b](http://tinyurl.com/4364h2b)

First result.

On Mon, Oct 17, 2011 at 10:46 AM, Vineeth Mohan  
[vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:

> Hi ,
> 
> Is there a group by facets feature in elasticSearch.
> 
> What i want is if my search returns 10 results and there are 4 facets  
> present - I want to know which all document have which all facets.
> 
> So the result which have the facet name and number of documents matching  
> facets , will also have which all documents matches each facets !!!!
> 
> Thanks  
> Vineeth

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [October 17, 2011, 1:46pm UTC](https://discuss.elastic.co/t/group-by-facets/5611/3 "2011-10-17T13:46:45Z")

</div>

Can anybody help me out on this !!!! ☹

Thanks  
Vineeth

On Mon, Oct 17, 2011 at 2:16 PM, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:

> Hi ,
> 
> Is there a group by facets feature in elasticSearch.
> 
> What i want is if my search returns 10 results and there are 4 facets  
> present - I want to know which all document have which all facets.
> 
> So the result which have the facet name and number of documents matching  
> facets , will also have which all documents matches each facets !!!!
> 
> Thanks  
> Vineeth

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [October 17, 2011, 3:01pm UTC](https://discuss.elastic.co/t/group-by-facets/5611/4 "2011-10-17T15:01:43Z")

</div>

what is your usecase? with facets you get only the count. with term  
filter you can look for documents with a specific term. but you don't  
have (yet) something like the group by feature in ES:

> <https://github.com/elastic/elasticsearch/issues/256>
>
> Ability to collapse on a field. For example, I want the most relevant result fro…m all different report types. Or similarly, the most recent result of each report type. Or maybe, I want to de-dup on headline. 
> 
> So, the sort order would dictate which one from the group is returned. Similar to what is discussed here:
> http://blog.jteam.nl/2009/10/20/result-grouping-field-collapsing-with-solr/
> 
> From my understanding, it seems that in order for field collapsing to be efficient, the result set must be relatively small.
> 
> This is also referred to as "Combine" on some other search products.

On 17 Okt., 15:46, Vineeth Mohan [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com) wrote:

> Can anybody help me out on this !!!! ☹
> 
> Thanks  
> Vineeth
> 
> On Mon, Oct 17, 2011 at 2:16 PM, Vineeth Mohan [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com)wrote:
> 
> > Hi ,
> 
> > Is there a group by facets feature in elasticSearch.
> 
> > What i want is if my search returns 10 results and there are 4 facets  
> > present - I want to know which all document have which all facets.
> 
> > So the result which have the facet name and number of documents matching  
> > facets , will also have which all documents matches each facets !!!!
> 
> > Thanks  
> > Vineeth

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [October 17, 2011, 3:28pm UTC](https://discuss.elastic.co/t/group-by-facets/5611/5 "2011-10-17T15:28:57Z")

</div>

Thanks Karussell ,

The feature told in the bug is exactly what i want.

THanks  
Vineeth

On Mon, Oct 17, 2011 at 8:31 PM, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com)wrote:

> what is your usecase? with facets you get only the count. with term  
> filter you can look for documents with a specific term. but you don't  
> have (yet) something like the group by feature in ES:
> 
> [https://github.com/elasticsearch/elasticsearch/issues/256](https://github.com/elasticsearch/elasticsearch/issues/256)
> 
> On 17 Okt., 15:46, Vineeth Mohan [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com) wrote:
> 
> > Can anybody help me out on this !!!! ☹
> > 
> > Thanks  
> > Vineeth
> > 
> > On Mon, Oct 17, 2011 at 2:16 PM, Vineeth Mohan \<  
> > [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com)\>wrote:
> > 
> > > Hi ,
> > 
> > > Is there a group by facets feature in elasticSearch.
> > 
> > > What i want is if my search returns 10 results and there are 4 facets  
> > > present - I want to know which all document have which all facets.
> > 
> > > So the result which have the facet name and number of documents  
> > > matching  
> > > facets , will also have which all documents matches each facets !!!!
> > 
> > > Thanks  
> > > Vineeth

---

<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:51am UTC](https://discuss.elastic.co/t/group-by-facets/5611/6 "2017-07-06T03:51:45Z")

</div>


