> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

Metric aggregations compute summary numbers over all documents that matched your `filter`.

Use metrics when you want one value (or stats object), not grouped buckets.

### Available Operators

| Operator                             | What it computes                              |
| ------------------------------------ | --------------------------------------------- |
| [`$avg`](./avg)                      | Arithmetic mean                               |
| [`$sum`](./sum)                      | Total of values                               |
| [`$min`](./min)                      | Smallest value                                |
| [`$max`](./max)                      | Largest value                                 |
| [`$count`](./count)                  | Count of values                               |
| [`$cardinality`](./cardinality)      | Count of distinct values                      |
| [`$stats`](./stats)                  | `count`, `sum`, `min`, `max`, `avg`           |
| [`$extendedStats`](./extended-stats) | `$stats` + variance and std deviation metrics |
| [`$percentiles`](./percentiles)      | Distribution percent points                   |

### Input Format

Every metric operator takes an object with at least a `field` property:

```json theme={"system"}
{"alias_name": {"$avg": {"field": "price"}}}
{"alias_name": {"$avg": {"field": "price", "missing": 0}}}
```

The `field` value must be a string pointing to a FAST field in your schema.

### Behavior Notes

* Metric operators require a `field`.
* The field must be `FAST` in your schema.
* Metric operators do not support nested `$aggs`.
* For many metric operators, `missing` lets you provide a fallback value for documents where the field does not exist.
