Merge contiguous temporal intervals into consolidated video moments, grouped by parent object
The Moment Group stage takes frame-level or chunk-level documents with temporal metadata and merges contiguous intervals into consolidated video moments (time ranges), grouped by parent object. Instead of returning individual frames that matched a query, you get precise start/end time ranges pinpointing where in a video the match occurs.
Stage Category: REDUCE (Merges intervals into moments)Transformation: N frame/chunk documents → M consolidated moments per parent video
Input documents must have temporal intervals — either query_chunks with start_ms/end_ms (attached by feature_search preprocessing) or document-level time fields.
The parent_field must exist on the documents so results can be grouped by source video/object.
Field to group results by parent video/object. Common values: source_object_id (standard ingest lineage), root_object_id (top-level ancestor), or any custom field.
time_field
string
"query_chunks"
Source of temporal intervals. "query_chunks" reads the array feature_search attaches (each entry has start_ms, end_ms, score). For document-level timestamps, use a dot-path like "metadata.start_ms" — the stage derives the end field by replacing "start" with "end".
merge_tolerance_ms
integer
2000
Maximum gap in milliseconds between intervals before they are split into separate moments. 0 = exact-overlap only. Range: 0–60000.
max_moments_per_parent
integer
10
Maximum moments returned per parent, sorted by score (highest first). Range: 1–100.
score_strategy
string
"max"
How to aggregate scores across merged intervals: "max", "avg", or "sum".
min_score
float
null
Drop moments scoring below this threshold. Range: 0.0–1.0.
output_mode
string
"annotated"
"annotated" keeps the best-scoring document per parent and attaches a moments array (preserves all original document fields). "moments_only" emits standalone moment documents with IDs like moment_{parent}_{start_ms}.