gsub.asciidoc 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. [[gsub-processor]]
  2. === Gsub processor
  3. ++++
  4. <titleabbrev>Gsub</titleabbrev>
  5. ++++
  6. Converts a string field by applying a regular expression and a replacement.
  7. 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.
  8. [[gsub-options]]
  9. .Gsub Options
  10. [options="header"]
  11. |======
  12. | Name | Required | Default | Description
  13. | `field` | yes | - | The field to apply the replacement to
  14. | `pattern` | yes | - | The pattern to be replaced
  15. | `replacement` | yes | - | The string to replace the matching patterns with
  16. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  17. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  18. include::common-options.asciidoc[]
  19. |======
  20. [source,js]
  21. --------------------------------------------------
  22. {
  23. "gsub": {
  24. "field": "field1",
  25. "pattern": "\\.",
  26. "replacement": "-"
  27. }
  28. }
  29. --------------------------------------------------
  30. // NOTCONSOLE