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 29549ded441a3..730946fddfef5 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 @@ -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, ValueType.STRING); if (childType == null) { throw new IllegalArgumentException("[childType] must not be null: [" + name + "]"); } 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 4386c417677a2..0591c2efd7f2f 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 @@ -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, ValueType.STRING); if (childType == null) { throw new IllegalArgumentException("[childType] must not be null: [" + name + "]"); } 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 32ff1d07c537a..5b31c580c1a46 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 @@ -70,7 +70,7 @@ public static ObjectParser createParser(String } public GeoGridAggregationBuilder(String name) { - super(name, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT); + super(name, ValueType.GEOPOINT); } protected GeoGridAggregationBuilder(GeoGridAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { 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 767ea35102660..d31c4c6caa001 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 @@ -134,7 +134,7 @@ public AutoDateHistogramAggregationBuilder setMinimumIntervalExpression(String m /** Create a new builder with the given name. */ public AutoDateHistogramAggregationBuilder(String name) { - super(name, ValuesSourceType.NUMERIC, ValueType.DATE); + super(name, ValueType.DATE); } /** Read from a stream, for internal use only. */ 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 cd07d7ed1f78c..888b1c844d96d 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 @@ -130,7 +130,7 @@ public static DateHistogramAggregationBuilder parse(String aggregationName, XCon /** Create a new builder with the given name. */ public DateHistogramAggregationBuilder(String name) { - super(name, ValuesSourceType.ANY, ValueType.DATE); + super(name, ValueType.DATE); } protected DateHistogramAggregationBuilder(DateHistogramAggregationBuilder clone, 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 a12f5d24b6c85..b104f8ae7b743 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 @@ -104,7 +104,7 @@ protected ValuesSourceType resolveScriptAny(Script script) { /** Create a new builder with the given name. */ public HistogramAggregationBuilder(String name) { - super(name, ValuesSourceType.ANY, ValueType.NUMERIC); + super(name, ValueType.NUMERIC); } protected HistogramAggregationBuilder(HistogramAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { 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 c685df31ab160..2dacd788f1097 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 @@ -54,7 +54,7 @@ public static MissingAggregationBuilder parse(String aggregationName, XContentPa } public MissingAggregationBuilder(String name, ValueType targetValueType) { - super(name, ValuesSourceType.ANY, targetValueType); + super(name, targetValueType); } protected MissingAggregationBuilder(MissingAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/AbstractRangeBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/AbstractRangeBuilder.java index 542929564e66f..6054100aa3f4d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/AbstractRangeBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/AbstractRangeBuilder.java @@ -45,7 +45,7 @@ public abstract class AbstractRangeBuilder rangeFactory) { - super(name, rangeFactory.getValueSourceType(), rangeFactory.getValueType()); + super(name, rangeFactory.getValueType()); this.rangeFactory = rangeFactory; } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/GeoDistanceAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/GeoDistanceAggregationBuilder.java index 92d8bbc15a754..5fc135d4a6f2a 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/GeoDistanceAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/GeoDistanceAggregationBuilder.java @@ -230,7 +230,7 @@ public GeoDistanceAggregationBuilder(String name, GeoPoint origin) { private GeoDistanceAggregationBuilder(String name, GeoPoint origin, InternalRange.Factory rangeFactory) { - super(name, rangeFactory.getValueSourceType(), rangeFactory.getValueType()); + super(name, rangeFactory.getValueType()); this.origin = origin; } 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 14a8eb3a1cd78..2a40221a6b893 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 @@ -220,7 +220,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws private List ranges = new ArrayList<>(); public IpRangeAggregationBuilder(String name) { - super(name, ValuesSourceType.BYTES, ValueType.IP); + super(name, ValueType.IP); } protected IpRangeAggregationBuilder(IpRangeAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { 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 eb7012ea69f94..ebdc44542b03b 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 @@ -62,7 +62,7 @@ public static AggregationBuilder parse(String aggregationName, XContentParser pa private String executionHint = null; public DiversifiedAggregationBuilder(String name) { - super(name, ValuesSourceType.ANY, null); + super(name, null); } protected DiversifiedAggregationBuilder(DiversifiedAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { 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 1eda817b494e1..fe36c92641faa 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 @@ -116,7 +116,7 @@ public AggregationBuilder parse(String aggregationName, XContentParser parser) t private SignificanceHeuristic significanceHeuristic = DEFAULT_SIGNIFICANCE_HEURISTIC; public SignificantTermsAggregationBuilder(String name, ValueType valueType) { - super(name, ValuesSourceType.ANY, valueType); + super(name, valueType); } /** 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 44c24e3248256..9f5b23cd85fb0 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 @@ -72,7 +72,7 @@ public static AggregationBuilder parse(String aggregationName, XContentParser pa private double precision = 0.001; public RareTermsAggregationBuilder(String name, ValueType valueType) { - super(name, ValuesSourceType.ANY, valueType); + super(name, valueType); } private RareTermsAggregationBuilder(RareTermsAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { 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 d019179334c61..670f4b5f2ebcc 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 @@ -109,7 +109,7 @@ public static AggregationBuilder parse(String aggregationName, XContentParser pa private boolean showTermDocCountError = false; public TermsAggregationBuilder(String name, ValueType valueType) { - super(name, ValuesSourceType.ANY, valueType); + super(name, valueType); } protected TermsAggregationBuilder(TermsAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { 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 896055120182c..811735d0dedd5 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 @@ -56,7 +56,7 @@ public static AggregationBuilder parse(String aggregationName, XContentParser pa private boolean wrapLongitude = true; public GeoBoundsAggregationBuilder(String name) { - super(name, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT); + super(name, ValueType.GEOPOINT); } protected GeoBoundsAggregationBuilder(GeoBoundsAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { 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 9c8cacc7859e0..8dfad1d2bf393 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 @@ -41,7 +41,7 @@ public abstract static class LeafOnly { protected LeafOnly(String name, ValuesSourceType valuesSourceType, ValueType targetValueType) { - super(name, valuesSourceType, targetValueType); + super(name, targetValueType); } protected LeafOnly(LeafOnly clone, Builder factoriesBuilder, Map metaData) { @@ -74,7 +74,6 @@ public final AB subAggregations(Builder subFactories) { } } - private final ValuesSourceType valuesSourceType; private final ValueType targetValueType; private String field = null; private Script script = null; @@ -84,19 +83,14 @@ public final AB subAggregations(Builder subFactories) { private ZoneId timeZone = null; protected ValuesSourceConfig config; - protected ValuesSourceAggregationBuilder(String name, ValuesSourceType valuesSourceType, ValueType targetValueType) { + protected ValuesSourceAggregationBuilder(String name, ValueType targetValueType) { super(name); - if (valuesSourceType == null) { - throw new IllegalArgumentException("[valuesSourceType] must not be null: [" + name + "]"); - } - this.valuesSourceType = valuesSourceType; this.targetValueType = targetValueType; } protected ValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { super(clone, factoriesBuilder, metaData); - this.valuesSourceType = clone.valuesSourceType; this.targetValueType = clone.targetValueType; this.field = clone.field; this.valueType = clone.valueType; @@ -116,7 +110,6 @@ protected ValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder protected ValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType valuesSourceType, ValueType targetValueType) throws IOException { super(in); - this.valuesSourceType = valuesSourceType; if (serializeTargetValueType(in.getVersion())) { this.targetValueType = in.readOptionalWriteable(ValueType::readFromStream); } else { @@ -133,7 +126,6 @@ protected ValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType values super(in); // TODO: Can we get rid of this constructor and always use the three value version? Does this assert provide any value? assert serializeTargetValueType(in.getVersion()) : "Wrong read constructor called for subclass that serializes its targetValueType"; - this.valuesSourceType = valuesSourceType; this.targetValueType = in.readOptionalWriteable(ValueType::readFromStream); read(in); } @@ -377,7 +369,7 @@ public final XContentBuilder internalXContent(XContentBuilder builder, Params pa @Override public int hashCode() { return Objects.hash(super.hashCode(), field, format, missing, script, - targetValueType, timeZone, valueType, valuesSourceType); + targetValueType, timeZone, valueType); } @Override @@ -386,8 +378,7 @@ public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) return false; if (super.equals(obj) == false) return false; ValuesSourceAggregationBuilder other = (ValuesSourceAggregationBuilder) obj; - return Objects.equals(valuesSourceType, other.valuesSourceType) - && Objects.equals(field, other.field) + return Objects.equals(field, other.field) && Objects.equals(format, other.format) && Objects.equals(missing, other.missing) && Objects.equals(script, other.script) 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 03de07f2475be..a043c88b4f063 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 @@ -21,7 +21,6 @@ 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 +44,7 @@ protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map