> ## Documentation Index
> Fetch the complete documentation index at: https://www.meilisearch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Search with different filters per index

> Apply different filters, sorting, and parameters to each index in a multi-search request.

Each query in a [multi-search](/capabilities/multi_search/overview) request is independent. This means you can apply different [filters](/capabilities/filtering_sorting_faceting/getting_started), [sorting](/capabilities/filtering_sorting_faceting/how_to/sort_results) rules, and search parameters to each index in the same request. This is useful when your indexes have different structures or when each content type requires different filtering logic.

## 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:

<CodeGroup>
  ```bash theme={null}
  # Products: filter by category and price
  curl \
    -X PATCH 'MEILISEARCH_URL/indexes/products/settings' \
    -H 'Content-Type: application/json' \
    --data-binary '{
      "filterableAttributes": ["category", "price", "in_stock"],
      "sortableAttributes": ["price"]
    }'

  # Articles: filter by published date and topic
  curl \
    -X PATCH 'MEILISEARCH_URL/indexes/articles/settings' \
    -H 'Content-Type: application/json' \
    --data-binary '{
      "filterableAttributes": ["published_at", "topic"]
    }'

  # Users: no filters needed
  ```
</CodeGroup>

## 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:

<CodeGroup>
  ```bash theme={null}
  curl \
    -X POST 'MEILISEARCH_URL/multi-search' \
    -H 'Content-Type: application/json' \
    --data-binary '{
      "queries": [
        {
          "indexUid": "products",
          "q": "keyboard",
          "filter": "category = electronics AND in_stock = true",
          "sort": ["price:asc"],
          "limit": 5
        },
        {
          "indexUid": "articles",
          "q": "keyboard",
          "filter": "published_at > 1704067200",
          "limit": 3
        },
        {
          "indexUid": "users",
          "q": "keyboard",
          "limit": 3
        }
      ]
    }'
  ```
</CodeGroup>

In this example:

* The `products` query filters by category and stock availability, sorts by price, and returns up to 5 results
* The `articles` query filters to only show articles published after a specific date and returns up to 3 results
* The `users` query 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:

<CodeGroup>
  ```json theme={null}
  {
    "results": [
      {
        "indexUid": "products",
        "hits": [
          { "id": 42, "name": "Mechanical Keyboard", "category": "electronics", "price": 79.99 }
        ],
        "query": "keyboard",
        "limit": 5,
        "estimatedTotalHits": 12
      },
      {
        "indexUid": "articles",
        "hits": [
          { "id": 7, "title": "Best Keyboards of 2025", "topic": "reviews" }
        ],
        "query": "keyboard",
        "limit": 3,
        "estimatedTotalHits": 4
      },
      {
        "indexUid": "users",
        "hits": [
          { "id": 101, "name": "KeyboardEnthusiast99" }
        ],
        "query": "keyboard",
        "limit": 3,
        "estimatedTotalHits": 1
      }
    ]
  }
  ```
</CodeGroup>

## Combine with federated mode

You can also use different filters per query in [federated search](/capabilities/multi_search/getting_started/federated_search) mode by adding the `federation` parameter. Each query retains its own filter, and results are merged into a single ranked list:

<CodeGroup>
  ```bash theme={null}
  curl \
    -X POST 'MEILISEARCH_URL/multi-search' \
    -H 'Content-Type: application/json' \
    --data-binary '{
      "federation": {},
      "queries": [
        {
          "indexUid": "products",
          "q": "keyboard",
          "filter": "category = electronics"
        },
        {
          "indexUid": "articles",
          "q": "keyboard",
          "filter": "published_at > 1704067200"
        }
      ]
    }'
  ```
</CodeGroup>

## 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 [`filterableAttributes`](/capabilities/filtering_sorting_faceting/getting_started) and [`sortableAttributes`](/capabilities/filtering_sorting_faceting/how_to/sort_results) separately on each index before using them in queries
* Queries without filters are valid and return unfiltered results for that index

## Next steps

<CardGroup cols={2}>
  <Card title="Multi-search overview" href="/capabilities/multi_search/overview">
    Learn about both modes of multi-search
  </Card>

  <Card title="Filter search results" href="/capabilities/filtering_sorting_faceting/getting_started">
    Learn how to configure and use filters
  </Card>
</CardGroup>
