From b5e958b2e0d1502d3e4c48b04f84399bf4bd714f Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Mon, 29 Jun 2015 12:53:38 +0100 Subject: [PATCH] Aggregations: Fix bucket_script builder method name --- .../pipeline/PipelineAggregatorBuilders.java | 2 +- .../expression/ExpressionScriptTests.java | 4 ++-- .../pipeline/BucketScriptTests.java | 20 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/PipelineAggregatorBuilders.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/PipelineAggregatorBuilders.java index 12f02920c7d..851b750e778 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/PipelineAggregatorBuilders.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/PipelineAggregatorBuilders.java @@ -57,7 +57,7 @@ public final class PipelineAggregatorBuilders { return new MovAvgBuilder(name); } - public static final BucketScriptBuilder seriesArithmetic(String name) { + public static final BucketScriptBuilder bucketScript(String name) { return new BucketScriptBuilder(name); } diff --git a/core/src/test/java/org/elasticsearch/script/expression/ExpressionScriptTests.java b/core/src/test/java/org/elasticsearch/script/expression/ExpressionScriptTests.java index e8895a3fc05..0156c727899 100644 --- a/core/src/test/java/org/elasticsearch/script/expression/ExpressionScriptTests.java +++ b/core/src/test/java/org/elasticsearch/script/expression/ExpressionScriptTests.java @@ -53,7 +53,7 @@ import java.util.Map; import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram; import static org.elasticsearch.search.aggregations.AggregationBuilders.sum; -import static org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorBuilders.seriesArithmetic; +import static org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorBuilders.bucketScript; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; @@ -533,7 +533,7 @@ public class ExpressionScriptTests extends ElasticsearchIntegrationTest { .subAggregation(sum("threeSum").field("three")) .subAggregation(sum("fourSum").field("four")) .subAggregation( - seriesArithmetic("totalSum").setBucketsPaths("twoSum", "threeSum", "fourSum").script( + bucketScript("totalSum").setBucketsPaths("twoSum", "threeSum", "fourSum").script( new Script("_value0 + _value1 + _value2", ScriptType.INLINE, ExpressionScriptEngineService.NAME, null)))).execute().actionGet(); InternalHistogram histogram = response.getAggregations().get("histogram"); diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptTests.java index 7823b960415..93d14dc0011 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptTests.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptTests.java @@ -42,7 +42,7 @@ import java.util.Map; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram; import static org.elasticsearch.search.aggregations.AggregationBuilders.sum; -import static org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorBuilders.seriesArithmetic; +import static org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorBuilders.bucketScript; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; @@ -105,7 +105,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation( - seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( + bucketScript("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( new Script("_value0 + _value1 + _value2", ScriptType.INLINE, null, null)))).execute().actionGet(); assertSearchResponse(response); @@ -153,7 +153,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation( - seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( + bucketScript("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( new Script("_value0 + _value1 / _value2", ScriptType.INLINE, null, null)))).execute().actionGet(); assertSearchResponse(response); @@ -199,7 +199,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest { .interval(interval) .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation( - seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum").script( + bucketScript("seriesArithmetic").setBucketsPaths("field2Sum").script( new Script("_value0", ScriptType.INLINE, null, null)))).execute().actionGet(); assertSearchResponse(response); @@ -245,7 +245,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation( - seriesArithmetic("seriesArithmetic").setBucketsPathsMap(bucketsPathsMap ).script( + bucketScript("seriesArithmetic").setBucketsPathsMap(bucketsPathsMap ).script( new Script("foo + bar + baz", ScriptType.INLINE, null, null)))).execute().actionGet(); assertSearchResponse(response); @@ -295,7 +295,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation( - seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( + bucketScript("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( new Script("(_value0 + _value1 + _value2) * factor", ScriptType.INLINE, null, params)))).execute().actionGet(); assertSearchResponse(response); @@ -343,7 +343,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation( - seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( + bucketScript("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( new Script("_value0 + _value1 + _value2", ScriptType.INLINE, null, null)).gapPolicy(GapPolicy.INSERT_ZEROS))).execute().actionGet(); assertSearchResponse(response); @@ -391,7 +391,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation( - seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( + bucketScript("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( new Script("my_script", ScriptType.INDEXED, null, null)).gapPolicy(GapPolicy.INSERT_ZEROS))).execute().actionGet(); assertSearchResponse(response); @@ -438,7 +438,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation( - seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( + bucketScript("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( new Script("_value0 + _value1 + _value2", ScriptType.INLINE, null, null)))) .execute().actionGet(); @@ -462,7 +462,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation( - seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( + bucketScript("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( new Script("_value0 + _value1 + _value2", ScriptType.INLINE, null, null)))).execute().actionGet(); assertSearchResponse(response);