From 9eeb5a50ceccc15a88cda1fbbcf84e78426661d8 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 14 Sep 2023 10:24:29 +0200 Subject: [PATCH] [docs][ingest-processors] Updated Example in Docs of append processor (#36478) (#36542) * Updated Example in Docs of append processor * Reworded the sentence in documentation (cherry picked from commit 9ca9434fc5b1792f8e659f2f6ed1b2988945ed7a) Co-authored-by: Vinit Chauhan --- .../processors/actions/docs/append.asciidoc | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/libbeat/processors/actions/docs/append.asciidoc b/libbeat/processors/actions/docs/append.asciidoc index a5ed9134ca3..78d4120b02b 100644 --- a/libbeat/processors/actions/docs/append.asciidoc +++ b/libbeat/processors/actions/docs/append.asciidoc @@ -8,10 +8,10 @@ The `append` processor appends one or more values to an existing array if the target field already exists and it is an array. Converts a scaler to an array and appends one or more values to it if the field exists and it is a scaler. Here the values can either be one or more static values or one or more values from the fields listed under 'fields' key. `target_field`:: The field in which you want to append the data. -`fields`:: (Optional) List of fields from which you want to copy data from. If the value is of a concrete type it will be appended directly to the target. +`fields`:: (Optional) List of fields from which you want to copy data from. If the value is of a concrete type it will be appended directly to the target. However, if the value is an array, all the elements of the array are pushed individually to the target field. `values`:: (Optional) List of static values you want to append to target field. -`ignore_empty_values`:: (Optional) If set to `true`, all the `""` and `nil` are omitted from being appended to the target field. +`ignore_empty_values`:: (Optional) If set to `true`, all the `""` and `nil` are omitted from being appended to the target field. `fail_on_error`:: (Optional) If set to `true` and an error occurs, the changes are reverted and the original is returned. If set to `false`, processing continues if an error occurs. Default is `true`. `allow_duplicate`:: (Optional) If set to `false`, the processor does not append values already present in the field. The default is `true`, which will append duplicate values in the array. @@ -30,11 +30,11 @@ processors: fields: message target: "" - append: - target_field: my-target-field - fields: + target_field: target-field + fields: - concrete.field - array.one - values: + values: - static-value - "" ignore_missing: true @@ -42,14 +42,22 @@ processors: ignore_empty_values: true ------------------------------------------------------------------------------ -Copies the values of `concrete.field`, `array.one` from response field to `my-target-field`: +Copies the values of `concrete.field`, `array.one` response fields and the static values to `target-field`: [source,json] ------------------------------------------------------------------------------- { - "message": "my-interesting-message", - "event": { - "original": "my-interesting-message" - } + "concrete": { + "field": "val0" + }, + "array": { + "one": [ "val1", "val2" ] + }, + "target-field": [ + "val0", + "val1", + "val2", + "static-value" + ] } -------------------------------------------------------------------------------