Fields
Fields are both the events attributes and a way to access the given attributes.
M42PL's commands support 5 type of fields:
- Literal: A literal value such as a number, a string or a list of values, e.g.
42
,'some text'
,(1, 2, 3)
- Path: A field name or a doted field name, e.g.
field
,field.subfield
- Eval: An evaulation expression, e.g.
at(list, 0)
- JsonPath: A JsonPath expression, e.g.
{list[0].name}
- Pipe: A sub-pipeline, e.g.
[ | kvread 'someName' ]
Fields interpretation
It is important to note that fields values are dynamic while fields types are static.
M42PL decides which field functor has to be instanciated using the field syntax.
For example, the field {user.emails[0]}
is matched as a JsonPath
field.
Each time an event is processed, the same JsonPath
instance will be called
with the event as first parameter to extrat the first item ([0]
) in the list
emails
in the root field user
.
Literal fields
Although literal fields always return the same value, they are also implemented as functors in M42PL.