$terms groups documents by distinct field values.
Each distinct value becomes one bucket with its own docCount.
Compatibility
Field must be
FAST.
Arguments
- TypeScript
- Python
- Redis CLI
Output
sumOtherDocCountis the number of matching documents that fell outside the returned buckets.
Count accuracy
docCountErrorUpperBound reports the maximum possible error on the returned counts (set showTermDocCountError: true for per-bucket values), and sumOtherDocCount is the number of matching documents not included in the returned buckets. Raising segmentSize reduces the error at the cost of more work per query. For an exact count of a specific term, use SEARCH.COUNT instead of reading it from a bucket.