Painless Reindex Script saving long as integer

I was able to figure this out. I needed to add (long) to the multiplication part so that it would be treaty as a long from the start.

The working script is:

if (ctx._source.telephony.duration != null && ctx._source.telephony.duration > 0) { long duration = (long)ctx._source.telephony.duration*1000000000; ctx._source.telephony.duration = (long)duration; }