# Elasticsearch group

**URL:** <https://discuss.elastic.co/t/elasticsearch-group/11468>\
**Category:** Elasticsearch\
**Created:** [April 5, 2013, 11:54pm UTC](https://discuss.elastic.co/t/elasticsearch-group/11468 "2013-04-05T23:54:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexis\_Okuwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexis_okuwa/32/1983_2.png) [@Alexis\_Okuwa](https://discuss.elastic.co/u/Alexis_Okuwa)\
**Post date:** [April 5, 2013, 11:54pm UTC](https://discuss.elastic.co/t/elasticsearch-group/11468/1 "2013-04-05T23:54:25Z")

</div>

I have been trying to find a way to get something like group by where it  
only returns documents that have a selective feild that is uniqie, and then  
be able to do something simular to a mysql min max sum or something of the  
sorts. Lets say i was building a database of dogs on houses on each street  
i may want to pull which houses have dogs, insteed of having a look up type  
or index i want to search all the dogs and then only reply once per  
address. what would also be useful is if it was able to return the number  
of dogs per house using a simular query.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 6, 2013, 12:07am UTC](https://discuss.elastic.co/t/elasticsearch-group/11468/2 "2013-04-06T00:07:21Z")

</div>

Sounds like you are looking for facets. The terms facet and the terms stats  
facet should solve most of your use cases.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--  
Ivan

On Fri, Apr 5, 2013 at 4:54 PM, Wojons Tech [wojonstech@gmail.com](mailto:wojonstech@gmail.com) wrote:

> I have been trying to find a way to get something like group by where it  
> only returns documents that have a selective feild that is uniqie, and then  
> be able to do something simular to a mysql min max sum or something of the  
> sorts. Lets say i was building a database of dogs on houses on each street  
> i may want to pull which houses have dogs, insteed of having a look up type  
> or index i want to search all the dogs and then only reply once per  
> address. what would also be useful is if it was able to return the number  
> of dogs per house using a simular query.
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Alexis\_Okuwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexis_okuwa/32/1983_2.png) [@Alexis\_Okuwa](https://discuss.elastic.co/u/Alexis_Okuwa)\
**Post date:** [April 6, 2013, 12:34am UTC](https://discuss.elastic.co/t/elasticsearch-group/11468/3 "2013-04-06T00:34:04Z")

</div>

I have come across these before but i am having a hard time understanding  
how to use them.

On Fri, Apr 5, 2013 at 5:07 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Sounds like you are looking for facets. The terms facet and the terms  
> stats facet should solve most of your use cases.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet/)
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/facets/terms-stats-facet/)
> 
> --  
> Ivan
> 
> On Fri, Apr 5, 2013 at 4:54 PM, Wojons Tech [wojonstech@gmail.com](mailto:wojonstech@gmail.com) wrote:
> 
> > I have been trying to find a way to get something like group by where it  
> > only returns documents that have a selective feild that is uniqie, and then  
> > be able to do something simular to a mysql min max sum or something of the  
> > sorts. Lets say i was building a database of dogs on houses on each street  
> > i may want to pull which houses have dogs, insteed of having a look up type  
> > or index i want to search all the dogs and then only reply once per  
> > address. what would also be useful is if it was able to return the number  
> > of dogs per house using a simular query.
> > 
> > --  
> > 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).
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/p8enWi6XqXI/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/p8enWi6XqXI/unsubscribe?hl=en-US)  
> .  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Enjoy,  
Alexis Okuwa  
WojonsTech  
424.835.1223

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 6, 2013, 3:21am UTC](https://discuss.elastic.co/t/elasticsearch-group/11468/4 "2013-04-06T03:21:07Z")

</div>

Post a few sample documents and someone can help you craft a query.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--  
Ivan

On Fri, Apr 5, 2013 at 5:34 PM, Wojons Tech [wojonstech@gmail.com](mailto:wojonstech@gmail.com) wrote:

> I have come across these before but i am having a hard time understanding  
> how to use them.
> 
> On Fri, Apr 5, 2013 at 5:07 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > Sounds like you are looking for facets. The terms facet and the terms  
> > stats facet should solve most of your use cases.
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet/)
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/facets/terms-stats-facet/)
> > 
> > --  
> > Ivan
> > 
> > On Fri, Apr 5, 2013 at 4:54 PM, Wojons Tech [wojonstech@gmail.com](mailto:wojonstech@gmail.com) wrote:
> > 
> > > I have been trying to find a way to get something like group by where it  
> > > only returns documents that have a selective feild that is uniqie, and then  
> > > be able to do something simular to a mysql min max sum or something of the  
> > > sorts. Lets say i was building a database of dogs on houses on each street  
> > > i may want to pull which houses have dogs, insteed of having a look up type  
> > > or index i want to search all the dogs and then only reply once per  
> > > address. what would also be useful is if it was able to return the number  
> > > of dogs per house using a simular query.
> > > 
> > > --  
> > > 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).
> > > 
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/p8enWi6XqXI/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/p8enWi6XqXI/unsubscribe?hl=en-US)  
> > .  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> Enjoy,  
> Alexis Okuwa  
> WojonsTech  
> 424.835.1223
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:42am UTC](https://discuss.elastic.co/t/elasticsearch-group/11468/5 "2017-07-06T02:42:30Z")

</div>


