Aggregations: Fix bucket_script builder method name

This commit is contained in:
Colin Goodheart-Smithe 2015-06-29 12:53:38 +01:00
parent 18b73ce829
commit b5e958b2e0
3 changed files with 13 additions and 13 deletions

View File

@ -57,7 +57,7 @@ public final class PipelineAggregatorBuilders {
return new MovAvgBuilder(name); return new MovAvgBuilder(name);
} }
public static final BucketScriptBuilder seriesArithmetic(String name) { public static final BucketScriptBuilder bucketScript(String name) {
return new BucketScriptBuilder(name); return new BucketScriptBuilder(name);
} }

View File

@ -53,7 +53,7 @@ import java.util.Map;
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram; import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum; 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.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThan;
@ -533,7 +533,7 @@ public class ExpressionScriptTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("threeSum").field("three")) .subAggregation(sum("threeSum").field("three"))
.subAggregation(sum("fourSum").field("four")) .subAggregation(sum("fourSum").field("four"))
.subAggregation( .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(); new Script("_value0 + _value1 + _value2", ScriptType.INLINE, ExpressionScriptEngineService.NAME, null)))).execute().actionGet();
InternalHistogram<Bucket> histogram = response.getAggregations().get("histogram"); InternalHistogram<Bucket> histogram = response.getAggregations().get("histogram");

View File

@ -42,7 +42,7 @@ import java.util.Map;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram; import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum; 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.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
@ -105,7 +105,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME))
.subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME))
.subAggregation( .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(); new Script("_value0 + _value1 + _value2", ScriptType.INLINE, null, null)))).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
@ -153,7 +153,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME))
.subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME))
.subAggregation( .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(); new Script("_value0 + _value1 / _value2", ScriptType.INLINE, null, null)))).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
@ -199,7 +199,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest {
.interval(interval) .interval(interval)
.subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(sum("field2Sum").field(FIELD_2_NAME))
.subAggregation( .subAggregation(
seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum").script( bucketScript("seriesArithmetic").setBucketsPaths("field2Sum").script(
new Script("_value0", ScriptType.INLINE, null, null)))).execute().actionGet(); new Script("_value0", ScriptType.INLINE, null, null)))).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
@ -245,7 +245,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME))
.subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME))
.subAggregation( .subAggregation(
seriesArithmetic("seriesArithmetic").setBucketsPathsMap(bucketsPathsMap ).script( bucketScript("seriesArithmetic").setBucketsPathsMap(bucketsPathsMap ).script(
new Script("foo + bar + baz", ScriptType.INLINE, null, null)))).execute().actionGet(); new Script("foo + bar + baz", ScriptType.INLINE, null, null)))).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
@ -295,7 +295,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME))
.subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME))
.subAggregation( .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(); new Script("(_value0 + _value1 + _value2) * factor", ScriptType.INLINE, null, params)))).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
@ -343,7 +343,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME))
.subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME))
.subAggregation( .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(); new Script("_value0 + _value1 + _value2", ScriptType.INLINE, null, null)).gapPolicy(GapPolicy.INSERT_ZEROS))).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
@ -391,7 +391,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME))
.subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME))
.subAggregation( .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(); new Script("my_script", ScriptType.INDEXED, null, null)).gapPolicy(GapPolicy.INSERT_ZEROS))).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
@ -438,7 +438,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME))
.subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME))
.subAggregation( .subAggregation(
seriesArithmetic("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script( bucketScript("seriesArithmetic").setBucketsPaths("field2Sum", "field3Sum", "field4Sum").script(
new Script("_value0 + _value1 + _value2", ScriptType.INLINE, null, null)))) new Script("_value0 + _value1 + _value2", ScriptType.INLINE, null, null))))
.execute().actionGet(); .execute().actionGet();
@ -462,7 +462,7 @@ public class BucketScriptTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME))
.subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME))
.subAggregation( .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(); new Script("_value0 + _value1 + _value2", ScriptType.INLINE, null, null)))).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);