Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

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