I'd like the top k hits from each index to be returned, I'm using the following query:
GET /index-*/_search
{
"query": {
"multi_match": {
"query": "word1 word2",
"type": "phrase",
"fields": ["field1", "field2]
}
},
"aggs": {
"byindex": {
"terms": {
"field": "_index",
"size" : 3
}
},
"aggs": {
"top_hits": {
"size": 1
}
}
}
}
similar to this thread, but I'm given the top hit from all buckets rather than from each bucket. What's wrong with my query?