【发布时间】:2020-11-24 00:02:43
【问题描述】:
我正在尝试在我的 Elasticsearch 索引映射中指定我的日期格式,如本文档所述:https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html
我有这样格式的日期:2020-10-29T05:36:06.143Z[UTC]。我如何将其转换为YYYY-MM-DD... 之类的格式?具体来说,最后如何表示[UTC]部分?
目前我有以下映射,我收到下面的错误,所以我试图指定日期的格式以查看它是否有效。谢谢!
"createdTimeStamp": {
"type": "date"
},
Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [createdTimeStamp] of type [date] in document with id 'testId1'.
Preview of field's value: '{offset={totalSeconds=0, rules={fixedOffset=true, transitionRules=[], transitions=[]}, id=Z}, year=2015, dayOfYear=1, nano=0, chronology={calendarType=iso8601, id=ISO}, minute=10, second=30, dayOfWeek=THURSDAY, month=JANUARY, hour=12, zone={totalSeconds=0, rules={fixedOffset=true, transitionRules=[], transitions=[]}, id=Z}, dayOfMonth=1, monthValue=1}']];
nested: ElasticsearchException[Elasticsearch exception [type=illegal_state_exception, reason=Can't get text on a START_OBJECT at 1:72]]
【问题讨论】:
标签: datetime elasticsearch mapping zoneddatetime datetimeformatter