Skip to main content

Pagination with Limit

Use limit() to control how many results to return and offset to skip results for pagination.

Limit Parameters

Pagination Patterns

Field Selection with Select

Control which fields are returned in your results to optimize data transfer and processing.

Selectable Fields

Performance Considerations

Selecting fewer fields improves performance by reducing data transfer:
  • Minimal: IDs only (default) - fastest queries
  • Moderate: Add scores and specific metadata fields
  • Heavy: Including documents and embeddings - larger payloads
  • Maximum: select_all() - returns everything

Edge Cases

No Limit Specified

Without a limit, the search attempts to return all matching results, but will be capped by quota limits in Chroma Cloud.

Empty Results

When no documents match, results will have empty lists/arrays.

Non-existent Fields

Selecting non-existent metadata fields simply omits them from the results - they won’t appear in the metadata dict.

Complete Example

Here’s a practical example combining pagination with field selection:

Tips and Best Practices

  • Select only what you need - Reduces network transfer and memory usage
  • Use appropriate page sizes - 10-50 for UI, 100-500 for batch processing
  • Consider bandwidth - Avoid selecting embeddings unless necessary
  • IDs are always included - No need to explicitly select them
  • Use select_all() sparingly - Only when you truly need all fields

Next Steps