Skip to main content
POST
/
multi-search
cURL
curl \
  -X POST 'MEILISEARCH_URL/multi-search' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "queries": [
      {
        "indexUid": "movies",
        "q": "pooh",
        "limit": 5
      },
      {
        "indexUid": "movies",
        "q": "nemo",
        "limit": 5
      },
      {
        "indexUid": "movie_ratings",
        "q": "us"
      }
    ]
  }'
{
  "hits": [
    {
      "id": 42,
      "title": "Batman returns",
      "overview": "The overview of batman returns",
      "_federation": {
        "indexUid": "movies",
        "queriesPosition": 0
      }
    },
    {
      "comicsId": "batman-killing-joke",
      "description": "This comic is really awesome",
      "title": "Batman: the killing joke",
      "_federation": {
        "indexUid": "comics",
        "queriesPosition": 1
      }
    }
  ],
  "processingTimeMs": 0,
  "limit": 20,
  "offset": 0,
  "estimatedTotalHits": 2,
  "semanticHitCount": 0
}

Authorizations

Authorization
string
header
required

An API key is a token that you provide when making API calls. Read more about how to secure your project.

Include the API key to the Authorization header, for instance:

-H 'Authorization: Bearer 6436fc5237b0d6e0d64253fbaac21d135012ecf1'

If you use a SDK, ensure you instantiate the client with the API key, for instance with JS SDK:

const client = new MeiliSearch({
host: 'MEILISEARCH_URL',
apiKey: '6436fc5237b0d6e0d64253fbaac21d135012ecf1'
});

Body

application/json

Request body for federated multi-search across multiple indexes. This allows you to execute multiple search queries in a single request and optionally combine their results into a unified response. Use this for cross-index search scenarios or to reduce network round-trips.

queries
object[]
required

An array of search queries to execute. Each query can target a different index and have its own parameters. When federation is null, results are returned separately for each query. When federation is set, results are merged.

federation
null | object

Configuration for combining results from multiple queries into a single response. When set, results are merged and ranked together. When null, each query's results are returned separately in an array.

Response

Federated multi-search.

Response from a federated multi-search query

hitsPerPage
integer
required

Number of results per page.

Required range: x >= 0
page
integer
required

Current page index (1-based).

Required range: x >= 0
totalPages
integer
required

Exhaustive total number of result pages.

Required range: x >= 0
totalHits
integer
required

Exhaustive total number of matching documents.

Required range: x >= 0
hits
object[]
required

Combined search results from all queries

processingTimeMs
integer
required

Total processing time in milliseconds

Required range: x >= 0
queryVectors
object | null
facetDistribution
object | null
facetStats
object | null

Merged facet statistics across all indexes

facetsByIndex
object

Facets grouped by index

requestUid
string<uuid> | null

Unique identifier for the request

metadata
object[] | null

Metadata for each query

remoteErrors
object | null

Errors from remote servers

semanticHitCount
integer<u-int32> | null
Required range: x >= 0
performanceDetails
any