Skip to main content
In standard (conjunctive) faceted navigation, selecting “Red” in the color facet filters the entire result set, including the color facet counts. The result: “Blue” drops to 0 because no document is both Red and Blue. Users cannot compare options within the same facet group. Disjunctive facets solve this. When a user selects “Red”, the color facet still shows “Blue (15), Green (8)” with their unfiltered counts, while other facet groups (brand, size) update normally. This is the pattern used by most ecommerce sites.

How it works

Meilisearch does not have a built-in disjunctive facet mode. Instead, you implement it client-side using multi-search. The idea is to send multiple queries in a single request:
  1. One main query with all active filters applied, returning the hits and facet counts for non-disjunctive groups
  2. One query per disjunctive facet group where you remove the filters for that group, so its counts reflect the broader result set
For example, if the user has selected color = Red and brand = Nike:

Implementation

Step 1: track active filters by group

Organize your active filters by facet group so you can selectively exclude each group:

Step 2: build the multi-search request

For each facet group that has active selections, create an additional query that excludes that group’s filters:
Setting limit: 0 on the per-group queries avoids fetching duplicate hits. You only need the facetDistribution from these queries.

Step 3: send the multi-search request

Step 4: merge facet distributions

Combine the facet distributions from all queries into a single object for your UI:
The first result contains the actual search hits. The remaining results contribute their facet distributions. Since each facet group appears in exactly one query, merging is a simple assignment with no conflicts.

Full example

Putting it all together with a complete search function:

Performance considerations

Disjunctive facets require one additional query per facet group with active selections. In practice this is fast because:
  • Multi-search executes all queries in a single HTTP request
  • Per-group queries set limit: 0, so Meilisearch skips ranking and document retrieval
  • Meilisearch processes multi-search queries concurrently
For most applications, the total response time is comparable to a single search request. If you have many facet groups (10+), consider only making disjunctive queries for groups that the user has actively filtered on.

Next steps

Multi-search

Learn more about multi-search and how to batch queries.

Build faceted navigation

Standard faceted navigation pattern for simpler use cases.

Optimize facet performance

Reduce indexing time and search latency for faceted search.