I assume you mixed the term attributes
with different contexts. I did that when I picked up NiFi for the first time and started working with JSON. To get things clarified, there are two types of attributes in this particular case:
- FlowFile attributes - These are the attributes that are sort of like metadata of the FlowFile, like
filename
, filesize
, mime.type
, etc. When you add an attribute using a processor like UpdateAttribute
they get added to the metadata of the FlowFile i.e. FlowFile attributes not to the FlowFile content itself.
- JSON attributes - These are the fields that are in the FlowFile content. Ex:
Name
is an attribute here -> { "Name" : "Smith, John"}
Having said that, using expressions like ${projectName}, ${filename}
are evaluated against the FlowFile attributes
. This syntax is called NiFi Expression Language. they won't be evaluated against the content of the FlowFile. EvaluateJsonPath
takes a JSON path expression like $.Name
So for example, lets assume you have the following JSON document in the FlowFile content:
{
"attr1": "some value for attr1",
"attr2": "some value for attr2"
}
In this case, you would have to configure the EvaluateJsonPath
processor with new properties which look like the following:
attribute1 : $.attr1
attribute2 : $.attr2
Once done, flowfiles that pass through the EvaluateJsonPath
will have the above two attributes added to the flowfile attributes
which you can read using NiFi Expression like ${attribute1}
. Then connect EvaluateJsonPath
processor to UpdateRecord
processor where you can add the combined composite key with the help of NiFi Expression Language
to the FlowFile JSON content.
Useful Links