File tree 1 file changed +19
-1
lines changed
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:
721
721
// NOTCONSOLE
722
722
723
723
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.
725
725
726
726
A `tag` is simply a string identifier of the specific instantiation of a certain
727
727
processor in a pipeline. The `tag` field does not affect the processor's behavior,
728
728
but is very useful for bookkeeping and tracing errors to specific processors.
729
729
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
+
730
748
See <<handling-failure-in-pipelines>> to learn more about the `on_failure` field and error handling in pipelines.
731
749
732
750
The <<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