# Return a result from every index when searching multiple indices

**URL:** https://discuss.elastic.co/t/return-a-result-from-every-index-when-searching-multiple-indices/7028
**Category:** Elasticsearch
**Created:** [March 16, 2012, 1:11pm UTC](https://discuss.elastic.co/t/return-a-result-from-every-index-when-searching-multiple-indices/7028 "2012-03-16T13:11:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![philipDS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/philipds/32/2817_2.png) [@philipDS](https://discuss.elastic.co/u/philipDS)
#### Post date: [March 16, 2012, 1:11pm UTC](https://discuss.elastic.co/t/return-a-result-from-every-index-when-searching-multiple-indices/7028/1 "2012-03-16T13:11:12Z")

</div>

Hey!

I have 4 indices with different types in them (and thus different mappings). Now, I want to execute a query and get at least 1 document from every index (if ES finds one related to the query). Is this possible?

Currently, I'm doing this:

return this.getClient().prepareSearch("W", "X", "Y", "Z")  
.setTypes("A", "B", "C", "D", "E", "F")  
.addIndexBoost("W", (float)1.4)  
.addIndexBoost("X", (float)1.1)  
.setFrom(q.getFrom())  
.setRouting(q.getUser())  
.setSize(MAX\_HITS).setExplain(q.getExplain())  
.addSort(sort, SortOrder.DESC)  
.setFilter(q.getBody());

I also tried playing around with boosting a little bit, but this doesn't give me the results I needed. Is it somehow possible to say to ES: distribute your results over W, X, Y, Z and get at least 5 results from every index, while doing only one search?

---

<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, 3:35am UTC](https://discuss.elastic.co/t/return-a-result-from-every-index-when-searching-multiple-indices/7028/2 "2017-07-06T03:35:56Z")

</div>


