Skip to main content
Metadata provides additional context about your documents, enabling powerful filtering and organization capabilities.

What is Metadata?

Metadata is structured information attached to each record in your collection. It consists of key-value pairs that describe attributes of your documents:

Supported Data Types

Chroma supports several metadata value types:

Primitive Types

List Types

Metadata values can be lists of primitive types:
Lists must be:
  • Non-empty
  • Homogeneous (all elements same type)
  • Contain only str, int, float, or bool

Sparse Vectors

Store sparse vector data efficiently in metadata:
Sparse vectors in metadata:
  • Must have sorted, unique indices
  • All arrays must have matching lengths
  • Validated automatically via __post_init__

Reserved Keys

Chroma reserves certain metadata keys for internal use:
Avoid keys starting with chroma: to prevent conflicts.

Adding Metadata

Single Record

Multiple Records

Without Documents

You can add records with embeddings and metadata but no documents:

Updating Metadata

Update metadata for existing records:
This replaces the entire metadata for the specified IDs.

Filtering with Metadata

Use the where parameter to filter results based on metadata:

Basic Equality

Comparison Operators

List Operators

Array Membership Operators

Logical Operators

Combine multiple conditions:

Filtering Documents

Filter based on document content using where_document:

Combining Metadata and Document Filters

Querying with Filters

Combine similarity search with metadata filtering:
This finds the 10 most similar documents that:
  • Are in the “research” category
  • Were published in 2020 or later
  • Contain “neural network” in the text

Type Definitions

From chromadb/base_types.py:

Validation

Chroma validates metadata to ensure data integrity:

Best Practices

Define a consistent structure for metadata across records:
Plan your metadata based on how you’ll query:
Choose the right type for your data:
Use consistent formatting and casing:

Next Steps

Querying

Learn about querying with metadata filters

Collections

Understand collection organization

Filtering Guide

Advanced filtering techniques

API Reference

Collection API methods