$contains operator is designed for search-as-you-type and autocomplete scenarios.
It matches documents where the field contains all the specified terms, with the last term treated as a prefix.
For example, searching for "noise cancel" matches documents containing:
- “noise cancelling” (the “cancel” prefix matches “cancelling”)
- “noise cancellation”
- “noise cancelled”
Compatibility
| Field Type | Supported |
|---|---|
| TEXT | Yes |
| U64/I64/F64 | No |
| DATE | No |
| BOOL | No |
Examples
- TypeScript
- Redis CLI