Attribute Filter
Filter documents by payload field values with boolean logic and comparison operators
Why do anything?
Vector search returns similar content regardless of metadata. You need filtering to scope results by category, date, status, etc.
Why now?
Real applications need faceted search. Users expect to filter by attributes while getting semantic results.
Why this feature?
Powerful payload filtering with AND/OR logic, comparison operators (eq, gt, lt, in, contains), and nested field support.
How It Works
Attribute filter is a retriever stage that filters documents by payload field values.
Condition Parsing
Parse filter conditions and boolean logic
Field Extraction
Extract field values from document payloads
Evaluation
Evaluate conditions against field values
Filtering
Pass/reject documents based on evaluation
Why This Approach
Flexible filtering enables faceted search. Boolean logic supports complex conditions.
Where This Is Used
Integration
retriever = client.retrievers.create(stages=[{"type": "attribute_filter", "conditions": [...]}])
