I am trying to pass value inside params field in scripted_metric from outside (which is aggregated sum of particular column), but its not getting updated there. Please help me in this. How should I pass total_price inside params and use params in reduxe_script.
{
"aggs": {
"group_by_sl_met": {
"total_price": {
"sum": {
"script": {
"lang": "painless",
"inline": "doc['Incident ID'].value"
}
}
},
"scripted_metric": {
"params": {
"field":"total_price.value"
},
"map_script": "if(doc['duplicateRecord'].value == false){if(params['_source']['_sirion_active'] == true){state.map.fixed++; state.map.result++}else{state.map.notfixed++}}",
"init_script": "state['map'] =['fixed': 0, 'notfixed': 0, 'result': 0]",
"reduce_script": "return states;",
"combine_script": "return state;"
}
}
}
}