How to create a new script field to group values

Dear All,

Am trying to create a new scripted field and need to group values. Please help me to write the script to get the values

if ( Status='Closed' or Status="Resolved' then 'Closed' else 'Pending').

How to write the same in Kibana script to create new field.

Vinay N

Hi @vinay.rao,

You'll want something like this:

if (doc['status.keyword'].value == "Resolved" ||  doc['status.keyword'].value == "Closed") {
    return "Closed";

return "Pending";

@Larry_Gregory : Thanks a lot for your Workaround. I have used the Script which is suggested by you. But am not able to get the output field in my index. Please find the attachment of the error which am facing. Appreciate your response to find out the solution.

Vinay N

Is result.state a keyword or text field? It should be a keyword field for this script to work correctly

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