Update elasticsearch with calculation on fields

(gpong) #1

Hi Guys,

Can I used elasticsearch update for calculate the same fields with plus or minus value??
for example :
first I have this document on elasticsearch

then I insert new document


can I use update API to do some calculation for stock_qty (+5) and warehouse_qty (-3)?
and the result will be like



(Mark Walkom) #2

I think you can do this with scripted updates.

(gpong) #3

Thanks Warkolm

(system) #4