The
query() and get() methods will continue to be supported, so migration to the Search API is optional.Parameter Mapping
The Search API is available in Chroma Cloud. This guide uses dictionary syntax for minimal migration effort.
query() Parameters
Legacy query() | Search API | Notes |
|---|---|---|
query_embeddings | rank={"$knn": {"query": ...}} | Can use text or embeddings |
query_texts | rank={"$knn": {"query": "text"}} | Text queries now supported |
query_images | Not yet supported | Image queries coming in future release |
query_uris | Not yet supported | URI queries coming in future release |
n_results | limit | Direct mapping |
ids | where={"#id": {"$in": [...]}} | Filter by IDs |
where | where | Same syntax |
where_document | where={"#document": {...}} | Use #document field |
include | select | See field mapping below |
get() Parameters
Legacy get() | Search API | Notes |
|---|---|---|
ids | where={"#id": {"$in": [...]}} | Filter by IDs |
where | where | Same syntax |
where_document | where={"#document": {...}} | Use #document field |
limit | limit | Direct mapping |
offset | limit={"offset": ...} | Part of limit dict |
include | select | See field mapping below |
Include/Select Field Mapping
Legacy include | Search API select | Description |
|---|---|---|
"ids" | Always included | IDs are always returned |
"documents" | "#document" | Document content |
"metadatas" | "#metadata" | All metadata fields |
"embeddings" | "#embedding" | Vector embeddings |
"distances" | "#score" | Distance/score from query |
"uris" | "#uri" | Document URIs |
Examples
Basic Similarity Search
Document Filtering
Combined Filters
Get by IDs
Pagination
Key Differences
Text Queries Now Supported
The Search API supports text queries directly - they are automatically converted to embeddings using the collection’s configured embedding function.New Capabilities
- Advanced filtering - Complex logical expressions
- Custom ranking - Combine and transform ranking expressions
- Hybrid search - RRF for combining multiple strategies
- Selective fields - Return only needed fields
- Flexible batch operations - Different parameters per search in batch
Flexible Batch Operations
The Search API allows different parameters for each search in a batch:Migration Tips
- Start with simple queries before complex ones
- Test both APIs in parallel during migration
- Use batch operations to reduce API calls
- Text queries are now supported - use them directly in the Search API
Next Steps
- Search Basics - Core search concepts
- Filtering - Advanced filtering options
- Examples - Practical search patterns