Tina, In NiFi, a FlowFile is made up of two parts: Content (the payload, or bytes) and Attributes (metadata about the content). When you are using the Expression Language, you are operating on FlowFile Attributes, not the content. So if you are wanting to count the number of occurrences of some string in the content, the Expression Language will not help you.
This is why I was suggesting using the ExecuteScript processor. You can have a script that reads the content from StdIn (this will provide you the content of the FlowFile) and count the number of occurrences of each word/phrase of interest. Once you have counted the number of occurrences, you can add those to the FlowFile as attributes. Or, alternatively, you could write out the data to the contents of the FlowFile, from within your script. Thanks -Mark > On Nov 9, 2017, at 4:05 PM, tzhu <js.tianlu...@gmail.com> wrote: > > Hi Mark, > > According to the language guide > <https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#count> > > , the count can be done by: > ${allMatchingAttributes("abc","xyz"):contains("world"):count()} > > I'm wondering if I can contain this one in one of the processor, as a side > product of "update attribute" or some other processor. > > Thanks, > > Tina > > > > -- > Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/