Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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" }