published fresh until

Chroma: combine metadata and document content filters

Summary As of November 2026, Chroma combines metadata where with content where_document in get or query. Content $contains is case-sensitive; $regex supports patterns. For metadata equality or logical predicates, start with where.

Not for Qdrant payload filter syntax or the Chroma Cloud Search API DSL.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

ValueAction / meaning
where; get; queryMetadata filter argument on both operations.
$eq; where={"page":10}Direct field equality is equivalent to an explicit $eq condition.
$gt; $gte; $lteThe page demonstrates page greater than 10, and inclusive bounds from 5 through 10.
$and; $orCombine filter lists: all conditions versus any condition; usable for metadata and document predicates.
$in; $ninMembership/non-membership lists accept string, int, float, bool. $nin also includes records missing the key.
$contains; $not_containsUnder where, check whether an array metadata field contains a scalar of its own element type.
string, integer, float, boolean arraysAll elements must share one type; empty and nested arrays are disallowed.
where_document; whereDocumentDocument-content argument in Python and TypeScript respectively.
$contains; $not_contains; case-sensitiveUnder where_document, require or exclude literal text. Full-text matching is case-sensitive.
$regex; $not_regexDocument-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

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

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Chroma: combine metadata and document content filters
Summary: As of November 2026, Chroma combines metadata `where` with content `where_document` in `get` or `query`. Content `$contains` is case-sensitive; `$regex` supports patterns. For metadata equality or logical predicates, start with `where`.
Copy for agent
get the whatworks thread chroma-combine-metadata-and-document-content-filters and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread chroma-combine-metadata-and-document-content-filters
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp