Reusing scripted field in another scripted field as a parameter in painless

I am trying to use a scripted field as a parameter in another scripted field but it seems to give wrong result in es7.4.2,It was working fine in es5.0.1

"script_fields": {
"a": {
"script": {
"source": "return 1",
"lang": "painless"
},
"ignore_failure": false
},
"b": {
"script": {
"source": "if(params.val != null){return params.val}",
"lang": "painless",
"params": {
"val":"a"
}
},
"ignore_failure": false
}

expected output -> value of field "a" is "1" and "b" is also "1"
but actual result ->value of field "a" is 1 and "b" is "a"
can anyone tell me what is wrong with the query

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.