$facet builds a hierarchical bucket tree from FACET field paths.
Use it for category navigation and drill-down style faceting.
Compatibility
| Field Type | Supported |
|---|---|
| TEXT | No |
| U64/I64/F64 | No |
| DATE | No |
| BOOL | No |
| KEYWORD | No |
| FACET | Yes |
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
field | string | Yes | FACET field name. |
path | string | Yes | Root path to expand. Must start with /. |
depth | number | No | Levels to traverse (>= 1). Default: 1. |
size | number | No | Max children per level. Default: 10. |
minDocCount | number | No | Minimum docs required for a child bucket. Default: 1. |
order | object | No | One-key order object: { "count": "asc|desc" } or { "path": "asc|desc" }. Default: { "count": "desc" }. |
- TypeScript
- Python
- Redis CLI
Output
- Increase
depthfor multi-level facet trees. - Use
sizeandminDocCountto control noise and response size. - Use
orderto sort by count or by path.
- TypeScript
- Python
- Redis CLI
depth: 2, the response includes nested children:
$facetcannot contain$aggs.$facetcannot be used as a sub-aggregation inside another$aggsblock.