Max aggregation in transforms

Hi,

In transform, i have created one max field with the below script, but when the documents are not present it is returning as null value and getting fail.
can you please suggest how to handle it.
"MaxHandlingDuration" :{
"max": {
"script": {
"lang": "painless",
"source": """
if(doc['CallActionName'].size() > 0 ){
if(doc['CallActionName'].value=='CallHandlingComplete' )
{
doc.Duration.value
}
}
"""
}
}
}

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