$boost operator adjusts the relevance score contribution of a field match.
This allows you to prioritize certain matches over others in the result ranking.
How Boosting Works
Search results are ordered by a relevance score that reflects how well each document matches the query. By default, all matching conditions contribute equally to this score. The$boost operator multiplies a match’s score contribution by the specified factor.
- Positive values greater than 1 increase the match’s importance (e.g.,
$boost: 2.0doubles the contribution) - Values between 0 and 1 decrease the match’s importance
- Negative values demote matches, pushing them lower in results
Use Cases
- Prioritize premium content: Boost matches in title fields over body text
- Promote featured items: Give higher scores to promoted products
- Demote less relevant matches: Use negative boosts to push certain matches down
Compatibility
The$boost operator can be used with any field type since it modifies the score rather than the matching behavior.
| Field Type | Supported |
|---|---|
| TEXT | Yes |
| U64/I64/F64 | Yes |
| DATE | Yes |
| BOOL | Yes |
Examples
- TypeScript
- Redis CLI