diff --git a/modules/ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/210_conditional_processor.yml b/modules/ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/210_conditional_processor.yml index 8ad2be2b41fe4..85adc4c504764 100644 --- a/modules/ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/210_conditional_processor.yml +++ b/modules/ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/210_conditional_processor.yml @@ -74,3 +74,44 @@ teardown: - match: { _source.bytes_source_field: "1kb" } - match: { _source.conditional_field: "bar" } - is_false: _source.bytes_target_field + +--- +"Test conditionals support params and statements": + - do: + ingest.put_pipeline: + id: "my_pipeline" + body: > + { + "description": "_description", + "processors": [ + { + "set" : { + "if" : { + "source": "def hit = params.success_codes.containsKey(ctx.code); return hit != null && hit == true;", + "params": { + "success_codes" : { + "10": true, + "20": true + } + } + }, + "field" : "result", + "value" : "success" + } + } + ] + } + - match: { acknowledged: true } + + - do: + index: + index: test + id: "1" + pipeline: "my_pipeline" + body: { code: "20" } + + - do: + get: + index: test + id: "1" + - match: { _source.result: "success" }