Skip to main content
Sort Attribute stage showing attribute-based document ordering
The Sort Attribute stage reorders documents based on metadata field values. It supports ascending/descending order, nested fields, and multiple sort criteria.
Stage Category: SORT (Reorders documents)Transformation: N documents → N documents (reordered by field value)

When to Use

When NOT to Use

Parameters

Configuration Examples

Field Types

The stage handles various field types:

Null Handling

Performance

Sorting is very fast. Unlike rerank, it doesn’t require model inference, making it ideal for simple ordering by attributes.

Common Pipeline Patterns

Search + Filter + Sort

Rerank + Sort (Tie-Breaking)

Dynamic Sort Direction

Comparison: sort_attribute vs rerank

Multiple Sort Criteria

For multi-field sorting, chain multiple sort stages (last sort is primary):
This sorts by featured first, then by created_at for ties.

Error Handling