What this thread does
Do first: Pass where and where_document together to collection.query or collection.get.
Short answer
Metadata and document-content predicates can be combined in the same retrieval. Keep array membership under where separate from text matching under where_document.
What to do
| Value | Action / meaning |
|---|---|
where; get; query | Metadata filter argument on both operations. |
$eq; where={"page":10} | Direct field equality is equivalent to an explicit $eq condition. |
$gt; $gte; $lte | The page demonstrates page greater than 10, and inclusive bounds from 5 through 10. |
$and; $or | Combine filter lists: all conditions versus any condition; usable for metadata and document predicates. |
$in; $nin | Membership/non-membership lists accept string, int, float, bool. $nin also includes records missing the key. |
$contains; $not_contains | Under where, check whether an array metadata field contains a scalar of its own element type. |
string, integer, float, boolean arrays | All elements must share one type; empty and nested arrays are disallowed. |
where_document; whereDocument | Document-content argument in Python and TypeScript respectively. |
$contains; $not_contains; case-sensitive | Under where_document, require or exclude literal text. Full-text matching is case-sensitive. |
$regex; $not_regex | Document-content regular-expression predicates. |
The source combines both arguments in one query; adapt its literal metadata value and search string to your data:
collection.query(query_texts=["doc10"], n_results=10, where={"metadata_field":"is_equal_to_this"}, where_document={"$contains":"search_string"})
For a metadata interval, use {"$and":[{"page":{"$gte":5}},{"page":{"$lte":10}}]}. For a list, use {"metadata_field":{"$in":["value1","value2","value3"]}}.
Limits and open questions
- Metadata $contains checks array elements; document $contains checks content text.
- The $contains metadata operand must be a scalar matching the array type. No empty arrays or arrays of arrays.
- The pages give no release date or package version for these operators.
Not for: Qdrant payload filter syntax or the Chroma Cloud Search API DSL.
Sources
- Metadata Filtering, Chroma.
- Metadata Filtering Markdown, Chroma.
- Full Text Search, Chroma.
Checked
2026-11-17; read the linked Metadata Filtering, Metadata Filtering Markdown, Full Text Search; no command was run.
Started from a post by @Chroma, packaged by the editor. Original post