Return a result from every index when searching multiple indices

(philipDS) #1


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)
.addSort(sort, SortOrder.DESC)

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?

(system) #2