From 04d101304395ac3b874e89dfca4810d4925c067d Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Tue, 4 Sep 2018 18:31:55 +0200 Subject: [PATCH 1/4] INGEST: Document Processor Conditional Relates #33188 --- docs/reference/ingest/ingest-node.asciidoc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/reference/ingest/ingest-node.asciidoc b/docs/reference/ingest/ingest-node.asciidoc index 0241751a4df3b..cd18731100dea 100644 --- a/docs/reference/ingest/ingest-node.asciidoc +++ b/docs/reference/ingest/ingest-node.asciidoc @@ -721,12 +721,29 @@ All processors are defined in the following way within a pipeline definition: // NOTCONSOLE Each processor defines its own configuration parameters, but all processors have -the ability to declare `tag` and `on_failure` fields. These fields are optional. +the ability to declare `tag` ,`on_failure` and `if` fields. These fields are optional. A `tag` is simply a string identifier of the specific instantiation of a certain processor in a pipeline. The `tag` field does not affect the processor's behavior, but is very useful for bookkeeping and tracing errors to specific processors. +The `if` field must contain a script that returns a boolean value. If the script evaluates to `true` +then the processor will be executed for the given document otherwise it will be skipped. +The `if` field takes a map with the script settings used defined in <> +and accesses a read only version of the document via the same `ctx` variable used by scripts in the +<>. + +[source,js] +-------------------------------------------------- +{ + "bytes": { + "if": "ctx.bar == 'expectedValue'", + "field": "foo" + } +} +-------------------------------------------------- +// NOTCONSOLE + See <> to learn more about the `on_failure` field and error handling in pipelines. The <> can be used to figure out what processors are available in a cluster. From 1472452ddf4655bf0d617a859c8d2e7eb2020921 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Wed, 5 Sep 2018 11:50:57 +0200 Subject: [PATCH 2/4] CR: Fix whitespace around comma --- docs/reference/ingest/ingest-node.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/ingest/ingest-node.asciidoc b/docs/reference/ingest/ingest-node.asciidoc index cd18731100dea..95bb0345fd203 100644 --- a/docs/reference/ingest/ingest-node.asciidoc +++ b/docs/reference/ingest/ingest-node.asciidoc @@ -721,7 +721,7 @@ All processors are defined in the following way within a pipeline definition: // NOTCONSOLE Each processor defines its own configuration parameters, but all processors have -the ability to declare `tag` ,`on_failure` and `if` fields. These fields are optional. +the ability to declare `tag`, `on_failure` and `if` fields. These fields are optional. A `tag` is simply a string identifier of the specific instantiation of a certain processor in a pipeline. The `tag` field does not affect the processor's behavior, From a45e0f6e29863a8216a5ce7b4c3e171df8049939 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Wed, 5 Sep 2018 11:57:47 +0200 Subject: [PATCH 3/4] Move to set proc --- docs/reference/ingest/ingest-node.asciidoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/reference/ingest/ingest-node.asciidoc b/docs/reference/ingest/ingest-node.asciidoc index 95bb0345fd203..fe4bbc4bc50ce 100644 --- a/docs/reference/ingest/ingest-node.asciidoc +++ b/docs/reference/ingest/ingest-node.asciidoc @@ -736,9 +736,10 @@ and accesses a read only version of the document via the same `ctx` variable use [source,js] -------------------------------------------------- { - "bytes": { + "set": { "if": "ctx.bar == 'expectedValue'", - "field": "foo" + "field": "foo", + "value": "bar" } } -------------------------------------------------- From 8add06524b48e45dbae4c8cb71578c5bbe864c12 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Wed, 5 Sep 2018 12:06:09 +0200 Subject: [PATCH 4/4] CR: wording 'map' -> 'object' --- docs/reference/ingest/ingest-node.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/ingest/ingest-node.asciidoc b/docs/reference/ingest/ingest-node.asciidoc index fe4bbc4bc50ce..bad758c8a3c0d 100644 --- a/docs/reference/ingest/ingest-node.asciidoc +++ b/docs/reference/ingest/ingest-node.asciidoc @@ -729,7 +729,7 @@ but is very useful for bookkeeping and tracing errors to specific processors. The `if` field must contain a script that returns a boolean value. If the script evaluates to `true` then the processor will be executed for the given document otherwise it will be skipped. -The `if` field takes a map with the script settings used defined in <> +The `if` field takes an object with the script fields defined in <> and accesses a read only version of the document via the same `ctx` variable used by scripts in the <>.