Hi all,
I am trying to use a painless script as part of a reindex to multiply a long by a number, and then save it as the source field. However, when the new value is saved it is saved as an integer instead of a long resulting in an overflow, and thus a messed up number. Does anyone have any ideas on this? I wasn't able to find much on Google about this issue.
Here is an example mapping:
{
"properties": {
"telephony": {
"properties": {
"duration": {
"type": "long"
}
}
}
}
}
Here is an example input doc:
{
"telephony.duration": 48
}
Here is the script that is being run:
if (ctx._source.telephony.duration != null && ctx._source.telephony.duration > 0) { long duration = ctx._source.telephony.duration*1000000000; ctx._source.telephony.duration = (long)duration; }
Here is the output that I get:
{
"telephony.duration": 755359744
}
Clearly the output has been added as an integer rather than a long, as the output number isn't even possible if it were executing the math correctly. What I don't understand is how/why this is happening, as everything that I can see should result in a long output.