Stage Category: ENRICH (Enriches documents)Transformation: N documents → N documents (with joined data added)
When to Use
When NOT to Use
Parameters
Join modes
The stage runs in one of two modes, chosen by whetherretriever_id or retriever_config is set.
Direct join (the default). The stage reads the value at source_field from each document and looks for a document in target_collection_id whose target_field has the same value. A document with no value at source_field is not looked up and passes through unchanged when allow_missing is true.
Retriever join. The stage evaluates retriever_inputs for each document and runs the retriever named by retriever_id, or the inline retriever_config, with those inputs. Documents that produce identical inputs share a single retriever run. In an inline retriever_config, string stage parameters that contain {{DOC.field_name}} are filled in from the current document. source_field and target_field are not used in this mode.
In both modes each document receives at most one match: the first document found, or the top result of the retriever. fields_to_merge, output_field, strategy, when and allow_missing apply the same way in both.
Merge strategies
enrichplaces the match underoutput_field. Withoutoutput_field, it merges the match into the document root and keeps existing fields unless the match has a field of the same name.replacemerges the match into the document root and overwrites fields of the same name.output_fieldis not used.appendadds the match to an array atoutput_field, or atenrichmentswhenoutput_fieldis unset.
Configuration Examples
Output Schema
Single Document Join
Append Strategy
Withstrategy: "append", output_field holds an array and the match is added to it.
No Match Found
Withallow_missing: true (the default) the document passes through unchanged and no output_field is added. With allow_missing: false the document is removed from the results.
documents_checked, documents_enriched and documents_skipped.
Performance
Common Pipeline Patterns
Search + Author Enrichment
Product Search with Reviews
Hierarchical Category Enrichment
Error Handling
vs Other Enrichment Stages
Related
- SQL Lookup - External database joins
- API Call - REST API enrichment
- Taxonomy Enrich - Classification enrichment

