Introducing multi-index search

Carolina Ferreira

Carolina Ferreira

Developer Advocate @ Meilisearch

··4 min read

Meilisearch v1.1 introduces the /multi-search endpoint. With this endpoint, users can now send multiple search queries on one or more indexes by bundling them into a single HTTP request. Essentially, the /multi-search endpoint paves the way for federated search

Federated search is available in Meilisearch 1.10 and highger.

Multi-index search with Meilisearch

With 277 votes, federated search was one of the most requested features. We are glad to finally announce the first stage of the feature.

We have introduced a /multi-search route that allows searching in multiple indexes with a single HTTP request. Suppose we have two indexes: movies and actors. Using the /multi-search endpoint, we can search for the name of an actress and retrieve both her biography and movies in the search results.

Take, for instance, the following multi-search request:

bash

The response will include a set of search results for each index searched:

JSON

As you can see, in the results array, the indexes are sorted in the same order as in the query. The response contains the usual fields that a conventional search returns along with the index UIDs. Note that, we restricted the number of documents returned to just one using the limit parameter in this example.

Multi-index search demo

Searching for 'Kate Winslet' returns both her biography and movies in which she starred, while searching for 'Titanic' returns the movie itself as well as actors who starred in it.

Try it yourself!

This demo uses two datasets: movies and actors. Each dataset is stored in its own index, has its own settings, and, as you can see in the example above, its own schema.

Since the two indexes have different schemas, they have different searchable attributes. In the movies index, you can search for a movie by its title, characters, actors, producers, directors, or movie overview.

JSON

The actors index allows you to search for actors by name, as well as the movies or shows they are most known for, and by keywords found in their biographies.

JSON

The full list of settings, dataset, and code are all available on GitHub, so feel free to explore them on your own. Don't hesitate to play around with the settings to customize the behavior to your needs. If you have ideas for improving the demo, like adding facets, don't hesitate to submit a pull request. All contributions are welcome!

Conclusion

We are excited to deliver this first iteration of federated search, and we’ll be working hard to push toward aggregated search results. We couldn't have achieved this without the valuable feedback and insights provided by our developer community. Your feedback has been instrumental in helping us prioritize and shape the feature to meet your needs.

If you're interested in keeping up with our progress, we encourage you to check out our product roadmap, join our discussions on GitHub, or connect with us on Discord.

As always, we are committed to providing our users with the best possible search experience and appreciate your help in achieving this goal.

Carolina Ferreira

Carolina Ferreira

Developer Advocate @ Meilisearch

Carolina joined Meilisearch in 2020 as a Developer Advocate. With a background in translation and teaching, she discovered programming by chance and quickly became passionate about it. She has worked in DevRel and tech support and is now transitioning into a Solution Engineer role, enjoying the diverse challenges along the way. Outside of work, she loves staying active, music, cinema, traveling, and exploring new cuisines—one of her favorite parts of any trip.

Related articles