Skip to main content

RemoveRecordField

Description

Modifies the contents of a FlowFile that contains Record-oriented data (i.e. data that can be read via a RecordReader and written by a RecordWriter) by removing selected fields. This Processor requires that at least one user-defined Property be added. The name of the property is ignored by the processor, but could be a meaningful identifier for the user. The value of the property should indicate a RecordPath that determines the field to be removed. The processor executes the removal in the order in which these properties are added to the processor. Set the "Record Writer" to "Inherit Record Schema" in order to use the updated Record Schema modified when removing Fields.

Tags

avro, csv, delete, freeform, generic, json, record, remove, schema, text, update

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 NameAPI NameDefault ValueAllowable ValuesDescription
Record Reader *Record ReaderController 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 WriterController Service:
RecordSetWriterFactory

Implementations:
AvroRecordSetWriter
CSVRecordSetWriter
FreeFormTextRecordSetWriter
JsonRecordSetWriter
RecordSetWriterLookup
ScriptedRecordSetWriter
XMLRecordSetWriter
Specifies the Controller Service to use for writing out the records

Dynamic Properties

NameValueDescription
A description of the field to removeA RecordPath to the field to be removed.Any field that matches the RecordPath set as the value will be removed.

Supports Expression Language: Yes, evaluated using FlowFile Attributes and Environment variables.

Relationships

NameDescription
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
successFlowFiles that are successfully transformed will be routed to this relationship

Reads Attributes

This processor does not read attributes.

Writes Attributes

NameDescription
record.error.messageThis attribute provides on failure the error message encountered by the Reader or Writer.

State Management

This component does not store state.

Restricted

This component is not restricted.

Input Requirement

This component requires an incoming relationship.

Example Use Cases

Use Case 1

Remove one or more fields from a Record, where the names of the fields to remove are known.

Configuration

Configure the Record Reader according to the incoming data format.
Configure the Record Writer according to the desired output format.

For each field that you want to remove, add a single new property to the Processor.
The name of the property can be anything but it's recommended to use a brief description of the field.
The value of the property is a RecordPath that matches the field to remove.

For example, to remove the name and email fields, add two Properties:
name = /name
email = /email

System Resource Considerations

This component does not specify system resource considerations.

See Also

UpdateRecord