# Distribute Search Results across a specific field / property

**URL:** <https://discuss.elastic.co/t/distribute-search-results-across-a-specific-field-property/23323>\
**Category:** Elasticsearch\
**Created:** [April 20, 2015, 2:18pm UTC](https://discuss.elastic.co/t/distribute-search-results-across-a-specific-field-property/23323 "2015-04-20T14:18:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frederik\_Lipfert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frederik_lipfert/32/758_2.png) [@Frederik\_Lipfert](https://discuss.elastic.co/u/Frederik_Lipfert)\
**Post date:** [April 20, 2015, 2:18pm UTC](https://discuss.elastic.co/t/distribute-search-results-across-a-specific-field-property/23323/1 "2015-04-20T14:18:49Z")

</div>

Hi Guys,

I am using ES to build out the search for an online store. The operator  
would like to have the results being returned in a way that showcases the  
varieties of manufactures he offers. So instead of returning order by  
score he would like there to be one result from each store on each page, at  
least on the first few pages.  
The issue is there is one manufactures who makes 80% of the portfolio so it  
always looks like there is only that one store.  
But if one could "mix" or "distribute" the results to showcase the variety  
that be pretty cool.  
I have seen a bunch of online stores do that somehow, although I do not  
know how.

Is there a way to use ES to somehow do a query like, return 20 results and  
2 of each Store?

Thanks for your help.

Frederik

--  
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/5e3f3787-79a5-4481-908a-0c2092da31ea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5e3f3787-79a5-4481-908a-0c2092da31ea%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [April 20, 2015, 2:29pm UTC](https://discuss.elastic.co/t/distribute-search-results-across-a-specific-field-property/23323/2 "2015-04-20T14:29:43Z")

</div>

I have a pull request in the works that adds an option for maintaining  
diversity in results: [Sampler aggregation by markharwood · Pull Request #10221 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/pull/10221)  
This is mainly for the purposes of sample-based aggregations but if used  
with the top\_hits aggregation it might give you some of what you need.

Cheers  
Mark

On Monday, April 20, 2015 at 3:18:49 PM UTC+1, Frederik Lipfert wrote:

> Hi Guys,
> 
> I am using ES to build out the search for an online store. The operator  
> would like to have the results being returned in a way that showcases the  
> varieties of manufactures he offers. So instead of returning order by  
> score he would like there to be one result from each store on each page, at  
> least on the first few pages.  
> The issue is there is one manufactures who makes 80% of the portfolio so  
> it always looks like there is only that one store.  
> But if one could "mix" or "distribute" the results to showcase the variety  
> that be pretty cool.  
> I have seen a bunch of online stores do that somehow, although I do not  
> know how.
> 
> Is there a way to use ES to somehow do a query like, return 20 results and  
> 2 of each Store?
> 
> Thanks for your help.
> 
> Frederik

--  
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/feaece21-85c0-405c-8eda-77d627f74bb1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/feaece21-85c0-405c-8eda-77d627f74bb1%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:18am UTC](https://discuss.elastic.co/t/distribute-search-results-across-a-specific-field-property/23323/3 "2017-07-06T00:18:44Z")

</div>


