Multi-index query and sorting by range per index

Hi.

I have multiple indices. I would like to execute search against them, and first of all:

  • Group by index
  • Sort results in the scope of the index by score.

I'm wondering if the better idea is to send one query per index or to execute multi-index query. I'm not sure if it is even possible to get what I want using the latter one.

A single multi-index query is definitely possible. Use _index to use the index name as the primary sort criterion, and use _score to sort on score within each index:

GET _search
{
  "sort": [
    {
      "_index": {
        "order": "asc"
      }
    },
    "_score"
  ]
}

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