append.asciidoc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. [[append-processor]]
  2. === Append processor
  3. ++++
  4. <titleabbrev>Append</titleabbrev>
  5. ++++
  6. Appends one or more values to an existing array if the field already exists and it is an array.
  7. Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar.
  8. Creates an array containing the provided values if the field doesn't exist.
  9. Accepts a single value or an array of values.
  10. [[append-options]]
  11. .Append Options
  12. [options="header"]
  13. |======
  14. | Name | Required | Default | Description
  15. | `field` | yes | - | The field to be appended to. Supports <<template-snippets,template snippets>>.
  16. | `value` | yes | - | The value to be appended. Supports <<template-snippets,template snippets>>.
  17. | `allow_duplicates` | no | true | If `false`, the processor does not append
  18. values already present in the field.
  19. | `media_type` | no | `application/json` | The media type for encoding `value`. Applies only when `value` is a
  20. <<template-snippets,template snippet>>. Must be one of `application/json`, `text/plain`, or
  21. `application/x-www-form-urlencoded`.
  22. include::common-options.asciidoc[]
  23. |======
  24. [source,js]
  25. --------------------------------------------------
  26. {
  27. "append": {
  28. "field": "tags",
  29. "value": ["production", "{{{app}}}", "{{{owner}}}"]
  30. }
  31. }
  32. --------------------------------------------------
  33. // NOTCONSOLE