Configure filter expressions for cleanse function
Learn how to use filter expressions to control when a cleanse function executes on entity data.
A filter expression is an optional condition defined on a cleanse function to control whether the function executes for a given entity data. Use a filter expression when you want the cleanse function to run only for specific entity data. This helps avoid unnecessary processing and ensures the function runs only when needed.
Configure a filter expression
To configure, define a filter expression at the cleanse-function level in the infos[].sequence[].chain[] section of the cleanse configuration.
cleanseConfig.infos[].sequence[].chain[].filterFor example, {
"uri": "configuration/entityTypes/Individual",
"cleanseConfig": {
"infos": [
{
"sequence": [
{
"chain": [
{
"cleanseFunction": "StringFunctionCleanser",
"resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
"filter": "equals(attributes.Country, 'US') and exists(attributes.Address)",
"mapping": {
"inputMapping": [ ... ],
"outputMapping": [ ... ]
}
}
]
}
]
}
]
}
}Filter evaluation and behavior
The filter expression is evaluated at runtime for each entity processed by the cleanse framework. If the ovOnly option is enabled, the filter expression is evaluated only against operational values (OV).
If a filter expression is defined, Reltio evaluates it against the current entity data to determine whether the cleanse function must be executed. The expression evaluates to true when the entity data matches the filter condition, and to false when the entity data does not match the filter condition.
| Filter expression | Cleanse behavior |
|---|---|
| No filter defined | Cleanse executes for all entity data |
| Filter expression is defined and it evaluates to true | Cleanse executes on the entity data and a cleanser crosswalk is created or updated |
| Filter expression is defined and it evaluates to false | Cleanse is skipped, no data is written, and no cleanser crosswalk is created or modified |
Runtime evaluation for object and nested attributes
Filter evaluation behavior depends on whether the cleanse function operates on object level or nested attributes.
- Object level cleansing
-
The filter is evaluated once against the entire entity.
- If the filter expression evaluates to true, the cleanse function executes for the entity.
- If the filter expression evaluates to false, the cleanse function is skipped.
For example, run the cleanse function only for entities where Country is
US:"filter":"equals(attributes.Country, 'US')" - Nested attribute cleansing
-
For nested attributes (such as Address or Consent), filter evaluation occurs in two steps:
- Entity level evaluation
- The filter is evaluated against the entire entity.
- If the entity does not match, the cleanse function is skipped for all nested values
-
Nested value evaluation
- If the entity matches, the filter is evaluated for each nested value.
- During this evaluation, attribute paths are resolved relative to the nested context.
For example, run the cleanse function only for Address values where City is
NYC:equals(attributes.Address.City, 'NYC')If an entity has multiple Address values, the filter is evaluated for each Address. Only the Address values where
City = NYCare processed, and the remaining Address values are skipped. - Entity level evaluation
Supported filter expressions
Filter expressions use the same syntax as Elasticsearch (ES) and Data Validation Functions (DVF) expressions, see Search, Understanding the Expression Attribute.
| Construct | Example | Description |
|---|---|---|
| Attribute equality | equals(attributes.Country, 'US') | Matches a specific attribute value |
| Attribute existence | exists(attributes.Email) | Checks if an attribute is present |
| Value in list | in(attributes.Country, 'US,IN') | Matches one of multiple values |
| Nested attribute | equals(attributes.Address.City, 'NYC') | Matches values in nested attributes |
| Crosswalk condition | equals(sourceSystems, 'CRM') | Matches data from a specific source |
| Composite expression | equals(attributes.Country, 'US') and exists(attributes.Email) | Combines multiple conditions |
Filter expression validation
All filter expressions are validated when the configuration is saved.
- Invalid syntax: If the filter contains a syntax error (for example, an unclosed parenthesis or an unknown function), the configuration save operation fails.
- Error message: The response includes a detailed error message from the expression parser, indicating the exact issue and preventing an invalid configuration from being deployed.