Skip to main content
Chroma is a lightweight, embeddable vector database designed for rapid prototyping and local development. It supports persistent storage, cloud deployments, and ephemeral in-memory databases with minimal configuration.

Key features

  • Local persistent storage: File-based storage without external dependencies
  • Ephemeral mode: In-memory databases for testing
  • Cloud deployment: Hosted Chroma instances
  • Hybrid search: Experimental support for dense + sparse vectors
  • Multi-tenancy: Tenant and database isolation
  • Metadata filtering: Chroma-native filter syntax

Installation

Chroma requires pysqlite3 for compatibility:

Connection

Local persistent client

Default mode for development:

Ephemeral client

In-memory for testing:

Cloud/remote client

From config file

configs/chroma.yaml

Collection creation

Basic collection

With custom embedding function

With metadata

Upserting documents

From Haystack documents

From raw dictionaries

Chroma automatically flattens nested metadata. Nested dicts use dot notation: {"user.id": 123} instead of {"user": {"id": 123}}.

Querying

Text search with auto-embedding

Requires collection with embedding function:

Metadata filtering

Chroma uses its own filter syntax:

Document content filtering

Hybrid search (experimental)

Chroma’s hybrid search is available on hosted/cloud instances:
Hybrid search requires Chroma 0.6.0+ and hosted/cloud environments. Local instances fall back to standard query().

Multi-tenancy

Tenant and database isolation

List collections

Deleting documents

Delete by IDs

Delete by filter

Deleting collections

Converting results

To Haystack Documents

Score conversion

Chroma returns distances (0-2 for cosine). VectorDB converts to similarity scores:

Metadata flattening

Chroma requires flat metadata. Nested structures are automatically flattened:
Manual flattening:

Best practices

Persistent storage survives process restarts:
Keep metadata flat and scalar for optimal filtering:
Use tenant/database scoping for multi-tenancy:
Use get_or_create=True for idempotent collection creation:

Limitations

Empty metadata handling

Chroma 1.4+ requires non-empty metadata or None:

Hybrid search availability

Hybrid search requires:
  • Chroma 0.6.0+
  • Hosted/cloud environment
  • Falls back to standard query on local instances

Scalar metadata only

Complex types are converted to strings:

Error handling

Source reference

Implementation: src/vectordb/databases/chroma.py Key classes and methods:
  • ChromaVectorDB.__init__(): src/vectordb/databases/chroma.py:75
  • create_collection(): src/vectordb/databases/chroma.py:220
  • upsert(): src/vectordb/databases/chroma.py:269
  • query(): src/vectordb/databases/chroma.py:329
  • search(): src/vectordb/databases/chroma.py:435
  • flatten_metadata(): src/vectordb/databases/chroma.py:593