Skip to main content
Taxonomy Enrich stage showing document classification with hierarchical taxonomies
The Taxonomy Enrich stage classifies documents against predefined taxonomies, adding structured category labels and hierarchical classifications to your search results.
Stage Category: ENRICH (Enriches documents with classifications)Transformation: N documents → N documents (with taxonomy labels added)

When to Use

When NOT to Use

Parameters

Each document stays one document: top_k limits how many assignments are considered for it and does not duplicate the document.

Configuration Examples

Output Schema

The stage writes assignments as flat fields on the document. Field names start with a prefix taken from the taxonomy ID: a leading tax_ is removed, the rest is lowercased, and runs of characters other than letters and digits become _. The taxonomy tax_product_categories gives the prefix product_categories. When several assignments are kept, these fields describe the highest-scoring one. Values selected by fields are merged for every kept assignment, from the highest score to the lowest.

Basic Classification

Hierarchical Taxonomy

For a hierarchical taxonomy the path and level fields are added as well.

Merged Enrichment Fields

Fields listed in fields are copied from the matched node onto the document, under target_field when one is set. With fields set to [{"field_path": "label", "target_field": "visual_style"}], the node’s label lands in visual_style.

No Match

When no assignment reaches min_score, the document continues without any taxonomy fields added.

Taxonomy Structure

Taxonomies are hierarchical classification systems:
A match reports:
  • ID: Identifier of the matched node, usually a collection ID (_taxonomy_{prefix}_id)
  • Label: Human-readable name (_taxonomy_{prefix}_label)
  • Level: Depth in the hierarchy, where 0 is the root ({prefix}_hierarchy_level)

Performance

Pre-compute taxonomy embeddings for faster classification. Use top_k: 1 and higher min_score when you only need the best match.

Common Pipeline Patterns

Search + Classify + Filter

Multi-Taxonomy Classification

Faceted Search Results

Error Handling