Support Questions

Find answers, ask questions, and share your expertise

How to segericate the twitter json file based on #tag and store into different location Using NiFi?

avatar
Rising Star
  • I can able to receive the twitter files as Json format from my twitter account but
  • i need to filter these files based on #tags (Ex, #fourseasondallas)
  • stored in a separate directory

Thanks

1 ACCEPTED SOLUTION

avatar
Master Guru

Looks like the Twitter API puts hash tags into the following JSON:

"entities": { "hashtags":[], "urls":[], "user_mentions":[] }

You could use EvaluteJsonPath to extract the value of the hashtags into FlowFile attributes, and then use RouteOnAttribute to route the ones matching your tag to a PutFile processor.

This blog shows an example of extracting values from the Twitter JSON and making routing decisions:

https://blogs.apache.org/nifi/entry/indexing_tweets_with_nifi_and

View solution in original post

1 REPLY 1

avatar
Master Guru

Looks like the Twitter API puts hash tags into the following JSON:

"entities": { "hashtags":[], "urls":[], "user_mentions":[] }

You could use EvaluteJsonPath to extract the value of the hashtags into FlowFile attributes, and then use RouteOnAttribute to route the ones matching your tag to a PutFile processor.

This blog shows an example of extracting values from the Twitter JSON and making routing decisions:

https://blogs.apache.org/nifi/entry/indexing_tweets_with_nifi_and