Search within differnt indices get same amount of documents

Hello
I want to got the same amount of documents from different indices within one query
For Examples:
two indices Company / Person, both have a field called "name"
And I want to search all name match "smart", but I want got the same amount from Company and Person
I want get the result like this [ company1, company2, ..., Company5] AND [Person1, Person2, ..., Person5], as you see, 10Results with 5 Companys and 5 Persons
Besides, I'm using es5.3

So Anyone have some ideas?
Cheers

You can use the multisearch API and set the size for both queries to 5 may be?

3x I'll have a try

@dadoonet thanks for your kind
I finally got the right result, my code like this

GET test-1/_msearch
{"index" : "company"}
{"query" : {"match_all" : {}},"size":3}
{"index" : "person"}
{"query" : {"match_all" : {}},"size":3}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.