Skip to content

Aggregate

Aggregate (aggregate)

Aggregate events by key and emit summary statistics.

Stateful Transform json

Minimal example

actions:
- aggregate: {}
JSON
{
"actions": [
{
"aggregate": {}
}
]
}

Contents

Fields

FieldTypeRequiredDescription
aggregationsAggregations[]Aggregations to compute for each group.

Behaviour

Behaviour
FieldTypeRequiredDescription
reset-on-documentboolean (bool)Reset aggregation state on document boundaries.
Default: false

General

General
FieldTypeRequiredDescription
descriptionstringdescribe this step.
conditionstringOnly run this action if the condition is met.

Grouping

Grouping
FieldTypeRequiredDescription
group-bystring[]Fields used to compute the grouping key (optional).

Output

Output
FieldTypeRequiredDescription
outputAggregation OutputOutput configuration (per-window record or expand).
Allowed values: per-window-record, expand-records

Resources

Resources
FieldTypeRequiredDescription
max-groupsnumber (integer)Maximum distinct groups tracked in-memory (new groups beyond this limit are dropped).
Examples: 42, 1.2e-10

State

State
FieldTypeRequiredDescription
stateAggregation StateState configuration (in-memory or spill-to-disk).
Allowed values: in-memory, spill-to-disk

Trigger

Trigger
FieldTypeRequiredDescription
aggregate-triggerAggregate TriggerTrigger policy controlling emission cadence.

Windowing

Windowing
FieldTypeRequiredDescription
time-fieldfield (string)Field containing the event timestamp (ISO 8601).
Examples: data_field
windowWindowOptional window definition for tumbling windows.
allowed-latenessstringAllow events to arrive up to this duration late (e.g. ”30s”).

Schema

Aggregation State Options

OptionNameTypeDescription
in-memoryIn Memorymap
spill-to-diskSpill To DiskobjectPersist state to disk under the job data directory configured for the runtime.

Aggregations Fields

FieldTypeRequiredDescription
fieldstringSource field for aggregation.
opAggregation FunctionAggregation operation.
Allowed values: count, sum, mean, min, max, first, last, stddev, variance, z-score
r-asstringAlias for the output field (defaults to op_field).

Aggregation State - Spill To Disk Fields

FieldTypeRequiredDescription
dirstringSubdirectory (or relative path) within the job data directory to store spill files.

Aggregate Trigger Fields

FieldTypeRequiredDescription
countnumber (integer)Emit after this many events per group.
Examples: 42, 1.2e-10
intervalstringEmit periodically based on processing time (e.g. ”30s”).
on-window-closeboolean (bool)Emit when a window closes.
Default: false

Window Fields

FieldTypeRequiredDescription
sizestringWindow size (e.g. “1m”).
offsetstringOptional offset applied to the window (e.g. ”10s”).

Aggregations - Aggregation Function Options

ValueNameDescription
countcountCount
sumsumSum
meanmeanMean
minminMin
maxmaxMax
firstfirstFirst
lastlastLast
stddevstddevStddev
variancevarianceVariance
z-scorez-scoreZ Score

Aggregation Output Options

ValueNameDescription
per-window-recordper-window-recordEmit a single record summarising the window/group
expand-recordsexpand-recordsExpand aggregated results into individual events per source event