Configure index settings
Before filtering, make sure the relevant attributes are marked as filterable on each index. For example, configure three indexes with different filterable attributes:Send a multi-search request with different filters
Once your index settings are configured, send a multi-search request where each query uses its own filter and parameters:- The
productsquery filters by category and stock availability, sorts by price, and returns up to 5 results - The
articlesquery filters to only show articles published after a specific date and returns up to 3 results - The
usersquery has no filter and returns up to 3 results
Understand the response
The response contains one result set for each query, in the same order:Combine with federated mode
You can also use different filters per query in federated search mode by adding thefederation parameter. Each query retains its own filter, and results are merged into a single ranked list:
Key points
- Each query’s
filter,sort,limit,offset,attributesToRetrieve, and other parameters are scoped to that query only - A filter on one query does not affect results from other queries
- You must configure
filterableAttributesandsortableAttributesseparately on each index before using them in queries - Queries without filters are valid and return unfiltered results for that index
Next steps
Multi-search overview
Learn about both modes of multi-search
Filter search results
Learn how to configure and use filters