Painless Script with date: hour_minute_second

Hi guys, I have date field with the following format:

"start": {
        "type": "date",
        "format": "hour_minute_second"
      }

Trying to get the field value in a script field using:
"doc['start'].value" it returns a long value like 86399000. The original value was "23:59:59".

Since it is persisting the value in milliseconds, how can I parse it to a LocalTime to compare with a param value?

Thanks!

In the painless scripting language (5.0+), you can use java's new time api. Also note in 6.0+, .value for a date field returns a ReadableDateTime instead of a long.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.