Pass params value to scripted_metric

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;"
  }
}

}
}

What version of Elasticsearch are you using? This should be fixed starting in 7.3.0. See https://github.com/elastic/elasticsearch/pull/42096

I am using elastic 7.3.2 but its not reflecting, my result still shows only the string param which i use in params parameter, but how to pass actual value like interger.
Suppose if total_price is 45 after aggregation then how do I pass this 45 to params that is my question,

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