# Ensuring results from multiple indexes

**URL:** https://discuss.elastic.co/t/ensuring-results-from-multiple-indexes/4203
**Category:** Elasticsearch
**Created:** [April 8, 2011, 1:12pm UTC](https://discuss.elastic.co/t/ensuring-results-from-multiple-indexes/4203 "2011-04-08T13:12:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Richard\_Livsey\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richard_livsey_2/32/3241_2.png) [@Richard\_Livsey\_2](https://discuss.elastic.co/u/Richard_Livsey_2)
#### Post date: [April 8, 2011, 1:12pm UTC](https://discuss.elastic.co/t/ensuring-results-from-multiple-indexes/4203/1 "2011-04-08T13:12:43Z")

</div>

I have a number of indexes and want to search across all of them but ensure I get results from all the indexes. Is this possible?

So say I have two indexes, "clients" and "colleagues" and I do a search across both of them, is there a way of specifying that I want to get a maximum of 5 results from each index, resulting in a total of up to 10 results returned?

Basically I'm building a spotlight alike quick search box which matches as the user types.  
Currently it's a bit weird because if I ask for a maximum of 10 results, all of them could come from the same type when instead I want to display at least one match (if there is one) for each type.

I can get round this by searching each type individually, but obviously it would be a lot faster to be able to do it in one query.

Cheers.

---

<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: [April 8, 2011, 6:25pm UTC](https://discuss.elastic.co/t/ensuring-results-from-multiple-indexes/4203/2 "2011-04-08T18:25:56Z")

</div>

Heya,

No, there isn't an option to specify that, so you will need to execute the search several times. It can be enabled as a feature for search, but, I think a proper way to solve it is to have bulk search support which will allow for other usecases.

-shay.banon  
On Friday, April 8, 2011 at 4:12 PM, Richard Livsey wrote:

> I have a number of indexes and want to search across all of them but ensure I get results from all the indexes. Is this possible?
> 
> So say I have two indexes, "clients" and "colleagues" and I do a search across both of them, is there a way of specifying that I want to get a maximum of 5 results from each index, resulting in a total of up to 10 results returned?
> 
> Basically I'm building a spotlight alike quick search box which matches as the user types.  
> Currently it's a bit weird because if I ask for a maximum of 10 results, all of them could come from the same type when instead I want to display at least one match (if there is one) for each type.
> 
> I can get round this by searching each type individually, but obviously it would be a lot faster to be able to do it in one query.
> 
> Cheers.

---

<div class="post-metadata">

### Author: ![Richard\_Livsey\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richard_livsey_2/32/3241_2.png) [@Richard\_Livsey\_2](https://discuss.elastic.co/u/Richard_Livsey_2)
#### Post date: [April 8, 2011, 7:16pm UTC](https://discuss.elastic.co/t/ensuring-results-from-multiple-indexes/4203/3 "2011-04-08T19:16:02Z")

</div>

No problem, I've got it working by issuing separate queries and combining the results and it's pretty quick for now.

Cheers.

On Friday, 8 April 2011 at 19:25, Shay Banon wrote:

> Heya,
> 
> No, there isn't an option to specify that, so you will need to execute the search several times. It can be enabled as a feature for search, but, I think a proper way to solve it is to have bulk search support which will allow for other usecases.
> 
> -shay.banon  
> On Friday, April 8, 2011 at 4:12 PM, Richard Livsey wrote:
> 
> > I have a number of indexes and want to search across all of them but ensure I get results from all the indexes. Is this possible?
> > 
> > So say I have two indexes, "clients" and "colleagues" and I do a search across both of them, is there a way of specifying that I want to get a maximum of 5 results from each index, resulting in a total of up to 10 results returned?
> > 
> > Basically I'm building a spotlight alike quick search box which matches as the user types.  
> > Currently it's a bit weird because if I ask for a maximum of 10 results, all of them could come from the same type when instead I want to display at least one match (if there is one) for each type.
> > 
> > I can get round this by searching each type individually, but obviously it would be a lot faster to be able to do it in one query.
> > 
> > Cheers.

---

<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:08am UTC](https://discuss.elastic.co/t/ensuring-results-from-multiple-indexes/4203/4 "2017-07-06T04:08:41Z")

</div>


