field.rename
Rename a group of fields.
Description
Rename a group of field names to new names. It is not
allowed to rename top-level fields (.Operation
, .Position
,
.Key
, .Metadata
, .Payload.Before
, .Payload.After
).
Note that this processor only runs on structured data, if the record contains raw
JSON data, then use the processor json.decode
to parse it into structured data first.
Configuration parameters
Name | Type | Default | Description |
---|---|---|---|
mapping | string | null | Mapping is a comma separated list of keys and values for fields and their new names (keys and values are separated by colons ":"). For example: For more information about the format, see Referencing fields. |
Examples
Rename multiple fields
This example renames the fields in .Metadata
and
.Payload.After
as specified in the mapping
configuration parameter.
Configuration parameters
Name | Value |
---|---|
mapping | .Metadata.key1:newKey,.Payload.After.foo:newFoo |
Record difference
Before | After | ||||
1 | { | 1 | { | ||
2 | "position": null, | 2 | "position": null, | ||
3 | "operation": "create", | 3 | "operation": "create", | ||
4 | "metadata": { | 4 | "metadata": { | ||
5 | - | "key1": "val1" | 5 | + | "newKey": "val1" |
6 | }, | 6 | }, | ||
7 | "key": null, | 7 | "key": null, | ||
8 | "payload": { | 8 | "payload": { | ||
9 | "before": { | 9 | "before": { | ||
10 | "bar": "baz" | 10 | "bar": "baz" | ||
11 | }, | 11 | }, | ||
12 | "after": { | 12 | "after": { | ||
13 | - | "foo": "bar" | 13 | + | "newFoo": "bar" |
14 | } | 14 | } | ||
15 | } | 15 | } | ||
16 | } | 16 | } |