cannectors

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: cannectors

After this filter, every record carries metadata.source = "cannectors".

Options

propertytypedefaultdescription
typerequired
"set"Module type discriminator. Must be `set` for this module.
id
stringUnique identifier within the pipeline.
name
stringHuman-readable name.
description
string
enabled
booleantrueWhether module is active.
tags
array<string>
onError
string"fail"Default error action. Case-insensitive; normalized to lowercase by the runtime.
targetrequired
stringField path to set (e.g. id, user.id, metadata.version). Supports dot notation for nested paths.
valuerequired
anyLiteral 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"]   # array

Creating nested paths

Writing to a nested path creates intermediate objects automatically:

- type: set
  target: metadata.audit.source
  value: cannectors

Even if the record had no metadata key, the filter creates metadata: { audit: { source: "cannectors" } }.

When to use set vs mapping

NeedReach for
Set a literal value (no transform)set
Map a source field to a target, optionally transformedmapping
Drop a fieldremove

set is the cheapest filter — no expressions, no transforms, no lookups. Use it freely for tagging, marking, or stamping.

Cross-references