INGEST: Document Processor Conditional
* INGEST: Document Processor Conditional
Relates
@@ -721,12 +721,30 @@ 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 an object with the script fields defined in <<script-processor, script-options>>
+and accesses a read only version of the document via the same `ctx` variable used by scripts in the
+<<script-processor>>.
+
+[source,js]
+--------------------------------------------------
+{
+ "set": {
+ "if": "ctx.bar == 'expectedValue'",
+ "field": "foo",
+ "value": "bar"
+ }
+}
+--------------------------------------------------
+// NOTCONSOLE
+
See <<handling-failure-in-pipelines>> to learn more about the `on_failure` field and error handling in pipelines.
The <<ingest-info,node info API>> can be used to figure out what processors are available in a cluster.
