When trying to start the master node of my cluster, just after the upgrade from 1.5 to 2.0 (yeah, that's a big jump), I get this error log:
[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]]]
Unfortunately, I don't have the detailed description of the field or the relevant analyzer configuration for the field, but as its name states, it's a timestamp from logstash, so it should look like one of these:
The log ends with this:
[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)
And the node shuts down..
I have carefully read issues #13169 and #13345, but none of these helped me, the node keeps failing to start.
i know that changing the mappings is easy when ES is up, but I'm kind of stuck here.
Any idea?
It is not possible to update the mapping of an existing field. If the mapping is set to the wrong type, re-creating the index with updated mapping and re-indexing is the only option available. In version 7.0, Elasticsearch has deprecated the document type and the default document type is set to _doc.
Basically, a type in Elasticsearch represented a class of similar documents and had a name such as customer or item . Lucene has no concept of document data types, so Elasticsearch would store the type name of each document in a metadata field of a document called _type.
from an Elasticsearch dev, it looks like a problem in my data, and not in ES itself: https://github.com/elastic/elasticsearch/issues/14491
your logstash-2015.10.18 index has a timestamp field which is mapped as a string on one type and as a date on another type, which is something that elasticsearch can't cope with. In elasticsearch 1.x this issue would be silent and only trip when trying to search/sort/aggregate on a field. In Elasticsearch 2.0, we detect these inconsistencies more proactively.
The definitive answer is here: https://www.elastic.co/blog/great-mapping-refactoring
You will not be able to upgrade indices with conflicting field mappings to Elasticsearch v2.0.
If the data in these indices is no longer needed, then you can simply delete the indices, otherwise you will need to reindex your data with correct mappings.
This tool may help to extract data and reimport it: https://github.com/taskrabbit/elasticsearch-dump
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With