Skip to content

Aggregate

Aggregate (aggregate)

Aggregate events by key and emit summary statistics.

Transform json

Minimal example

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

Contents

Fields

FieldTypeRequiredDescription
description Generalstringdescribe this step.
condition GeneralstringOnly run this action if the condition is met.
group-by Groupingstring[]Fields used to compute the grouping key (optional).
aggregationsAggregations[]Aggregations to compute for each group.
time-field Windowingfield (string)Field containing the event timestamp (ISO 8601).
Examples: data_field
window WindowingWindowOptional window definition for tumbling windows.
allowed-lateness WindowingstringAllow events to arrive up to this duration late (e.g. ”30s”).
aggregate-trigger TriggerAggregate TriggerTrigger policy controlling emission cadence.
max-groups Resourcesnumber (integer)Maximum distinct groups tracked in-memory (new groups beyond this limit are dropped).
Examples: 42, 1.2e-10
output OutputOutputOutput configuration (per-window record or expand).
Allowed values: per-window-record, expand-records
state StateStateState configuration (in-memory or spill-to-disk).
reset-on-document Behaviourboolean (bool)Reset aggregation state on document boundaries.

General

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

Grouping

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

Windowing

Show fields
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”).

Trigger

Show fields
FieldTypeRequiredDescription
aggregate-triggerAggregate TriggerTrigger policy controlling emission cadence.

Resources

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

Output

Show fields
FieldTypeRequiredDescription
outputOutputOutput configuration (per-window record or expand).
Allowed values: per-window-record, expand-records

State

Show fields
FieldTypeRequiredDescription
stateStateState configuration (in-memory or spill-to-disk).

Behaviour

Show fields
FieldTypeRequiredDescription
reset-on-documentboolean (bool)Reset aggregation state on document boundaries.

Schema

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.
opOpAggregation operation.
Allowed values: count, sum, mean, min, max, first, last, stddev, …
r-asstringAlias for the output field (defaults to op_field).

Window Fields

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

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.

State - Spill To Disk Fields

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

Aggregations - Op Options

ValueDescription
countCount
sumSum
meanMean
minMin
maxMax
firstFirst
lastLast
stddevStddev
varianceVariance
z-scoreZ Score

Output Options

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