Elasticsearch Upgrade 1.x to 2.x

Hi Guys, I'm trying to upgrade elasticsearch-1.4.5 to elasticsearch 2.x but I'm getting the following error on elasticsearch.log, and I can see from error message it's something related to index mapping. but I have around 1000 indexes.

[2018-06-18 15:45:27,390][ERROR][bootstrap ] Guice Exception: java.lang.IllegalStateException: unable to upgrade the mappings for the index [logstash-2018.04.06], reason: [Field name [activemq.broker] cannot contain '.']
Likely root cause: MapperParsingException[Field name [activemq.broker] cannot contain '.']
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:277)
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:222)
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:197)
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:309)
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:222)
at org.elasticsearch.index.mapper.object.RootObjectMapper$TypeParser.parse(RootObjectMapper.java:139)
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:118)
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:99)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:549)
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:319)
at org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService.checkMappingsCompatibility(MetaDataIndexUpgradeService.java:302)
at org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService.upgradeIndexMetaData(MetaDataIndexUpgradeService.java:116)
at org.elasticsearch.gateway.GatewayMetaState.pre20Upgrade(GatewayMetaState.java:228)
at org.elasticsearch.gateway.GatewayMetaState.(GatewayMetaState.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at <<>>
at org.elasticsearch.node.Node.(Node.java:213)
at org.elasticsearch.node.Node.(Node.java:140)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:143)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)

Any Ideas to get rid of this error.

Fields with dots were an issue in 1.x which we could not address without failing to index documents with dots in field names. Support for dots in field names was added back in 5.0, implemented in a different way, so the easiest way to upgrade might be to go to 5.x (or even 6.x) directly. Here is the PR that enabled dots in field names again: https://github.com/elastic/elasticsearch/pull/19899.

1 Like

Hi jpountz,
How can I upgrade to 5.x while my indexes was created before V2.0.0, actually I tried to upgrade to 5.x but I received the following error

  1. Error injecting constructor, ElasticsearchException[java.io.IOException: failed to read [id:2, legacy:true, file:/mnt/data_vol/elasticsearch/elasticsearch/nodes/0/indices/piap-2017.10.31/_state/state-2]]; nested: IOException[failed to read [id:2, legacy:true, file:/mnt/data_vol/elasticsearch/elasticsearch/nodes/0/indices/piap-2017.10.31/_state/state-2]]; nested: IllegalStateException[unsupported compression: index was created before v2.0.0.beta1 and wasn't upgraded?];

Indeed you can't upgrade in-place, you would need to reindex. Elasticsearch N only supports reading indices created by versions N or N-1.

One way that you could do that would be by temporarily setting up a new 5.x (or 6.x) cluster and use the reindex from remote API to reindex from the old cluster into the new cluster. https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-reindex.html#reindex-from-remote

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.