# Any way to ensure diversity in search results?

**URL:** <https://discuss.elastic.co/t/any-way-to-ensure-diversity-in-search-results/4753>\
**Category:** Elasticsearch\
**Created:** [July 1, 2011, 9:39pm UTC](https://discuss.elastic.co/t/any-way-to-ensure-diversity-in-search-results/4753 "2011-07-01T21:39:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_2](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Andy\_2](https://discuss.elastic.co/u/Andy_2)\
**Post date:** [July 1, 2011, 9:39pm UTC](https://discuss.elastic.co/t/any-way-to-ensure-diversity-in-search-results/4753/1 "2011-07-01T21:39:30Z")

</div>

My documents have a field "category".

When a user conducts a search, I want to make sure that the results  
are diverse and aren't dominated by 1 category. Say I want to make  
sure that category "A" doesn't have more than 3 results in the top 10.

Is there any way to do that? Thanks.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 2, 2011, 8:34pm UTC](https://discuss.elastic.co/t/any-way-to-ensure-diversity-in-search-results/4753/2 "2011-07-02T20:34:15Z")

</div>

No built in support except for asking for more docs instead of what you are going to present, and filter things out.

On Saturday, July 2, 2011 at 12:39 AM, Andy wrote:

> My documents have a field "category".
> 
> When a user conducts a search, I want to make sure that the results  
> are diverse and aren't dominated by 1 category. Say I want to make  
> sure that category "A" doesn't have more than 3 results in the top 10.
> 
> Is there any way to do that? Thanks.

---

<div class="post-metadata">

**Author:** ![Paul\_Loy](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Paul\_Loy](https://discuss.elastic.co/u/Paul_Loy)\
**Post date:** [July 3, 2011, 9:18am UTC](https://discuss.elastic.co/t/any-way-to-ensure-diversity-in-search-results/4753/3 "2011-07-03T09:18:09Z")

</div>

In our project we used a custom script to score docs (actually random) after  
filtering. That helped us to give 'fresh' results.

On Sat, Jul 2, 2011 at 9:34 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> No built in support except for asking for more docs instead of what you  
> are going to present, and filter things out.
> 
> On Saturday, July 2, 2011 at 12:39 AM, Andy wrote:
> 
> My documents have a field "category".
> 
> When a user conducts a search, I want to make sure that the results  
> are diverse and aren't dominated by 1 category. Say I want to make  
> sure that category "A" doesn't have more than 3 results in the top 10.
> 
> Is there any way to do that? Thanks.

## --

Paul Loy  
[paul@keteracel.com](mailto:paul@keteracel.com)  
[http://uk.linkedin.com/in/paulloy](http://uk.linkedin.com/in/paulloy)

---

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [July 3, 2011, 7:18pm UTC](https://discuss.elastic.co/t/any-way-to-ensure-diversity-in-search-results/4753/4 "2011-07-03T19:18:31Z")

</div>

Hi,

Don't think there is anything built into ES for that. We've done this  
before for Solr, though. It was a fun project with pluggable  
diversification of search results and such. Please get in touch if  
you want us to develop something like that for you for Elastic Search

- [Contact](http://sematext.com/about/contact.html)

## Otis

Sematext is hiring search people! [Jobs](http://sematext.com/about/jobs.html)

On Jul 1, 5:39 pm, Andy [selforgani...@gmail.com](mailto:selforgani...@gmail.com) wrote:

> My documents have a field "category".
> 
> When a user conducts a search, I want to make sure that the results  
> are diverse and aren't dominated by 1 category. Say I want to make  
> sure that category "A" doesn't have more than 3 results in the top 10.
> 
> Is there any way to do that? Thanks.

---

<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, 4:01am UTC](https://discuss.elastic.co/t/any-way-to-ensure-diversity-in-search-results/4753/5 "2017-07-06T04:01:55Z")

</div>


