$unwind, Snowflake’s LATERAL FLATTEN, and Spark’s explode().
Stage Category: APPLY (Expands documents)Transformation: N documents → M documents (where M ≥ N, one per array element)
When to Use
When NOT to Use
Parameters
Configuration Examples
How It Works
- For each input document, extracts the array value at the specified
fieldpath - If the value is an array with K elements, produces K output documents
- Each output document preserves all original fields, with the array field replaced by a single element
- Documents with null/empty arrays are either dropped or preserved based on
preserve_null_and_empty - Non-array values are passed through unchanged
Performance
Common Pipeline Patterns
Per-Tag Scoring
Segment-Level Retrieval
Error Handling
Call unwind from the API
Add the stage to a retriever’sstages array as {"stage_name": "<your label>", "stage_type": "apply", "config": {"stage_id": "unwind", "parameters": {...}}}. The parameters are the ones on this page.
- Create Retriever (
POST /v1/retrievers) saves a retriever that runs the stage. - Execute Ad-hoc Retriever (
POST /v1/retrievers/execute) runs stages without saving a retriever. - List Available Retriever Stages (
GET /v1/retrievers/stages) returns every stage’s parameter schema.
Related
- JSON Transform - Restructure document fields without expansion
- Group By - Inverse operation: group documents by field value
- Deduplicate - Remove duplicates after expansion

