Hello,
I would like to make thousands of upsert and computing a time difference between the document already indexed (not with a time-based key but with an id key) and an already stored date, so I can tell what was the last time between two connections.
I would like to do something like this in my script:
ctx._source.diffdate = params.infodate.epoch_second - ctx._source.lastinfodate.epoch_second
Where params.infodate contains the latest timestamp and the ctx._source.lastinfodate contains the former latest timestamp.
In the mapping, the lastinfodate is known as a Date but, in the script, it is known as a String, so I can't access epoch_second method.
"reason" : "Unable to find dynamic field [epoch_second] for class [java.lang.String]."
I would like to load the field directly as a number in the script to do the difference. Doing "string to date" conversion in the script would result in an non-affordable CPU time.
How can I do it?