Mark Payne created NIFI-12707: --------------------------------- Summary: Allow LookupRecord to operate on multiple "child records" Key: NIFI-12707 URL: https://issues.apache.org/jira/browse/NIFI-12707 Project: Apache NiFi Issue Type: Improvement Components: Extensions Reporter: Mark Payne Assignee: Mark Payne
LookupRecord provides a lot of power when it comes to performing enrichment in Records. However, there are cases in which a single Record has many sub-records, or child records. For example, let's take the following record: {code:java} { "fileSet": { "id": "11223344", "source": "external", "files": [{ "filename": "file1.txt", "size": 4810 }, { "filename": "file2.pdf", "size": 47203782 }, { "filename": "unknown-file.unk", "size": 278102 } ] } } {code} Let's say that I want to lookup a MIME type, based on the filename. So I want an output such as: {code:java} { "fileSet" : { "id" : "11223344", "source" : "external", "files" : [ { "filename" : "file1.txt", "size" : 4810, "mimeType" : "text/plain" }, { "filename" : "file2.pdf", "size" : 47203782, "mimeType" : "application/pdf" }, { "filename" : "unknown-file.unk", "size" : 278102, "mimeType" : null } ] } } {code} I can have a Lookup Service that is capable of handling this, no problem. And in LookupRecord, I can specify the path to lookup as {{/fileSet/files[*]/filename}} but then I have a problem - there's no way to tell it where to place the returned values (i.e., the mimeType field) because it is relative to each individual value. We need to add a "Root Record Path" that allows us to choose a sub-record. In this case, {{/fileSet/files[*]}} and then specify the value to lookup as {{/filename}} and the return value should be placed at {{{}/mimeType{}}}. This gives us much greater flexibility in performing lookups/enrichments. -- This message was sent by Atlassian Jira (v8.20.10#820010)