Agg builder accessibility fixes (#24323)

- Getters for DateHisto `interval` and `offset` should return a
long, not double
- Add getter for the filter in a FilterAgg
- Add getters for subaggs / pipelines in base AggregationBuilder
This commit is contained in:
Zachary Tong 2017-04-27 16:50:59 -04:00 committed by GitHub
parent cdcc75dd2a
commit 350573290f
3 changed files with 17 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import org.elasticsearch.index.query.QueryParseContext;
import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
@ -69,6 +70,16 @@ public abstract class AggregationBuilder
/** Add a sub aggregation to this builder. */
public abstract AggregationBuilder subAggregation(PipelineAggregationBuilder aggregation);
/** Return the configured set of subaggregations **/
public List<AggregationBuilder> getSubAggregations() {
return factoriesBuilder.getAggregatorFactories();
}
/** Return the configured set of pipeline aggregations **/
public List<PipelineAggregationBuilder> getPipelineAggregations() {
return factoriesBuilder.getPipelineAggregatorFactories();
}
/**
* Internal: Registers sub-factories with this factory. The sub-factory will be
* responsible for the creation of sub-aggregators under the aggregator

View File

@ -102,4 +102,8 @@ public class FilterAggregationBuilder extends AbstractAggregationBuilder<FilterA
public String getType() {
return NAME;
}
public QueryBuilder getFilter() {
return filter;
}
}

View File

@ -164,7 +164,7 @@ public class DateHistogramAggregationBuilder
}
/** Get the current interval in milliseconds that is set on this builder. */
public double interval() {
public long interval() {
return interval;
}
@ -196,7 +196,7 @@ public class DateHistogramAggregationBuilder
}
/** Get the offset to use when rounding, which is a number of milliseconds. */
public double offset() {
public long offset() {
return offset;
}