I am new to kibana and trying to create dashboard. I have 4 scripted fields which are calculating dollar savings for specific process due to automation. i am trying to get sum of these 4 scripted fields to show total savings due to process automation. I looked at documentation but unable to find way to achieve this. Some fields may have null value for certain record. i have tried following code but its not working.
i have tried to assign following code to new scripted field to get sum for 2 fields.
def field1_value = params['_source']['HR_COST_AV'];
def field2_value = params['_source']['Marketing_Cost_AV'];
if(field1_value != null) {
if(field2_value != null) {
return field1_value + field2_value;
} else {
return field1_value;
}
} else {
return field2_value;
}