Assuming this is on some late 7.x version, according to the java the docs that we link from our format docs, five is the magic number in this case:
Offset Z : This formats the offset based on the number of pattern letters. One, two or three letters outputs the hour and minute, without a colon, such as '+0130'. The output will be '+0000' when the offset is zero. Four letters outputs the full form of localized offset, equivalent to four letters of Offset-O. The output will be the corresponding localized offset text if the offset is zero. Five letters outputs the hour, minute, with optional second if non-zero, with colon. It outputs 'Z' if the offset is zero. Six or more letters throws
IllegalArgumentException
.
This at least works for me on 7.6.2
DELETE test
PUT /_template/test
{
"index_patterns": ["test"],
"mappings": {
"properties": {
"date": { "type": "date", "format": "yyyy-MM-dd HH:mm:ssZZZZZ" }
}
}
}
PUT /test/_doc/1
{ "date1": "2020-05-07 13:16:44+00:00" }
GET /test/_search
{
"docvalue_fields": ["date"]
})
Formatting is also often weird to me, I keep re-reading those docs and need to try things every time, and zone offsets are especially hard. Hope this helps.