Adding a new field to _source using scripts


I am trying to add a new field while reindexing the data if a particular condition is satisfied.

Can anyone solve this problem.

Thanks and Regards,

What have you tried so far? What is the problem you need help solving?

Hi Christian Dahlqvist

I sorted this out using script.

ctx._source.newfield = ctx._source.field1 + ctx._source.field2

Thanks you