Rename
Synopsis
Renames one or more fields in the document. Supports both single field renaming and bulk field renaming operations.
Schema
rename:
- field: <ident>
- fields:
- from: <ident>
to: <ident>
- target_field: <ident>
- description: <text>
- if: <script>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- tag: <string>
Configuration
Field | Required | Default | Description |
---|---|---|---|
field | N | - | Single field to rename (mutually exclusive with fields ) |
target_field | N | - | New name for the field (required if field is used) |
fields | N | - | Array of field rename operations (mutually exclusive with field ) |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | See Handling Failures |
ignore_missing | N | false | If true , continue silently if field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
The processor can handle nested fields using dot notation and supports template variables in field names. If a target field already exists or the source field is missing, an exception is raised unless appropriate error handling is configured.
Multiple field rename is sequential. Each field is removed after being renamed unless the source and target names are identical.
Be careful when renaming fields that are part of a nested structure. The processor creates intermediate objects as needed, but this might affect existing field paths.
Examples
Single Field
Replace a field's name... |
|
with a new name: |
|
Multiple Fields
Rename multiple fields at once... |
|
creating a nested structure: |
|
Templates
Rename using template variables... |
|
evaluating the variables: |
|
Error Handling
Handling missing fields gracefully... |
|
continues execution: |
|