Move
Synopsis
Moves fields from one location to another within the document structure.
Schema
move:
- target_field: <ident>
- fields: <string[]>
- exclude: <string[]>
- move_to_root: <boolean>
- override: <boolean>
- ignore_missing: <boolean>
- description: <text>
- if: <script>
- ignore_failure: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- tag: <string>
Configuration
Field | Required | Default | Description |
---|---|---|---|
target_field | N* | - | Destination field (required unless move_to_root: true ) |
fields | N | ["*"] | List of patterns to match fields for moving |
exclude | N | - | List of patterns to exclude from moving |
move_to_root | N | false | Move matched fields to document root |
override | N | false | Allow overwriting existing target fields |
ignore_missing | N | false | Continue silently if source fields don't exist |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | See Handling Failures |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
The processor supports moving nested fields, pattern matching, and exclusions. It can move fields to a specific target field or to the root level of the document.
The processor is particularly useful for modifying and tidying document hierarchies, flattening nested objects, and isolating specific fields.
Fields are removed from their original location after moving. When move_to_root
is set to true
, target_field
is ignored.
Pattern matching uses filepath.Match syntax, e.g. *
for any characters, so patterns ending with .*
handle immediate children differently.
Moving fields to root level can overwrite existing fields. Be careful with pattern matching to avoid unintended moves.
Also, when moving nested structures, field conflicts can occur. Consider using exclude
patterns to protect critical fields.
Examples
Basic
Moving fields to a target location... |
|
restructures the document: |
|
Moving to Root
Flattening nested structures... |
|
brings fields to the top level: |
|
Exclusions
Moving selected fields while excluding others... |
|
preserves excluded fields: |
|
Immediate Children
Children fields... |
|
are moved up one level: |
|
Target Fields
Replacing existing fields... |
|
allows for field replacement: |
|