Member since
02-15-2022
10
Posts
1
Kudos Received
1
Solution
My Accepted Solutions
Title | Views | Posted |
---|---|---|
134 | 03-16-2022 10:17 PM |
04-15-2022
10:16 PM
Could you probably give me an example of how to frame a Mongo query in NiFi ? My key to select the record is " my_id ", which I get from an evaluate json path processor. The Columns that I want to update is a nested json key like so : [ 'a']['b']['exists_in_file']. The query that I now have in update Query Key is : {"$my_id":["a.b.exists_in_file":"True"]}. This errors our saying : BasicDBList cannot be cast to java.util.Map
... View more
04-12-2022
08:53 AM
How do you configure a PutMongo NiFi Processor with ID as the primary key used to select the document and updating 2-3 fields inside the document with user defined attributes? What I have so far and it errors out : Update Query--> {my_id:${my_id},$set:{['a']['b']['exists_in_file']:"True"}}
... View more
Labels:
- Labels:
-
Apache NiFi
03-16-2022
10:17 PM
Update : I solved this. I had to use a splitjson before the lookup record processor, then it worked all fine.
... View more
03-12-2022
12:18 PM
I have the following json file : “a”:{ “after”:{ “a123”:{ “ip”:”1.0.0.0”, “p_id”:”4500” } }, “before”:{ “a123”:{ “ip”:”1.0.0.0”, “p_id”:”4500 } } } I'm trying to create a lookuprecord Processor in NiFi to match with the p_id. If matched then route to something and if unmatched then route to something else. The lookuprecord processor I have is a MongoDBLookUpService. The user expression I've written for the lookuprecord processor is : key : /a/after/*['p_id'] Note: [*] because that bit in json keeps changing with every json file. I've even tried /a/after/*/p_id and nothing seems to work. They all seem to route to unmatched. Please help me figure out if I'm doing something wrong in the expression.
... View more
Labels:
- Labels:
-
Apache NiFi
03-07-2022
01:26 AM
1 Kudo
@araujo - thank you so much. I referred to the same flow file you have attached. It works perfectly. The problem with mine was I was using two eval json processors and route on attributes wasn't able to compare from two different flowfiles.
... View more
03-07-2022
01:12 AM
Hi @araujo - you've attached a text file. How do I import that as a template? If you could attach your flow as an xml file that would be helpful.
... View more
03-06-2022
09:58 PM
@araujo Sample input data : “a”:{ “after”:{ “a123”:{ “ip”:”1.0.0.0”, “series”:”4500” } }, “Before”:{ “a123”:{ “ip”:”1.0.0.0”, “series”:”4500 } } }
... View more
03-06-2022
08:02 PM
Hi Andre, thank you for your answer. 1. The empty [] is actually [*] because that value keeps changing. It think that did not get copied. 2.I’ve checked for space and there are none 3. Yes thank you for pointing that out. And sorry about that. I was a copy paste mistake. I've just edited my OP.
... View more
03-06-2022
12:20 PM
I have a nested json with few first level keys. I want to compare two keys before and after in that json to see if the states are matching or not. If the states match then route to update api else insert api. What I have tried so far : getfile-->evaluate json path(to get the two keys before and after)-->route on attributes Now my problem is that route on attributes always evaluates to unmatched even if the values in eval json path for before and after are the same. Expression : Eval json path 1 : a_before = $.['a']['before'][*]['ip'] Eval json path 2 : a_after = $.['a']['after'][*]['ip'] Above results in the same ip - ["1.0.0.0"] RouteOnAttribute : ${a_after:equals(${a_before})} This always results in an unmatched even if the records match. Any help will be appreciated.
... View more
Labels:
- Labels:
-
Apache NiFi
02-15-2022
11:42 AM
I have a JSON file myData.json having content below : {
"attributes" : {
"before" : {
"cw1234567" : {
"40" : {
"changed_by" : "olivia"
} ,
"45" : {
"changed_by" : "olivia"
} ,
"81" : {
"changed_by" : "olivia"
}
}
} ,
"after" : {
"cw1234567" : {
"45" : {
"changed_by" : "olivia"
} ,
"66" : {
"changed_by" : "olivia"
}
}
}
} ,
"action" : "Changedev"
}
And I also have a my_lookup JSON which is stored in MongoDb. Something like below: {
"40" : "olivia test" ,
"45" : "olivia test" ,
"81" : {
"id" : "81" ,
"idPath" : [
"0" ,
"64" ,
"32" ,
"81"
] ,
"locked" : 0 ,
"name" : "Test 5" ,
"namePath" : [
"All Attributes" ,
"New category 1" ,
"New category 2" ,
"New category 3"
] ,
"parentId" : 32
}
}
Now, my use case is that I wanted to be able to append to the JSON file myData for each key that matches the my_lookup JSON. Result something like below : {
"attributes" : {
"before" : {
"cw1234567" : {
"40" : {
"changed_by" : "olivia"
} ,
"45" : {
"changed_by" : "olivia"
} ,
"81" : {
"id" : "81" ,
"idPath" : [
"0" ,
"64" ,
"32" ,
"81"
] ,
"locked" : 0 ,
"name" : "Test 5" ,
"namePath" : [
"All Attributes" ,
"new Category 1" ,
"new category 2" ,
"new category 3"
] ,
"parentId" : 32
}
}
} ,
"after" : {
"cw1234567" : {
"45" : {
"changed_by" : "olivia"
} ,
"66" : {
"changed_by" : "olivia"
}
}
}
} ,
"action" : "Changedev"
}
I have been trying to use LookupRecord processor for this but since I'm new to NiFi I'm a little confused how to use it correctly and what should I define as my key and schema text in this case. Any help will be appreciated.
... View more
- Tags:
- json
- LookupRecord
- NiFi
Labels:
- Labels:
-
Apache NiFi