JSON Document Router
The Document Router allows you to route documents based on a flexible set of filters.
Getting Started
To get started, add a JSON Document Router component to your pipeline and enter its configuration.
Allow Multi-route
By default, the document will go out through the first route that matches its filter (or that has no filter), by using Allow Multi-route the documents will go out on all matching routes, including routes without a filter.
The Routing Table configuration has two levels:
- Route: each route has a number starting from 0, each route is a path the document can take out of the component. By default, a new route comes without a filter (anything that reaches it gets through)
- Filter: You can add a filter to a route, allowing you to define the rules that will be evaluated when a document reaches the Document Router. A filter can be configured in multiple ways via operators, this can range from checking if a JSON path exists, to nested conditions using dates and Regular expressions.
Dates
When working with dates, the Value defines an offset from the date when a document reaches the Document Router.
Operators
The Operator field is what defines who a filter will work, there are multiple to choose from:
- And: Only returns true if all nested conditions are true.
- Or: Returns true if at least one nested condition is true.
- Not: Inverse a nested condition.
- Equal to value (eq): Returns true if the content from
Path
matchesValue
. - Not equal to value (ne): Returns true if the content from
Path
is different fromValue
. - Greater than value (gt): Returns true if the content from
Path
is greater thanValue
. - Greater than or equal to value (gte): Returns true if the content from
Path
is greater than or equal toValue
. - Less than value (lt): Returns true if the content from
Path
is less thanValue
. - Less than or equal to value (lte): Returns true if the content from
Path
is less than or equal toValue
. - Json path exists (exists): Returns true if the
Path
can be found. - Match regex in value (match): Returns true if the content from
Path
matches the regular expression fromRegex
. You can test regular expressions here.
Node
You can easily peek into the filter configuration by hovering over the route number:
JSON Editor (Advanced)
By using the JSON|Builder
toggle, you can view and edit the Routing Table definition directly.
While we don't recommend using it to write new routing table definitions from the ground up, it can be very useful to import and export configuration snippets from other Document Routers without the need to reconfigure manually through the Builder.
Updated about 1 month ago