From d07e61b187233787190fd860025a39a1eaf071a1 Mon Sep 17 00:00:00 2001 From: Nick Knize Date: Mon, 11 Feb 2019 16:26:45 -0600 Subject: [PATCH] Fix the version check for LegacyGeoShapeFieldMapper (#38547) Change version check from 7.0 to 6.6 in BaseGeoShapeFieldMapper to correctly use LegacyGeoShapeFieldMapper for indexes created prior to 6.6. --- .../org/elasticsearch/index/mapper/BaseGeoShapeFieldMapper.java | 2 +- .../java/org/elasticsearch/index/mapper/ExternalMapper.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/index/mapper/BaseGeoShapeFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/BaseGeoShapeFieldMapper.java index ea30f1c5c2312..74892bf7d516c 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/BaseGeoShapeFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/BaseGeoShapeFieldMapper.java @@ -190,7 +190,7 @@ public Mapper.Builder parse(String name, Map node, ParserContext } } final Builder builder; - if (parsedDeprecatedParams || parserContext.indexVersionCreated().before(Version.V_7_0_0)) { + if (parsedDeprecatedParams || parserContext.indexVersionCreated().before(Version.V_6_6_0)) { // Legacy index-based shape builder = new LegacyGeoShapeFieldMapper.Builder(name, deprecatedParameters); } else { diff --git a/server/src/test/java/org/elasticsearch/index/mapper/ExternalMapper.java b/server/src/test/java/org/elasticsearch/index/mapper/ExternalMapper.java index ea3125accd059..31864abc2e459 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/ExternalMapper.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/ExternalMapper.java @@ -87,7 +87,7 @@ public ExternalMapper build(BuilderContext context) { BinaryFieldMapper binMapper = binBuilder.build(context); BooleanFieldMapper boolMapper = boolBuilder.build(context); GeoPointFieldMapper pointMapper = latLonPointBuilder.build(context); - BaseGeoShapeFieldMapper shapeMapper = (context.indexCreatedVersion().before(Version.V_7_0_0)) + BaseGeoShapeFieldMapper shapeMapper = (context.indexCreatedVersion().before(Version.V_6_6_0)) ? legacyShapeBuilder.build(context) : shapeBuilder.build(context); FieldMapper stringMapper = (FieldMapper)stringBuilder.build(context);