From dee94c798c6165f3c1b768e157528e62102bd1a3 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 25 Sep 2015 22:31:20 +0200 Subject: [PATCH] add additional checks for version compatibility --- .../cluster/metadata/MetaDataIndexUpgradeService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java index e98f43c5f44..f0d1db9bf99 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java @@ -182,11 +182,15 @@ public class MetaDataIndexUpgradeService extends AbstractComponent { */ private static boolean isSupportedVersion(IndexMetaData indexMetaData) { if (indexMetaData.creationVersion().onOrAfter(Version.V_2_0_0_beta1)) { - // The index was created with elasticsearch that was using Lucene 4.0 + // The index was created with elasticsearch that was using Lucene 5.2.1 return true; } + if (indexMetaData.getUpgradeVersion().onOrAfter(Version.V_2_0_0_beta1) == false) { + // early terminate if we are not upgrade - we don't even need to look at the segment version + return false; + } if (indexMetaData.getMinimumCompatibleVersion() != null && - indexMetaData.getMinimumCompatibleVersion().onOrAfter(org.apache.lucene.util.Version.LUCENE_4_0_0)) { + indexMetaData.getMinimumCompatibleVersion().onOrAfter(org.apache.lucene.util.Version.LUCENE_5_0_0)) { //The index was upgraded we can work with it return true; }