public class AggregateArgs extends Object
FT.AGGREGATE command.
FT.AGGREGATE runs a search query on an index and performs aggregate transformations on the results. It provides a powerful aggregation pipeline that can group, sort, apply mathematical expressions, filter, and limit results in a single command.
{
@code
// Simple aggregation with grouping and counting
AggregateArgs args = AggregateArgs.builder().groupBy("category").reduce(Reducer.count().as("count"))
.sortBy("count", SortDirection.DESC).build();
SearchReply result = redis.ftAggregate("myindex", "*", args);
}
{
@code
// Complex aggregation pipeline
AggregateArgs args = AggregateArgs.builder().load("price", "quantity", "category")
.apply("@price * @quantity", "total_value").filter("@total_value > 100").groupBy("category")
.reduce(Reducer.sum("@total_value").as("category_total")).reduce(Reducer.avg("@price").as("avg_price"))
.sortBy("category_total", SortDirection.DESC).limit(0, 10).dialect(QueryDialects.DIALECT2).build();
}
| Modifier and Type | Class and Description |
|---|---|
static class |
AggregateArgs.Apply
Represents an APPLY clause in an aggregation pipeline.
|
static class |
AggregateArgs.Builder
Builder for
AggregateArgs. |
static class |
AggregateArgs.CollectReducer
Represents a
REDUCE COLLECT clause in an aggregation pipeline. |
static class |
AggregateArgs.Filter
Represents a FILTER clause in an aggregation pipeline.
|
static class |
AggregateArgs.GroupBy
Represents a GROUPBY clause in an aggregation pipeline.
|
static class |
AggregateArgs.Limit |
static class |
AggregateArgs.LoadField |
static interface |
AggregateArgs.PipelineOperation
Interface for pipeline operations that need to be applied in user-specified order.
|
static class |
AggregateArgs.Reducer
Represents a REDUCE function in a GROUPBY clause.
|
static class |
AggregateArgs.SortBy
Represents a SORTBY clause in an aggregation pipeline.
|
static class |
AggregateArgs.SortDirection
Sort direction enumeration.
|
static class |
AggregateArgs.SortProperty
Represents a sort property with direction.
|
static class |
AggregateArgs.WithCursor |
| Constructor and Description |
|---|
AggregateArgs() |
| Modifier and Type | Method and Description |
|---|---|
void |
build(CommandArgs<?,?> args)
Build a
CommandArgs object that contains all the arguments. |
static AggregateArgs.Builder |
builder()
Creates a new
AggregateArgs instance. |
Optional<AggregateArgs.WithCursor> |
getWithCursor() |
public static AggregateArgs.Builder builder()
AggregateArgs instance.AggregateArgs.public void build(CommandArgs<?,?> args)
CommandArgs object that contains all the arguments.args - the CommandArgs objectpublic Optional<AggregateArgs.WithCursor> getWithCursor()
Copyright © 2026 lettuce.io. All rights reserved.