Skip to content

Filters

Filters are fast pre-checks evaluated before the full condition block. They are designed to short-circuit rules that clearly don't apply to a document without fetching the full document details from Paperless-ngx.


Supported fields

Only classifier fields are supported in filters:

Field Description
correspondent The document's assigned correspondent name.
document_type The document's assigned document type name.
storage_path The document's assigned storage path name.
tags One of the document's tags (name).

Syntax

Each filter is a single-key mapping:

filters:
  - correspondent: "ACME GmbH"
  - document_type: "Invoice"
  - storage_path: "archive/invoices"
  - tags: "Inbox"

All filters must match (implicit AND). If any filter fails, the rule is skipped immediately — no conditions or actions are evaluated.


Filters vs. conditions

Filters Conditions
Evaluated Before condition block After filters pass
Supported fields Classifier fields only All document fields, variables, templates
Logical operators None (always AND) not, and, or
Purpose Fast pre-screening Full business logic

Use filters for coarse matching (e.g. "only run this rule for ACME GmbH invoices") and conditions for the detailed checks.


Example

- id: acme_invoice_title
  triggers:
    - all
  filters:
    - correspondent: "ACME GmbH"   # skip immediately if not ACME
    - document_type: "Invoice"      # skip immediately if not an invoice
  conditions:
    - not:
        - field: title
          match: '^\d{4}/'          # only process if title doesn't already match
  actions:
    - match: 'Invoice dated (\d{4})-(\d{2})'
      field: content
      replace: "{{ m1 }}/{{ m2 }}"
      as: date_result
    - if: "{{ date_result is defined }}"
      actions:
        - set_field: title
          value: "{{ date_result }}"
      else:
        - add_tag: "Problem"
    - save