set
Set a field to a literal value on every record.
The set filter writes a literal value to a target path on every
record. If the path includes nested objects that don't exist yet,
they're created.
Minimal example
filters:
- type: set
target: metadata.source
value: cannectorsAfter this filter, every record carries metadata.source = "cannectors".
Options
| property | type | default | description |
|---|---|---|---|
typerequired | "set" | — | Module type discriminator. Must be `set` for this module. |
id | string | — | Unique identifier within the pipeline. |
name | string | — | Human-readable name. |
description | string | — | — |
enabled | boolean | true | Whether module is active. |
tags | array<string> | — | — |
onError | string | "fail" | Default error action. Case-insensitive; normalized to lowercase by the runtime. |
targetrequired | string | — | Field path to set (e.g. id, user.id, metadata.version). Supports dot notation for nested paths. |
valuerequired | any | — | Literal value to set. Can be string, number, boolean, or null. Type is preserved. |
Type preservation
The YAML type of value is preserved — strings stay strings, numbers
stay numbers, booleans stay booleans, null stays null. Use YAML
quoting if you need an explicit string:
- type: set
target: version
value: "1.0" # string "1.0", not number 1.0
- type: set
target: count
value: 0 # number 0
- type: set
target: tags
value: ["api", "internal"] # arrayCreating nested paths
Writing to a nested path creates intermediate objects automatically:
- type: set
target: metadata.audit.source
value: cannectorsEven if the record had no metadata key, the filter creates
metadata: { audit: { source: "cannectors" } }.
When to use set vs mapping
| Need | Reach for |
|---|---|
| Set a literal value (no transform) | set |
| Map a source field to a target, optionally transformed | mapping |
| Drop a field | remove |
set is the cheapest filter — no expressions, no transforms, no
lookups. Use it freely for tagging, marking, or stamping.