Back to Elasticsearch

Gsub processor [gsub-processor]

docs/reference/enrich-processor/gsub-processor.md

9.4.01.7 KB
Original Source

Gsub processor [gsub-processor]

Converts a string field by applying a regular expression and a replacement. If the field is an array of string, all members of the array will be converted. If any non-string values are encountered, the processor will throw an exception.

$$$gsub-options$$$

NameRequiredDefaultDescription
fieldyes-The field to apply the replacement to
patternyes-The pattern to be replaced
replacementyes-The string to replace the matching patterns with
target_fieldnofieldThe field to assign the converted value to, by default field is updated in-place
ignore_missingnofalseIf true and field does not exist or is null, the processor quietly exits without modifying the document
descriptionno-Description of the processor. Useful for describing the purpose of the processor or its configuration.
ifno-Conditionally execute the processor. See Conditionally run a processor.
ignore_failurenofalseIgnore failures for the processor. See Handling pipeline failures.
on_failureno-Handle failures for the processor. See Handling pipeline failures.
tagno-Identifier for the processor. Useful for debugging and metrics.
js
{
  "gsub": {
    "field": "field1",
    "pattern": "\\.",
    "replacement": "-"
  }
}

% NOTCONSOLE