尝试启动群集的主节点时,刚刚从1.5升级到2.0(是的,这是一个很大的跳转),我收到此错误日志:
[2015-11-03 18:15:10,948][ERROR][gateway ] [mon-01] failed to read local state, exiting...
java.lang.IllegalStateException: unable to upgrade the mappings for the index [logstash-2015.10.18], reason: [Mapper for [timestamp] conflicts with existing mapping in other types:
[mapper [timestamp] cannot be changed from type [date] to [string]]]
不幸的是,我没有该字段的详细描述或该字段的相关分析器配置,但正如其名称所述,它是logstash的时间戳,因此它看起来应该是以下之一:
日志以此结尾:
[2015-11-03 18:15:11,383][ERROR][bootstrap ] Guice Exception: java.lang.IllegalStateException: unable to upgrade the mappings for the index [logstash-2015.10.18], reason: [Mapper for [timestamp] conflicts with existing mapping in other types:
[mapper [timestamp] cannot be changed from type [date] to [string]]]
Likely root cause: java.lang.IllegalArgumentException: Mapper for [timestamp] conflicts with existing mapping in other types:
[mapper [timestamp] cannot be changed from type [date] to [string]]
at org.elasticsearch.index.mapper.FieldTypeLookup.checkCompatibility(FieldTypeLookup.java:117)
at org.elasticsearch.index.mapper.MapperService.checkNewMappersCompatibility(MapperService.java:345)
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:296)
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:242)
at org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService.checkMappingsCompatibility(MetaDataIndexUpgradeService.java:329)
at org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService.upgradeIndexMetaData(MetaDataIndexUpgradeService.java:112)
at org.elasticsearch.gateway.GatewayMetaState.pre20Upgrade(GatewayMetaState.java:226)
at org.elasticsearch.gateway.GatewayMetaState.<init>(GatewayMetaState.java:85)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at <<<guice>>>
at org.elasticsearch.node.Node.<init>(Node.java:198)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
节点关闭..
我仔细阅读了问题#13169和#13345,但这些都没有帮助我,节点始终无法启动。
我知道当ES升级时changing the mappings很容易,但我有点被困在这里。
有什么想法吗?
答案 0 :(得分:5)
,它看起来像我的数据中的问题,而不是ES本身:https://github.com/elastic/elasticsearch/issues/14491
你的logstash-2015.10.18索引有一个映射的时间戳字段 作为一种类型的字符串和另一种类型的日期,即 弹性搜索无法解决的问题。在elasticsearch 1.x中 这个问题是沉默的,只有在尝试时才会出行 在字段上搜索/排序/聚合。在Elasticsearch 2.0中,我们检测到 这些不一致更加主动。
最终答案如下:https://www.elastic.co/blog/great-mapping-refactoring
您将无法升级具有冲突字段的索引 映射到Elasticsearch v2.0。
如果不再需要这些索引中的数据,那么您可以简单地进行操作 删除索引,否则您需要使用重新索引数据 正确的映射。
此工具可能有助于提取数据并重新导入数据:https://github.com/taskrabbit/elasticsearch-dump