从 1.5.2 升级后 Elasticsearch 2.2.0 日期格式失败
Elasticsearch 2.2.0 date formats failed after upgrading from 1.5.2
我正在尝试将数据插入 Elastisearch 2.2.0,并将 mapped 归档为:
...
"startTime": {
"format": "yyyy/MM/dd HH:mm:ss",
"type": "date"
}
...
插入的数据为(字符串):
...
"startTime":1454858900301
...
我遇到异常:
MapperParsingException[failed to parse [startTime]]; nested: IllegalArgumentException[Invalid format: "1454858900301" is malformed at "0301"];
Caused by: java.lang.IllegalArgumentException: Invalid format: "1454858900301" is malformed at "0301"
at org.joda.time.format.DateTimeParserBucket.doParseMillis(DateTimeParserBucket.java:187)
at org.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:780)
at org.elasticsearch.index.mapper.core.DateFieldMapper$DateFieldType.parseStringValue(DateFieldMapper.java:362)
at org.elasticsearch.index.mapper.core.DateFieldMapper.innerParseCreateField(DateFieldMapper.java:528)
at org.elasticsearch.index.mapper.core.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:241)
at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:335)
在 Elastic 版本 1.5.2 中没有发生,在我升级到 2.2.0 之前,我使用了应该列出所有映射问题的 migration plugin - 没有出现...
异常是什么原因造成的?我插入了长纪元时间字符串(以毫秒为单位),应该被解析为我在映射中列出的格式,不是吗?
为什么它在 1.5.2 中有效而在 2.2.0 中失败?
我认为你必须在 ES 2.X 中完成 breaking change in date format。从文档中,
In 2.0, we have added two formats: epoch_millis and epoch_second. Only
date fields that use these formats will be able to parse timestamps
迁移工具不会检测到这一点,因为这不是映射问题。作为解决方案,您可能必须将日期格式更改为 epoch_millis 或 epoch_second.
中的任何一种
我正在尝试将数据插入 Elastisearch 2.2.0,并将 mapped 归档为:
...
"startTime": {
"format": "yyyy/MM/dd HH:mm:ss",
"type": "date"
}
...
插入的数据为(字符串):
...
"startTime":1454858900301
...
我遇到异常:
MapperParsingException[failed to parse [startTime]]; nested: IllegalArgumentException[Invalid format: "1454858900301" is malformed at "0301"];
Caused by: java.lang.IllegalArgumentException: Invalid format: "1454858900301" is malformed at "0301"
at org.joda.time.format.DateTimeParserBucket.doParseMillis(DateTimeParserBucket.java:187)
at org.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:780)
at org.elasticsearch.index.mapper.core.DateFieldMapper$DateFieldType.parseStringValue(DateFieldMapper.java:362)
at org.elasticsearch.index.mapper.core.DateFieldMapper.innerParseCreateField(DateFieldMapper.java:528)
at org.elasticsearch.index.mapper.core.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:241)
at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:335)
在 Elastic 版本 1.5.2 中没有发生,在我升级到 2.2.0 之前,我使用了应该列出所有映射问题的 migration plugin - 没有出现...
异常是什么原因造成的?我插入了长纪元时间字符串(以毫秒为单位),应该被解析为我在映射中列出的格式,不是吗?
为什么它在 1.5.2 中有效而在 2.2.0 中失败?
我认为你必须在 ES 2.X 中完成 breaking change in date format。从文档中,
In 2.0, we have added two formats: epoch_millis and epoch_second. Only date fields that use these formats will be able to parse timestamps
迁移工具不会检测到这一点,因为这不是映射问题。作为解决方案,您可能必须将日期格式更改为 epoch_millis 或 epoch_second.
中的任何一种