LookupRecord
Description
Extracts one or more fields from a Record and looks up a value for those fields in a LookupService. If a result is returned by the LookupService, that result is optionally added to the Record. In this case, the processor functions as an Enrichment processor. Regardless, the Record is then routed to either the 'matched' relationship or 'unmatched' relationship (if the 'Routing Strategy' property is configured to do so), indicating whether or not a result was returned by the LookupService, allowing the processor to also function as a Routing processor. The "coordinates" to use for looking up a value in the Lookup Service are defined by adding a user-defined property. Each property that is added will have an entry added to a Map, where the name of the property becomes the Map Key and the value returned by the RecordPath becomes the value for that key. If multiple values are returned by the RecordPath, then the Record will be routed to the 'unmatched' relationship (or 'success', depending on the 'Routing Strategy' property's configuration). If one or more fields match the Result RecordPath, all fields that match will be updated. If there is no match in the configured LookupService, then no fields will be updated. I.e., it will not overwrite an existing value in the Record with a null value. Please note, however, that if the results returned by the LookupService are not accounted for in your schema (specifically, the schema that is configured for your Record Writer) then the fields will not be written out to the FlowFile.
Tags
avro, convert, csv, database, db, enrichment, filter, json, logs, lookup, record, route
Properties
In the list below required Properties are shown with an asterisk (*). Other properties are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.
Display Name | API Name | Default Value | Allowable Values | Description |
---|---|---|---|---|
Record Reader * | record-reader | Controller Service: RecordReaderFactory Implementations: AvroReader CEFReader CSVReader ExcelReader GrokReader JsonPathReader JsonTreeReader ReaderLookup ScriptedReader Syslog5424Reader SyslogReader WindowsEventLogReader XMLReader YamlTreeReader | Specifies the Controller Service to use for reading incoming data | |
Record Writer * | record-writer | Controller Service: RecordSetWriterFactory Implementations: AvroRecordSetWriter CSVRecordSetWriter FreeFormTextRecordSetWriter JsonRecordSetWriter RecordSetWriterLookup ScriptedRecordSetWriter XMLRecordSetWriter | Specifies the Controller Service to use for writing out the records | |
Lookup Service * | lookup-service | Controller Service: LookupService Implementations: CSVRecordLookupService DatabaseLookup DatabaseRecordLookupService DistributedMapCacheLookupService ElasticSearchLookupService ElasticSearchStringLookupService IPLookupService MongoDBLookupService PropertiesFileLookupService RestLookupService ScriptedLookupService SimpleCsvFileLookupService SimpleDatabaseLookupService SimpleKeyValueLookupService SimpleScriptedLookupService XMLFileLookupService | The Lookup Service to use in order to lookup a value in each Record | |
Root Record Path | Root Record Path | A RecordPath that points to a child Record within each of the top-level Records in the FlowFile. If specified, the additional RecordPath properties will be evaluated against this child Record instead of the top-level Record. This allows for performing enrichment against multiple child Records within a single top-level Record. Supports Expression Language, using FlowFile attributes and Environment variables. | ||
Routing Strategy * | routing-strategy | Route to 'success' |
| Specifies how to route records after a Lookup has completed |
Record Result Contents * | result-contents | Insert Entire Record |
| When a result is obtained that contains a Record, this property determines whether the Record itself is inserted at the configured path or if the contents of the Record (i.e., the sub-fields) will be inserted at the configured path. |
Record Update Strategy * | record-update-strategy | Use "Result RecordPath" Property |
| This property defines the strategy to use when updating the record with the value returned by the Lookup Service. |
Result RecordPath | result-record-path | A RecordPath that points to the field whose value should be updated with whatever value is returned from the Lookup Service. If not specified, the value that is returned from the Lookup Service will be ignored, except for determining whether the FlowFile should be routed to the 'matched' or 'unmatched' Relationship. Supports Expression Language, using FlowFile attributes and Environment variables. This property is only considered if:
| ||
Cache Size * | record-path-lookup-miss-result-cache-size | 0 | Specifies how many lookup values/records should be cached.Setting this property to zero means no caching will be done and the table will be queried for each lookup value in each record. If the lookup table changes often or the most recent data must be retrieved, do not use the cache. Supports Expression Language, using Environment variables. |
Dynamic Properties
Name | Value | Description |
---|---|---|
Value To Lookup | Valid Record Path | A RecordPath that points to the field whose value will be looked up in the configured Lookup Service Supports Expression Language: Yes, evaluated using FlowFile Attributes and Environment variables. |
Relationships
Name | Description |
---|---|
failure | If a FlowFile cannot be enriched, the unchanged FlowFile will be routed to this relationship |
success | All records will be sent to this Relationship if configured to do so, unless a failure occurs |
Reads Attributes
This processor does not read attributes.
Writes Attributes
Name | Description |
---|---|
mime.type | Sets the mime.type attribute to the MIME Type specified by the Record Writer |
record.count | The number of records in the FlowFile |
State Management
This component does not store state.
Restricted
This component is not restricted.
Input Requirement
This component requires an incoming relationship.
System Resource Considerations
This component does not specify system resource considerations.
See Also
SimpleKeyValueLookupService, DatabaseRecordLookupService, IPLookupService, ConvertRecord, SplitRecord