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:

lookup, enrichment, route, record, csv, json, avro, logs, convert, filter

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

NameDefault ValueAllowable ValuesDescription
Record ReaderController Service API:
RecordReaderFactory
Implementations: Syslog5424Reader
AvroReader
JsonPathReader
ScriptedReader
XMLReader
GrokReader
JsonTreeReader
SyslogReader
CSVReader
Specifies the Controller Service to use for reading incoming data
Record WriterController Service API:
RecordSetWriterFactory
Implementations: ScriptedRecordSetWriter
JsonRecordSetWriter
CSVRecordSetWriter
AvroRecordSetWriter
XMLRecordSetWriter
FreeFormTextRecordSetWriter
Specifies the Controller Service to use for writing out the records
Lookup ServiceController Service API:
LookupService
Implementations: XMLFileLookupService
SimpleKeyValueLookupService
SimpleCsvFileLookupService
RestLookupService
CSVRecordLookupService
CouchbaseKeyValueLookupService
HBase_1_1_2_RecordLookupService
PropertiesFileLookupService
ElasticSearchLookupService
MongoDBLookupService
DistributedMapCacheLookupService
CouchbaseRecordLookupService
IPLookupService
ScriptedLookupService
The Lookup Service to use in order to lookup a value in each Record
Result RecordPathA 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: true (will be evaluated using flow file attributes and variable registry)
Routing Strategyroute-to-success
  • Route to 'success' Records will be routed to a 'success' Relationship regardless of whether or not there is a match in the configured Lookup Service
  • Route to 'matched' or 'unmatched' Records will be routed to either a 'matched' or an 'unmatched' Relationship depending on whether or not there was a match in the configured Lookup Service. A single input FlowFile may result in two different output FlowFiles.
Specifies how to route records after a Lookup has completed
Record Result Contentsinsert-entire-record
  • Insert Entire Record The entire Record that is retrieved from the Lookup Service will be inserted into the destination path.
  • Insert Record Fields All of the fields in the Record that is retrieved from the Lookup Service will be inserted into the destination path.
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.

Dynamic Properties:

Dynamic Properties allow the user to specify both the name and value of a property.

NameValueDescription
Value To LookupValid Record PathA RecordPath that points to the field whose value will be looked up in the configured Lookup Service
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)

Relationships:

NameDescription
successAll records will be sent to this Relationship if configured to do so, unless a failure occurs
failureIf a FlowFile cannot be transformed from the configured input format to the configured output format, the unchanged FlowFile will be routed to this relationship

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
mime.typeSets the mime.type attribute to the MIME Type specified by the Record Writer
record.countThe 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:

None specified.

See Also:

ConvertRecord, SplitRecord, SimpleKeyValueLookupService, IPLookupService