Skip to content

Commit 04d1013

Browse files
INGEST: Document Processor Conditional
Relates elastic#33188
1 parent c5109a5 commit 04d1013

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

docs/reference/ingest/ingest-node.asciidoc

+18-1
Original file line numberDiff line numberDiff line change
@@ -721,12 +721,29 @@ All processors are defined in the following way within a pipeline definition:
721721
// NOTCONSOLE
722722

723723
Each processor defines its own configuration parameters, but all processors have
724-
the ability to declare `tag` and `on_failure` fields. These fields are optional.
724+
the ability to declare `tag` ,`on_failure` and `if` fields. These fields are optional.
725725

726726
A `tag` is simply a string identifier of the specific instantiation of a certain
727727
processor in a pipeline. The `tag` field does not affect the processor's behavior,
728728
but is very useful for bookkeeping and tracing errors to specific processors.
729729

730+
The `if` field must contain a script that returns a boolean value. If the script evaluates to `true`
731+
then the processor will be executed for the given document otherwise it will be skipped.
732+
The `if` field takes a map with the script settings used defined in <<script-processor, script-options>>
733+
and accesses a read only version of the document via the same `ctx` variable used by scripts in the
734+
<<script-processor>>.
735+
736+
[source,js]
737+
--------------------------------------------------
738+
{
739+
"bytes": {
740+
"if": "ctx.bar == 'expectedValue'",
741+
"field": "foo"
742+
}
743+
}
744+
--------------------------------------------------
745+
// NOTCONSOLE
746+
730747
See <<handling-failure-in-pipelines>> to learn more about the `on_failure` field and error handling in pipelines.
731748

732749
The <<ingest-info,node info API>> can be used to figure out what processors are available in a cluster.

0 commit comments

Comments
 (0)