diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregationBuilder.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregationBuilder.java index 7385ba4dc15..e917d79d2d9 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregationBuilder.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregationBuilder.java @@ -28,11 +28,11 @@ import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.support.ArrayValuesSourceAggregationBuilder; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -44,7 +44,7 @@ public class MatrixStatsAggregationBuilder private MultiValueMode multiValueMode = MultiValueMode.AVG; public MatrixStatsAggregationBuilder(String name) { - super(name, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(name, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } protected MatrixStatsAggregationBuilder(MatrixStatsAggregationBuilder clone, @@ -62,7 +62,7 @@ public class MatrixStatsAggregationBuilder * Read from a stream. */ public MatrixStatsAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(in, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } @Override diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregationBuilder.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregationBuilder.java index 3d4c786440f..c0cd45c3b1c 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregationBuilder.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregationBuilder.java @@ -266,16 +266,16 @@ public abstract class ArrayValuesSourceAggregationBuilder config = new ValuesSourceConfig<>(ValuesSourceType.ANY); + ValuesSourceConfig config = new ValuesSourceConfig<>(CoreValuesSourceType.ANY); return config.format(resolveFormat(null, valueType)); } ValuesSourceType valuesSourceType = valueType != null ? valueType.getValuesSourceType() : this.valuesSourceType; - if (valuesSourceType == null || valuesSourceType == ValuesSourceType.ANY) { + if (valuesSourceType == null || valuesSourceType == CoreValuesSourceType.ANY) { // the specific value source type is undefined, but for scripts, // we need to have a specific value source // type to know how to handle the script values, so we fallback // on Bytes - valuesSourceType = ValuesSourceType.BYTES; + valuesSourceType = CoreValuesSourceType.BYTES; } ValuesSourceConfig config = new ValuesSourceConfig<>(valuesSourceType); config.missing(missingMap.get(field)); @@ -294,13 +294,13 @@ public abstract class ArrayValuesSourceAggregationBuilder indexFieldData = queryShardContext.getForField(fieldType); ValuesSourceConfig config; - if (valuesSourceType == ValuesSourceType.ANY) { + if (valuesSourceType == CoreValuesSourceType.ANY) { if (indexFieldData instanceof IndexNumericFieldData) { - config = new ValuesSourceConfig<>(ValuesSourceType.NUMERIC); + config = new ValuesSourceConfig<>(CoreValuesSourceType.NUMERIC); } else if (indexFieldData instanceof IndexGeoPointFieldData) { - config = new ValuesSourceConfig<>(ValuesSourceType.GEOPOINT); + config = new ValuesSourceConfig<>(CoreValuesSourceType.GEOPOINT); } else { - config = new ValuesSourceConfig<>(ValuesSourceType.BYTES); + config = new ValuesSourceConfig<>(CoreValuesSourceType.BYTES); } } else { config = new ValuesSourceConfig<>(valuesSourceType); diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceParser.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceParser.java index acfbc04f872..a0e7016291b 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceParser.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceParser.java @@ -38,28 +38,28 @@ public abstract class ArrayValuesSourceParser implement public abstract static class AnyValuesSourceParser extends ArrayValuesSourceParser { protected AnyValuesSourceParser(boolean formattable) { - super(formattable, ValuesSourceType.ANY, null); + super(formattable, CoreValuesSourceType.ANY, null); } } public abstract static class NumericValuesSourceParser extends ArrayValuesSourceParser { protected NumericValuesSourceParser(boolean formattable) { - super(formattable, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(formattable, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } } public abstract static class BytesValuesSourceParser extends ArrayValuesSourceParser { protected BytesValuesSourceParser(boolean formattable) { - super(formattable, ValuesSourceType.BYTES, ValueType.STRING); + super(formattable, CoreValuesSourceType.BYTES, ValueType.STRING); } } public abstract static class GeoPointValuesSourceParser extends ArrayValuesSourceParser { protected GeoPointValuesSourceParser(boolean formattable) { - super(formattable, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT); + super(formattable, CoreValuesSourceType.GEOPOINT, ValueType.GEOPOINT); } } diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregationBuilder.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregationBuilder.java index 29549ded441..23a89752964 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregationBuilder.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregationBuilder.java @@ -33,13 +33,13 @@ import org.elasticsearch.join.mapper.ParentJoinFieldMapper; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.FieldContext; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource.Bytes.WithOrdinals; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -61,7 +61,7 @@ public class ChildrenAggregationBuilder * the type of children documents */ public ChildrenAggregationBuilder(String name, String childType) { - super(name, ValuesSourceType.BYTES, ValueType.STRING); + super(name, CoreValuesSourceType.BYTES, ValueType.STRING); if (childType == null) { throw new IllegalArgumentException("[childType] must not be null: [" + name + "]"); } @@ -85,7 +85,7 @@ public class ChildrenAggregationBuilder * Read from a stream. */ public ChildrenAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.BYTES, ValueType.STRING); + super(in, CoreValuesSourceType.BYTES, ValueType.STRING); childType = in.readString(); } @@ -105,7 +105,7 @@ public class ChildrenAggregationBuilder @Override protected ValuesSourceConfig resolveConfig(QueryShardContext queryShardContext) { - ValuesSourceConfig config = new ValuesSourceConfig<>(ValuesSourceType.BYTES); + ValuesSourceConfig config = new ValuesSourceConfig<>(CoreValuesSourceType.BYTES); joinFieldResolveConfig(queryShardContext, config); return config; } diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregationBuilder.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregationBuilder.java index 4386c417677..dd58d5b11e5 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregationBuilder.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregationBuilder.java @@ -33,13 +33,13 @@ import org.elasticsearch.join.mapper.ParentJoinFieldMapper; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.FieldContext; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource.Bytes.WithOrdinals; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -61,7 +61,7 @@ public class ParentAggregationBuilder * the type of children documents */ public ParentAggregationBuilder(String name, String childType) { - super(name, ValuesSourceType.BYTES, ValueType.STRING); + super(name, CoreValuesSourceType.BYTES, ValueType.STRING); if (childType == null) { throw new IllegalArgumentException("[childType] must not be null: [" + name + "]"); } @@ -85,7 +85,7 @@ public class ParentAggregationBuilder * Read from a stream. */ public ParentAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.BYTES, ValueType.STRING); + super(in, CoreValuesSourceType.BYTES, ValueType.STRING); childType = in.readString(); } @@ -105,7 +105,7 @@ public class ParentAggregationBuilder @Override protected ValuesSourceConfig resolveConfig(QueryShardContext queryShardContext) { - ValuesSourceConfig config = new ValuesSourceConfig<>(ValuesSourceType.BYTES); + ValuesSourceConfig config = new ValuesSourceConfig<>(CoreValuesSourceType.BYTES); joinFieldResolveConfig(queryShardContext, config); return config; } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java index 32ff1d07c53..e1c42211392 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java @@ -31,13 +31,13 @@ import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.bucket.BucketUtils; import org.elasticsearch.search.aggregations.bucket.MultiBucketAggregationBuilder; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -70,7 +70,7 @@ public abstract class GeoGridAggregationBuilder extends ValuesSourceAggregationB } public GeoGridAggregationBuilder(String name) { - super(name, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT); + super(name, CoreValuesSourceType.GEOPOINT, ValueType.GEOPOINT); } protected GeoGridAggregationBuilder(GeoGridAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { @@ -85,7 +85,7 @@ public abstract class GeoGridAggregationBuilder extends ValuesSourceAggregationB * Read from a stream. */ public GeoGridAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT); + super(in, CoreValuesSourceType.GEOPOINT, ValueType.GEOPOINT); precision = in.readVInt(); requiredSize = in.readVInt(); shardSize = in.readVInt(); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregationBuilder.java index f096eee448d..1472ca015af 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregationBuilder.java @@ -34,6 +34,7 @@ import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.MultiBucketConsumerService; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; @@ -41,7 +42,6 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuil import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.time.ZoneId; @@ -134,12 +134,12 @@ public class AutoDateHistogramAggregationBuilder /** Create a new builder with the given name. */ public AutoDateHistogramAggregationBuilder(String name) { - super(name, ValuesSourceType.NUMERIC, ValueType.DATE); + super(name, CoreValuesSourceType.NUMERIC, ValueType.DATE); } /** Read from a stream, for internal use only. */ public AutoDateHistogramAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.NUMERIC, ValueType.DATE); + super(in, CoreValuesSourceType.NUMERIC, ValueType.DATE); numBuckets = in.readVInt(); if (in.getVersion().onOrAfter(Version.V_7_3_0)) { minimumIntervalExpression = in.readOptionalString(); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregationBuilder.java index d75b3e0ff70..5b70c63ee4d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregationBuilder.java @@ -45,6 +45,7 @@ import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.InternalOrder.CompoundOrder; import org.elasticsearch.search.aggregations.bucket.MultiBucketAggregationBuilder; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; @@ -136,7 +137,7 @@ public class DateHistogramAggregationBuilder extends ValuesSourceAggregationBuil /** Create a new builder with the given name. */ public DateHistogramAggregationBuilder(String name) { - super(name, ValuesSourceType.ANY, ValueType.DATE); + super(name, CoreValuesSourceType.ANY, ValueType.DATE); } protected DateHistogramAggregationBuilder(DateHistogramAggregationBuilder clone, @@ -157,7 +158,7 @@ public class DateHistogramAggregationBuilder extends ValuesSourceAggregationBuil /** Read from a stream, for internal use only. */ public DateHistogramAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.ANY, ValueType.DATE); + super(in, CoreValuesSourceType.ANY, ValueType.DATE); order = InternalOrder.Streams.readHistogramOrder(in, true); keyed = in.readBoolean(); minDocCount = in.readVLong(); @@ -169,7 +170,7 @@ public class DateHistogramAggregationBuilder extends ValuesSourceAggregationBuil @Override protected ValuesSourceType resolveScriptAny(Script script) { // TODO: No idea how we'd support Range scripts here. - return ValuesSourceType.NUMERIC; + return CoreValuesSourceType.NUMERIC; } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregationBuilder.java index 90091b2697d..79fea3ac452 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregationBuilder.java @@ -34,6 +34,7 @@ import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.InternalOrder.CompoundOrder; import org.elasticsearch.search.aggregations.bucket.MultiBucketAggregationBuilder; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; @@ -99,12 +100,12 @@ public class HistogramAggregationBuilder extends ValuesSourceAggregationBuilder< @Override protected ValuesSourceType resolveScriptAny(Script script) { // TODO: No idea how we'd support Range scripts here. - return ValuesSourceType.NUMERIC; + return CoreValuesSourceType.NUMERIC; } /** Create a new builder with the given name. */ public HistogramAggregationBuilder(String name) { - super(name, ValuesSourceType.ANY, ValueType.NUMERIC); + super(name, CoreValuesSourceType.ANY, ValueType.NUMERIC); } protected HistogramAggregationBuilder(HistogramAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { @@ -125,7 +126,7 @@ public class HistogramAggregationBuilder extends ValuesSourceAggregationBuilder< /** Read from a stream, for internal use only. */ public HistogramAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.ANY, ValueType.NUMERIC); + super(in, CoreValuesSourceType.ANY, ValueType.NUMERIC); order = InternalOrder.Streams.readHistogramOrder(in, true); keyed = in.readBoolean(); minDocCount = in.readVLong(); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregationBuilder.java index c685df31ab1..7d6cdea562c 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregationBuilder.java @@ -29,13 +29,13 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -54,7 +54,7 @@ public class MissingAggregationBuilder extends ValuesSourceAggregationBuilder metaData) { @@ -70,7 +70,7 @@ public class MissingAggregationBuilder extends ValuesSourceAggregationBuilder { @Override public ValuesSourceType getValueSourceType() { - return ValuesSourceType.GEOPOINT; + return CoreValuesSourceType.GEOPOINT; } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java index 45003df5370..5788c9ba736 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java @@ -28,6 +28,7 @@ import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; @@ -193,7 +194,7 @@ public class InternalRange> { public ValuesSourceType getValueSourceType() { - return ValuesSourceType.NUMERIC; + return CoreValuesSourceType.NUMERIC; } public ValueType getValueType() { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/IpRangeAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/IpRangeAggregationBuilder.java index 14a8eb3a1cd..e0b3fad96f6 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/IpRangeAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/IpRangeAggregationBuilder.java @@ -36,13 +36,13 @@ import org.elasticsearch.script.Script; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.net.InetAddress; @@ -220,7 +220,7 @@ public final class IpRangeAggregationBuilder private List ranges = new ArrayList<>(); public IpRangeAggregationBuilder(String name) { - super(name, ValuesSourceType.BYTES, ValueType.IP); + super(name, CoreValuesSourceType.BYTES, ValueType.IP); } protected IpRangeAggregationBuilder(IpRangeAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { @@ -337,7 +337,7 @@ public final class IpRangeAggregationBuilder } public IpRangeAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.BYTES, ValueType.IP); + super(in, CoreValuesSourceType.BYTES, ValueType.IP); final int numRanges = in.readVInt(); for (int i = 0; i < numRanges; ++i) { addRange(new Range(in)); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/DiversifiedAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/DiversifiedAggregationBuilder.java index eb7012ea69f..e7781b5586b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/DiversifiedAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/DiversifiedAggregationBuilder.java @@ -28,12 +28,12 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -62,7 +62,7 @@ public class DiversifiedAggregationBuilder extends ValuesSourceAggregationBuilde private String executionHint = null; public DiversifiedAggregationBuilder(String name) { - super(name, ValuesSourceType.ANY, null); + super(name, CoreValuesSourceType.ANY, null); } protected DiversifiedAggregationBuilder(DiversifiedAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { @@ -81,7 +81,7 @@ public class DiversifiedAggregationBuilder extends ValuesSourceAggregationBuilde * Read from a stream. */ public DiversifiedAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.ANY, null); + super(in, CoreValuesSourceType.ANY, null); shardSize = in.readVInt(); maxDocsPerValue = in.readVInt(); executionHint = in.readOptionalString(); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregationBuilder.java index 1eda817b494..908bc058616 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregationBuilder.java @@ -46,7 +46,7 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuil import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import java.io.IOException; import java.util.Map; @@ -116,14 +116,14 @@ public class SignificantTermsAggregationBuilder extends ValuesSourceAggregationB private SignificanceHeuristic significanceHeuristic = DEFAULT_SIGNIFICANCE_HEURISTIC; public SignificantTermsAggregationBuilder(String name, ValueType valueType) { - super(name, ValuesSourceType.ANY, valueType); + super(name, CoreValuesSourceType.ANY, valueType); } /** * Read from a Stream. */ public SignificantTermsAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.ANY); + super(in, CoreValuesSourceType.ANY); bucketCountThresholds = new BucketCountThresholds(in); executionHint = in.readOptionalString(); filterBuilder = in.readOptionalNamedWriteable(QueryBuilder.class); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/RareTermsAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/RareTermsAggregationBuilder.java index 44c24e32482..d0f6b18d1a5 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/RareTermsAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/RareTermsAggregationBuilder.java @@ -29,13 +29,13 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -72,7 +72,7 @@ public class RareTermsAggregationBuilder extends ValuesSourceAggregationBuilder< private double precision = 0.001; public RareTermsAggregationBuilder(String name, ValueType valueType) { - super(name, ValuesSourceType.ANY, valueType); + super(name, CoreValuesSourceType.ANY, valueType); } private RareTermsAggregationBuilder(RareTermsAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { @@ -89,7 +89,7 @@ public class RareTermsAggregationBuilder extends ValuesSourceAggregationBuilder< * Read from a stream. */ public RareTermsAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.ANY); + super(in, CoreValuesSourceType.ANY); includeExclude = in.readOptionalWriteable(IncludeExclude::new); maxDocCount = in.readVInt(); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregationBuilder.java index d019179334c..228a3ca7ee2 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregationBuilder.java @@ -36,13 +36,13 @@ import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.InternalOrder.CompoundOrder; import org.elasticsearch.search.aggregations.bucket.MultiBucketAggregationBuilder; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.List; @@ -109,7 +109,7 @@ public class TermsAggregationBuilder extends ValuesSourceAggregationBuilder metaData) { @@ -131,7 +131,7 @@ public class TermsAggregationBuilder extends ValuesSourceAggregationBuilder metaData) { @@ -64,7 +64,7 @@ public class AvgAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOn * Read from a stream. */ public AvgAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(in, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregationBuilder.java index 587476bb132..b8deece0e7b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregationBuilder.java @@ -30,12 +30,12 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -64,7 +64,7 @@ public final class CardinalityAggregationBuilder private Long precisionThreshold = null; public CardinalityAggregationBuilder(String name, ValueType targetValueType) { - super(name, ValuesSourceType.ANY, targetValueType); + super(name, CoreValuesSourceType.ANY, targetValueType); } public CardinalityAggregationBuilder(CardinalityAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { @@ -76,7 +76,7 @@ public final class CardinalityAggregationBuilder * Read from a stream. */ public CardinalityAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.ANY); + super(in, CoreValuesSourceType.ANY); if (in.readBoolean()) { precisionThreshold = in.readLong(); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsAggregationBuilder.java index e1a7d52bd44..df3c3d34138 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsAggregationBuilder.java @@ -28,13 +28,13 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -58,7 +58,7 @@ public class ExtendedStatsAggregationBuilder private double sigma = 2.0; public ExtendedStatsAggregationBuilder(String name) { - super(name, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(name, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } protected ExtendedStatsAggregationBuilder(ExtendedStatsAggregationBuilder clone, @@ -76,7 +76,7 @@ public class ExtendedStatsAggregationBuilder * Read from a stream. */ public ExtendedStatsAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(in, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); sigma = in.readDouble(); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsAggregationBuilder.java index 89605512018..8b9f89fd542 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsAggregationBuilder.java @@ -33,7 +33,7 @@ import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import java.io.IOException; import java.util.Map; @@ -56,7 +56,7 @@ public class GeoBoundsAggregationBuilder extends ValuesSourceAggregationBuilder< private boolean wrapLongitude = true; public GeoBoundsAggregationBuilder(String name) { - super(name, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT); + super(name, CoreValuesSourceType.GEOPOINT, ValueType.GEOPOINT); } protected GeoBoundsAggregationBuilder(GeoBoundsAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { @@ -73,7 +73,7 @@ public class GeoBoundsAggregationBuilder extends ValuesSourceAggregationBuilder< * Read from a stream. */ public GeoBoundsAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT); + super(in, CoreValuesSourceType.GEOPOINT, ValueType.GEOPOINT); wrapLongitude = in.readBoolean(); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/GeoCentroidAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/GeoCentroidAggregationBuilder.java index c40de7f7790..daf357186f3 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/GeoCentroidAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/GeoCentroidAggregationBuilder.java @@ -28,12 +28,12 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -53,7 +53,7 @@ public class GeoCentroidAggregationBuilder } public GeoCentroidAggregationBuilder(String name) { - super(name, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT); + super(name, CoreValuesSourceType.GEOPOINT, ValueType.GEOPOINT); } protected GeoCentroidAggregationBuilder(GeoCentroidAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { @@ -69,7 +69,7 @@ public class GeoCentroidAggregationBuilder * Read from a stream. */ public GeoCentroidAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT); + super(in, CoreValuesSourceType.GEOPOINT, ValueType.GEOPOINT); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MaxAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MaxAggregationBuilder.java index e8412a6b40e..8d215f169d1 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MaxAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MaxAggregationBuilder.java @@ -28,13 +28,13 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -53,7 +53,7 @@ public class MaxAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOn } public MaxAggregationBuilder(String name) { - super(name, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(name, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } protected MaxAggregationBuilder(MaxAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { @@ -69,7 +69,7 @@ public class MaxAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOn * Read from a stream. */ public MaxAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(in, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregationBuilder.java index dae78275f50..e02e382fa5d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregationBuilder.java @@ -29,13 +29,13 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.LeafOnly; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -62,11 +62,11 @@ public class MedianAbsoluteDeviationAggregationBuilder extends LeafOnly metaData) { @@ -69,7 +69,7 @@ public class MinAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOn * Read from a stream. */ public MinAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(in, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/PercentileRanksAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/PercentileRanksAggregationBuilder.java index d1a04667c6b..ae9afe476bf 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/PercentileRanksAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/PercentileRanksAggregationBuilder.java @@ -30,6 +30,7 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; @@ -37,7 +38,6 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuil import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Arrays; @@ -115,7 +115,7 @@ public class PercentileRanksAggregationBuilder extends LeafOnly metaData) { @@ -69,7 +69,7 @@ public class SumAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOn * Read from a stream. */ public SumAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(in, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ValueCountAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ValueCountAggregationBuilder.java index eca8d1ead8c..f019fbd3e3b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ValueCountAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ValueCountAggregationBuilder.java @@ -29,12 +29,12 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -53,7 +53,7 @@ public class ValueCountAggregationBuilder extends ValuesSourceAggregationBuilder } public ValueCountAggregationBuilder(String name, ValueType targetValueType) { - super(name, ValuesSourceType.ANY, targetValueType); + super(name, CoreValuesSourceType.ANY, targetValueType); } protected ValueCountAggregationBuilder(ValueCountAggregationBuilder clone, @@ -70,7 +70,7 @@ public class ValueCountAggregationBuilder extends ValuesSourceAggregationBuilder * Read from a stream. */ public ValueCountAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.ANY); + super(in, CoreValuesSourceType.ANY); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/support/CoreValuesSourceType.java b/server/src/main/java/org/elasticsearch/search/aggregations/support/CoreValuesSourceType.java new file mode 100644 index 00000000000..2eae054d55e --- /dev/null +++ b/server/src/main/java/org/elasticsearch/search/aggregations/support/CoreValuesSourceType.java @@ -0,0 +1,218 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.search.aggregations.support; + +import org.apache.lucene.util.BytesRef; +import org.elasticsearch.common.geo.GeoPoint; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Writeable; +import org.elasticsearch.index.fielddata.IndexFieldData; +import org.elasticsearch.index.fielddata.IndexGeoPointFieldData; +import org.elasticsearch.index.fielddata.IndexNumericFieldData; +import org.elasticsearch.index.fielddata.IndexOrdinalsFieldData; +import org.elasticsearch.index.mapper.MappedFieldType; +import org.elasticsearch.index.mapper.RangeFieldMapper; +import org.elasticsearch.script.AggregationScript; +import org.elasticsearch.search.DocValueFormat; +import org.elasticsearch.search.aggregations.AggregationExecutionException; + +import java.io.IOException; +import java.util.Locale; +import java.util.function.LongSupplier; + +/** + * {@link CoreValuesSourceType} holds the {@link ValuesSourceType} implementations for the core aggregations package. + */ +public enum CoreValuesSourceType implements Writeable, ValuesSourceType { + ANY { + // ANY still has a lot of special handling in ValuesSourceConfig, and as such doesn't adhere to this interface yet + @Override + public ValuesSource getEmpty() { + // TODO: Implement this or get rid of ANY + throw new UnsupportedOperationException("CoreValuesSourceType.ANY is still a special case"); + } + + @Override + public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType scriptValueType) { + // TODO: Implement this or get rid of ANY + throw new UnsupportedOperationException("CoreValuesSourceType.ANY is still a special case"); + } + + @Override + public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFactory script) { + // TODO: Implement this or get rid of ANY + throw new UnsupportedOperationException("CoreValuesSourceType.ANY is still a special case"); + } + + @Override + public ValuesSource replaceMissing(ValuesSource valuesSource, Object rawMissing, DocValueFormat docValueFormat, LongSupplier now) { + return BYTES.replaceMissing(valuesSource, rawMissing, docValueFormat, now); + } + }, + NUMERIC { + @Override + public ValuesSource getEmpty() { + return ValuesSource.Numeric.EMPTY; + } + + @Override + public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType scriptValueType) { + return new ValuesSource.Numeric.Script(script, scriptValueType); + } + + @Override + public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFactory script) { + + if ((fieldContext.indexFieldData() instanceof IndexNumericFieldData) == false) { + // TODO: Is this the correct exception type here? + throw new IllegalArgumentException("Expected numeric type on field [" + fieldContext.field() + + "], but got [" + fieldContext.fieldType().typeName() + "]"); + } + + ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData)fieldContext.indexFieldData()); + if (script != null) { + // Value script case + dataSource = new ValuesSource.Numeric.WithScript(dataSource, script); + } + return dataSource; + } + + @Override + public ValuesSource replaceMissing(ValuesSource valuesSource, Object rawMissing, DocValueFormat docValueFormat, LongSupplier now) { + Number missing = docValueFormat.parseDouble(rawMissing.toString(), false, now); + return MissingValues.replaceMissing((ValuesSource.Numeric) valuesSource, missing); + } + }, + BYTES { + @Override + public ValuesSource getEmpty() { + return ValuesSource.Bytes.WithOrdinals.EMPTY; + } + + @Override + public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType scriptValueType) { + return new ValuesSource.Bytes.Script(script); + } + + @Override + public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFactory script) { + final IndexFieldData indexFieldData = fieldContext.indexFieldData(); + ValuesSource dataSource; + if (indexFieldData instanceof IndexOrdinalsFieldData) { + dataSource = new ValuesSource.Bytes.WithOrdinals.FieldData((IndexOrdinalsFieldData) indexFieldData); + } else { + dataSource = new ValuesSource.Bytes.FieldData(indexFieldData); + } + if (script != null) { + // Again, what's the difference between WithScript and Script? + dataSource = new ValuesSource.Bytes.WithScript(dataSource, script); + } + return dataSource; + } + + @Override + public ValuesSource replaceMissing(ValuesSource valuesSource, Object rawMissing, DocValueFormat docValueFormat, LongSupplier now) { + final BytesRef missing = docValueFormat.parseBytesRef(rawMissing.toString()); + if (valuesSource instanceof ValuesSource.Bytes.WithOrdinals) { + return MissingValues.replaceMissing((ValuesSource.Bytes.WithOrdinals) valuesSource, missing); + } else { + return MissingValues.replaceMissing((ValuesSource.Bytes) valuesSource, missing); + } + } + }, + GEOPOINT { + @Override + public ValuesSource getEmpty() { + return ValuesSource.GeoPoint.EMPTY; + } + + @Override + public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType scriptValueType) { + throw new AggregationExecutionException("value source of type [" + this.value() + "] is not supported by scripts"); + } + + @Override + public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFactory script) { + if (!(fieldContext.indexFieldData() instanceof IndexGeoPointFieldData)) { + // TODO: Is this the correct exception type here? + throw new IllegalArgumentException("Expected geo_point type on field [" + fieldContext.field() + + "], but got [" + fieldContext.fieldType().typeName() + "]"); + } + + return new ValuesSource.GeoPoint.Fielddata((IndexGeoPointFieldData) fieldContext.indexFieldData()); + } + + @Override + public ValuesSource replaceMissing(ValuesSource valuesSource, Object rawMissing, DocValueFormat docValueFormat, LongSupplier now) { + // TODO: also support the structured formats of geo points + final GeoPoint missing = new GeoPoint(rawMissing.toString()); + return MissingValues.replaceMissing((ValuesSource.GeoPoint) valuesSource, missing); + } + }, + RANGE { + @Override + public ValuesSource getEmpty() { + // TODO: Is this the correct exception type here? + throw new IllegalArgumentException("Can't deal with unmapped ValuesSource type " + this.value()); + } + + @Override + public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType scriptValueType) { + throw new AggregationExecutionException("value source of type [" + this.value() + "] is not supported by scripts"); + } + + @Override + public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFactory script) { + MappedFieldType fieldType = fieldContext.fieldType(); + + if (fieldType instanceof RangeFieldMapper.RangeFieldType == false) { + // TODO: Is this the correct exception type here? + throw new IllegalStateException("Asked for range ValuesSource, but field is of type " + fieldType.name()); + } + RangeFieldMapper.RangeFieldType rangeFieldType = (RangeFieldMapper.RangeFieldType)fieldType; + return new ValuesSource.Range(fieldContext.indexFieldData(), rangeFieldType.rangeType()); + } + + @Override + public ValuesSource replaceMissing(ValuesSource valuesSource, Object rawMissing, DocValueFormat docValueFormat, LongSupplier now) { + throw new IllegalArgumentException("Can't apply missing values on a " + valuesSource.getClass()); + } + }; + + public static ValuesSourceType fromString(String name) { + return valueOf(name.trim().toUpperCase(Locale.ROOT)); + } + + public static ValuesSourceType fromStream(StreamInput in) throws IOException { + return in.readEnum(CoreValuesSourceType.class); + } + + @Override + public void writeTo(StreamOutput out) throws IOException { + CoreValuesSourceType state = this; + out.writeEnum(state); + } + + public String value() { + return name().toLowerCase(Locale.ROOT); + } + +} diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValueType.java b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValueType.java index d130b385be8..a1e3237288f 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValueType.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValueType.java @@ -35,22 +35,22 @@ import java.time.ZoneOffset; public enum ValueType implements Writeable { - STRING((byte) 1, "string", "string", ValuesSourceType.BYTES, + STRING((byte) 1, "string", "string", CoreValuesSourceType.BYTES, IndexFieldData.class, DocValueFormat.RAW), LONG((byte) 2, "byte|short|integer|long", "long", - ValuesSourceType.NUMERIC, + CoreValuesSourceType.NUMERIC, IndexNumericFieldData.class, DocValueFormat.RAW), - DOUBLE((byte) 3, "float|double", "double", ValuesSourceType.NUMERIC, IndexNumericFieldData.class, DocValueFormat.RAW), - NUMBER((byte) 4, "number", "number", ValuesSourceType.NUMERIC, IndexNumericFieldData.class, DocValueFormat.RAW), - DATE((byte) 5, "date", "date", ValuesSourceType.NUMERIC, IndexNumericFieldData.class, + DOUBLE((byte) 3, "float|double", "double", CoreValuesSourceType.NUMERIC, IndexNumericFieldData.class, DocValueFormat.RAW), + NUMBER((byte) 4, "number", "number", CoreValuesSourceType.NUMERIC, IndexNumericFieldData.class, DocValueFormat.RAW), + DATE((byte) 5, "date", "date", CoreValuesSourceType.NUMERIC, IndexNumericFieldData.class, new DocValueFormat.DateTime(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER, ZoneOffset.UTC, DateFieldMapper.Resolution.MILLISECONDS)), - IP((byte) 6, "ip", "ip", ValuesSourceType.BYTES, IndexFieldData.class, DocValueFormat.IP), + IP((byte) 6, "ip", "ip", CoreValuesSourceType.BYTES, IndexFieldData.class, DocValueFormat.IP), // TODO: what is the difference between "number" and "numeric"? - NUMERIC((byte) 7, "numeric", "numeric", ValuesSourceType.NUMERIC, IndexNumericFieldData.class, DocValueFormat.RAW), - GEOPOINT((byte) 8, "geo_point", "geo_point", ValuesSourceType.GEOPOINT, IndexGeoPointFieldData.class, DocValueFormat.GEOHASH), - BOOLEAN((byte) 9, "boolean", "boolean", ValuesSourceType.NUMERIC, IndexNumericFieldData.class, DocValueFormat.BOOLEAN), - RANGE((byte) 10, "range", "range", ValuesSourceType.RANGE, BinaryDVIndexFieldData.class, DocValueFormat.RAW); + NUMERIC((byte) 7, "numeric", "numeric", CoreValuesSourceType.NUMERIC, IndexNumericFieldData.class, DocValueFormat.RAW), + GEOPOINT((byte) 8, "geo_point", "geo_point", CoreValuesSourceType.GEOPOINT, IndexGeoPointFieldData.class, DocValueFormat.GEOHASH), + BOOLEAN((byte) 9, "boolean", "boolean", CoreValuesSourceType.NUMERIC, IndexNumericFieldData.class, DocValueFormat.BOOLEAN), + RANGE((byte) 10, "range", "range", CoreValuesSourceType.RANGE, BinaryDVIndexFieldData.class, DocValueFormat.RAW); final String description; final ValuesSourceType valuesSourceType; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSource.java b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSource.java index 19a607a0f17..2bbd7ce2c9b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSource.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSource.java @@ -44,7 +44,7 @@ import org.elasticsearch.index.fielddata.SortingBinaryDocValues; import org.elasticsearch.index.fielddata.SortingNumericDoubleValues; import org.elasticsearch.index.mapper.RangeType; import org.elasticsearch.script.AggregationScript; -import org.elasticsearch.search.aggregations.support.ValuesSource.WithScript.BytesValues; +import org.elasticsearch.search.aggregations.support.ValuesSource.Bytes.WithScript.BytesValues; import org.elasticsearch.search.aggregations.support.values.ScriptBytesValues; import org.elasticsearch.search.aggregations.support.values.ScriptDoubleValues; import org.elasticsearch.search.aggregations.support.values.ScriptLongValues; @@ -219,6 +219,9 @@ public abstract class ValuesSource { } + /** + * {@link ValuesSource} implementation for stand alone scripts returning a Bytes value + */ public static class Script extends Bytes { private final AggregationScript.LeafFactory script; @@ -237,6 +240,69 @@ public abstract class ValuesSource { return script.needs_score(); } } + + // No need to implement ReaderContextAware here, the delegate already takes care of updating data structures + /** + * {@link ValuesSource} subclass for Bytes fields with a Value Script applied + */ + public static class WithScript extends Bytes { + + private final ValuesSource delegate; + private final AggregationScript.LeafFactory script; + + public WithScript(ValuesSource delegate, AggregationScript.LeafFactory script) { + this.delegate = delegate; + this.script = script; + } + + @Override + public boolean needsScores() { + return script.needs_score(); + } + + @Override + public SortedBinaryDocValues bytesValues(LeafReaderContext context) throws IOException { + return new BytesValues(delegate.bytesValues(context), script.newInstance(context)); + } + + static class BytesValues extends SortingBinaryDocValues implements ScorerAware { + + private final SortedBinaryDocValues bytesValues; + private final AggregationScript script; + + BytesValues(SortedBinaryDocValues bytesValues, AggregationScript script) { + this.bytesValues = bytesValues; + this.script = script; + } + + @Override + public void setScorer(Scorable scorer) { + script.setScorer(scorer); + } + + @Override + public boolean advanceExact(int doc) throws IOException { + if (bytesValues.advanceExact(doc)) { + count = bytesValues.docValueCount(); + grow(); + script.setDocument(doc); + for (int i = 0; i < count; ++i) { + final BytesRef value = bytesValues.nextValue(); + script.setNextAggregationValue(value.utf8ToString()); + Object run = script.execute(); + CollectionUtils.ensureNoSelfReferences(run, "ValuesSource.BytesValues script"); + values[i].copyChars(run.toString()); + } + sort(); + return true; + } else { + count = 0; + grow(); + return false; + } + } + } + } } public abstract static class Numeric extends ValuesSource { @@ -285,6 +351,9 @@ public abstract class ValuesSource { } } + /** + * {@link ValuesSource} subclass for Numeric fields with a Value Script applied + */ public static class WithScript extends Numeric { private final Numeric delegate; @@ -307,7 +376,7 @@ public abstract class ValuesSource { @Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) throws IOException { - return new ValuesSource.WithScript.BytesValues(delegate.bytesValues(context), script.newInstance(context)); + return new Bytes.WithScript.BytesValues(delegate.bytesValues(context), script.newInstance(context)); } @Override @@ -412,6 +481,9 @@ public abstract class ValuesSource { } } + /** + * {@link ValuesSource} implementation for stand alone scripts returning a Numeric value + */ public static class Script extends Numeric { private final AggregationScript.LeafFactory script; private final ValueType scriptValueType; @@ -449,66 +521,6 @@ public abstract class ValuesSource { } - // No need to implement ReaderContextAware here, the delegate already takes care of updating data structures - public static class WithScript extends Bytes { - - private final ValuesSource delegate; - private final AggregationScript.LeafFactory script; - - public WithScript(ValuesSource delegate, AggregationScript.LeafFactory script) { - this.delegate = delegate; - this.script = script; - } - - @Override - public boolean needsScores() { - return script.needs_score(); - } - - @Override - public SortedBinaryDocValues bytesValues(LeafReaderContext context) throws IOException { - return new BytesValues(delegate.bytesValues(context), script.newInstance(context)); - } - - static class BytesValues extends SortingBinaryDocValues implements ScorerAware { - - private final SortedBinaryDocValues bytesValues; - private final AggregationScript script; - - BytesValues(SortedBinaryDocValues bytesValues, AggregationScript script) { - this.bytesValues = bytesValues; - this.script = script; - } - - @Override - public void setScorer(Scorable scorer) { - script.setScorer(scorer); - } - - @Override - public boolean advanceExact(int doc) throws IOException { - if (bytesValues.advanceExact(doc)) { - count = bytesValues.docValueCount(); - grow(); - script.setDocument(doc); - for (int i = 0; i < count; ++i) { - final BytesRef value = bytesValues.nextValue(); - script.setNextAggregationValue(value.utf8ToString()); - Object run = script.execute(); - CollectionUtils.ensureNoSelfReferences(run, "ValuesSource.BytesValues script"); - values[i].copyChars(run.toString()); - } - sort(); - return true; - } else { - count = 0; - grow(); - return false; - } - } - } - } - public abstract static class GeoPoint extends ValuesSource { public static final GeoPoint EMPTY = new GeoPoint() { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregationBuilder.java index 14ef917a357..080b4a6641d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregationBuilder.java @@ -324,14 +324,14 @@ public abstract class ValuesSourceAggregationBuilder ext /** * This method provides a hook for aggregations that need finer grained control over the ValuesSource selected when the user supplies a * missing value and there is no mapped field to infer the type from. This will only be called for aggregations that specify the - * ValuesSourceType.ANY in their constructors (On the builder class). The user supplied object is passed as a parameter, so its type - * may be inspected as needed. + * CoreValuesSourceType.ANY in their constructors (On the builder class). The user supplied object is passed as a parameter, so its + * type * may be inspected as needed. * * Generally, only the type of the returned ValuesSource is used, so returning the EMPTY instance of the chosen type is recommended. * diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceConfig.java b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceConfig.java index d906260c756..df29b77a287 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceConfig.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceConfig.java @@ -18,14 +18,11 @@ */ package org.elasticsearch.search.aggregations.support; -import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.Nullable; -import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.index.fielddata.IndexFieldData; import org.elasticsearch.index.fielddata.IndexGeoPointFieldData; import org.elasticsearch.index.fielddata.IndexNumericFieldData; -import org.elasticsearch.index.fielddata.IndexOrdinalsFieldData; import org.elasticsearch.index.mapper.DateFieldMapper; import org.elasticsearch.index.mapper.MappedFieldType; import org.elasticsearch.index.mapper.RangeFieldMapper; @@ -33,7 +30,6 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.script.AggregationScript; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.aggregations.AggregationExecutionException; import java.time.ZoneId; import java.time.ZoneOffset; @@ -55,7 +51,7 @@ public class ValuesSourceConfig { Object missing, ZoneId timeZone, String format) { - return resolve(context, valueType, field, script, missing, timeZone, format, s -> ValuesSourceType.BYTES); + return resolve(context, valueType, field, script, missing, timeZone, format, s -> CoreValuesSourceType.BYTES); } /** @@ -73,12 +69,12 @@ public class ValuesSourceConfig { if (field == null) { if (script == null) { - ValuesSourceConfig config = new ValuesSourceConfig<>(ValuesSourceType.ANY); + ValuesSourceConfig config = new ValuesSourceConfig<>(CoreValuesSourceType.ANY); config.format(resolveFormat(null, valueType, timeZone)); return config; } - ValuesSourceType valuesSourceType = valueType != null ? valueType.getValuesSourceType() : ValuesSourceType.ANY; - if (valuesSourceType == ValuesSourceType.ANY) { + ValuesSourceType valuesSourceType = valueType != null ? valueType.getValuesSourceType() : CoreValuesSourceType.ANY; + if (valuesSourceType == CoreValuesSourceType.ANY) { // the specific value source type is undefined, but for scripts, // we need to have a specific value source // type to know how to handle the script values, so we fallback @@ -96,7 +92,7 @@ public class ValuesSourceConfig { MappedFieldType fieldType = context.fieldMapper(field); if (fieldType == null) { - ValuesSourceType valuesSourceType = valueType != null ? valueType.getValuesSourceType() : ValuesSourceType.ANY; + ValuesSourceType valuesSourceType = valueType != null ? valueType.getValuesSourceType() : CoreValuesSourceType.ANY; ValuesSourceConfig config = new ValuesSourceConfig<>(valuesSourceType); config.missing(missing); config.timezone(timeZone); @@ -113,14 +109,14 @@ public class ValuesSourceConfig { ValuesSourceConfig config; if (indexFieldData instanceof IndexNumericFieldData) { - config = new ValuesSourceConfig<>(ValuesSourceType.NUMERIC); + config = new ValuesSourceConfig<>(CoreValuesSourceType.NUMERIC); } else if (indexFieldData instanceof IndexGeoPointFieldData) { - config = new ValuesSourceConfig<>(ValuesSourceType.GEOPOINT); + config = new ValuesSourceConfig<>(CoreValuesSourceType.GEOPOINT); } else if (fieldType instanceof RangeFieldMapper.RangeFieldType) { - config = new ValuesSourceConfig<>(ValuesSourceType.RANGE); + config = new ValuesSourceConfig<>(CoreValuesSourceType.RANGE); } else { if (valueType == null) { - config = new ValuesSourceConfig<>(ValuesSourceType.BYTES); + config = new ValuesSourceConfig<>(CoreValuesSourceType.BYTES); } else { config = new ValuesSourceConfig<>(valueType.getValuesSourceType()); } @@ -262,126 +258,30 @@ public class ValuesSourceConfig { if (missing() == null) { // otherwise we will have values because of the missing value vs = null; - } else if (valueSourceType() == ValuesSourceType.NUMERIC) { - vs = (VS) ValuesSource.Numeric.EMPTY; - } else if (valueSourceType() == ValuesSourceType.GEOPOINT) { - vs = (VS) ValuesSource.GeoPoint.EMPTY; - } else if (valueSourceType() == ValuesSourceType.BYTES) { - vs = (VS) ValuesSource.Bytes.WithOrdinals.EMPTY; - } else if (valueSourceType() == ValuesSourceType.ANY) { + } else if (valueSourceType() == CoreValuesSourceType.ANY) { + // TODO: Clean up special cases around CoreValuesSourceType.ANY vs = (VS) resolveMissingAny.apply(missing()); } else { - throw new IllegalArgumentException("Can't deal with unmapped ValuesSource type " + valueSourceType()); + vs = (VS) valueSourceType().getEmpty(); } } else { - vs = originalValuesSource(); + if (fieldContext() == null) { + vs = (VS) valueSourceType().getScript(script(), scriptValueType()); + } else { + if (valueSourceType() == CoreValuesSourceType.ANY) { + // TODO: Clean up special cases around CoreValuesSourceType.ANY + // falling back to bytes values + vs = (VS) CoreValuesSourceType.BYTES.getField(fieldContext(), script()); + } else { + // TODO: Better docs for Scripts vs Scripted Fields + vs = (VS) valueSourceType().getField(fieldContext(), script()); + } + } } if (missing() == null) { return vs; } - - if (vs instanceof ValuesSource.Bytes) { - final BytesRef missing = format.parseBytesRef(missing().toString()); - if (vs instanceof ValuesSource.Bytes.WithOrdinals) { - return (VS) MissingValues.replaceMissing((ValuesSource.Bytes.WithOrdinals) vs, missing); - } else { - return (VS) MissingValues.replaceMissing((ValuesSource.Bytes) vs, missing); - } - } else if (vs instanceof ValuesSource.Numeric) { - Number missing = format.parseDouble(missing().toString(), false, context::nowInMillis); - return (VS) MissingValues.replaceMissing((ValuesSource.Numeric) vs, missing); - } else if (vs instanceof ValuesSource.GeoPoint) { - // TODO: also support the structured formats of geo points - final GeoPoint missing = new GeoPoint(missing().toString()); - return (VS) MissingValues.replaceMissing((ValuesSource.GeoPoint) vs, missing); - } else { - // Should not happen - throw new IllegalArgumentException("Can't apply missing values on a " + vs.getClass()); - } - } - - /** - * Return the original values source, before we apply `missing`. - */ - private VS originalValuesSource() { - if (fieldContext() == null) { - if (valueSourceType() == ValuesSourceType.NUMERIC) { - return (VS) numericScript(); - } - if (valueSourceType() == ValuesSourceType.BYTES) { - return (VS) bytesScript(); - } - throw new AggregationExecutionException("value source of type [" + valueSourceType().name() - + "] is not supported by scripts"); - } - - if (valueSourceType() == ValuesSourceType.NUMERIC) { - return (VS) numericField(); - } - if (valueSourceType() == ValuesSourceType.GEOPOINT) { - return (VS) geoPointField(); - } - if (valueSourceType() == ValuesSourceType.RANGE) { - return (VS) rangeField(); - } - // falling back to bytes values - return (VS) bytesField(); - } - - private ValuesSource.Numeric numericScript() { - return new ValuesSource.Numeric.Script(script(), scriptValueType()); - } - - private ValuesSource.Numeric numericField() { - - if (!(fieldContext().indexFieldData() instanceof IndexNumericFieldData)) { - throw new IllegalArgumentException("Expected numeric type on field [" + fieldContext().field() + - "], but got [" + fieldContext().fieldType().typeName() + "]"); - } - - ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData)fieldContext().indexFieldData()); - if (script() != null) { - dataSource = new ValuesSource.Numeric.WithScript(dataSource, script()); - } - return dataSource; - } - - private ValuesSource bytesField() { - final IndexFieldData indexFieldData = fieldContext().indexFieldData(); - ValuesSource dataSource; - if (indexFieldData instanceof IndexOrdinalsFieldData) { - dataSource = new ValuesSource.Bytes.WithOrdinals.FieldData((IndexOrdinalsFieldData) indexFieldData); - } else { - dataSource = new ValuesSource.Bytes.FieldData(indexFieldData); - } - if (script() != null) { - dataSource = new ValuesSource.WithScript(dataSource, script()); - } - return dataSource; - } - - private ValuesSource.Bytes bytesScript() { - return new ValuesSource.Bytes.Script(script()); - } - - private ValuesSource.GeoPoint geoPointField() { - - if (!(fieldContext().indexFieldData() instanceof IndexGeoPointFieldData)) { - throw new IllegalArgumentException("Expected geo_point type on field [" + fieldContext().field() + - "], but got [" + fieldContext().fieldType().typeName() + "]"); - } - - return new ValuesSource.GeoPoint.Fielddata((IndexGeoPointFieldData) fieldContext().indexFieldData()); - } - - private ValuesSource rangeField() { - MappedFieldType fieldType = fieldContext.fieldType(); - - if (fieldType instanceof RangeFieldMapper.RangeFieldType == false) { - throw new IllegalStateException("Asked for range ValuesSource, but field is of type " + fieldType.name()); - } - RangeFieldMapper.RangeFieldType rangeFieldType = (RangeFieldMapper.RangeFieldType)fieldType; - return new ValuesSource.Range(fieldContext().indexFieldData(), rangeFieldType.rangeType()); + return (VS) valueSourceType().replaceMissing(vs, missing, format, context::nowInMillis); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceType.java b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceType.java index 93398abe99e..52f39cfe932 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceType.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceType.java @@ -19,35 +19,55 @@ package org.elasticsearch.search.aggregations.support; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; +import org.elasticsearch.script.AggregationScript; +import org.elasticsearch.search.DocValueFormat; -import java.io.IOException; -import java.util.Locale; +import java.util.function.LongSupplier; -public enum ValuesSourceType implements Writeable { - ANY, - NUMERIC, - BYTES, - GEOPOINT, - RANGE; +/** + * ValuesSourceType wraps the creation of specific per-source instances each {@link ValuesSource} needs to provide. Every top-level + * subclass of {@link ValuesSource} should have a corresponding implementation of this interface. In general, new data types seeking + * aggregation support should create a top level {@link ValuesSource}, then implement this to return wrappers for the specific sources of + * values. + */ +public interface ValuesSourceType { + /** + * Called when an aggregation is operating over a known empty set (usually because the field isn't specified), this method allows for + * returning a no-op implementation. All {@link ValuesSource}s should implement this method. + * @return - Empty specialization of the base {@link ValuesSource} + */ + ValuesSource getEmpty(); - public static ValuesSourceType fromString(String name) { - return valueOf(name.trim().toUpperCase(Locale.ROOT)); - } + /** + * Returns the type-specific sub class for a script data source. {@link ValuesSource}s that do not support scripts should throw + * {@link org.elasticsearch.search.aggregations.AggregationExecutionException}. Note that this method is called when a script is + * operating without an underlying field. Scripts operating over fields are handled by the script argument to getField below. + * + * @param script - The script being wrapped + * @param scriptValueType - The expected output type of the script + * @return - Script specialization of the base {@link ValuesSource} + */ + ValuesSource getScript(AggregationScript.LeafFactory script, ValueType scriptValueType); - public static ValuesSourceType fromStream(StreamInput in) throws IOException { - return in.readEnum(ValuesSourceType.class); - } + /** + * Return a {@link ValuesSource} wrapping a field for the given type. All {@link ValuesSource}s must implement this method. + * + * @param fieldContext - The field being wrapped + * @param script - Optional script that might be applied over the field + * @return - Field specialization of the base {@link ValuesSource} + */ + ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFactory script); - @Override - public void writeTo(StreamOutput out) throws IOException { - ValuesSourceType state = this; - out.writeEnum(state); - } - - public String value() { - return name().toLowerCase(Locale.ROOT); - } + /** + * Apply the given missing value to an already-constructed {@link ValuesSource}. Types which do not support missing values should throw + * {@link org.elasticsearch.search.aggregations.AggregationExecutionException} + * + * @param valuesSource - The original {@link ValuesSource} + * @param rawMissing - The missing value we got from the parser, typically a string or number + * @param docValueFormat - The format to use for further parsing the user supplied value, e.g. a date format + * @param now - Used in conjunction with the formatter, should return the current time in milliseconds + * @return - Wrapper over the provided {@link ValuesSource} to apply the given missing value + */ + ValuesSource replaceMissing(ValuesSource valuesSource, Object rawMissing, DocValueFormat docValueFormat, + LongSupplier now); } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/support/CoreValuesSourceTypeTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/support/CoreValuesSourceTypeTests.java new file mode 100644 index 00000000000..e7e39e7a43b --- /dev/null +++ b/server/src/test/java/org/elasticsearch/search/aggregations/support/CoreValuesSourceTypeTests.java @@ -0,0 +1,74 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.search.aggregations.support; + +import org.elasticsearch.common.io.stream.AbstractWriteableEnumTestCase; + +import java.io.IOException; + +import static org.hamcrest.Matchers.equalTo; + +public class CoreValuesSourceTypeTests extends AbstractWriteableEnumTestCase { + + public CoreValuesSourceTypeTests() { + super(CoreValuesSourceType::fromStream); + } + + @Override + public void testValidOrdinals() { + assertThat(CoreValuesSourceType.ANY.ordinal(), equalTo(0)); + assertThat(CoreValuesSourceType.NUMERIC.ordinal(), equalTo(1)); + assertThat(CoreValuesSourceType.BYTES.ordinal(), equalTo(2)); + assertThat(CoreValuesSourceType.GEOPOINT.ordinal(), equalTo(3)); + assertThat(CoreValuesSourceType.RANGE.ordinal(), equalTo(4)); + } + + @Override + public void testFromString() { + assertThat(CoreValuesSourceType.fromString("any"), equalTo(CoreValuesSourceType.ANY)); + assertThat(CoreValuesSourceType.fromString("numeric"), equalTo(CoreValuesSourceType.NUMERIC)); + assertThat(CoreValuesSourceType.fromString("bytes"), equalTo(CoreValuesSourceType.BYTES)); + assertThat(CoreValuesSourceType.fromString("geopoint"), equalTo(CoreValuesSourceType.GEOPOINT)); + assertThat(CoreValuesSourceType.fromString("range"), equalTo(CoreValuesSourceType.RANGE)); + IllegalArgumentException e = expectThrows(IllegalArgumentException.class, + () -> CoreValuesSourceType.fromString("does_not_exist")); + assertThat(e.getMessage(), + equalTo("No enum constant org.elasticsearch.search.aggregations.support.CoreValuesSourceType.DOES_NOT_EXIST")); + expectThrows(NullPointerException.class, () -> CoreValuesSourceType.fromString(null)); + } + + @Override + public void testReadFrom() throws IOException { + assertReadFromStream(0, CoreValuesSourceType.ANY); + assertReadFromStream(1, CoreValuesSourceType.NUMERIC); + assertReadFromStream(2, CoreValuesSourceType.BYTES); + assertReadFromStream(3, CoreValuesSourceType.GEOPOINT); + assertReadFromStream(4, CoreValuesSourceType.RANGE); + } + + @Override + public void testWriteTo() throws IOException { + assertWriteToStream(CoreValuesSourceType.ANY, 0); + assertWriteToStream(CoreValuesSourceType.NUMERIC, 1); + assertWriteToStream(CoreValuesSourceType.BYTES, 2); + assertWriteToStream(CoreValuesSourceType.GEOPOINT, 3); + assertWriteToStream(CoreValuesSourceType.RANGE, 4); + } +} diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/support/ValuesSourceTypeTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/support/ValuesSourceTypeTests.java deleted file mode 100644 index 42c276e0c4e..00000000000 --- a/server/src/test/java/org/elasticsearch/search/aggregations/support/ValuesSourceTypeTests.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.search.aggregations.support; - -import org.elasticsearch.common.io.stream.AbstractWriteableEnumTestCase; - -import java.io.IOException; - -import static org.hamcrest.Matchers.equalTo; - -public class ValuesSourceTypeTests extends AbstractWriteableEnumTestCase { - - public ValuesSourceTypeTests() { - super(ValuesSourceType::fromStream); - } - - @Override - public void testValidOrdinals() { - assertThat(ValuesSourceType.ANY.ordinal(), equalTo(0)); - assertThat(ValuesSourceType.NUMERIC.ordinal(), equalTo(1)); - assertThat(ValuesSourceType.BYTES.ordinal(), equalTo(2)); - assertThat(ValuesSourceType.GEOPOINT.ordinal(), equalTo(3)); - assertThat(ValuesSourceType.RANGE.ordinal(), equalTo(4)); - } - - @Override - public void testFromString() { - assertThat(ValuesSourceType.fromString("any"), equalTo(ValuesSourceType.ANY)); - assertThat(ValuesSourceType.fromString("numeric"), equalTo(ValuesSourceType.NUMERIC)); - assertThat(ValuesSourceType.fromString("bytes"), equalTo(ValuesSourceType.BYTES)); - assertThat(ValuesSourceType.fromString("geopoint"), equalTo(ValuesSourceType.GEOPOINT)); - assertThat(ValuesSourceType.fromString("range"), equalTo(ValuesSourceType.RANGE)); - IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> ValuesSourceType.fromString("does_not_exist")); - assertThat(e.getMessage(), - equalTo("No enum constant org.elasticsearch.search.aggregations.support.ValuesSourceType.DOES_NOT_EXIST")); - expectThrows(NullPointerException.class, () -> ValuesSourceType.fromString(null)); - } - - @Override - public void testReadFrom() throws IOException { - assertReadFromStream(0, ValuesSourceType.ANY); - assertReadFromStream(1, ValuesSourceType.NUMERIC); - assertReadFromStream(2, ValuesSourceType.BYTES); - assertReadFromStream(3, ValuesSourceType.GEOPOINT); - assertReadFromStream(4, ValuesSourceType.RANGE); - } - - @Override - public void testWriteTo() throws IOException { - assertWriteToStream(ValuesSourceType.ANY, 0); - assertWriteToStream(ValuesSourceType.NUMERIC, 1); - assertWriteToStream(ValuesSourceType.BYTES, 2); - assertWriteToStream(ValuesSourceType.GEOPOINT, 3); - assertWriteToStream(ValuesSourceType.RANGE, 4); - } -} diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/stringstats/StringStatsAggregationBuilder.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/stringstats/StringStatsAggregationBuilder.java index 59097a69e16..60c5bde1e7b 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/stringstats/StringStatsAggregationBuilder.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/stringstats/StringStatsAggregationBuilder.java @@ -15,12 +15,12 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -46,7 +46,7 @@ public class StringStatsAggregationBuilder extends ValuesSourceAggregationBuilde } public StringStatsAggregationBuilder(String name) { - super(name, ValuesSourceType.BYTES, ValueType.STRING); + super(name, CoreValuesSourceType.BYTES, ValueType.STRING); } public StringStatsAggregationBuilder(StringStatsAggregationBuilder clone, @@ -58,7 +58,7 @@ public class StringStatsAggregationBuilder extends ValuesSourceAggregationBuilde /** Read from a stream. */ public StringStatsAggregationBuilder(StreamInput in) throws IOException { - super(in, ValuesSourceType.BYTES, ValueType.STRING); + super(in, CoreValuesSourceType.BYTES, ValueType.STRING); this.showDistribution = in.readBoolean(); } diff --git a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/cumulativecardinality/CumulativeCardinalityAggregatorTests.java b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/cumulativecardinality/CumulativeCardinalityAggregatorTests.java index 2e569f19c37..8f5cfb66192 100644 --- a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/cumulativecardinality/CumulativeCardinalityAggregatorTests.java +++ b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/cumulativecardinality/CumulativeCardinalityAggregatorTests.java @@ -40,10 +40,10 @@ import org.elasticsearch.search.aggregations.bucket.histogram.Histogram; import org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregatorFactory; import org.elasticsearch.search.aggregations.metrics.CardinalityAggregationBuilder; import org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import org.elasticsearch.xpack.analytics.StubAggregatorFactory; import java.io.IOException; @@ -116,7 +116,7 @@ public class CumulativeCardinalityAggregatorTests extends AggregatorTestCase { } public void testParentValidations() throws IOException { - ValuesSourceConfig valuesSourceConfig = new ValuesSourceConfig<>(ValuesSourceType.NUMERIC); + ValuesSourceConfig valuesSourceConfig = new ValuesSourceConfig<>(CoreValuesSourceType.NUMERIC); // Histogram Set aggBuilders = new HashSet<>(); @@ -139,7 +139,7 @@ public class CumulativeCardinalityAggregatorTests extends AggregatorTestCase { builder.validate(parent, Collections.emptySet(), aggBuilders); // Auto Date Histogram - ValuesSourceConfig numericVS = new ValuesSourceConfig<>(ValuesSourceType.NUMERIC); + ValuesSourceConfig numericVS = new ValuesSourceConfig<>(CoreValuesSourceType.NUMERIC); aggBuilders.clear(); aggBuilders.add(new CumulativeCardinalityPipelineAggregationBuilder("cumulative_card", "sum")); AutoDateHistogramAggregationBuilder.RoundingInfo[] roundings = new AutoDateHistogramAggregationBuilder.RoundingInfo[1]; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/MockDeprecatedAggregationBuilder.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/MockDeprecatedAggregationBuilder.java index 03de07f2475..8f04e8ff110 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/MockDeprecatedAggregationBuilder.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/MockDeprecatedAggregationBuilder.java @@ -16,12 +16,12 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; -import org.elasticsearch.search.aggregations.support.ValuesSourceType; import java.io.IOException; import java.util.Map; @@ -45,7 +45,7 @@ public class MockDeprecatedAggregationBuilder extends ValuesSourceAggregationBui } public MockDeprecatedAggregationBuilder() { - super(NAME, ValuesSourceType.NUMERIC, ValueType.NUMERIC); + super(NAME, CoreValuesSourceType.NUMERIC, ValueType.NUMERIC); } /**