Elasticsearch mapping date format

Hi,

I have a date field and I use painless language to update the date field. Since ES7, I have to pass string rather than LocalDateTime because RestHighLevelClient doesn't take the format specified in the mapping into account, so it adds the zone 'Z' to the date.

LocalDateTime.toString() drops the seconds/ms when the sec/ms is zero e.g. 2019-12-01T12:30:00 or 2019-12-01T12:30:10:000.

Currently this is how the field mapping looks like:

"updatedDate": {
          "type": "date",
          "format": "strictDateHourMinuteSecondMillis || strictDateHourMinuteSecond || strictDateHourMinute"
}

Is it possible to have just a single date format which is strict date and time but sec/ms are optional?

Thank you
Uthayam

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