Hi, I'm trying use scripted fields to get day, month and year of a date field but get some trouble over month field. I have the following scenario:
First Test:
Timezone of Server : UTC-3 (America/Fortaleza)
Timezone of Kibana Advanced Settings: UTC (Standard)
Time Day Month ID
01/11/2019 00:03:00 1 November 21769
31/10/2019 23:58:00 31 October 21768
But expected
Time Day Month ID
31/10/2019 21:03:00 31 October 21769
31/10/2019 20:58:00 31 October 21768
Second Test:
Timezone of Server : UTC-3 (America/Fortaleza)
Timezone of Kibana Advanced Settings: UTC-3 (America/Fortaleza)
Time Day Month ID
31/10/2019 21:03:00 1 November 21769
31/10/2019 20:58:00 31 October 21768
But expected
Time Day Month ID
31/10/2019 21:03:00 31 October 21769
31/10/2019 20:58:00 31 October 21768
Third Test:
Timezone of Server : UTC-3 (America/Fortaleza)
Timezone of Kibana Advanced Settings: UTC-3 (America/Fortaleza)
Scripted Field in Index Patterns
def day = LocalDateTime.ofInstant(Instant.ofEpochMilli(doc['datetime'].value.millis),ZoneId.of('UTC-3')).dayOfMonth; return day;
Time Day Month ID
31/10/2019 21:03:00 31 November 21769
31/10/2019 20:58:00 31 October 21768
But expected
Time Day Month ID
31/10/2019 21:03:00 31 October 21769
31/10/2019 20:58:00 31 October 21768
So my ask is how define timeZone in scripted field of month or other solution option?
I use this scripted field for month
def month = doc['datetime'].value.monthOfYear; def months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; return months[month-1];