# Federated / Multi Search

You can send multiple search requests in a single HTTP request, using the Multi-Search feature. This is especially useful to avoid round-trip network latencies incurred otherwise if each of these requests are sent in separate HTTP requests.

You can also use this feature to do a federated search across multiple collections in a single HTTP request. For eg: in an ecommerce products dataset, you can show results from both a "products" collection, and a "brands" collection to the user, by searching them in parallel with a multi_search request.

Sample Response


POST ${TYPESENSE_HOST}/multi_search

# multi_search Parameters

You can use any of the Search Parameters here for each individual search operation within a multi_search request.

In addition, you can use the following parameters with multi_search requests:

Parameter Required Description
limit_multi_searches no Max number of search requests that can be sent in a multi-search request. Eg: 20

Default: 50

You want to generate a scoped API key with this parameter embedded and use that API key to perform the search, so it's automatically applied and can't be changed at search time.
x-typesense-api-key no You can embed a separate search API key for each search within a multi_search request.

This is useful when you want to apply different embedded filters for each collection in individual scoped API keys.


The results array in a multi_search response is guaranteed to be in the same order as the queries you send in the searches array in your request.

# Example UI Implementation

Here's a demo Frontend app that shows you how to implement a Federated Search UI: federated-search.typesense.org (opens new window).

Here's the source code for it: https://github.com/typesense/showcase-federated-search/blob/master/src/app.js (opens new window)

Last Updated: 9/11/2023, 10:12:44 AM