Minimum Should Match
What it is
In boolean queries, MUST clauses require matching; MUST NOT clauses forbid matching. SHOULD clauses are optional, improving score if matched. Minimum should match (MM) specifies the minimum number of SHOULD clauses that must match for a document to be retrieved.
How it works
Boolean query execution:
- MUST clauses: document must match all
- SHOULD clauses: optional; document matches if ≥ MM of them match
- MUST NOT clauses: document must not match any
- Scoring: MUST clauses contribute fixed importance; SHOULD matches increase score proportionally
MM can be specified as:
- Absolute count: “2” (at least 2 SHOULD clauses)
- Percentage: “75%” (at least 75% of SHOULD clauses)
- Expression: “1<-25% 9<-3” (1 below 9 terms: 25% of clauses; 9 or more: 3 clauses)
[illustrate: Query with multiple SHOULD clauses and varying MM thresholds showing which documents match]
Example
Query: (lucene OR elasticsearch OR solr) AND language:java
- MM=1: documents with java and any one search engine
- MM=2: documents with java and any two search engines
- MM=3: documents with java and all three search engines
Variants and history
Lucene and Elasticsearch both support MM configuration. Useful for precision tuning in complex disjunctive queries. Sometimes called “minimum match” or “match clauses”. Related to fuzzy matching (k of n constraints).
When to use it
Control recall-precision in complex queries with many SHOULD clauses. Use MM=1 for broad recall; increase MM to narrow results. Useful when query contains multiple variations or optional conditions. Allows query-time fine-tuning without reformulation.