RenameRecordField 2.0.0

Bundle
org.apache.nifi | nifi-standard-nar
Description
Renames one or more fields in each Record of a FlowFile. This Processor requires that at least one user-defined Property be added. The name of the Property should indicate a RecordPath that determines the field that should be updated. The value of the Property is the new name to assign to the Record Field that matches the RecordPath. The property value may use Expression Language to reference FlowFile attributes as well as the variables `field.name`, `field.value`, `field.type`, and `record.index`
Tags
avro, csv, field, generic, json, log, logs, record, rename, schema, update
Input Requirement
REQUIRED
Supports Sensitive Dynamic Properties
false
Properties
Dynamic Properties
Relationships
Name Description
failure If a FlowFile cannot be transformed from the configured input format to the configured output format, the unchanged FlowFile will be routed to this relationship
success FlowFiles that are successfully transformed will be routed to this relationship
Writes Attributes
Name Description
record.index This attribute provides the current row index and is only available inside the literal value expression.
Use Cases
  • Rename a field in each Record to a specific, known name.
    Description
    Rename a field in each Record to a specific, known name.
    Keywords
    rename, field, static, specific, name
    Configuration
    Configure the 'Record Reader' according to the input format.
    Configure the 'Record Writer' according to the desired output format.
    
    Add a property to the Processor such that the name of the property is a RecordPath to identifies the field to rename. The value of the property is the new name of the property.
    
    For example, to rename the `name` field to `full_name`, add a property with a name of `/name` and a value of `full_name`.
    
    Many properties can be added following this pattern in order to rename multiple fields.
    
  • Rename a field in each Record to a name that is derived from a FlowFile attribute.
    Description
    Rename a field in each Record to a name that is derived from a FlowFile attribute.
    Keywords
    rename, field, expression language, EL, flowfile, attribute
    Configuration
    Configure the 'Record Reader' according to the input format.
    Configure the 'Record Writer' according to the desired output format.
    
    Add a property to the Processor such that the name of the property is a RecordPath to identifies the field to rename. The value of the property is an Expression Language expression that can be used to determine the new name of the field.
    
    For example, to rename the `addr` field to whatever value is stored in the `preferred_address_name` attribute, add a property with a name of `/name` and a value of `${preferred_address_name}`.
    
    Many properties can be added following this pattern in order to rename multiple fields.
    
  • Rename a field in each Record to a new name that is derived from the current field name.
    Description
    Rename a field in each Record to a new name that is derived from the current field name.
    Notes
    This might be used, for example, to add a prefix or a suffix to some fields, or to transform the name of the field by making it uppercase.
    Keywords
    rename, field, expression language, EL, field.name
    Configuration
    Configure the 'Record Reader' according to the input format.
    Configure the 'Record Writer' according to the desired output format.
    
    Add a property to the Processor such that the name of the property is a RecordPath to identifies the field to rename. The value of the property is an Expression Language expression that references the `field.name` property.
    
    For example, to rename all fields with a prefix of `pre_`, we add a property named `/*` and a value of `pre_${field.name}`. If we would like this to happen recursively, to nested fields as well, we use a property name of `//*` with the value of `pre_${field.name}`.
    
    To make all field names uppercase, we can add a property named `//*` with a value of `${field.name:toUpper()}`.
    
    Many properties can be added following this pattern in order to rename multiple fields.
    
See Also