summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsTests.java
diff options
context:
space:
mode:
authorColin Goodheart-Smithe <colings86@users.noreply.github.com>2015-07-14 15:29:20 +0100
committerColin Goodheart-Smithe <colings86@users.noreply.github.com>2015-07-14 15:41:11 +0100
commitbccfcfa52206114a46325d714ccc540135e5d28c (patch)
treeb12b783fceac2e248125f3f9a1a10918098c7e49 /core/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsTests.java
parent7db293c6167179bd470bb8a189223fcb67c0fae1 (diff)
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.
Diffstat (limited to 'core/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsTests.java')
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsTests.java279
1 files changed, 0 insertions, 279 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsTests.java
index 93721ff15c..3d9a0d46b5 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsTests.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsTests.java
@@ -578,283 +578,4 @@ public class ExtendedStatsTests extends AbstractNumericTests {
assertThat(stats.getStdDeviationBound(ExtendedStats.Bounds.LOWER), equalTo(stats.getAvg() - (stats.getStdDeviation() * sigma)));
}
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testSingleValuedField_WithValueScript_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
- .addAggregation(extendedStats("stats").field("value").script("_value + 1").sigma(sigma)).execute().actionGet();
-
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(), equalTo((double) (2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11) / 10));
- assertThat(stats.getMin(), equalTo(2.0));
- assertThat(stats.getMax(), equalTo(11.0));
- assertThat(stats.getSum(), equalTo((double) 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11));
- assertThat(stats.getCount(), equalTo(10l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 + 121));
- assertThat(stats.getVariance(), equalTo(variance(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- checkUpperLowerBounds(stats, sigma);
- }
-
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testSingleValuedField_WithValueScript_WithParams_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
- .addAggregation(extendedStats("stats").field("value").script("_value + inc").param("inc", 1).sigma(sigma)).execute()
- .actionGet();
-
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(), equalTo((double) (2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11) / 10));
- assertThat(stats.getMin(), equalTo(2.0));
- assertThat(stats.getMax(), equalTo(11.0));
- assertThat(stats.getSum(), equalTo((double) 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11));
- assertThat(stats.getCount(), equalTo(10l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 + 121));
- assertThat(stats.getVariance(), equalTo(variance(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- checkUpperLowerBounds(stats, sigma);
- }
-
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testMultiValuedField_WithValueScript_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
- .addAggregation(extendedStats("stats").field("values").script("_value - 1").sigma(sigma)).execute().actionGet();
-
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(),
- equalTo((double) (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11) / 20));
- assertThat(stats.getMin(), equalTo(1.0));
- assertThat(stats.getMax(), equalTo(11.0));
- assertThat(stats.getSum(), equalTo((double) 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11));
- assertThat(stats.getCount(), equalTo(20l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 + 4 + 9 + 16 + 25 + 36 + 49 + 64
- + 81 + 100 + 121));
- assertThat(stats.getVariance(), equalTo(variance(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- checkUpperLowerBounds(stats, sigma);
- }
-
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testMultiValuedField_WithValueScript_WithParams_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
- .addAggregation(extendedStats("stats").field("values").script("_value - dec").param("dec", 1).sigma(sigma)).execute()
- .actionGet();
-
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(),
- equalTo((double) (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11) / 20));
- assertThat(stats.getMin(), equalTo(1.0));
- assertThat(stats.getMax(), equalTo(11.0));
- assertThat(stats.getSum(), equalTo((double) 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11));
- assertThat(stats.getCount(), equalTo(20l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 + 4 + 9 + 16 + 25 + 36 + 49 + 64
- + 81 + 100 + 121));
- assertThat(stats.getVariance(), equalTo(variance(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- checkUpperLowerBounds(stats, sigma);
- }
-
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testScript_SingleValued_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
- .addAggregation(extendedStats("stats").script("doc['value'].value").sigma(sigma)).execute().actionGet();
-
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(), equalTo((double) (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10) / 10));
- assertThat(stats.getMin(), equalTo(1.0));
- assertThat(stats.getMax(), equalTo(10.0));
- assertThat(stats.getSum(), equalTo((double) 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10));
- assertThat(stats.getCount(), equalTo(10l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100));
- assertThat(stats.getVariance(), equalTo(variance(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)));
- checkUpperLowerBounds(stats, sigma);
- }
-
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testScript_SingleValued_WithParams_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
- .addAggregation(extendedStats("stats").script("doc['value'].value + inc").param("inc", 1).sigma(sigma)).execute()
- .actionGet();
-
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(), equalTo((double) (2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11) / 10));
- assertThat(stats.getMin(), equalTo(2.0));
- assertThat(stats.getMax(), equalTo(11.0));
- assertThat(stats.getSum(), equalTo((double) 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11));
- assertThat(stats.getCount(), equalTo(10l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 + 121));
- assertThat(stats.getVariance(), equalTo(variance(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- checkUpperLowerBounds(stats, sigma);
- }
-
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testScript_ExplicitSingleValued_WithParams_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
- .addAggregation(extendedStats("stats").script("doc['value'].value + inc").param("inc", 1).sigma(sigma)).execute()
- .actionGet();
-
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(), equalTo((double) (2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11) / 10));
- assertThat(stats.getMin(), equalTo(2.0));
- assertThat(stats.getMax(), equalTo(11.0));
- assertThat(stats.getSum(), equalTo((double) 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11));
- assertThat(stats.getCount(), equalTo(10l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 + 121));
- assertThat(stats.getVariance(), equalTo(variance(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
- checkUpperLowerBounds(stats, sigma);
- }
-
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testScript_MultiValued_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
- .addAggregation(extendedStats("stats").script("doc['values'].values").sigma(sigma)).execute().actionGet();
-
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(),
- equalTo((double) (2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12) / 20));
- assertThat(stats.getMin(), equalTo(2.0));
- assertThat(stats.getMax(), equalTo(12.0));
- assertThat(stats.getSum(), equalTo((double) 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12));
- assertThat(stats.getCount(), equalTo(20l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 + 121 + 9 + 16 + 25 + 36 + 49 + 64
- + 81 + 100 + 121 + 144));
- assertThat(stats.getVariance(), equalTo(variance(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)));
- checkUpperLowerBounds(stats, sigma);
- }
-
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testScript_ExplicitMultiValued_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
- .addAggregation(extendedStats("stats").script("doc['values'].values").sigma(sigma)).execute().actionGet();
-
- assertShardExecutionState(searchResponse, 0);
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(),
- equalTo((double) (2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12) / 20));
- assertThat(stats.getMin(), equalTo(2.0));
- assertThat(stats.getMax(), equalTo(12.0));
- assertThat(stats.getSum(), equalTo((double) 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12));
- assertThat(stats.getCount(), equalTo(20l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 + 121 + 9 + 16 + 25 + 36 + 49 + 64
- + 81 + 100 + 121 + 144));
- assertThat(stats.getVariance(), equalTo(variance(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)));
- checkUpperLowerBounds(stats, sigma);
-
- }
-
- /*
- * TODO Remove in 3.0
- */
- @Override
- @Test
- public void testScript_MultiValued_WithParams_OldScriptAPI() throws Exception {
- double sigma = randomDouble() * randomIntBetween(1, 10);
- SearchResponse searchResponse = client()
- .prepareSearch("idx")
- .setQuery(matchAllQuery())
- .addAggregation(
- extendedStats("stats").script("[ doc['value'].value, doc['value'].value - dec ]").param("dec", 1).sigma(sigma))
- .execute().actionGet();
-
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(10l));
-
- ExtendedStats stats = searchResponse.getAggregations().get("stats");
- assertThat(stats, notNullValue());
- assertThat(stats.getName(), equalTo("stats"));
- assertThat(stats.getAvg(), equalTo((double) (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9) / 20));
- assertThat(stats.getMin(), equalTo(0.0));
- assertThat(stats.getMax(), equalTo(10.0));
- assertThat(stats.getSum(), equalTo((double) 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9));
- assertThat(stats.getCount(), equalTo(20l));
- assertThat(stats.getSumOfSquares(), equalTo((double) 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 + 0 + 1 + 4 + 9 + 16 + 25 + 36
- + 49 + 64 + 81));
- assertThat(stats.getVariance(), equalTo(variance(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)));
- assertThat(stats.getStdDeviation(), equalTo(stdDev(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)));
- checkUpperLowerBounds(stats, sigma);
- }
-
} \ No newline at end of file