diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/DateHistogramValuesSourceBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/DateHistogramValuesSourceBuilder.java index 837540daf21..5592fefb27a 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/DateHistogramValuesSourceBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/DateHistogramValuesSourceBuilder.java @@ -260,7 +260,7 @@ public class DateHistogramValuesSourceBuilder RoundingValuesSource vs = new RoundingValuesSource(numeric, preparedRounding); // is specified in the builder. final DocValueFormat docValueFormat = format() == null ? DocValueFormat.RAW : config.format(); - final MappedFieldType fieldType = config.fieldContext() != null ? config.fieldContext().fieldType() : null; + final MappedFieldType fieldType = config.fieldType(); return new CompositeValuesSourceConfig(name, fieldType, vs, docValueFormat, order(), missingBucket(), config.script() != null); } else { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilder.java index 533f112aed4..b1ea58a0d3d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilder.java @@ -136,7 +136,7 @@ public class GeoTileGridValuesSourceBuilder extends CompositeValuesSourceBuilder if (orig instanceof ValuesSource.GeoPoint) { ValuesSource.GeoPoint geoPoint = (ValuesSource.GeoPoint) orig; // is specified in the builder. - final MappedFieldType fieldType = config.fieldContext() != null ? config.fieldContext().fieldType() : null; + final MappedFieldType fieldType = config.fieldType(); CellIdSource cellIdSource = new CellIdSource(geoPoint, precision, geoBoundingBox, GeoTileUtils::longEncode); return new CompositeValuesSourceConfig(name, fieldType, cellIdSource, DocValueFormat.GEOTILE, order(), missingBucket(), script() != null); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/HistogramValuesSourceBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/HistogramValuesSourceBuilder.java index d422ac4dbbe..ce66c763fcc 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/HistogramValuesSourceBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/HistogramValuesSourceBuilder.java @@ -118,7 +118,7 @@ public class HistogramValuesSourceBuilder extends CompositeValuesSourceBuilder 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, null, "bytes", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, null, "bytes", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Bytes valuesSource = (ValuesSource.Bytes) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); SortedBinaryDocValues values = valuesSource.bytesValues(ctx); @@ -68,14 +68,14 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, null, "bytes", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, null, "bytes", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Bytes valuesSource = (ValuesSource.Bytes) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); SortedBinaryDocValues values = valuesSource.bytesValues(ctx); assertFalse(values.advanceExact(0)); config = ValuesSourceConfig.resolve( - context, null, "bytes", null, "abc", null, null, CoreValuesSourceType.BYTES, null); + context, null, "bytes", null, "abc", null, null, CoreValuesSourceType.BYTES); valuesSource = (ValuesSource.Bytes) config.getValuesSource(); values = valuesSource.bytesValues(ctx); assertTrue(values.advanceExact(0)); @@ -94,13 +94,13 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { try (Engine.Searcher searcher = indexService.getShard(0).acquireSearcher("test")) { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, ValueType.STRING, "bytes", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, ValueType.STRING, "bytes", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Bytes valuesSource = (ValuesSource.Bytes) config.getValuesSource(); assertNotNull(valuesSource); assertFalse(config.hasValues()); config = ValuesSourceConfig.resolve( - context, ValueType.STRING, "bytes", null, "abc", null, null, CoreValuesSourceType.BYTES, null); + context, ValueType.STRING, "bytes", null, "abc", null, null, CoreValuesSourceType.BYTES); valuesSource = (ValuesSource.Bytes) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); SortedBinaryDocValues values = valuesSource.bytesValues(ctx); @@ -122,7 +122,7 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, null, "long", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, null, "long", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Numeric valuesSource = (ValuesSource.Numeric) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); SortedNumericDocValues values = valuesSource.longValues(ctx); @@ -144,14 +144,14 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, null, "long", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, null, "long", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Numeric valuesSource = (ValuesSource.Numeric) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); SortedNumericDocValues values = valuesSource.longValues(ctx); assertFalse(values.advanceExact(0)); config = ValuesSourceConfig.resolve( - context, null, "long", null, 42, null, null, CoreValuesSourceType.BYTES, null); + context, null, "long", null, 42, null, null, CoreValuesSourceType.BYTES); valuesSource = (ValuesSource.Numeric) config.getValuesSource(); values = valuesSource.longValues(ctx); assertTrue(values.advanceExact(0)); @@ -171,13 +171,13 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, ValueType.NUMBER, "long", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, ValueType.NUMBER, "long", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Numeric valuesSource = (ValuesSource.Numeric) config.getValuesSource(); assertNotNull(valuesSource); assertFalse(config.hasValues()); config = ValuesSourceConfig.resolve( - context, ValueType.NUMBER, "long", null, 42, null, null, CoreValuesSourceType.BYTES, null); + context, ValueType.NUMBER, "long", null, 42, null, null, CoreValuesSourceType.BYTES); valuesSource = (ValuesSource.Numeric) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); SortedNumericDocValues values = valuesSource.longValues(ctx); @@ -199,7 +199,7 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, null, "bool", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, null, "bool", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Numeric valuesSource = (ValuesSource.Numeric) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); SortedNumericDocValues values = valuesSource.longValues(ctx); @@ -221,14 +221,14 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, null, "bool", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, null, "bool", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Numeric valuesSource = (ValuesSource.Numeric) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); SortedNumericDocValues values = valuesSource.longValues(ctx); assertFalse(values.advanceExact(0)); config = ValuesSourceConfig.resolve( - context, null, "bool", null, true, null, null, CoreValuesSourceType.BYTES, null); + context, null, "bool", null, true, null, null, CoreValuesSourceType.BYTES); valuesSource = (ValuesSource.Numeric) config.getValuesSource(); values = valuesSource.longValues(ctx); assertTrue(values.advanceExact(0)); @@ -248,13 +248,13 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, ValueType.BOOLEAN, "bool", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, ValueType.BOOLEAN, "bool", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Numeric valuesSource = (ValuesSource.Numeric) config.getValuesSource(); assertNotNull(valuesSource); assertFalse(config.hasValues()); config = ValuesSourceConfig.resolve( - context, ValueType.BOOLEAN, "bool", null, true, null, null, CoreValuesSourceType.BYTES, null); + context, ValueType.BOOLEAN, "bool", null, true, null, null, CoreValuesSourceType.BYTES); valuesSource = (ValuesSource.Numeric) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); SortedNumericDocValues values = valuesSource.longValues(ctx); @@ -270,7 +270,7 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, null, TypeFieldMapper.NAME, null, null, null, null, CoreValuesSourceType.BYTES, null); + context, null, TypeFieldMapper.NAME, null, null, null, null, CoreValuesSourceType.BYTES); assertWarnings(QueryShardContext.TYPES_DEPRECATION_MESSAGE); } } @@ -286,7 +286,7 @@ public class ValuesSourceConfigTests extends ESSingleNodeTestCase { try (Engine.Searcher searcher = indexService.getShard(0).acquireSearcher("test")) { QueryShardContext context = indexService.newQueryShardContext(0, searcher, () -> 42L, null); ValuesSourceConfig config = ValuesSourceConfig.resolve( - context, ValueType.STRING, "alias", null, null, null, null, CoreValuesSourceType.BYTES, null); + context, ValueType.STRING, "alias", null, null, null, null, CoreValuesSourceType.BYTES); ValuesSource.Bytes valuesSource = (ValuesSource.Bytes) config.getValuesSource(); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(0); diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/topmetrics/TopMetricsAggregatorFactory.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/topmetrics/TopMetricsAggregatorFactory.java index 71ed774cdec..63904c1debd 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/topmetrics/TopMetricsAggregatorFactory.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/topmetrics/TopMetricsAggregatorFactory.java @@ -61,7 +61,7 @@ public class TopMetricsAggregatorFactory extends AggregatorFactory { ValuesSourceConfig resolved = ValuesSourceConfig.resolve( searchContext.getQueryShardContext(), ValueType.NUMERIC, config.getFieldName(), config.getScript(), config.getMissing(), config.getTimeZone(), null, - CoreValuesSourceType.NUMERIC, TopMetricsAggregationBuilder.NAME); + CoreValuesSourceType.NUMERIC); return new TopMetricsAggregator.MetricSource(config.getFieldName(), resolved.format(), (ValuesSource.Numeric) resolved.getValuesSource()); }).collect(toList());