Expression language syntax
Custom unified fields use an expression language that can be used to create more complex field mappings
There are three types of expressions supported:
JSON Path Expressions
When the expression starts with $
, it is treated as a JSON Path expression and will be evaluated as such.
JSON Path Syntax
JSON Path | Description |
---|---|
$ | The root object |
. | Child operator |
@ | The current object |
* | Wildcard. All elements in an array, or all properties of an object |
.. | Recursive descent |
[] | Subscript operator |
[,] | Union operator |
[start : end : step] | Array slice operator |
?(expression) | Filter expression |
() | Script expression |
Examples:
For more information on JSON Path syntax, refer to the original JSON Path documentation.
JEXL Expressions
This kind of expression is enclosed in double brackets {{expression}}
. It supports variables and operators.
Operators
Operator | Description |
---|---|
! | Logical NOT |
+ | Addition, string concatenation |
- | Subtraction |
* | Multiplication |
/ | Division |
// | Floor division |
% | Modulus |
^ | Exponentiation |
&& | Logical AND |
| | Logical OR |
== | Equal |
!= | Not equal |
> | Greater than |
>= | Greater than or equal |
< | Less than |
<= | Less than or equal |
in | Element of string or array |
? : | Ternary operator |
Examples:
Identifiers
Identifiers can be used to reference variables in the context.
Collections
Collections, or arrays of objects, can be filtered by including a filter expression in brackets.
String Interpolation
To simplify strings usage, a more straightforward syntax is provided for string interpolation of variables using the ${var}
syntax.
Examples:
Note: If the expression is a string without any of the patterns described above, it will be returned as is.
For more information on the JEXL syntax, refer to the JEXL Syntax documentation.
Was this page helpful?