How to sum two fields in Kibana?

I have two different fields. Let Suppose A and B and I want sum of these two fields A+B and create new field and save records in this new created field.

Hi @padamrai ,

You can create a scripted field, go to Stack Management -> Index Pattern -> select index pattern -> Scripted fields tab and hit Create:

Regards, Dzmitry

Thanks Dear Dzmitry,
I have a question after apply this formulla, In which field it is saved?

It will be saved in the field that you created, you must specify the name of your wish here:

Regards, Dzmitry

Thank you so much Dear Dzmitry I got it.

Syntax Error:
doc['CreditedAmount'].value + doc['debitedAmount'].value
Script is invalid. View script preview for details


Be careful and check that your fields always have valid number as a value. If not, you need to modify script so it handles it. In first post I shared an article with nice examples. You can also use script preview to see why it fails.

Good luck!

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