Stage Category: GROUP (Groups documents)Transformation: N documents → G groups (where G = unique field values)
When to Use
When NOT to Use
Parameters
Configuration Examples
Output Schema
Performance
Common Pipeline Patterns
Search + Group by Category
Grouped Results with Aggregations
Author-Grouped Search
Time-Based Grouping
Document Sorting Within Groups
Documents within each group are automatically sorted by relevancescore (highest first), then limited to max_per_group.
Output Modes
Handling Missing Values
Documents missing thegroup_by_field value are grouped under a null key.
Error Handling
Group By vs Cluster
Call group_by from the API
Add the stage to a retriever’sstages array as {"stage_name": "<your label>", "stage_type": "reduce", "config": {"stage_id": "group_by", "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
- Aggregate - Statistical aggregations
- Cluster - Semantic grouping
- Sample - Select from groups
- Sort Attribute - Simple sorting

