- “What is the average price?”
- “How many unique users do we have?”
- “How many orders fall into each price range?”
- “How does traffic change per hour/day?”
- TypeScript
- Python
- Redis CLI
- Document selection: Optional
filterselects which documents participate. - Aggregation computation: the selected set is reduced into metric values and/or buckets.
Response Format
- TypeScript
- Python
- Redis CLI
Filtering
Usefilter to restrict which documents participate in the aggregation.
Filtering uses the same query syntax as queries.
- TypeScript
- Python
- Redis CLI
Multiple Aggregations in One Request
You can compute multiple top-level aggregations in one call by defining multiple aliases underaggregations.
Each alias is computed against the same filtered document set.
- TypeScript
- Python
- Redis CLI
Nested Aggregations
Bucket operators can include sub-aggregations via$aggs, so you can compute per-bucket metrics.
$terms,$range,$histogram, and$dateHistogramsupport nested$aggs.$facetdoes not support nested$aggs.- Metric operators do not support nested
$aggs.
- TypeScript
- Python
- Redis CLI
Operator Families
Metric Aggregations
Metric aggregations return numeric summaries.
See the metric overview.
Bucket Aggregations
Bucket aggregations partition documents into groups.
See the bucket overview.