Adding a new numeric field based on addition of different fields from same index (using scripting fields)

I'm trying to create a new column in my existing index with a number type based on doc[''].value addition of total 4 columns, however, I'm not able to create a number based addition and create that new column using scripting fields (painless language) - Can someone please help?

I tried multiple code like below but, no luck in building this field named "totaltime"

    def totaltime = doc['responsetime'].value + doc['deliverytime'].value + doc['uiloadtime'].value + doc['uiapiloadtime'].value ;
    return totaltime;

Hi @prasad-jagtap,

Do you mind sharing the error that you get? Usually, they provide very good hints about what's breaking.

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