Skip to main content
The $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”
This differs from a simple term search because complete words must match exactly, while only the last word can be a partial match. This makes it ideal for search boxes where users type incrementally.

Compatibility

Field TypeSupported
TEXTYes
U64/I64/F64No
DATENo
BOOLNo

Examples

// TODO: SDK does not support $contains operator