Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to do dynamic mapping to mongodb and by using EL?

How to do dynamic mapping to mongodb and by using EL?

New Contributor

Good day,

I have created dummy flowfile with certain structures like below

{"created_at":"Mon Mar 12 14:30:50 ICT 2018",
"id_message":455,
"msisdn":854,
"body":"hello world",
"sender":"asura",
"rule":"false"}

Now, i also have created a record in mongodb which contains:

_id:5aa608dab183163784c3f7dd
rule:"${anyAttribute("body"):contains("world")}"
action:"route"
destinations :"moon" 

My purpose is, for each flowfile, evaluate using rule attributes in database record, and if it is matched, then add "action" and "destinations" as additional record attributes, in short, the final record might looks like this.

{"created_at":"Mon Mar 12 14:30:50 ICT 2018",
"id_message":455,
"msisdn":854,
"body":"hello world",
"sender":"asura",
"rule":"true",
"action":"route"
"destinations" :"moon" 
}

I have tried with below schema and even hardcoded the EL into lookup record processor, but still ended up failed

62843-nifi-schema.png

62844-nifi-lookup-record.png

Where do i go wrong? Worst case i might implement custom processor

Thank you

Don't have an account?
Coming from Hortonworks? Activate your account here