JSON Document Router

What Is the Document Router?

The Document Router is a component that directs documents through different paths in a pipeline based on custom filters. It's useful when you need to route documents differently depending on their metadata, structure, or content.

Key Features

  • Route documents using flexible JSON-based filters.
  • Supports multiple routes per document.
  • Filters use operators like eq, gt, exists, and regex matching.
  • Includes both visual builder and raw JSON editor for configuration.

Getting Started with the JSON Document Router

To use the Document Router:

  • Add the JSON Document Router to your pipeline.
  • Open the component’s configuration panel:

💡

Tip: Allow Multi-route

By default, a document follows only the first matching route. Enable Allow Multi-route to send the same document through all routes that match, including those without filters.

Routing Table Configuration

Each Document Router contains a Routing Table with two configuration layers:

1. Route

  • A numbered output path (e.g., 0, 1, 2…).
  • By default, routes allow all documents unless a filter is defined.

2. Filter

  • Filters define conditions a document must meet to take a given route.
  • Filters are evaluated using operators.

📆

Date Filtering

Date-based filters use relative offsets. For example, you can route documents only if a timestamp field is within the last 7 days.

Filter Operators

Operators control how each filter behaves. Here's a list of supported options:

OperatorDescription
andAll nested conditions must be true.
orAt least one nested condition must be true.
notInverts a nested condition.
eqPath value equals a specific value.
nePath value does not equal the value.
gtPath value is greater than the value.
gtePath value is greater than or equal to the value.
ltPath value is less than the value.
ltePath value is less than or equal to the value.
existsJSON path must exist in the document.
matchPath matches a regular expression (test here) .

Node Inspector

To view a route's filter quickly, hover over its route number in the UI:

JSON Editor (Advanced Users)

Switch between the Builder and JSON modes using the JSON|Builder toggle.

Use JSON mode to:

  • Copy/paste routing configurations across pipelines.
  • Make bulk edits or review raw logic.

Avoid writing new routing logic entirely in JSON unless you’re confident in the syntax.

FAQ

Can I route a document through more than one path?

Yes! Enable Allow Multi-route to send documents through all matching routes.

What kinds of filters can I create?

You can check for field existence, compare numeric or date values, or even match patterns using regex.

Where can I test my regex filters?

Use regex101.com to test your patterns before using them in the filter.