From bccfcfa52206114a46325d714ccc540135e5d28c Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Tue, 14 Jul 2015 15:29:20 +0100 Subject: [PATCH] Aggregation: Removed Old Script Java API from metrics aggregations The old script syntax has been removed from the Java API but the metrics aggregations were missed. This change removes the old script API from the ValuesSourceMetricsAggregationBuilder and removes the relevant test methods for the metrics aggregations. --- ...ValuesSourceMetricsAggregationBuilder.java | 68 ----- .../expression/ExpressionScriptTests.java | 9 +- .../aggregations/bucket/TopHitsTests.java | 20 +- .../metrics/AbstractNumericTests.java | 20 -- .../search/aggregations/metrics/AvgTests.java | 190 ------------ .../metrics/CardinalityTests.java | 148 ---------- .../metrics/ExtendedStatsTests.java | 279 ------------------ .../search/aggregations/metrics/MaxTests.java | 173 ----------- .../search/aggregations/metrics/MinTests.java | 204 ------------- .../metrics/PercentileRanksTests.java | 211 ------------- .../metrics/PercentilesTests.java | 202 ------------- .../aggregations/metrics/StatsTests.java | 235 --------------- .../search/aggregations/metrics/SumTests.java | 164 ---------- .../aggregations/metrics/ValueCountTests.java | 64 ---- 14 files changed, 13 insertions(+), 1974 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/ValuesSourceMetricsAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/ValuesSourceMetricsAggregationBuilder.java index d584b0596dc..e6755486225 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/ValuesSourceMetricsAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/ValuesSourceMetricsAggregationBuilder.java @@ -19,13 +19,10 @@ package org.elasticsearch.search.aggregations.metrics; -import com.google.common.collect.Maps; - import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.script.Script; import java.io.IOException; -import java.util.Map; /** * @@ -34,12 +31,6 @@ public abstract class ValuesSourceMetricsAggregationBuilder params; // TODO Remove in 3.0 private String format; private Object missing; @@ -62,53 +53,6 @@ public abstract class ValuesSourceMetricsAggregationBuilder params) { - if (this.params == null) { - this.params = params; - } else { - this.params.putAll(params); - } - return (B) this; - } - - /** - * @deprecated use {@link #script(Script)} instead. - */ - @Deprecated - @SuppressWarnings("unchecked") - public B param(String name, Object value) { - if (this.params == null) { - this.params = Maps.newHashMap(); - } - this.params.put(name, value); - return (B) this; - } - @SuppressWarnings("unchecked") public B format(String format) { this.format = format; @@ -133,22 +77,10 @@ public abstract class ValuesSourceMetricsAggregationBuilder