File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -721,12 +721,30 @@ All processors are defined in the following way within a pipeline definition:
721721// NOTCONSOLE
722722
723723Each 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
726726A `tag` is simply a string identifier of the specific instantiation of a certain
727727processor in a pipeline. The `tag` field does not affect the processor's behavior,
728728but 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 an object with the script fields 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+ "set": {
740+ "if": "ctx.bar == 'expectedValue'",
741+ "field": "foo",
742+ "value": "bar"
743+ }
744+ }
745+ --------------------------------------------------
746+ // NOTCONSOLE
747+
730748See <<handling-failure-in-pipelines>> to learn more about the `on_failure` field and error handling in pipelines.
731749
732750The <<ingest-info,node info API>> can be used to figure out what processors are available in a cluster.
You can’t perform that action at this time.
0 commit comments