Skip to main content
Filters narrow results using logical operators to combine conditions. They operate on document payloads (metadata, enrichments, passthrough fields) and can be applied in retriever execution or as dedicated filter@v1 stages.

Logical Operators

Mixpeek filters support three logical operators for composing conditions:
OperatorDescriptionUsage
ANDAll conditions must be trueCombine multiple required constraints
ORAt least one condition must be trueMatch any of several alternatives
NOTInverts the conditionExclude matching documents

AND Operator

Requires all nested conditions to match:
{
  "AND": [
    { "field": "metadata.status", "operator": "eq", "value": "published" },
    { "field": "metadata.price", "operator": "lte", "value": 100 }
  ]
}

OR Operator

Matches if any nested condition is true:
{
  "OR": [
    { "field": "metadata.category", "operator": "eq", "value": "video" },
    { "field": "metadata.category", "operator": "eq", "value": "audio" }
  ]
}

NOT Operator

Excludes documents matching the condition:
{
  "NOT": {
    "field": "metadata.status", "operator": "eq", "value": "draft"
  }
}

Nesting Operators

Logical operators can be nested to create complex filter logic:
{
  "AND": [
    { "field": "metadata.status", "operator": "eq", "value": "published" },
    {
      "OR": [
        { "field": "metadata.category", "operator": "eq", "value": "video" },
        { "field": "metadata.category", "operator": "eq", "value": "audio" }
      ]
    },
    {
      "NOT": {
        "field": "metadata.restricted", "operator": "eq", "value": true
      }
    }
  ]
}
This filter matches documents that are:
  • Published AND
  • Either video or audio AND
  • Not restricted

Comparison Operators

Use these operators within conditions:
OperatorDescription
eqEquals
neNot equals
gtGreater than
gteGreater than or equal
ltLess than
lteLess than or equal
inValue in list
ninValue not in list
existsField exists
is_nullField is null
containsString contains substring
starts_withString starts with prefix
ends_withString ends with suffix
regexMatches regular expression

Using Templates

Reference request inputs or stage outputs in filter values:
{
  "AND": [
    { "field": "metadata.category", "operator": "eq", "value": "{{INPUT.category}}" },
    { "field": "metadata.price", "operator": "lte", "value": "{{INPUT.max_price}}" }
  ]
}

Filter Stage Example

{
  "stage_name": "filter",
  "version": "v1",
  "parameters": {
    "strategy": "structured",
    "structured_filter": {
      "AND": [
        { "field": "metadata.category", "operator": "eq", "value": "audio" },
        { "field": "metadata.price", "operator": "lte", "value": "{{INPUT.max_price}}" }
      ]
    }
  }
}

Options

OptionDefaultDescription
case_sensitivefalseEnable case-sensitive string comparisons
{
  "field": "metadata.title",
  "operator": "contains",
  "value": "AI",
  "case_sensitive": true
}