FT.AGGREGATE
Run a search query on an index and perform aggregate transformations on the results
Browse all commands · Upstream source documentation
| Reference field | Value |
|---|---|
| Canonical name | FT.AGGREGATE |
| Catalog group | Search commands |
| Upstream since | 1.1.0 — upstream Redis/module version, not an ffkv release |
| Pinned catalog | Redis 8.10.0 |
Syntax
Section titled “Syntax”FT.AGGREGATE index query [VERBATIM] [ADDSCORES] [WITHCOUNT | WITHOUTCOUNT] [FORMAT STRING | EXPAND] [LOAD count field [AS alias] ... | LOAD *] [GROUPBY count property ... [REDUCE function nargs arg ... [AS alias]] ...] [APPLY expression AS name] [FILTER expression] [SORTBY count property [ASC | DESC] ... [MAX count]] [LIMIT offset count] [WITHCURSOR [COUNT count] [MAXIDLE milliseconds]] [PARAMS nargs name value ...] [DIALECT version] [TIMEOUT milliseconds]The pinned catalog leaves this syntax empty. This grammar is supplied from src/engine/search/pipeline.rs and the actual aggregation scenarios in tests/bdd/features/search.feature; pipeline clauses may be repeated.
ffkv behavior and limits
Section titled “ffkv behavior and limits”Search worker configuration controls a real Rayon pool; GC schedules generation-fenced Rust compaction, not a POSIX fork. Search indexes and documents are bounded and RAM-resident; upstream syntax is not a promise of every option combination or Redis module ABI parity.
Source: README.md:375–377, 636–642; src/engine/search/; tests/bdd/features/search.feature.
All requests share the 8 MiB framing/1,024-argument ingress limit; normal RESP replies have 64 MiB wire/logical budgets with bounded nesting/value counts. Management and Lua origins impose smaller budgets. These are not a process RSS cap. Catalog inclusion is not exhaustive option or wire-format parity. See limits and compatibility.
Metadata availability
Section titled “Metadata availability”This command is in the canonical catalog but has no matching entry in the pinned src/command_metadata.json. Argument flags, complexity and key specifications are not invented. Use the syntax, upstream source documentation and actual scenario evidence below.
BDD coverage and source examples
Section titled “BDD coverage and source examples”These are source observations, not a test run performed by this documentation build. A tag identifies scenario intent; an extracted vector identifies a command invocation, which may intentionally produce an error. Scenarios may require setup, multiple connections, persistence, cluster nodes or native-module fixtures.
- Ordered transformations feed genuine grouped reducers —
tests/bdd/features/search.feature:511; command tag and invocation observed. - Global reducers consume all input rows exactly once —
tests/bdd/features/search.feature:532; command tag and invocation observed. - Repeated grouping preserves stage order and sorted distinct records —
tests/bdd/features/search.feature:565; command tag and invocation observed. - A cursor advances real pipeline state without duplicate or skipped rows —
tests/bdd/features/search.feature:598; invocation observed. - Deleted cursor handles cannot be reused —
tests/bdd/features/search.feature:637; invocation observed. - Invalid query schema and pipeline options fail without document mutation (Scenario Outline) —
tests/bdd/features/search.feature:1027; command tag and invocation observed. - COLLECT preserves nested stage-local records across chained grouping —
tests/bdd/features/search.feature:1058; command tag and invocation observed. - Expressions compose string arithmetic conditional and UTC date functions —
tests/bdd/features/search.feature:1075; command tag and invocation observed. - Search payloads and aggregate LOAD remain binary safe —
tests/bdd/features/search.feature:1092; command tag and invocation observed.
Extracted command vectors
Section titled “Extracted command vectors”The following JSON arrays are the test harness’s argument vectors, not shell commands. Numeric arguments are converted by the harness; objects of the form {"base64":"…"} represent decoded binary bytes, not a literal JSON command argument. Preserve scenario setup and connection ordering. See the CLI guide for shell quoting and binary stdin. No reply is invented or inferred.
Search payloads and aggregate LOAD remain binary safe — tests/bdd/features/search.feature:1106 (I execute:)
[ "FT.AGGREGATE", "idx", "*", "LOAD", "1", "@blob"]Next source assertion: the reply equals:
[1,["blob",{"type":"bytes","base64":"/wA="}]]Repeated grouping preserves stage order and sorted distinct records — tests/bdd/features/search.feature:572 (client “aggregate” executes:)
[ "FT.AGGREGATE", "idx", "*", "LIMIT", "0", "1", "GROUPBY", "1", "@g", "REDUCE", "SUM", "1", "@n", "AS", "sum"]Next source assertion: the reply contains:
{"total_results":1,"results":[{"extra_attributes":{"g":"a","sum":{"$approx":1}}}]}A cursor advances real pipeline state without duplicate or skipped rows — tests/bdd/features/search.feature:604 (I execute:)
[ "FT.AGGREGATE", "idx", "*", "WITHCOUNT", "LOAD", "1", "@title", "SORTBY", "2", "@title", "ASC", "WITHCURSOR", "COUNT", "1"]Next source assertion: the reply has JSON path “0” equal to:
[4,["title","a"]]