diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java index 5babcef2e8d65..103679f5328ef 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java @@ -161,7 +161,7 @@ static BinaryFieldMapper createQueryBuilderFieldBuilder(BuilderContext context) } static RangeFieldMapper createExtractedRangeFieldBuilder(String name, RangeType rangeType, BuilderContext context) { - RangeFieldMapper.Builder builder = new RangeFieldMapper.Builder(name, rangeType, context.indexCreatedVersion()); + RangeFieldMapper.Builder builder = new RangeFieldMapper.Builder(name, rangeType); // For now no doc values, because in processQuery(...) only the Lucene range fields get added: builder.docValues(false); return builder.build(context); diff --git a/server/src/main/java/org/elasticsearch/index/mapper/RangeFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/RangeFieldMapper.java index e1ebfd58cd2d7..4c356c3a5592d 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/RangeFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/RangeFieldMapper.java @@ -40,7 +40,6 @@ import org.apache.lucene.store.ByteArrayDataOutput; import org.apache.lucene.util.BytesRef; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.Version; import org.elasticsearch.common.Explicit; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.collect.Tuple; @@ -93,8 +92,8 @@ public static class Builder extends FieldMapper.Builder parse(String name, Map node, ParserContext parserContext) throws MapperParsingException { - Builder builder = new Builder(name, type, parserContext.indexVersionCreated()); + Builder builder = new Builder(name, type); TypeParsers.parseField(builder, name, node, parserContext); for (Iterator> iterator = node.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = iterator.next(); @@ -205,7 +204,7 @@ public static final class RangeFieldType extends MappedFieldType { protected FormatDateTimeFormatter dateTimeFormatter; protected DateMathParser dateMathParser; - RangeFieldType(RangeType type, Version indexVersionCreated) { + RangeFieldType(RangeType type) { super(); this.rangeType = Objects.requireNonNull(type); setTokenized(false); diff --git a/server/src/test/java/org/elasticsearch/index/mapper/RangeFieldTypeTests.java b/server/src/test/java/org/elasticsearch/index/mapper/RangeFieldTypeTests.java index 803ec60153d5e..6ecd61275fe96 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/RangeFieldTypeTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/RangeFieldTypeTests.java @@ -77,12 +77,12 @@ public void modify(MappedFieldType ft) { @Override protected RangeFieldType createDefaultFieldType() { - return new RangeFieldType(type, Version.CURRENT); + return new RangeFieldType(type); } public void testRangeQuery() throws Exception { QueryShardContext context = createContext(); - RangeFieldType ft = new RangeFieldType(type, Version.CURRENT); + RangeFieldType ft = new RangeFieldType(type); ft.setName(FIELDNAME); ft.setIndexOptions(IndexOptions.DOCS); @@ -106,7 +106,7 @@ private QueryShardContext createContext() { public void testDateRangeQueryUsingMappingFormat() { QueryShardContext context = createContext(); - RangeFieldType fieldType = new RangeFieldType(RangeType.DATE, Version.CURRENT); + RangeFieldType fieldType = new RangeFieldType(RangeType.DATE); fieldType.setName(FIELDNAME); fieldType.setIndexOptions(IndexOptions.DOCS); fieldType.setHasDocValues(false); @@ -313,7 +313,7 @@ public void testParseIp() { public void testTermQuery() throws Exception { // See https://github.com/elastic/elasticsearch/issues/25950 QueryShardContext context = createContext(); - RangeFieldType ft = new RangeFieldType(type, Version.CURRENT); + RangeFieldType ft = new RangeFieldType(type); ft.setName(FIELDNAME); ft.setIndexOptions(IndexOptions.DOCS);