Facing Error in Painless script in Kibana Version 7.3, But same script is working in 6.5.3

Dear Team,

Am facing error in Painless script in version 7.3. Same script is working fine in the version 6.5.3. Please help to identify the issue.

Error message : Script is invalid. View script preview for details(Attaching the screenshot)

Below is the script

if (doc['result.state'].value == "Resolved"){
return "Resolved";
}else if (doc['result.state'].value == "Closed") {
return "Closed";
}else if (doc['result.state'].value == "New") {
return "Pending";
}

It's likely the scripted field is trying to do a lookup for the fields mapping, and if there's any indices matched on the pattern where this doesn't exist you'll see this error.

You can do something like

if (!doc.containsKey('result.state') return null;

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