# ElasticSearch (Nest) and grouping

**URL:** <https://discuss.elastic.co/t/elasticsearch-nest-and-grouping/12707>\
**Category:** Elasticsearch\
**Created:** [July 8, 2013, 11:39pm UTC](https://discuss.elastic.co/t/elasticsearch-nest-and-grouping/12707 "2013-07-08T23:39:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aref\_Karimi](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@Aref\_Karimi](https://discuss.elastic.co/u/Aref_Karimi)\
**Post date:** [July 8, 2013, 11:39pm UTC](https://discuss.elastic.co/t/elasticsearch-nest-and-grouping/12707/1 "2013-07-08T23:39:25Z")

</div>

Hi guys,

We have an index in ElasticSearch whose root document includes a property  
called Type. Type can have one of the following values:

"Track", "Video","Ringtone".

We want to query the index, and return all documents whose Title property  
includes "Micheal". However, we want exactly 10 documents of each Type in  
the result set. For example 10 Tracks, 10 Videos and 10 Ringtones whose  
Title property includes "Michael".

I am using Nest. How can I do this grouping?

--  
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:** ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)\
**Post date:** [July 9, 2013, 5:53am UTC](https://discuss.elastic.co/t/elasticsearch-nest-and-grouping/12707/2 "2013-07-09T05:53:42Z")

</div>

There are currently two options:

- Run 3 queries - I'd recommend this approach using the multi-search  
interface
- Request a large number of results and group client side

Baked in grouping support is lacking:  
[Field Collapsing/Combining · Issue #256 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/256) ( don't +1 the  
issue, it has enough 🙂 )

Thanks,  
Paul

On Monday, July 8, 2013 5:39:25 PM UTC-6, Aref Karimi wrote:

> Hi guys,
> 
> We have an index in Elasticsearch whose root document includes a property  
> called Type. Type can have one of the following values:
> 
> "Track", "Video","Ringtone".
> 
> We want to query the index, and return all documents whose Title property  
> includes "Micheal". However, we want exactly 10 documents of each Type in  
> the result set. For example 10 Tracks, 10 Videos and 10 Ringtones whose  
> Title property includes "Michael".
> 
> I am using Nest. How can I do this grouping?

--  
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:** [July 9, 2013, 4:58pm UTC](https://discuss.elastic.co/t/elasticsearch-nest-and-grouping/12707/3 "2013-07-09T16:58:48Z")

</div>

I have almost stopped linking to issues because of the +1s. 🙂

On Mon, Jul 8, 2013 at 10:53 PM, ppearcy [ppearcy@gmail.com](mailto:ppearcy@gmail.com) wrote:

> Baked in grouping support is lacking:  
> [Field Collapsing/Combining · Issue #256 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/256) ( don't +1 the  
> issue, it has enough 🙂 )

--  
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:27am UTC](https://discuss.elastic.co/t/elasticsearch-nest-and-grouping/12707/4 "2017-07-06T02:27:26Z")

</div>


