Skip to main content

Overview

Filters narrow search and recommendation results based on product attributes. Use filters for price ranges, categories, availability, and custom metadata.

Basic Syntax

Each filter has three properties:
string
required
The product field to filter on. Use dot notation for nested metadata fields: metadata.color.
string
required
The comparison operator. See Operators below.
any
required
The value to compare against. Type depends on the operator.

Operators

Equality

Exact match. Case-sensitive for strings.

Comparison

Greater than (exclusive).

Array Operators

Field value is one of the provided values.

Existence

Check if a field exists (true) or doesn’t exist (false).

Text Matching

Partial text match within the field. Case-insensitive.

Operator Reference

Common Patterns

Price Range

In Stock Only

Multiple Categories

Exclude Sale Items

Has Reviews

Brand Exclusion

Filter Logic

Multiple filters are combined with AND logic. All conditions must be true for a product to be included.
OR logic isn’t directly supported. Use the in operator for “field equals A OR field equals B” scenarios.

Metadata Fields

Access nested metadata using dot notation:

Sorting

Combine filters with sorting:
Available sort fields depend on your catalog schema. Common options:
  • price
  • metadata.rating
  • metadata.popularity
  • metadata.createdAt
Sorting by relevance (default) uses the AI ranking. Sorting by other fields overrides the AI ranking.

Filter Options in Response

Search responses include available filter values:
Use this to build dynamic filter UIs:

Performance Tips

  • Filter on indexed fields for best performance
  • Use in with small arrays (under 100 values)
  • Avoid match on large text fields when possible
  • Combine price ranges into a single range filter

Next Steps

Text Search

Search with text queries

Recommendations

Filter recommendations too