File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
modules/ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -74,3 +74,44 @@ teardown:
7474 - match : { _source.bytes_source_field: "1kb" }
7575 - match : { _source.conditional_field: "bar" }
7676 - is_false : _source.bytes_target_field
77+
78+ ---
79+ " Test conditionals support params and statements " :
80+ - do :
81+ ingest.put_pipeline :
82+ id : " my_pipeline"
83+ body : >
84+ {
85+ "description": "_description",
86+ "processors": [
87+ {
88+ "set" : {
89+ "if" : {
90+ "source": "def hit = params.success_codes.containsKey(ctx.code); return hit != null && hit == true;",
91+ "params": {
92+ "success_codes" : {
93+ "10": true,
94+ "20": true
95+ }
96+ }
97+ },
98+ "field" : "result",
99+ "value" : "success"
100+ }
101+ }
102+ ]
103+ }
104+ - match : { acknowledged: true }
105+
106+ - do :
107+ index :
108+ index : test
109+ id : " 1"
110+ pipeline : " my_pipeline"
111+ body : { code: "20" }
112+
113+ - do :
114+ get :
115+ index : test
116+ id : " 1"
117+ - match : { _source.result: "success" }
You can’t perform that action at this time.
0 commit comments