Rename AggregatorBuilder and all of its subclasses to
AggregationBuilder, in keeping consistent with the Java APIs. Closes #18377 Closes #18367
This commit is contained in:
parent
35d3bdab84
commit
fc6df23fea
|
@ -27,7 +27,7 @@ import org.elasticsearch.common.bytes.BytesReference;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorBuilder;
|
||||
import org.elasticsearch.search.highlight.HighlightBuilder;
|
||||
import org.elasticsearch.search.sort.SortBuilder;
|
||||
|
@ -165,9 +165,9 @@ public class PercolateRequestBuilder extends ActionRequestBuilder<PercolateReque
|
|||
|
||||
/**
|
||||
* Delegates to
|
||||
* {@link PercolateSourceBuilder#addAggregation(AggregatorBuilder)}
|
||||
* {@link PercolateSourceBuilder#addAggregation(AggregationBuilder)}
|
||||
*/
|
||||
public PercolateRequestBuilder addAggregation(AggregatorBuilder<?> aggregationBuilder) {
|
||||
public PercolateRequestBuilder addAggregation(AggregationBuilder<?> aggregationBuilder) {
|
||||
sourceBuilder().addAggregation(aggregationBuilder);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorBuilder;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.search.highlight.HighlightBuilder;
|
||||
|
@ -53,7 +53,7 @@ public class PercolateSourceBuilder extends ToXContentToBytes {
|
|||
private List<SortBuilder<?>> sorts;
|
||||
private Boolean trackScores;
|
||||
private HighlightBuilder highlightBuilder;
|
||||
private List<AggregatorBuilder<?>> aggregationBuilders;
|
||||
private List<AggregationBuilder<?>> aggregationBuilders;
|
||||
private List<PipelineAggregatorBuilder<?>> pipelineAggregationBuilders;
|
||||
|
||||
/**
|
||||
|
@ -126,7 +126,7 @@ public class PercolateSourceBuilder extends ToXContentToBytes {
|
|||
/**
|
||||
* Add an aggregation definition.
|
||||
*/
|
||||
public PercolateSourceBuilder addAggregation(AggregatorBuilder<?> aggregationBuilder) {
|
||||
public PercolateSourceBuilder addAggregation(AggregationBuilder<?> aggregationBuilder) {
|
||||
if (aggregationBuilders == null) {
|
||||
aggregationBuilders = new ArrayList<>();
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public class PercolateSourceBuilder extends ToXContentToBytes {
|
|||
builder.field("aggregations");
|
||||
builder.startObject();
|
||||
if (aggregationBuilders != null) {
|
||||
for (AggregatorBuilder<?> aggregation : aggregationBuilders) {
|
||||
for (AggregationBuilder<?> aggregation : aggregationBuilders) {
|
||||
aggregation.toXContent(builder, params);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.elasticsearch.index.query.QueryBuilder;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.Template;
|
||||
import org.elasticsearch.search.Scroll;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorBuilder;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.search.highlight.HighlightBuilder;
|
||||
|
@ -373,7 +373,7 @@ public class SearchRequestBuilder extends ActionRequestBuilder<SearchRequest, Se
|
|||
/**
|
||||
* Adds an aggregation to the search operation.
|
||||
*/
|
||||
public SearchRequestBuilder addAggregation(AggregatorBuilder<?> aggregation) {
|
||||
public SearchRequestBuilder addAggregation(AggregationBuilder<?> aggregation) {
|
||||
sourceBuilder().aggregation(aggregation);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -98,51 +98,51 @@ import org.elasticsearch.indices.query.IndicesQueriesRegistry;
|
|||
import org.elasticsearch.search.action.SearchTransportService;
|
||||
import org.elasticsearch.search.aggregations.AggregationPhase;
|
||||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorParsers;
|
||||
import org.elasticsearch.search.aggregations.bucket.children.ChildrenAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.children.ChildrenAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.children.InternalChildren;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.InternalFilters;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGridParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.InternalGeoHashGrid;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.InternalGlobal;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.HistogramParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.InternalHistogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.missing.InternalMissing;
|
||||
import org.elasticsearch.search.aggregations.bucket.missing.MissingAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.missing.MissingAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.missing.MissingParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.InternalNested;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.InternalReverseNested;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.ReverseNestedAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.ReverseNestedAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.InternalRange;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.InternalDateRange;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.InternalGeoDistance;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.InternalBinaryRange;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.DiversifiedAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.DiversifiedAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.DiversifiedSamplerParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.InternalSampler;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.UnmappedSampler;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantLongTerms;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantStringTerms;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.UnmappedSignificantTerms;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare;
|
||||
|
@ -156,50 +156,50 @@ import org.elasticsearch.search.aggregations.bucket.significant.heuristics.Signi
|
|||
import org.elasticsearch.search.aggregations.bucket.terms.DoubleTerms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.LongTerms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.StringTerms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.UnmappedTerms;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.AvgAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.AvgAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.AvgParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.InternalAvg;
|
||||
import org.elasticsearch.search.aggregations.metrics.cardinality.CardinalityAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.cardinality.CardinalityAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.cardinality.CardinalityParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.cardinality.InternalCardinality;
|
||||
import org.elasticsearch.search.aggregations.metrics.geobounds.GeoBoundsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.geobounds.GeoBoundsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.geobounds.GeoBoundsParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.geobounds.InternalGeoBounds;
|
||||
import org.elasticsearch.search.aggregations.metrics.geocentroid.GeoCentroidAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.geocentroid.GeoCentroidAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.geocentroid.GeoCentroidParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.geocentroid.InternalGeoCentroid;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.InternalMax;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.MaxAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.MaxAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.MaxParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.min.InternalMin;
|
||||
import org.elasticsearch.search.aggregations.metrics.min.MinAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.min.MinAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.min.MinParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentileRanksAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentileRanksAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentileRanksParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentilesAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentilesAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentilesParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.hdr.InternalHDRPercentileRanks;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.hdr.InternalHDRPercentiles;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.tdigest.InternalTDigestPercentileRanks;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.tdigest.InternalTDigestPercentiles;
|
||||
import org.elasticsearch.search.aggregations.metrics.scripted.InternalScriptedMetric;
|
||||
import org.elasticsearch.search.aggregations.metrics.scripted.ScriptedMetricAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.scripted.ScriptedMetricAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.InternalStats;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.StatsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.StatsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.StatsParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStatsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStatsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStatsParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.InternalExtendedStats;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.InternalSum;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.SumAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.SumAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.SumParser;
|
||||
import org.elasticsearch.search.aggregations.metrics.tophits.InternalTopHits;
|
||||
import org.elasticsearch.search.aggregations.metrics.tophits.TopHitsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.tophits.TopHitsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.InternalValueCount;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCountAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCountAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCountParser;
|
||||
import org.elasticsearch.search.aggregations.pipeline.InternalSimpleValue;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
@ -424,10 +424,10 @@ public class SearchModule extends AbstractModule {
|
|||
* @param aggregationName names by which the aggregation may be parsed. The first name is special because it is the name that the reader
|
||||
* is registered under.
|
||||
*/
|
||||
public <AB extends AggregatorBuilder<AB>> void registerAggregation(Writeable.Reader<AB> reader, Aggregator.Parser aggregationParser,
|
||||
ParseField aggregationName) {
|
||||
public <AB extends AggregationBuilder<AB>> void registerAggregation(Writeable.Reader<AB> reader, Aggregator.Parser aggregationParser,
|
||||
ParseField aggregationName) {
|
||||
aggregationParserRegistry.register(aggregationParser, aggregationName);
|
||||
namedWriteableRegistry.register(AggregatorBuilder.class, aggregationName.getPreferredName(), reader);
|
||||
namedWriteableRegistry.register(AggregationBuilder.class, aggregationName.getPreferredName(), reader);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -481,55 +481,57 @@ public class SearchModule extends AbstractModule {
|
|||
}
|
||||
|
||||
protected void configureAggs() {
|
||||
registerAggregation(AvgAggregatorBuilder::new, new AvgParser(), AvgAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(SumAggregatorBuilder::new, new SumParser(), SumAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(MinAggregatorBuilder::new, new MinParser(), MinAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(MaxAggregatorBuilder::new, new MaxParser(), MaxAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(StatsAggregatorBuilder::new, new StatsParser(), StatsAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(ExtendedStatsAggregatorBuilder::new, new ExtendedStatsParser(),
|
||||
ExtendedStatsAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(ValueCountAggregatorBuilder::new, new ValueCountParser(), ValueCountAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(PercentilesAggregatorBuilder::new, new PercentilesParser(),
|
||||
PercentilesAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(PercentileRanksAggregatorBuilder::new, new PercentileRanksParser(),
|
||||
PercentileRanksAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(CardinalityAggregatorBuilder::new, new CardinalityParser(),
|
||||
CardinalityAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(GlobalAggregatorBuilder::new, GlobalAggregatorBuilder::parse, GlobalAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(MissingAggregatorBuilder::new, new MissingParser(), MissingAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(FilterAggregatorBuilder::new, FilterAggregatorBuilder::parse, FilterAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(FiltersAggregatorBuilder::new, FiltersAggregatorBuilder::parse,
|
||||
FiltersAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(SamplerAggregatorBuilder::new, SamplerAggregatorBuilder::parse,
|
||||
SamplerAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(DiversifiedAggregatorBuilder::new, new DiversifiedSamplerParser(),
|
||||
DiversifiedAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(TermsAggregatorBuilder::new, new TermsParser(), TermsAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(SignificantTermsAggregatorBuilder::new,
|
||||
registerAggregation(AvgAggregationBuilder::new, new AvgParser(), AvgAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(SumAggregationBuilder::new, new SumParser(), SumAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(MinAggregationBuilder::new, new MinParser(), MinAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(MaxAggregationBuilder::new, new MaxParser(), MaxAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(StatsAggregationBuilder::new, new StatsParser(), StatsAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(ExtendedStatsAggregationBuilder::new, new ExtendedStatsParser(),
|
||||
ExtendedStatsAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(ValueCountAggregationBuilder::new, new ValueCountParser(), ValueCountAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(PercentilesAggregationBuilder::new, new PercentilesParser(),
|
||||
PercentilesAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(PercentileRanksAggregationBuilder::new, new PercentileRanksParser(),
|
||||
PercentileRanksAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(CardinalityAggregationBuilder::new, new CardinalityParser(),
|
||||
CardinalityAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(GlobalAggregationBuilder::new, GlobalAggregationBuilder::parse,
|
||||
GlobalAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(MissingAggregationBuilder::new, new MissingParser(), MissingAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(FilterAggregationBuilder::new, FilterAggregationBuilder::parse,
|
||||
FilterAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(FiltersAggregationBuilder::new, FiltersAggregationBuilder::parse,
|
||||
FiltersAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(SamplerAggregationBuilder::new, SamplerAggregationBuilder::parse,
|
||||
SamplerAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(DiversifiedAggregationBuilder::new, new DiversifiedSamplerParser(),
|
||||
DiversifiedAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(TermsAggregationBuilder::new, new TermsParser(), TermsAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(SignificantTermsAggregationBuilder::new,
|
||||
new SignificantTermsParser(significanceHeuristicParserRegistry, queryParserRegistry),
|
||||
SignificantTermsAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(RangeAggregatorBuilder::new, new RangeParser(), RangeAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(DateRangeAggregatorBuilder::new, new DateRangeParser(), DateRangeAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(IpRangeAggregatorBuilder::new, new IpRangeParser(), IpRangeAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(HistogramAggregatorBuilder::new, new HistogramParser(), HistogramAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(DateHistogramAggregatorBuilder::new, new DateHistogramParser(),
|
||||
DateHistogramAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(GeoDistanceAggregatorBuilder::new, new GeoDistanceParser(),
|
||||
GeoDistanceAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(GeoGridAggregatorBuilder::new, new GeoHashGridParser(), GeoGridAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(NestedAggregatorBuilder::new, NestedAggregatorBuilder::parse, NestedAggregatorBuilder.AGGREGATION_FIELD_NAME);
|
||||
registerAggregation(ReverseNestedAggregatorBuilder::new, ReverseNestedAggregatorBuilder::parse,
|
||||
ReverseNestedAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(TopHitsAggregatorBuilder::new, TopHitsAggregatorBuilder::parse,
|
||||
TopHitsAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(GeoBoundsAggregatorBuilder::new, new GeoBoundsParser(), GeoBoundsAggregatorBuilder.AGGREGATION_NAME_FIED);
|
||||
registerAggregation(GeoCentroidAggregatorBuilder::new, new GeoCentroidParser(),
|
||||
GeoCentroidAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(ScriptedMetricAggregatorBuilder::new, ScriptedMetricAggregatorBuilder::parse,
|
||||
ScriptedMetricAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(ChildrenAggregatorBuilder::new, ChildrenAggregatorBuilder::parse,
|
||||
ChildrenAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
|
||||
SignificantTermsAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(RangeAggregationBuilder::new, new RangeParser(), RangeAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(DateRangeAggregationBuilder::new, new DateRangeParser(), DateRangeAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(IpRangeAggregationBuilder::new, new IpRangeParser(), IpRangeAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(HistogramAggregationBuilder::new, new HistogramParser(), HistogramAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(DateHistogramAggregationBuilder::new, new DateHistogramParser(),
|
||||
DateHistogramAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(GeoDistanceAggregationBuilder::new, new GeoDistanceParser(),
|
||||
GeoDistanceAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(GeoGridAggregationBuilder::new, new GeoHashGridParser(), GeoGridAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(NestedAggregationBuilder::new, NestedAggregationBuilder::parse,
|
||||
NestedAggregationBuilder.AGGREGATION_FIELD_NAME);
|
||||
registerAggregation(ReverseNestedAggregationBuilder::new, ReverseNestedAggregationBuilder::parse,
|
||||
ReverseNestedAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(TopHitsAggregationBuilder::new, TopHitsAggregationBuilder::parse,
|
||||
TopHitsAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(GeoBoundsAggregationBuilder::new, new GeoBoundsParser(), GeoBoundsAggregationBuilder.AGGREGATION_NAME_FIED);
|
||||
registerAggregation(GeoCentroidAggregationBuilder::new, new GeoCentroidParser(),
|
||||
GeoCentroidAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(ScriptedMetricAggregationBuilder::new, ScriptedMetricAggregationBuilder::parse,
|
||||
ScriptedMetricAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerAggregation(ChildrenAggregationBuilder::new, ChildrenAggregationBuilder::parse,
|
||||
ChildrenAggregationBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerPipelineAggregation(DerivativePipelineAggregatorBuilder::new, DerivativePipelineAggregatorBuilder::parse,
|
||||
DerivativePipelineAggregatorBuilder.AGGREGATION_NAME_FIELD);
|
||||
registerPipelineAggregation(MaxBucketPipelineAggregatorBuilder::new, MaxBucketPipelineAggregatorBuilder.PARSER,
|
||||
|
|
|
@ -36,7 +36,9 @@ import java.util.Objects;
|
|||
/**
|
||||
* A factory that knows how to create an {@link Aggregator} of a specific type.
|
||||
*/
|
||||
public abstract class AggregatorBuilder<AB extends AggregatorBuilder<AB>> extends ToXContentToBytes implements NamedWriteable, ToXContent {
|
||||
public abstract class AggregationBuilder<AB extends AggregationBuilder<AB>>
|
||||
extends ToXContentToBytes
|
||||
implements NamedWriteable, ToXContent {
|
||||
|
||||
protected String name;
|
||||
protected Type type;
|
||||
|
@ -44,12 +46,12 @@ public abstract class AggregatorBuilder<AB extends AggregatorBuilder<AB>> extend
|
|||
protected Map<String, Object> metaData;
|
||||
|
||||
/**
|
||||
* Constructs a new aggregator factory.
|
||||
* Constructs a new aggregation builder.
|
||||
*
|
||||
* @param name The aggregation name
|
||||
* @param type The aggregation type
|
||||
*/
|
||||
public AggregatorBuilder(String name, Type type) {
|
||||
public AggregationBuilder(String name, Type type) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("[name] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -63,7 +65,7 @@ public abstract class AggregatorBuilder<AB extends AggregatorBuilder<AB>> extend
|
|||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
protected AggregatorBuilder(StreamInput in, Type type) throws IOException {
|
||||
protected AggregationBuilder(StreamInput in, Type type) throws IOException {
|
||||
name = in.readString();
|
||||
this.type = type;
|
||||
factoriesBuilder = new AggregatorFactories.Builder(in);
|
||||
|
@ -84,7 +86,7 @@ public abstract class AggregatorBuilder<AB extends AggregatorBuilder<AB>> extend
|
|||
* Add a sub aggregation to this aggregation.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public AB subAggregation(AggregatorBuilder<?> aggregation) {
|
||||
public AB subAggregation(AggregationBuilder<?> aggregation) {
|
||||
if (aggregation == null) {
|
||||
throw new IllegalArgumentException("[aggregation] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -178,7 +180,7 @@ public abstract class AggregatorBuilder<AB extends AggregatorBuilder<AB>> extend
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
@SuppressWarnings("unchecked")
|
||||
AggregatorBuilder<AB> other = (AggregatorBuilder<AB>) obj;
|
||||
AggregationBuilder<AB> other = (AggregationBuilder<AB>) obj;
|
||||
if (!Objects.equals(name, other.name))
|
||||
return false;
|
||||
if (!Objects.equals(type, other.type))
|
|
@ -22,65 +22,65 @@ import org.elasticsearch.common.geo.GeoDistance;
|
|||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.children.Children;
|
||||
import org.elasticsearch.search.aggregations.bucket.children.ChildrenAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.children.ChildrenAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.Filters;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregator.KeyedFilter;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGrid;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.missing.Missing;
|
||||
import org.elasticsearch.search.aggregations.bucket.missing.MissingAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.missing.MissingAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.Nested;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.ReverseNested;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.ReverseNestedAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.ReverseNestedAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.DiversifiedAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.DiversifiedAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.Sampler;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.AvgAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.AvgAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.cardinality.Cardinality;
|
||||
import org.elasticsearch.search.aggregations.metrics.cardinality.CardinalityAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.cardinality.CardinalityAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.geobounds.GeoBounds;
|
||||
import org.elasticsearch.search.aggregations.metrics.geobounds.GeoBoundsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.geobounds.GeoBoundsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.geocentroid.GeoCentroid;
|
||||
import org.elasticsearch.search.aggregations.metrics.geocentroid.GeoCentroidAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.geocentroid.GeoCentroidAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.Max;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.MaxAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.MaxAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.min.Min;
|
||||
import org.elasticsearch.search.aggregations.metrics.min.MinAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.min.MinAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentileRanks;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentileRanksAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentileRanksAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.Percentiles;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentilesAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.percentiles.PercentilesAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.scripted.ScriptedMetric;
|
||||
import org.elasticsearch.search.aggregations.metrics.scripted.ScriptedMetricAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.scripted.ScriptedMetricAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.Stats;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.StatsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.StatsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStats;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStatsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStatsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.SumAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.SumAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.tophits.TopHits;
|
||||
import org.elasticsearch.search.aggregations.metrics.tophits.TopHitsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.tophits.TopHitsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCountAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCountAggregationBuilder;
|
||||
|
||||
/**
|
||||
* Utility class to create aggregations.
|
||||
|
@ -93,234 +93,234 @@ public class AggregationBuilders {
|
|||
/**
|
||||
* Create a new {@link ValueCount} aggregation with the given name.
|
||||
*/
|
||||
public static ValueCountAggregatorBuilder count(String name) {
|
||||
return new ValueCountAggregatorBuilder(name, null);
|
||||
public static ValueCountAggregationBuilder count(String name) {
|
||||
return new ValueCountAggregationBuilder(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Avg} aggregation with the given name.
|
||||
*/
|
||||
public static AvgAggregatorBuilder avg(String name) {
|
||||
return new AvgAggregatorBuilder(name);
|
||||
public static AvgAggregationBuilder avg(String name) {
|
||||
return new AvgAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Max} aggregation with the given name.
|
||||
*/
|
||||
public static MaxAggregatorBuilder max(String name) {
|
||||
return new MaxAggregatorBuilder(name);
|
||||
public static MaxAggregationBuilder max(String name) {
|
||||
return new MaxAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Min} aggregation with the given name.
|
||||
*/
|
||||
public static MinAggregatorBuilder min(String name) {
|
||||
return new MinAggregatorBuilder(name);
|
||||
public static MinAggregationBuilder min(String name) {
|
||||
return new MinAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Sum} aggregation with the given name.
|
||||
*/
|
||||
public static SumAggregatorBuilder sum(String name) {
|
||||
return new SumAggregatorBuilder(name);
|
||||
public static SumAggregationBuilder sum(String name) {
|
||||
return new SumAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Stats} aggregation with the given name.
|
||||
*/
|
||||
public static StatsAggregatorBuilder stats(String name) {
|
||||
return new StatsAggregatorBuilder(name);
|
||||
public static StatsAggregationBuilder stats(String name) {
|
||||
return new StatsAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link ExtendedStats} aggregation with the given name.
|
||||
*/
|
||||
public static ExtendedStatsAggregatorBuilder extendedStats(String name) {
|
||||
return new ExtendedStatsAggregatorBuilder(name);
|
||||
public static ExtendedStatsAggregationBuilder extendedStats(String name) {
|
||||
return new ExtendedStatsAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Filter} aggregation with the given name.
|
||||
*/
|
||||
public static FilterAggregatorBuilder filter(String name, QueryBuilder filter) {
|
||||
return new FilterAggregatorBuilder(name, filter);
|
||||
public static FilterAggregationBuilder filter(String name, QueryBuilder filter) {
|
||||
return new FilterAggregationBuilder(name, filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Filters} aggregation with the given name.
|
||||
*/
|
||||
public static FiltersAggregatorBuilder filters(String name, KeyedFilter... filters) {
|
||||
return new FiltersAggregatorBuilder(name, filters);
|
||||
public static FiltersAggregationBuilder filters(String name, KeyedFilter... filters) {
|
||||
return new FiltersAggregationBuilder(name, filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Filters} aggregation with the given name.
|
||||
*/
|
||||
public static FiltersAggregatorBuilder filters(String name, QueryBuilder... filters) {
|
||||
return new FiltersAggregatorBuilder(name, filters);
|
||||
public static FiltersAggregationBuilder filters(String name, QueryBuilder... filters) {
|
||||
return new FiltersAggregationBuilder(name, filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Sampler} aggregation with the given name.
|
||||
*/
|
||||
public static SamplerAggregatorBuilder sampler(String name) {
|
||||
return new SamplerAggregatorBuilder(name);
|
||||
public static SamplerAggregationBuilder sampler(String name) {
|
||||
return new SamplerAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Sampler} aggregation with the given name.
|
||||
*/
|
||||
public static DiversifiedAggregatorBuilder diversifiedSampler(String name) {
|
||||
return new DiversifiedAggregatorBuilder(name);
|
||||
public static DiversifiedAggregationBuilder diversifiedSampler(String name) {
|
||||
return new DiversifiedAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Global} aggregation with the given name.
|
||||
*/
|
||||
public static GlobalAggregatorBuilder global(String name) {
|
||||
return new GlobalAggregatorBuilder(name);
|
||||
public static GlobalAggregationBuilder global(String name) {
|
||||
return new GlobalAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Missing} aggregation with the given name.
|
||||
*/
|
||||
public static MissingAggregatorBuilder missing(String name) {
|
||||
return new MissingAggregatorBuilder(name, null);
|
||||
public static MissingAggregationBuilder missing(String name) {
|
||||
return new MissingAggregationBuilder(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Nested} aggregation with the given name.
|
||||
*/
|
||||
public static NestedAggregatorBuilder nested(String name, String path) {
|
||||
return new NestedAggregatorBuilder(name, path);
|
||||
public static NestedAggregationBuilder nested(String name, String path) {
|
||||
return new NestedAggregationBuilder(name, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link ReverseNested} aggregation with the given name.
|
||||
*/
|
||||
public static ReverseNestedAggregatorBuilder reverseNested(String name) {
|
||||
return new ReverseNestedAggregatorBuilder(name);
|
||||
public static ReverseNestedAggregationBuilder reverseNested(String name) {
|
||||
return new ReverseNestedAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Children} aggregation with the given name.
|
||||
*/
|
||||
public static ChildrenAggregatorBuilder children(String name, String childType) {
|
||||
return new ChildrenAggregatorBuilder(name, childType);
|
||||
public static ChildrenAggregationBuilder children(String name, String childType) {
|
||||
return new ChildrenAggregationBuilder(name, childType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link GeoDistance} aggregation with the given name.
|
||||
*/
|
||||
public static GeoDistanceAggregatorBuilder geoDistance(String name, GeoPoint origin) {
|
||||
return new GeoDistanceAggregatorBuilder(name, origin);
|
||||
public static GeoDistanceAggregationBuilder geoDistance(String name, GeoPoint origin) {
|
||||
return new GeoDistanceAggregationBuilder(name, origin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Histogram} aggregation with the given name.
|
||||
*/
|
||||
public static HistogramAggregatorBuilder histogram(String name) {
|
||||
return new HistogramAggregatorBuilder(name);
|
||||
public static HistogramAggregationBuilder histogram(String name) {
|
||||
return new HistogramAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link GeoHashGrid} aggregation with the given name.
|
||||
*/
|
||||
public static GeoGridAggregatorBuilder geohashGrid(String name) {
|
||||
return new GeoGridAggregatorBuilder(name);
|
||||
public static GeoGridAggregationBuilder geohashGrid(String name) {
|
||||
return new GeoGridAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link SignificantTerms} aggregation with the given name.
|
||||
*/
|
||||
public static SignificantTermsAggregatorBuilder significantTerms(String name) {
|
||||
return new SignificantTermsAggregatorBuilder(name, null);
|
||||
public static SignificantTermsAggregationBuilder significantTerms(String name) {
|
||||
return new SignificantTermsAggregationBuilder(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link DateHistogramAggregatorBuilder} aggregation with the given
|
||||
* Create a new {@link DateHistogramAggregationBuilder} aggregation with the given
|
||||
* name.
|
||||
*/
|
||||
public static DateHistogramAggregatorBuilder dateHistogram(String name) {
|
||||
return new DateHistogramAggregatorBuilder(name);
|
||||
public static DateHistogramAggregationBuilder dateHistogram(String name) {
|
||||
return new DateHistogramAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Range} aggregation with the given name.
|
||||
*/
|
||||
public static RangeAggregatorBuilder range(String name) {
|
||||
return new RangeAggregatorBuilder(name);
|
||||
public static RangeAggregationBuilder range(String name) {
|
||||
return new RangeAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link DateRangeAggregatorBuilder} aggregation with the
|
||||
* Create a new {@link DateRangeAggregationBuilder} aggregation with the
|
||||
* given name.
|
||||
*/
|
||||
public static DateRangeAggregatorBuilder dateRange(String name) {
|
||||
return new DateRangeAggregatorBuilder(name);
|
||||
public static DateRangeAggregationBuilder dateRange(String name) {
|
||||
return new DateRangeAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link IpRangeAggregatorBuilder} aggregation with the
|
||||
* Create a new {@link IpRangeAggregationBuilder} aggregation with the
|
||||
* given name.
|
||||
*/
|
||||
public static IpRangeAggregatorBuilder ipRange(String name) {
|
||||
return new IpRangeAggregatorBuilder(name);
|
||||
public static IpRangeAggregationBuilder ipRange(String name) {
|
||||
return new IpRangeAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Terms} aggregation with the given name.
|
||||
*/
|
||||
public static TermsAggregatorBuilder terms(String name) {
|
||||
return new TermsAggregatorBuilder(name, null);
|
||||
public static TermsAggregationBuilder terms(String name) {
|
||||
return new TermsAggregationBuilder(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Percentiles} aggregation with the given name.
|
||||
*/
|
||||
public static PercentilesAggregatorBuilder percentiles(String name) {
|
||||
return new PercentilesAggregatorBuilder(name);
|
||||
public static PercentilesAggregationBuilder percentiles(String name) {
|
||||
return new PercentilesAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link PercentileRanks} aggregation with the given name.
|
||||
*/
|
||||
public static PercentileRanksAggregatorBuilder percentileRanks(String name) {
|
||||
return new PercentileRanksAggregatorBuilder(name);
|
||||
public static PercentileRanksAggregationBuilder percentileRanks(String name) {
|
||||
return new PercentileRanksAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Cardinality} aggregation with the given name.
|
||||
*/
|
||||
public static CardinalityAggregatorBuilder cardinality(String name) {
|
||||
return new CardinalityAggregatorBuilder(name, null);
|
||||
public static CardinalityAggregationBuilder cardinality(String name) {
|
||||
return new CardinalityAggregationBuilder(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link TopHits} aggregation with the given name.
|
||||
*/
|
||||
public static TopHitsAggregatorBuilder topHits(String name) {
|
||||
return new TopHitsAggregatorBuilder(name);
|
||||
public static TopHitsAggregationBuilder topHits(String name) {
|
||||
return new TopHitsAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link GeoBounds} aggregation with the given name.
|
||||
*/
|
||||
public static GeoBoundsAggregatorBuilder geoBounds(String name) {
|
||||
return new GeoBoundsAggregatorBuilder(name);
|
||||
public static GeoBoundsAggregationBuilder geoBounds(String name) {
|
||||
return new GeoBoundsAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link GeoCentroid} aggregation with the given name.
|
||||
*/
|
||||
public static GeoCentroidAggregatorBuilder geoCentroid(String name) {
|
||||
return new GeoCentroidAggregatorBuilder(name);
|
||||
public static GeoCentroidAggregationBuilder geoCentroid(String name) {
|
||||
return new GeoCentroidAggregationBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link ScriptedMetric} aggregation with the given name.
|
||||
*/
|
||||
public static ScriptedMetricAggregatorBuilder scriptedMetric(String name) {
|
||||
return new ScriptedMetricAggregatorBuilder(name);
|
||||
public static ScriptedMetricAggregationBuilder scriptedMetric(String name) {
|
||||
return new ScriptedMetricAggregationBuilder(name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public abstract class Aggregator extends BucketCollector implements Releasable {
|
|||
/**
|
||||
* Parses the aggregation request and creates the appropriate aggregator factory for it.
|
||||
*
|
||||
* @see AggregatorBuilder
|
||||
* @see AggregationBuilder
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Parser {
|
||||
|
@ -55,7 +55,7 @@ public abstract class Aggregator extends BucketCollector implements Releasable {
|
|||
* @return The resolved aggregator factory or {@code null} in case the aggregation should be skipped
|
||||
* @throws java.io.IOException When parsing fails
|
||||
*/
|
||||
AggregatorBuilder<?> parse(String aggregationName, QueryParseContext context) throws IOException;
|
||||
AggregationBuilder<?> parse(String aggregationName, QueryParseContext context) throws IOException;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -124,7 +124,7 @@ public class AggregatorFactories {
|
|||
|
||||
public static class Builder extends ToXContentToBytes implements Writeable {
|
||||
private final Set<String> names = new HashSet<>();
|
||||
private final List<AggregatorBuilder<?>> aggregatorBuilders = new ArrayList<>();
|
||||
private final List<AggregationBuilder<?>> aggregationBuilders = new ArrayList<>();
|
||||
private final List<PipelineAggregatorBuilder<?>> pipelineAggregatorBuilders = new ArrayList<>();
|
||||
private boolean skipResolveOrder;
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class AggregatorFactories {
|
|||
public Builder(StreamInput in) throws IOException {
|
||||
int factoriesSize = in.readVInt();
|
||||
for (int i = 0; i < factoriesSize; i++) {
|
||||
addAggregator(in.readNamedWriteable(AggregatorBuilder.class));
|
||||
addAggregator(in.readNamedWriteable(AggregationBuilder.class));
|
||||
}
|
||||
int pipelineFactoriesSize = in.readVInt();
|
||||
for (int i = 0; i < pipelineFactoriesSize; i++) {
|
||||
|
@ -150,8 +150,8 @@ public class AggregatorFactories {
|
|||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeVInt(this.aggregatorBuilders.size());
|
||||
for (AggregatorBuilder<?> factory : aggregatorBuilders) {
|
||||
out.writeVInt(this.aggregationBuilders.size());
|
||||
for (AggregationBuilder<?> factory : aggregationBuilders) {
|
||||
out.writeNamedWriteable(factory);
|
||||
}
|
||||
out.writeVInt(this.pipelineAggregatorBuilders.size());
|
||||
|
@ -164,11 +164,11 @@ public class AggregatorFactories {
|
|||
throw new UnsupportedOperationException("This needs to be removed");
|
||||
}
|
||||
|
||||
public Builder addAggregator(AggregatorBuilder<?> factory) {
|
||||
public Builder addAggregator(AggregationBuilder<?> factory) {
|
||||
if (!names.add(factory.name)) {
|
||||
throw new IllegalArgumentException("Two sibling aggregations cannot have the same name: [" + factory.name + "]");
|
||||
}
|
||||
aggregatorBuilders.add(factory);
|
||||
aggregationBuilders.add(factory);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -186,30 +186,30 @@ public class AggregatorFactories {
|
|||
}
|
||||
|
||||
public AggregatorFactories build(AggregationContext context, AggregatorFactory<?> parent) throws IOException {
|
||||
if (aggregatorBuilders.isEmpty() && pipelineAggregatorBuilders.isEmpty()) {
|
||||
if (aggregationBuilders.isEmpty() && pipelineAggregatorBuilders.isEmpty()) {
|
||||
return EMPTY;
|
||||
}
|
||||
List<PipelineAggregatorBuilder<?>> orderedpipelineAggregators = null;
|
||||
if (skipResolveOrder) {
|
||||
orderedpipelineAggregators = new ArrayList<>(pipelineAggregatorBuilders);
|
||||
} else {
|
||||
orderedpipelineAggregators = resolvePipelineAggregatorOrder(this.pipelineAggregatorBuilders, this.aggregatorBuilders);
|
||||
orderedpipelineAggregators = resolvePipelineAggregatorOrder(this.pipelineAggregatorBuilders, this.aggregationBuilders);
|
||||
}
|
||||
AggregatorFactory<?>[] aggFactories = new AggregatorFactory<?>[aggregatorBuilders.size()];
|
||||
for (int i = 0; i < aggregatorBuilders.size(); i++) {
|
||||
aggFactories[i] = aggregatorBuilders.get(i).build(context, parent);
|
||||
AggregatorFactory<?>[] aggFactories = new AggregatorFactory<?>[aggregationBuilders.size()];
|
||||
for (int i = 0; i < aggregationBuilders.size(); i++) {
|
||||
aggFactories[i] = aggregationBuilders.get(i).build(context, parent);
|
||||
}
|
||||
return new AggregatorFactories(parent, aggFactories, orderedpipelineAggregators);
|
||||
}
|
||||
|
||||
private List<PipelineAggregatorBuilder<?>> resolvePipelineAggregatorOrder(
|
||||
List<PipelineAggregatorBuilder<?>> pipelineAggregatorBuilders, List<AggregatorBuilder<?>> aggBuilders) {
|
||||
List<PipelineAggregatorBuilder<?>> pipelineAggregatorBuilders, List<AggregationBuilder<?>> aggBuilders) {
|
||||
Map<String, PipelineAggregatorBuilder<?>> pipelineAggregatorBuildersMap = new HashMap<>();
|
||||
for (PipelineAggregatorBuilder<?> builder : pipelineAggregatorBuilders) {
|
||||
pipelineAggregatorBuildersMap.put(builder.getName(), builder);
|
||||
}
|
||||
Map<String, AggregatorBuilder<?>> aggBuildersMap = new HashMap<>();
|
||||
for (AggregatorBuilder<?> aggBuilder : aggBuilders) {
|
||||
Map<String, AggregationBuilder<?>> aggBuildersMap = new HashMap<>();
|
||||
for (AggregationBuilder<?> aggBuilder : aggBuilders) {
|
||||
aggBuildersMap.put(aggBuilder.name, aggBuilder);
|
||||
}
|
||||
List<PipelineAggregatorBuilder<?>> orderedPipelineAggregatorrs = new LinkedList<>();
|
||||
|
@ -223,7 +223,7 @@ public class AggregatorFactories {
|
|||
return orderedPipelineAggregatorrs;
|
||||
}
|
||||
|
||||
private void resolvePipelineAggregatorOrder(Map<String, AggregatorBuilder<?>> aggBuildersMap,
|
||||
private void resolvePipelineAggregatorOrder(Map<String, AggregationBuilder<?>> aggBuildersMap,
|
||||
Map<String, PipelineAggregatorBuilder<?>> pipelineAggregatorBuildersMap,
|
||||
List<PipelineAggregatorBuilder<?>> orderedPipelineAggregators, List<PipelineAggregatorBuilder<?>> unmarkedBuilders,
|
||||
Set<PipelineAggregatorBuilder<?>> temporarilyMarked, PipelineAggregatorBuilder<?> builder) {
|
||||
|
@ -238,7 +238,7 @@ public class AggregatorFactories {
|
|||
if (bucketsPath.equals("_count") || bucketsPath.equals("_key")) {
|
||||
continue;
|
||||
} else if (aggBuildersMap.containsKey(firstAggName)) {
|
||||
AggregatorBuilder<?> aggBuilder = aggBuildersMap.get(firstAggName);
|
||||
AggregationBuilder<?> aggBuilder = aggBuildersMap.get(firstAggName);
|
||||
for (int i = 1; i < bucketsPathElements.size(); i++) {
|
||||
PathElement pathElement = bucketsPathElements.get(i);
|
||||
String aggName = pathElement.name;
|
||||
|
@ -247,9 +247,9 @@ public class AggregatorFactories {
|
|||
} else {
|
||||
// Check the non-pipeline sub-aggregator
|
||||
// factories
|
||||
AggregatorBuilder<?>[] subBuilders = aggBuilder.factoriesBuilder.getAggregatorFactories();
|
||||
AggregationBuilder<?>[] subBuilders = aggBuilder.factoriesBuilder.getAggregatorFactories();
|
||||
boolean foundSubBuilder = false;
|
||||
for (AggregatorBuilder<?> subBuilder : subBuilders) {
|
||||
for (AggregationBuilder<?> subBuilder : subBuilders) {
|
||||
if (aggName.equals(subBuilder.name)) {
|
||||
aggBuilder = subBuilder;
|
||||
foundSubBuilder = true;
|
||||
|
@ -289,8 +289,8 @@ public class AggregatorFactories {
|
|||
}
|
||||
}
|
||||
|
||||
AggregatorBuilder<?>[] getAggregatorFactories() {
|
||||
return this.aggregatorBuilders.toArray(new AggregatorBuilder<?>[this.aggregatorBuilders.size()]);
|
||||
AggregationBuilder<?>[] getAggregatorFactories() {
|
||||
return this.aggregationBuilders.toArray(new AggregationBuilder<?>[this.aggregationBuilders.size()]);
|
||||
}
|
||||
|
||||
List<PipelineAggregatorBuilder<?>> getPipelineAggregatorFactories() {
|
||||
|
@ -298,14 +298,14 @@ public class AggregatorFactories {
|
|||
}
|
||||
|
||||
public int count() {
|
||||
return aggregatorBuilders.size() + pipelineAggregatorBuilders.size();
|
||||
return aggregationBuilders.size() + pipelineAggregatorBuilders.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject();
|
||||
if (aggregatorBuilders != null) {
|
||||
for (AggregatorBuilder<?> subAgg : aggregatorBuilders) {
|
||||
if (aggregationBuilders != null) {
|
||||
for (AggregationBuilder<?> subAgg : aggregationBuilders) {
|
||||
subAgg.toXContent(builder, params);
|
||||
}
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ public class AggregatorFactories {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(aggregatorBuilders, pipelineAggregatorBuilders);
|
||||
return Objects.hash(aggregationBuilders, pipelineAggregatorBuilders);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -330,7 +330,7 @@ public class AggregatorFactories {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Builder other = (Builder) obj;
|
||||
if (!Objects.equals(aggregatorBuilders, other.aggregatorBuilders))
|
||||
if (!Objects.equals(aggregationBuilders, other.aggregationBuilders))
|
||||
return false;
|
||||
if (!Objects.equals(pipelineAggregatorBuilders, other.pipelineAggregatorBuilders))
|
||||
return false;
|
||||
|
|
|
@ -104,7 +104,7 @@ public class AggregatorParsers {
|
|||
+ token + "], expected a [" + XContentParser.Token.START_OBJECT + "].");
|
||||
}
|
||||
|
||||
AggregatorBuilder<?> aggFactory = null;
|
||||
AggregationBuilder<?> aggFactory = null;
|
||||
PipelineAggregatorBuilder<?> pipelineAggregatorFactory = null;
|
||||
AggregatorFactories.Builder subFactories = null;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import org.elasticsearch.search.aggregations.support.FieldContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Bytes.ParentChild;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
@ -44,7 +44,7 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ChildrenAggregatorBuilder extends ValuesSourceAggregatorBuilder<ParentChild, ChildrenAggregatorBuilder> {
|
||||
public class ChildrenAggregationBuilder extends ValuesSourceAggregationBuilder<ParentChild, ChildrenAggregationBuilder> {
|
||||
public static final String NAME = InternalChildren.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class ChildrenAggregatorBuilder extends ValuesSourceAggregatorBuilder<Par
|
|||
* @param childType
|
||||
* the type of children documents
|
||||
*/
|
||||
public ChildrenAggregatorBuilder(String name, String childType) {
|
||||
public ChildrenAggregationBuilder(String name, String childType) {
|
||||
super(name, InternalChildren.TYPE, ValuesSourceType.BYTES, ValueType.STRING);
|
||||
if (childType == null) {
|
||||
throw new IllegalArgumentException("[childType] must not be null: [" + name + "]");
|
||||
|
@ -70,7 +70,7 @@ public class ChildrenAggregatorBuilder extends ValuesSourceAggregatorBuilder<Par
|
|||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public ChildrenAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public ChildrenAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalChildren.TYPE, ValuesSourceType.BYTES, ValueType.STRING);
|
||||
childType = in.readString();
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class ChildrenAggregatorBuilder extends ValuesSourceAggregatorBuilder<Par
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static ChildrenAggregatorBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
public static ChildrenAggregationBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
String childType = null;
|
||||
|
||||
XContentParser.Token token;
|
||||
|
@ -148,7 +148,7 @@ public class ChildrenAggregatorBuilder extends ValuesSourceAggregatorBuilder<Par
|
|||
}
|
||||
|
||||
|
||||
return new ChildrenAggregatorBuilder(aggregationName, childType);
|
||||
return new ChildrenAggregationBuilder(aggregationName, childType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -158,7 +158,7 @@ public class ChildrenAggregatorBuilder extends ValuesSourceAggregatorBuilder<Par
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
ChildrenAggregatorBuilder other = (ChildrenAggregatorBuilder) obj;
|
||||
ChildrenAggregationBuilder other = (ChildrenAggregationBuilder) obj;
|
||||
return Objects.equals(childType, other.childType);
|
||||
}
|
||||
|
||||
|
@ -166,4 +166,4 @@ public class ChildrenAggregatorBuilder extends ValuesSourceAggregatorBuilder<Par
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,12 +24,11 @@ import org.elasticsearch.common.ParsingException;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.query.EmptyQueryBuilder;
|
||||
import org.elasticsearch.index.query.MatchAllQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
|
@ -37,7 +36,7 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class FilterAggregatorBuilder extends AggregatorBuilder<FilterAggregatorBuilder> {
|
||||
public class FilterAggregationBuilder extends AggregationBuilder<FilterAggregationBuilder> {
|
||||
public static final String NAME = InternalFilter.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -51,7 +50,7 @@ public class FilterAggregatorBuilder extends AggregatorBuilder<FilterAggregatorB
|
|||
* filter will fall into the bucket defined by this
|
||||
* {@link Filter} aggregation.
|
||||
*/
|
||||
public FilterAggregatorBuilder(String name, QueryBuilder filter) {
|
||||
public FilterAggregationBuilder(String name, QueryBuilder filter) {
|
||||
super(name, InternalFilter.TYPE);
|
||||
if (filter == null) {
|
||||
throw new IllegalArgumentException("[filter] must not be null: [" + name + "]");
|
||||
|
@ -66,7 +65,7 @@ public class FilterAggregatorBuilder extends AggregatorBuilder<FilterAggregatorB
|
|||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public FilterAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public FilterAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalFilter.TYPE);
|
||||
filter = in.readNamedWriteable(QueryBuilder.class);
|
||||
}
|
||||
|
@ -90,7 +89,7 @@ public class FilterAggregatorBuilder extends AggregatorBuilder<FilterAggregatorB
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static FilterAggregatorBuilder parse(String aggregationName, QueryParseContext context)
|
||||
public static FilterAggregationBuilder parse(String aggregationName, QueryParseContext context)
|
||||
throws IOException {
|
||||
QueryBuilder filter = context.parseInnerQueryBuilder();
|
||||
|
||||
|
@ -98,7 +97,7 @@ public class FilterAggregatorBuilder extends AggregatorBuilder<FilterAggregatorB
|
|||
throw new ParsingException(null, "filter cannot be null in filter aggregation [{}]", aggregationName);
|
||||
}
|
||||
|
||||
return new FilterAggregatorBuilder(aggregationName, filter);
|
||||
return new FilterAggregationBuilder(aggregationName, filter);
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +108,7 @@ public class FilterAggregatorBuilder extends AggregatorBuilder<FilterAggregatorB
|
|||
|
||||
@Override
|
||||
protected boolean doEquals(Object obj) {
|
||||
FilterAggregatorBuilder other = (FilterAggregatorBuilder) obj;
|
||||
FilterAggregationBuilder other = (FilterAggregationBuilder) obj;
|
||||
return Objects.equals(filter, other.filter);
|
||||
}
|
||||
|
||||
|
@ -117,4 +116,4 @@ public class FilterAggregatorBuilder extends AggregatorBuilder<FilterAggregatorB
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
|||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregator.KeyedFilter;
|
||||
|
@ -43,7 +43,7 @@ import java.util.Objects;
|
|||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
|
||||
public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregatorBuilder> {
|
||||
public class FiltersAggregationBuilder extends AggregationBuilder<FiltersAggregationBuilder> {
|
||||
public static final String NAME = InternalFilters.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -62,11 +62,11 @@ public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregato
|
|||
* @param filters
|
||||
* the KeyedFilters to use with this aggregation.
|
||||
*/
|
||||
public FiltersAggregatorBuilder(String name, KeyedFilter... filters) {
|
||||
public FiltersAggregationBuilder(String name, KeyedFilter... filters) {
|
||||
this(name, Arrays.asList(filters));
|
||||
}
|
||||
|
||||
private FiltersAggregatorBuilder(String name, List<KeyedFilter> filters) {
|
||||
private FiltersAggregationBuilder(String name, List<KeyedFilter> filters) {
|
||||
super(name, InternalFilters.TYPE);
|
||||
// internally we want to have a fixed order of filters, regardless of the order of the filters in the request
|
||||
this.filters = new ArrayList<>(filters);
|
||||
|
@ -80,7 +80,7 @@ public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregato
|
|||
* @param filters
|
||||
* the filters to use with this aggregation
|
||||
*/
|
||||
public FiltersAggregatorBuilder(String name, QueryBuilder... filters) {
|
||||
public FiltersAggregationBuilder(String name, QueryBuilder... filters) {
|
||||
super(name, InternalFilters.TYPE);
|
||||
List<KeyedFilter> keyedFilters = new ArrayList<>(filters.length);
|
||||
for (int i = 0; i < filters.length; i++) {
|
||||
|
@ -93,7 +93,7 @@ public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregato
|
|||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public FiltersAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public FiltersAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalFilters.TYPE);
|
||||
keyed = in.readBoolean();
|
||||
int filtersSize = in.readVInt();
|
||||
|
@ -131,7 +131,7 @@ public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregato
|
|||
/**
|
||||
* Set whether to include a bucket for documents not matching any filter
|
||||
*/
|
||||
public FiltersAggregatorBuilder otherBucket(boolean otherBucket) {
|
||||
public FiltersAggregationBuilder otherBucket(boolean otherBucket) {
|
||||
this.otherBucket = otherBucket;
|
||||
return this;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregato
|
|||
* Set the key to use for the bucket for documents not matching any
|
||||
* filter.
|
||||
*/
|
||||
public FiltersAggregatorBuilder otherBucketKey(String otherBucketKey) {
|
||||
public FiltersAggregationBuilder otherBucketKey(String otherBucketKey) {
|
||||
if (otherBucketKey == null) {
|
||||
throw new IllegalArgumentException("[otherBucketKey] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregato
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static FiltersAggregatorBuilder parse(String aggregationName, QueryParseContext context)
|
||||
public static FiltersAggregationBuilder parse(String aggregationName, QueryParseContext context)
|
||||
throws IOException {
|
||||
XContentParser parser = context.parser();
|
||||
|
||||
|
@ -264,12 +264,12 @@ public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregato
|
|||
otherBucketKey = "_other_";
|
||||
}
|
||||
|
||||
FiltersAggregatorBuilder factory;
|
||||
FiltersAggregationBuilder factory;
|
||||
if (keyedFilters != null) {
|
||||
factory = new FiltersAggregatorBuilder(aggregationName,
|
||||
factory = new FiltersAggregationBuilder(aggregationName,
|
||||
keyedFilters.toArray(new FiltersAggregator.KeyedFilter[keyedFilters.size()]));
|
||||
} else {
|
||||
factory = new FiltersAggregatorBuilder(aggregationName,
|
||||
factory = new FiltersAggregationBuilder(aggregationName,
|
||||
nonKeyedFilters.toArray(new QueryBuilder[nonKeyedFilters.size()]));
|
||||
}
|
||||
if (otherBucket != null) {
|
||||
|
@ -288,7 +288,7 @@ public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregato
|
|||
|
||||
@Override
|
||||
protected boolean doEquals(Object obj) {
|
||||
FiltersAggregatorBuilder other = (FiltersAggregatorBuilder) obj;
|
||||
FiltersAggregationBuilder other = (FiltersAggregationBuilder) obj;
|
||||
return Objects.equals(filters, other.filters)
|
||||
&& Objects.equals(keyed, other.keyed)
|
||||
&& Objects.equals(otherBucket, other.otherBucket)
|
||||
|
@ -299,4 +299,4 @@ public class FiltersAggregatorBuilder extends AggregatorBuilder<FiltersAggregato
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,7 +37,7 @@ import org.elasticsearch.search.aggregations.bucket.BucketUtils;
|
|||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
@ -45,7 +45,7 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class GeoGridAggregatorBuilder extends ValuesSourceAggregatorBuilder<ValuesSource.GeoPoint, GeoGridAggregatorBuilder> {
|
||||
public class GeoGridAggregationBuilder extends ValuesSourceAggregationBuilder<ValuesSource.GeoPoint, GeoGridAggregationBuilder> {
|
||||
public static final String NAME = InternalGeoHashGrid.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -53,14 +53,14 @@ public class GeoGridAggregatorBuilder extends ValuesSourceAggregatorBuilder<Valu
|
|||
private int requiredSize = GeoHashGridParser.DEFAULT_MAX_NUM_CELLS;
|
||||
private int shardSize = -1;
|
||||
|
||||
public GeoGridAggregatorBuilder(String name) {
|
||||
public GeoGridAggregationBuilder(String name) {
|
||||
super(name, InternalGeoHashGrid.TYPE, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public GeoGridAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public GeoGridAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalGeoHashGrid.TYPE, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT);
|
||||
precision = in.readVInt();
|
||||
requiredSize = in.readVInt();
|
||||
|
@ -74,7 +74,7 @@ public class GeoGridAggregatorBuilder extends ValuesSourceAggregatorBuilder<Valu
|
|||
out.writeVInt(shardSize);
|
||||
}
|
||||
|
||||
public GeoGridAggregatorBuilder precision(int precision) {
|
||||
public GeoGridAggregationBuilder precision(int precision) {
|
||||
this.precision = GeoHashGridParams.checkPrecision(precision);
|
||||
return this;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class GeoGridAggregatorBuilder extends ValuesSourceAggregatorBuilder<Valu
|
|||
return precision;
|
||||
}
|
||||
|
||||
public GeoGridAggregatorBuilder size(int size) {
|
||||
public GeoGridAggregationBuilder size(int size) {
|
||||
if (size < -1) {
|
||||
throw new IllegalArgumentException(
|
||||
"[size] must be greater than or equal to 0. Found [" + shardSize + "] in [" + name + "]");
|
||||
|
@ -96,7 +96,7 @@ public class GeoGridAggregatorBuilder extends ValuesSourceAggregatorBuilder<Valu
|
|||
return requiredSize;
|
||||
}
|
||||
|
||||
public GeoGridAggregatorBuilder shardSize(int shardSize) {
|
||||
public GeoGridAggregationBuilder shardSize(int shardSize) {
|
||||
if (shardSize < -1) {
|
||||
throw new IllegalArgumentException(
|
||||
"[shardSize] must be greater than or equal to 0. Found [" + shardSize + "] in [" + name + "]");
|
||||
|
@ -145,7 +145,7 @@ public class GeoGridAggregatorBuilder extends ValuesSourceAggregatorBuilder<Valu
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
GeoGridAggregatorBuilder other = (GeoGridAggregatorBuilder) obj;
|
||||
GeoGridAggregationBuilder other = (GeoGridAggregationBuilder) obj;
|
||||
if (precision != other.precision) {
|
||||
return false;
|
||||
}
|
|
@ -46,10 +46,10 @@ public class GeoHashGridAggregator extends BucketsAggregator {
|
|||
|
||||
private final int requiredSize;
|
||||
private final int shardSize;
|
||||
private final GeoGridAggregatorBuilder.CellIdSource valuesSource;
|
||||
private final GeoGridAggregationBuilder.CellIdSource valuesSource;
|
||||
private final LongHash bucketOrds;
|
||||
|
||||
public GeoHashGridAggregator(String name, AggregatorFactories factories, GeoGridAggregatorBuilder.CellIdSource valuesSource,
|
||||
public GeoHashGridAggregator(String name, AggregatorFactories factories, GeoGridAggregationBuilder.CellIdSource valuesSource,
|
||||
int requiredSize, int shardSize, AggregationContext aggregationContext, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metaData) throws IOException {
|
||||
super(name, factories, aggregationContext, parent, pipelineAggregators, metaData);
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.elasticsearch.search.aggregations.AggregatorFactory;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation.Type;
|
||||
import org.elasticsearch.search.aggregations.NonCollectingAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregatorBuilder.CellIdSource;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregationBuilder.CellIdSource;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
|
|
|
@ -45,10 +45,10 @@ public class GeoHashGridParser extends GeoPointValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected GeoGridAggregatorBuilder createFactory(
|
||||
protected GeoGridAggregationBuilder createFactory(
|
||||
String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
GeoGridAggregatorBuilder factory = new GeoGridAggregatorBuilder(aggregationName);
|
||||
GeoGridAggregationBuilder factory = new GeoGridAggregationBuilder(aggregationName);
|
||||
Integer precision = (Integer) otherOptions.get(GeoHashGridParams.FIELD_PRECISION);
|
||||
if (precision != null) {
|
||||
factory.precision(precision);
|
||||
|
|
|
@ -24,25 +24,25 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GlobalAggregatorBuilder extends AggregatorBuilder<GlobalAggregatorBuilder> {
|
||||
public class GlobalAggregationBuilder extends AggregationBuilder<GlobalAggregationBuilder> {
|
||||
public static final String NAME = InternalGlobal.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public GlobalAggregatorBuilder(String name) {
|
||||
public GlobalAggregationBuilder(String name) {
|
||||
super(name, InternalGlobal.TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public GlobalAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public GlobalAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalGlobal.TYPE);
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,9 @@ public class GlobalAggregatorBuilder extends AggregatorBuilder<GlobalAggregatorB
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static GlobalAggregatorBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
public static GlobalAggregationBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
context.parser().nextToken();
|
||||
return new GlobalAggregatorBuilder(aggregationName);
|
||||
return new GlobalAggregationBuilder(aggregationName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,4 +83,4 @@ public class GlobalAggregatorBuilder extends AggregatorBuilder<GlobalAggregatorB
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,14 +24,14 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.rounding.Rounding;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class AbstractHistogramBuilder<AB extends AbstractHistogramBuilder<AB>>
|
||||
extends ValuesSourceAggregatorBuilder<ValuesSource.Numeric, AB> {
|
||||
extends ValuesSourceAggregationBuilder<ValuesSource.Numeric, AB> {
|
||||
|
||||
protected long interval;
|
||||
protected long offset = 0;
|
||||
|
@ -200,4 +200,4 @@ public abstract class AbstractHistogramBuilder<AB extends AbstractHistogramBuild
|
|||
&& Objects.equals(minDocCount, other.minDocCount)
|
||||
&& Objects.equals(extendedBounds, other.extendedBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,21 +33,21 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DateHistogramAggregatorBuilder extends AbstractHistogramBuilder<DateHistogramAggregatorBuilder> {
|
||||
public class DateHistogramAggregationBuilder extends AbstractHistogramBuilder<DateHistogramAggregationBuilder> {
|
||||
|
||||
public static final String NAME = InternalDateHistogram.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
private DateHistogramInterval dateHistogramInterval;
|
||||
|
||||
public DateHistogramAggregatorBuilder(String name) {
|
||||
public DateHistogramAggregationBuilder(String name) {
|
||||
super(name, InternalDateHistogram.HISTOGRAM_FACTORY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public DateHistogramAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public DateHistogramAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalDateHistogram.HISTOGRAM_FACTORY);
|
||||
dateHistogramInterval = in.readOptionalWriteable(DateHistogramInterval::new);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class DateHistogramAggregatorBuilder extends AbstractHistogramBuilder<Dat
|
|||
/**
|
||||
* Set the interval.
|
||||
*/
|
||||
public DateHistogramAggregatorBuilder dateHistogramInterval(DateHistogramInterval dateHistogramInterval) {
|
||||
public DateHistogramAggregationBuilder dateHistogramInterval(DateHistogramInterval dateHistogramInterval) {
|
||||
if (dateHistogramInterval == null) {
|
||||
throw new IllegalArgumentException("[dateHistogramInterval] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class DateHistogramAggregatorBuilder extends AbstractHistogramBuilder<Dat
|
|||
return this;
|
||||
}
|
||||
|
||||
public DateHistogramAggregatorBuilder offset(String offset) {
|
||||
public DateHistogramAggregationBuilder offset(String offset) {
|
||||
if (offset == null) {
|
||||
throw new IllegalArgumentException("[offset] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -79,12 +79,12 @@ public class DateHistogramAggregatorBuilder extends AbstractHistogramBuilder<Dat
|
|||
protected static long parseStringOffset(String offset) {
|
||||
if (offset.charAt(0) == '-') {
|
||||
return -TimeValue
|
||||
.parseTimeValue(offset.substring(1), null, DateHistogramAggregatorBuilder.class.getSimpleName() + ".parseOffset")
|
||||
.parseTimeValue(offset.substring(1), null, DateHistogramAggregationBuilder.class.getSimpleName() + ".parseOffset")
|
||||
.millis();
|
||||
}
|
||||
int beginIndex = offset.charAt(0) == '+' ? 1 : 0;
|
||||
return TimeValue
|
||||
.parseTimeValue(offset.substring(beginIndex), null, DateHistogramAggregatorBuilder.class.getSimpleName() + ".parseOffset")
|
||||
.parseTimeValue(offset.substring(beginIndex), null, DateHistogramAggregationBuilder.class.getSimpleName() + ".parseOffset")
|
||||
.millis();
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class DateHistogramAggregatorBuilder extends AbstractHistogramBuilder<Dat
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
DateHistogramAggregatorBuilder other = (DateHistogramAggregatorBuilder) obj;
|
||||
DateHistogramAggregationBuilder other = (DateHistogramAggregationBuilder) obj;
|
||||
return super.innerEquals(obj) && Objects.equals(dateHistogramInterval, other.dateHistogramInterval);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,9 +42,9 @@ public class DateHistogramParser extends HistogramParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected DateHistogramAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
DateHistogramAggregatorBuilder factory = new DateHistogramAggregatorBuilder(aggregationName);
|
||||
protected DateHistogramAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
DateHistogramAggregationBuilder factory = new DateHistogramAggregationBuilder(aggregationName);
|
||||
Object interval = otherOptions.get(Rounding.Interval.INTERVAL_FIELD);
|
||||
if (interval == null) {
|
||||
throw new ParsingException(null, "Missing required field [interval] for histogram aggregation [" + aggregationName + "]");
|
||||
|
@ -89,6 +89,6 @@ public class DateHistogramParser extends HistogramParser {
|
|||
|
||||
@Override
|
||||
protected long parseStringOffset(String offset) throws IOException {
|
||||
return DateHistogramAggregatorBuilder.parseStringOffset(offset);
|
||||
return DateHistogramAggregationBuilder.parseStringOffset(offset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,18 +29,18 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class HistogramAggregatorBuilder extends AbstractHistogramBuilder<HistogramAggregatorBuilder> {
|
||||
public class HistogramAggregationBuilder extends AbstractHistogramBuilder<HistogramAggregationBuilder> {
|
||||
public static final String NAME = InternalHistogram.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public HistogramAggregatorBuilder(String name) {
|
||||
public HistogramAggregationBuilder(String name) {
|
||||
super(name, InternalHistogram.HISTOGRAM_FACTORY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public HistogramAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public HistogramAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalHistogram.HISTOGRAM_FACTORY);
|
||||
}
|
||||
|
||||
|
@ -55,4 +55,4 @@ public class HistogramAggregatorBuilder extends AbstractHistogramBuilder<Histogr
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ public class HistogramParser extends NumericValuesSourceParser {
|
|||
@Override
|
||||
protected AbstractHistogramBuilder<?> createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
HistogramAggregatorBuilder factory = new HistogramAggregatorBuilder(aggregationName);
|
||||
HistogramAggregationBuilder factory = new HistogramAggregationBuilder(aggregationName);
|
||||
Long interval = (Long) otherOptions.get(Rounding.Interval.INTERVAL_FIELD);
|
||||
if (interval == null) {
|
||||
throw new ParsingException(null, "Missing required field [interval] for histogram aggregation [" + aggregationName + "]");
|
||||
|
|
|
@ -28,25 +28,25 @@ import org.elasticsearch.search.aggregations.AggregatorFactory;
|
|||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class MissingAggregatorBuilder extends ValuesSourceAggregatorBuilder<ValuesSource, MissingAggregatorBuilder> {
|
||||
public class MissingAggregationBuilder extends ValuesSourceAggregationBuilder<ValuesSource, MissingAggregationBuilder> {
|
||||
public static final String NAME = InternalMissing.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public MissingAggregatorBuilder(String name, ValueType targetValueType) {
|
||||
public MissingAggregationBuilder(String name, ValueType targetValueType) {
|
||||
super(name, InternalMissing.TYPE, ValuesSourceType.ANY, targetValueType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public MissingAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public MissingAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalMissing.TYPE, ValuesSourceType.ANY);
|
||||
}
|
||||
|
||||
|
@ -85,4 +85,4 @@ public class MissingAggregatorBuilder extends ValuesSourceAggregatorBuilder<Valu
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,8 +41,8 @@ public class MissingParser extends AnyValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected MissingAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new MissingAggregatorBuilder(aggregationName, targetValueType);
|
||||
protected MissingAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new MissingAggregationBuilder(aggregationName, targetValueType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
|
@ -34,7 +34,7 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class NestedAggregatorBuilder extends AggregatorBuilder<NestedAggregatorBuilder> {
|
||||
public class NestedAggregationBuilder extends AggregationBuilder<NestedAggregationBuilder> {
|
||||
public static final String NAME = InternalNested.TYPE.name();
|
||||
public static final ParseField AGGREGATION_FIELD_NAME = new ParseField(NAME);
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class NestedAggregatorBuilder extends AggregatorBuilder<NestedAggregatorB
|
|||
* the path to use for this nested aggregation. The path must
|
||||
* match the path to a nested object in the mappings.
|
||||
*/
|
||||
public NestedAggregatorBuilder(String name, String path) {
|
||||
public NestedAggregationBuilder(String name, String path) {
|
||||
super(name, InternalNested.TYPE);
|
||||
if (path == null) {
|
||||
throw new IllegalArgumentException("[path] must not be null: [" + name + "]");
|
||||
|
@ -58,7 +58,7 @@ public class NestedAggregatorBuilder extends AggregatorBuilder<NestedAggregatorB
|
|||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public NestedAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public NestedAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalNested.TYPE);
|
||||
path = in.readString();
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class NestedAggregatorBuilder extends AggregatorBuilder<NestedAggregatorB
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static NestedAggregatorBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
public static NestedAggregationBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
String path = null;
|
||||
|
||||
XContentParser.Token token;
|
||||
|
@ -115,7 +115,7 @@ public class NestedAggregatorBuilder extends AggregatorBuilder<NestedAggregatorB
|
|||
throw new ParsingException(parser.getTokenLocation(), "Missing [path] field for nested aggregation [" + aggregationName + "]");
|
||||
}
|
||||
|
||||
return new NestedAggregatorBuilder(aggregationName, path);
|
||||
return new NestedAggregationBuilder(aggregationName, path);
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class NestedAggregatorBuilder extends AggregatorBuilder<NestedAggregatorB
|
|||
|
||||
@Override
|
||||
protected boolean doEquals(Object obj) {
|
||||
NestedAggregatorBuilder other = (NestedAggregatorBuilder) obj;
|
||||
NestedAggregationBuilder other = (NestedAggregationBuilder) obj;
|
||||
return Objects.equals(path, other.path);
|
||||
}
|
||||
|
||||
|
@ -134,4 +134,4 @@ public class NestedAggregatorBuilder extends AggregatorBuilder<NestedAggregatorB
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
|
@ -34,20 +34,20 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ReverseNestedAggregatorBuilder extends AggregatorBuilder<ReverseNestedAggregatorBuilder> {
|
||||
public class ReverseNestedAggregationBuilder extends AggregationBuilder<ReverseNestedAggregationBuilder> {
|
||||
public static final String NAME = InternalReverseNested.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
private String path;
|
||||
|
||||
public ReverseNestedAggregatorBuilder(String name) {
|
||||
public ReverseNestedAggregationBuilder(String name) {
|
||||
super(name, InternalReverseNested.TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public ReverseNestedAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public ReverseNestedAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalReverseNested.TYPE);
|
||||
path = in.readOptionalString();
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class ReverseNestedAggregatorBuilder extends AggregatorBuilder<ReverseNes
|
|||
* the path to a nested object in the mappings. If it is not specified
|
||||
* then this aggregation will go back to the root document.
|
||||
*/
|
||||
public ReverseNestedAggregatorBuilder path(String path) {
|
||||
public ReverseNestedAggregationBuilder path(String path) {
|
||||
if (path == null) {
|
||||
throw new IllegalArgumentException("[path] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class ReverseNestedAggregatorBuilder extends AggregatorBuilder<ReverseNes
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static ReverseNestedAggregatorBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
public static ReverseNestedAggregationBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
String path = null;
|
||||
|
||||
XContentParser.Token token;
|
||||
|
@ -114,7 +114,7 @@ public class ReverseNestedAggregatorBuilder extends AggregatorBuilder<ReverseNes
|
|||
}
|
||||
}
|
||||
|
||||
ReverseNestedAggregatorBuilder factory = new ReverseNestedAggregatorBuilder(
|
||||
ReverseNestedAggregationBuilder factory = new ReverseNestedAggregationBuilder(
|
||||
aggregationName);
|
||||
if (path != null) {
|
||||
factory.path(path);
|
||||
|
@ -130,7 +130,7 @@ public class ReverseNestedAggregatorBuilder extends AggregatorBuilder<ReverseNes
|
|||
|
||||
@Override
|
||||
protected boolean doEquals(Object obj) {
|
||||
ReverseNestedAggregatorBuilder other = (ReverseNestedAggregatorBuilder) obj;
|
||||
ReverseNestedAggregationBuilder other = (ReverseNestedAggregationBuilder) obj;
|
||||
return Objects.equals(path, other.path);
|
||||
}
|
||||
|
||||
|
@ -138,4 +138,4 @@ public class ReverseNestedAggregatorBuilder extends AggregatorBuilder<ReverseNes
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -33,7 +33,7 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
public abstract class AbstractRangeBuilder<AB extends AbstractRangeBuilder<AB, R>, R extends Range>
|
||||
extends ValuesSourceAggregatorBuilder<ValuesSource.Numeric, AB> {
|
||||
extends ValuesSourceAggregationBuilder<ValuesSource.Numeric, AB> {
|
||||
|
||||
protected final InternalRange.Factory<?, ?> rangeFactory;
|
||||
protected List<R> ranges = new ArrayList<>();
|
||||
|
@ -103,4 +103,4 @@ public abstract class AbstractRangeBuilder<AB extends AbstractRangeBuilder<AB, R
|
|||
return Objects.equals(ranges, other.ranges)
|
||||
&& Objects.equals(keyed, other.keyed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,18 +30,18 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class RangeAggregatorBuilder extends AbstractRangeBuilder<RangeAggregatorBuilder, Range> {
|
||||
public class RangeAggregationBuilder extends AbstractRangeBuilder<RangeAggregationBuilder, Range> {
|
||||
public static final String NAME = InternalRange.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public RangeAggregatorBuilder(String name) {
|
||||
public RangeAggregationBuilder(String name) {
|
||||
super(name, InternalRange.FACTORY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public RangeAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public RangeAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalRange.FACTORY, Range::new);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class RangeAggregatorBuilder extends AbstractRangeBuilder<RangeAggregator
|
|||
* @param to
|
||||
* the upper bound on the distances, exclusive
|
||||
*/
|
||||
public RangeAggregatorBuilder addRange(String key, double from, double to) {
|
||||
public RangeAggregationBuilder addRange(String key, double from, double to) {
|
||||
addRange(new Range(key, from, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class RangeAggregatorBuilder extends AbstractRangeBuilder<RangeAggregator
|
|||
* automatically generated based on <code>from</code> and
|
||||
* <code>to</code>.
|
||||
*/
|
||||
public RangeAggregatorBuilder addRange(double from, double to) {
|
||||
public RangeAggregationBuilder addRange(double from, double to) {
|
||||
return addRange(null, from, to);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class RangeAggregatorBuilder extends AbstractRangeBuilder<RangeAggregator
|
|||
* @param to
|
||||
* the upper bound on the distances, exclusive
|
||||
*/
|
||||
public RangeAggregatorBuilder addUnboundedTo(String key, double to) {
|
||||
public RangeAggregationBuilder addUnboundedTo(String key, double to) {
|
||||
addRange(new Range(key, null, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class RangeAggregatorBuilder extends AbstractRangeBuilder<RangeAggregator
|
|||
* Same as {@link #addUnboundedTo(String, double)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public RangeAggregatorBuilder addUnboundedTo(double to) {
|
||||
public RangeAggregationBuilder addUnboundedTo(double to) {
|
||||
return addUnboundedTo(null, to);
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class RangeAggregatorBuilder extends AbstractRangeBuilder<RangeAggregator
|
|||
* @param from
|
||||
* the lower bound on the distances, inclusive
|
||||
*/
|
||||
public RangeAggregatorBuilder addUnboundedFrom(String key, double from) {
|
||||
public RangeAggregationBuilder addUnboundedFrom(String key, double from) {
|
||||
addRange(new Range(key, from, null));
|
||||
return this;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class RangeAggregatorBuilder extends AbstractRangeBuilder<RangeAggregator
|
|||
* Same as {@link #addUnboundedFrom(String, double)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public RangeAggregatorBuilder addUnboundedFrom(double from) {
|
||||
public RangeAggregationBuilder addUnboundedFrom(double from) {
|
||||
return addUnboundedFrom(null, from);
|
||||
}
|
||||
|
||||
|
@ -122,4 +122,4 @@ public class RangeAggregatorBuilder extends AbstractRangeBuilder<RangeAggregator
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,7 +51,7 @@ public class RangeParser extends NumericValuesSourceParser {
|
|||
@Override
|
||||
protected AbstractRangeBuilder<?, ?> createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
RangeAggregatorBuilder factory = new RangeAggregatorBuilder(aggregationName);
|
||||
RangeAggregationBuilder factory = new RangeAggregationBuilder(aggregationName);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<? extends Range> ranges = (List<? extends Range>) otherOptions.get(RangeAggregator.RANGES_FIELD);
|
||||
for (Range range : ranges) {
|
||||
|
|
|
@ -33,18 +33,18 @@ import org.joda.time.DateTime;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAggregatorBuilder, RangeAggregator.Range> {
|
||||
public class DateRangeAggregationBuilder extends AbstractRangeBuilder<DateRangeAggregationBuilder, RangeAggregator.Range> {
|
||||
public static final String NAME = InternalDateRange.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public DateRangeAggregatorBuilder(String name) {
|
||||
public DateRangeAggregationBuilder(String name) {
|
||||
super(name, InternalDateRange.FACTORY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public DateRangeAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalDateRange.FACTORY, Range::new);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* @param to
|
||||
* the upper bound on the dates, exclusive
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addRange(String key, String from, String to) {
|
||||
public DateRangeAggregationBuilder addRange(String key, String from, String to) {
|
||||
addRange(new Range(key, from, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* Same as {@link #addRange(String, String, String)} but the key will be
|
||||
* automatically generated based on <code>from</code> and <code>to</code>.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addRange(String from, String to) {
|
||||
public DateRangeAggregationBuilder addRange(String from, String to) {
|
||||
return addRange(null, from, to);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* @param to
|
||||
* the upper bound on the dates, exclusive
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedTo(String key, String to) {
|
||||
public DateRangeAggregationBuilder addUnboundedTo(String key, String to) {
|
||||
addRange(new Range(key, null, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* Same as {@link #addUnboundedTo(String, String)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedTo(String to) {
|
||||
public DateRangeAggregationBuilder addUnboundedTo(String to) {
|
||||
return addUnboundedTo(null, to);
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* @param from
|
||||
* the lower bound on the distances, inclusive
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedFrom(String key, String from) {
|
||||
public DateRangeAggregationBuilder addUnboundedFrom(String key, String from) {
|
||||
addRange(new Range(key, from, null));
|
||||
return this;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* Same as {@link #addUnboundedFrom(String, String)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedFrom(String from) {
|
||||
public DateRangeAggregationBuilder addUnboundedFrom(String from) {
|
||||
return addUnboundedFrom(null, from);
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* @param to
|
||||
* the upper bound on the dates, exclusive
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addRange(String key, double from, double to) {
|
||||
public DateRangeAggregationBuilder addRange(String key, double from, double to) {
|
||||
addRange(new Range(key, from, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* Same as {@link #addRange(String, double, double)} but the key will be
|
||||
* automatically generated based on <code>from</code> and <code>to</code>.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addRange(double from, double to) {
|
||||
public DateRangeAggregationBuilder addRange(double from, double to) {
|
||||
return addRange(null, from, to);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* @param to
|
||||
* the upper bound on the dates, exclusive
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedTo(String key, double to) {
|
||||
public DateRangeAggregationBuilder addUnboundedTo(String key, double to) {
|
||||
addRange(new Range(key, null, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* Same as {@link #addUnboundedTo(String, double)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedTo(double to) {
|
||||
public DateRangeAggregationBuilder addUnboundedTo(double to) {
|
||||
return addUnboundedTo(null, to);
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* @param from
|
||||
* the lower bound on the distances, inclusive
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedFrom(String key, double from) {
|
||||
public DateRangeAggregationBuilder addUnboundedFrom(String key, double from) {
|
||||
addRange(new Range(key, from, null));
|
||||
return this;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* Same as {@link #addUnboundedFrom(String, double)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedFrom(double from) {
|
||||
public DateRangeAggregationBuilder addUnboundedFrom(double from) {
|
||||
return addUnboundedFrom(null, from);
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* @param to
|
||||
* the upper bound on the dates, exclusive
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addRange(String key, DateTime from, DateTime to) {
|
||||
public DateRangeAggregationBuilder addRange(String key, DateTime from, DateTime to) {
|
||||
addRange(new Range(key, convertDateTime(from), convertDateTime(to)));
|
||||
return this;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* Same as {@link #addRange(String, DateTime, DateTime)} but the key will be
|
||||
* automatically generated based on <code>from</code> and <code>to</code>.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addRange(DateTime from, DateTime to) {
|
||||
public DateRangeAggregationBuilder addRange(DateTime from, DateTime to) {
|
||||
return addRange(null, from, to);
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* @param to
|
||||
* the upper bound on the dates, exclusive
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedTo(String key, DateTime to) {
|
||||
public DateRangeAggregationBuilder addUnboundedTo(String key, DateTime to) {
|
||||
addRange(new Range(key, null, convertDateTime(to)));
|
||||
return this;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* Same as {@link #addUnboundedTo(String, DateTime)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedTo(DateTime to) {
|
||||
public DateRangeAggregationBuilder addUnboundedTo(DateTime to) {
|
||||
return addUnboundedTo(null, to);
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* @param from
|
||||
* the lower bound on the distances, inclusive
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedFrom(String key, DateTime from) {
|
||||
public DateRangeAggregationBuilder addUnboundedFrom(String key, DateTime from) {
|
||||
addRange(new Range(key, convertDateTime(from), null));
|
||||
return this;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ public class DateRangeAggregatorBuilder extends AbstractRangeBuilder<DateRangeAg
|
|||
* Same as {@link #addUnboundedFrom(String, DateTime)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public DateRangeAggregatorBuilder addUnboundedFrom(DateTime from) {
|
||||
public DateRangeAggregationBuilder addUnboundedFrom(DateTime from) {
|
||||
return addUnboundedFrom(null, from);
|
||||
}
|
||||
|
|
@ -38,9 +38,9 @@ public class DateRangeParser extends RangeParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected DateRangeAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
DateRangeAggregatorBuilder factory = new DateRangeAggregatorBuilder(aggregationName);
|
||||
protected DateRangeAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
DateRangeAggregationBuilder factory = new DateRangeAggregationBuilder(aggregationName);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Range> ranges = (List<Range>) otherOptions.get(RangeAggregator.RANGES_FIELD);
|
||||
for (Range range : ranges) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator;
|
|||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceParser.Range;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
|
||||
|
@ -42,7 +42,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<ValuesSource.GeoPoint, GeoDistanceAggregatorBuilder> {
|
||||
public class GeoDistanceAggregationBuilder extends ValuesSourceAggregationBuilder<ValuesSource.GeoPoint, GeoDistanceAggregationBuilder> {
|
||||
public static final String NAME = InternalGeoDistance.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -52,12 +52,12 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
private GeoDistance distanceType = GeoDistance.DEFAULT;
|
||||
private boolean keyed = false;
|
||||
|
||||
public GeoDistanceAggregatorBuilder(String name, GeoPoint origin) {
|
||||
public GeoDistanceAggregationBuilder(String name, GeoPoint origin) {
|
||||
this(name, origin, InternalGeoDistance.FACTORY);
|
||||
}
|
||||
|
||||
private GeoDistanceAggregatorBuilder(String name, GeoPoint origin,
|
||||
InternalRange.Factory<InternalGeoDistance.Bucket, InternalGeoDistance> rangeFactory) {
|
||||
private GeoDistanceAggregationBuilder(String name, GeoPoint origin,
|
||||
InternalRange.Factory<InternalGeoDistance.Bucket, InternalGeoDistance> rangeFactory) {
|
||||
super(name, rangeFactory.type(), rangeFactory.getValueSourceType(), rangeFactory.getValueType());
|
||||
if (origin == null) {
|
||||
throw new IllegalArgumentException("[origin] must not be null: [" + name + "]");
|
||||
|
@ -68,7 +68,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public GeoDistanceAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public GeoDistanceAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalGeoDistance.FACTORY.type(), InternalGeoDistance.FACTORY.getValueSourceType(),
|
||||
InternalGeoDistance.FACTORY.getValueType());
|
||||
origin = new GeoPoint(in.readDouble(), in.readDouble());
|
||||
|
@ -95,7 +95,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
unit.writeTo(out);
|
||||
}
|
||||
|
||||
public GeoDistanceAggregatorBuilder addRange(Range range) {
|
||||
public GeoDistanceAggregationBuilder addRange(Range range) {
|
||||
if (range == null) {
|
||||
throw new IllegalArgumentException("[range] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
* @param to
|
||||
* the upper bound on the distances, exclusive
|
||||
*/
|
||||
public GeoDistanceAggregatorBuilder addRange(String key, double from, double to) {
|
||||
public GeoDistanceAggregationBuilder addRange(String key, double from, double to) {
|
||||
ranges.add(new Range(key, from, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
* automatically generated based on <code>from</code> and
|
||||
* <code>to</code>.
|
||||
*/
|
||||
public GeoDistanceAggregatorBuilder addRange(double from, double to) {
|
||||
public GeoDistanceAggregationBuilder addRange(double from, double to) {
|
||||
return addRange(null, from, to);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
* @param to
|
||||
* the upper bound on the distances, exclusive
|
||||
*/
|
||||
public GeoDistanceAggregatorBuilder addUnboundedTo(String key, double to) {
|
||||
public GeoDistanceAggregationBuilder addUnboundedTo(String key, double to) {
|
||||
ranges.add(new Range(key, null, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
* Same as {@link #addUnboundedTo(String, double)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public GeoDistanceAggregatorBuilder addUnboundedTo(double to) {
|
||||
public GeoDistanceAggregationBuilder addUnboundedTo(double to) {
|
||||
return addUnboundedTo(null, to);
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
* @param from
|
||||
* the lower bound on the distances, inclusive
|
||||
*/
|
||||
public GeoDistanceAggregatorBuilder addUnboundedFrom(String key, double from) {
|
||||
public GeoDistanceAggregationBuilder addUnboundedFrom(String key, double from) {
|
||||
addRange(new Range(key, from, null));
|
||||
return this;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
* Same as {@link #addUnboundedFrom(String, double)} but the key will be
|
||||
* computed automatically.
|
||||
*/
|
||||
public GeoDistanceAggregatorBuilder addUnboundedFrom(double from) {
|
||||
public GeoDistanceAggregationBuilder addUnboundedFrom(double from) {
|
||||
return addUnboundedFrom(null, from);
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
return NAME;
|
||||
}
|
||||
|
||||
public GeoDistanceAggregatorBuilder unit(DistanceUnit unit) {
|
||||
public GeoDistanceAggregationBuilder unit(DistanceUnit unit) {
|
||||
if (unit == null) {
|
||||
throw new IllegalArgumentException("[unit] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
return unit;
|
||||
}
|
||||
|
||||
public GeoDistanceAggregatorBuilder distanceType(GeoDistance distanceType) {
|
||||
public GeoDistanceAggregationBuilder distanceType(GeoDistance distanceType) {
|
||||
if (distanceType == null) {
|
||||
throw new IllegalArgumentException("[distanceType] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
return distanceType;
|
||||
}
|
||||
|
||||
public GeoDistanceAggregatorBuilder keyed(boolean keyed) {
|
||||
public GeoDistanceAggregationBuilder keyed(boolean keyed) {
|
||||
this.keyed = keyed;
|
||||
return this;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
GeoDistanceAggregatorBuilder other = (GeoDistanceAggregatorBuilder) obj;
|
||||
GeoDistanceAggregationBuilder other = (GeoDistanceAggregationBuilder) obj;
|
||||
return Objects.equals(origin, other.origin)
|
||||
&& Objects.equals(ranges, other.ranges)
|
||||
&& Objects.equals(keyed, other.keyed)
|
||||
|
@ -244,4 +244,4 @@ public class GeoDistanceAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
&& Objects.equals(unit, other.unit);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -85,10 +85,10 @@ public class GeoDistanceParser extends GeoPointValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected GeoDistanceAggregatorBuilder createFactory(
|
||||
protected GeoDistanceAggregationBuilder createFactory(
|
||||
String aggregationName, ValuesSourceType valuesSourceType, ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
GeoPoint origin = (GeoPoint) otherOptions.get(ORIGIN_FIELD);
|
||||
GeoDistanceAggregatorBuilder factory = new GeoDistanceAggregatorBuilder(aggregationName, origin);
|
||||
GeoDistanceAggregationBuilder factory = new GeoDistanceAggregationBuilder(aggregationName, origin);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Range> ranges = (List<Range>) otherOptions.get(RangeAggregator.RANGES_FIELD);
|
||||
for (Range range : ranges) {
|
||||
|
@ -171,4 +171,4 @@ public class GeoDistanceParser extends GeoPointValuesSourceParser {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,14 +44,14 @@ import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator;
|
|||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
|
||||
public final class IpRangeAggregatorBuilder
|
||||
extends ValuesSourceAggregatorBuilder<ValuesSource.Bytes, IpRangeAggregatorBuilder> {
|
||||
public final class IpRangeAggregationBuilder
|
||||
extends ValuesSourceAggregationBuilder<ValuesSource.Bytes, IpRangeAggregationBuilder> {
|
||||
private static final String NAME = "ip_range";
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
private static final InternalAggregation.Type TYPE = new InternalAggregation.Type(NAME);
|
||||
|
@ -163,7 +163,7 @@ public final class IpRangeAggregatorBuilder
|
|||
private boolean keyed = false;
|
||||
private List<Range> ranges = new ArrayList<>();
|
||||
|
||||
public IpRangeAggregatorBuilder(String name) {
|
||||
public IpRangeAggregationBuilder(String name) {
|
||||
super(name, TYPE, ValuesSourceType.BYTES, ValueType.IP);
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ public final class IpRangeAggregatorBuilder
|
|||
return NAME;
|
||||
}
|
||||
|
||||
public IpRangeAggregatorBuilder keyed(boolean keyed) {
|
||||
public IpRangeAggregationBuilder keyed(boolean keyed) {
|
||||
this.keyed = keyed;
|
||||
return this;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public final class IpRangeAggregatorBuilder
|
|||
}
|
||||
|
||||
/** Add a new {@link Range} to this aggregation. */
|
||||
public IpRangeAggregatorBuilder addRange(Range range) {
|
||||
public IpRangeAggregationBuilder addRange(Range range) {
|
||||
ranges.add(range);
|
||||
return this;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ public final class IpRangeAggregatorBuilder
|
|||
* @param to
|
||||
* the upper bound on the distances, exclusive
|
||||
*/
|
||||
public IpRangeAggregatorBuilder addRange(String key, String from, String to) {
|
||||
public IpRangeAggregationBuilder addRange(String key, String from, String to) {
|
||||
addRange(new Range(key, from, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ public final class IpRangeAggregatorBuilder
|
|||
/**
|
||||
* Add a new range to this aggregation using the CIDR notation.
|
||||
*/
|
||||
public IpRangeAggregatorBuilder addMaskRange(String key, String mask) {
|
||||
public IpRangeAggregationBuilder addMaskRange(String key, String mask) {
|
||||
return addRange(new Range(key, mask));
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ public final class IpRangeAggregatorBuilder
|
|||
* Same as {@link #addMaskRange(String, String)} but uses the mask itself as
|
||||
* a key.
|
||||
*/
|
||||
public IpRangeAggregatorBuilder addMaskRange(String mask) {
|
||||
public IpRangeAggregationBuilder addMaskRange(String mask) {
|
||||
return addRange(new Range(mask, mask));
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ public final class IpRangeAggregatorBuilder
|
|||
* Same as {@link #addRange(String, String, String)} but the key will be
|
||||
* automatically generated.
|
||||
*/
|
||||
public IpRangeAggregatorBuilder addRange(String from, String to) {
|
||||
public IpRangeAggregationBuilder addRange(String from, String to) {
|
||||
return addRange(null, from, to);
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ public final class IpRangeAggregatorBuilder
|
|||
* Same as {@link #addRange(String, String, String)} but there will be no
|
||||
* lower bound.
|
||||
*/
|
||||
public IpRangeAggregatorBuilder addUnboundedTo(String key, String to) {
|
||||
public IpRangeAggregationBuilder addUnboundedTo(String key, String to) {
|
||||
addRange(new Range(key, null, to));
|
||||
return this;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ public final class IpRangeAggregatorBuilder
|
|||
* Same as {@link #addUnboundedTo(String, String)} but the key will be
|
||||
* generated automatically.
|
||||
*/
|
||||
public IpRangeAggregatorBuilder addUnboundedTo(String to) {
|
||||
public IpRangeAggregationBuilder addUnboundedTo(String to) {
|
||||
return addUnboundedTo(null, to);
|
||||
}
|
||||
|
||||
|
@ -251,13 +251,13 @@ public final class IpRangeAggregatorBuilder
|
|||
* Same as {@link #addRange(String, String, String)} but there will be no
|
||||
* upper bound.
|
||||
*/
|
||||
public IpRangeAggregatorBuilder addUnboundedFrom(String key, String from) {
|
||||
public IpRangeAggregationBuilder addUnboundedFrom(String key, String from) {
|
||||
addRange(new Range(key, from, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IpRangeAggregatorBuilder script(Script script) {
|
||||
public IpRangeAggregationBuilder script(Script script) {
|
||||
throw new IllegalArgumentException("[ip_range] does not support scripts");
|
||||
}
|
||||
|
||||
|
@ -265,11 +265,11 @@ public final class IpRangeAggregatorBuilder
|
|||
* Same as {@link #addUnboundedFrom(String, String)} but the key will be
|
||||
* generated automatically.
|
||||
*/
|
||||
public IpRangeAggregatorBuilder addUnboundedFrom(String from) {
|
||||
public IpRangeAggregationBuilder addUnboundedFrom(String from) {
|
||||
return addUnboundedFrom(null, from);
|
||||
}
|
||||
|
||||
public IpRangeAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public IpRangeAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, TYPE, ValuesSourceType.BYTES, ValueType.IP);
|
||||
final int numRanges = in.readVInt();
|
||||
for (int i = 0; i < numRanges; ++i) {
|
||||
|
@ -323,7 +323,7 @@ public final class IpRangeAggregatorBuilder
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
IpRangeAggregatorBuilder that = (IpRangeAggregatorBuilder) obj;
|
||||
IpRangeAggregationBuilder that = (IpRangeAggregationBuilder) obj;
|
||||
return keyed == that.keyed
|
||||
&& ranges.equals(that.ranges);
|
||||
}
|
|
@ -30,10 +30,10 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
|||
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
||||
import org.elasticsearch.search.aggregations.support.AbstractValuesSourceParser.BytesValuesSourceParser;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeAggregatorBuilder.Range;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeAggregationBuilder.Range;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
/**
|
||||
|
@ -48,10 +48,10 @@ public class IpRangeParser extends BytesValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ValuesSourceAggregatorBuilder<ValuesSource.Bytes, ?> createFactory(
|
||||
protected ValuesSourceAggregationBuilder<ValuesSource.Bytes, ?> createFactory(
|
||||
String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
IpRangeAggregatorBuilder range = new IpRangeAggregatorBuilder(aggregationName);
|
||||
IpRangeAggregationBuilder range = new IpRangeAggregationBuilder(aggregationName);
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterable<Range> ranges = (Iterable<Range>) otherOptions.get(RangeAggregator.RANGES_FIELD);
|
||||
if (otherOptions.containsKey(RangeAggregator.RANGES_FIELD)) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.elasticsearch.search.aggregations.AggregatorFactory;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation.Type;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
@ -36,25 +36,25 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DiversifiedAggregatorBuilder extends ValuesSourceAggregatorBuilder<ValuesSource, DiversifiedAggregatorBuilder> {
|
||||
public class DiversifiedAggregationBuilder extends ValuesSourceAggregationBuilder<ValuesSource, DiversifiedAggregationBuilder> {
|
||||
public static final String NAME = "diversified_sampler";
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
public static final Type TYPE = new Type(NAME);
|
||||
|
||||
public static final int MAX_DOCS_PER_VALUE_DEFAULT = 1;
|
||||
|
||||
private int shardSize = SamplerAggregatorBuilder.DEFAULT_SHARD_SAMPLE_SIZE;
|
||||
private int shardSize = SamplerAggregationBuilder.DEFAULT_SHARD_SAMPLE_SIZE;
|
||||
private int maxDocsPerValue = MAX_DOCS_PER_VALUE_DEFAULT;
|
||||
private String executionHint = null;
|
||||
|
||||
public DiversifiedAggregatorBuilder(String name) {
|
||||
public DiversifiedAggregationBuilder(String name) {
|
||||
super(name, TYPE, ValuesSourceType.ANY, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public DiversifiedAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public DiversifiedAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, TYPE, ValuesSourceType.ANY, null);
|
||||
shardSize = in.readVInt();
|
||||
maxDocsPerValue = in.readVInt();
|
||||
|
@ -71,7 +71,7 @@ public class DiversifiedAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
/**
|
||||
* Set the max num docs to be returned from each shard.
|
||||
*/
|
||||
public DiversifiedAggregatorBuilder shardSize(int shardSize) {
|
||||
public DiversifiedAggregationBuilder shardSize(int shardSize) {
|
||||
if (shardSize < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[shardSize] must be greater than or equal to 0. Found [" + shardSize + "] in [" + name + "]");
|
||||
|
@ -90,7 +90,7 @@ public class DiversifiedAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
/**
|
||||
* Set the max num docs to be returned per value.
|
||||
*/
|
||||
public DiversifiedAggregatorBuilder maxDocsPerValue(int maxDocsPerValue) {
|
||||
public DiversifiedAggregationBuilder maxDocsPerValue(int maxDocsPerValue) {
|
||||
if (maxDocsPerValue < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[maxDocsPerValue] must be greater than or equal to 0. Found [" + maxDocsPerValue + "] in [" + name + "]");
|
||||
|
@ -109,7 +109,7 @@ public class DiversifiedAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
/**
|
||||
* Set the execution hint.
|
||||
*/
|
||||
public DiversifiedAggregatorBuilder executionHint(String executionHint) {
|
||||
public DiversifiedAggregationBuilder executionHint(String executionHint) {
|
||||
this.executionHint = executionHint;
|
||||
return this;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class DiversifiedAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
DiversifiedAggregatorBuilder other = (DiversifiedAggregatorBuilder) obj;
|
||||
DiversifiedAggregationBuilder other = (DiversifiedAggregationBuilder) obj;
|
||||
return Objects.equals(shardSize, other.shardSize)
|
||||
&& Objects.equals(maxDocsPerValue, other.maxDocsPerValue)
|
||||
&& Objects.equals(executionHint, other.executionHint);
|
||||
|
@ -155,4 +155,4 @@ public class DiversifiedAggregatorBuilder extends ValuesSourceAggregatorBuilder<
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,9 +38,9 @@ public class DiversifiedSamplerParser extends AnyValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected DiversifiedAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
DiversifiedAggregatorBuilder factory = new DiversifiedAggregatorBuilder(aggregationName);
|
||||
protected DiversifiedAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
DiversifiedAggregationBuilder factory = new DiversifiedAggregationBuilder(aggregationName);
|
||||
Integer shardSize = (Integer) otherOptions.get(SamplerAggregator.SHARD_SIZE_FIELD);
|
||||
if (shardSize != null) {
|
||||
factory.shardSize(shardSize);
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
|
@ -34,7 +34,7 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SamplerAggregatorBuilder extends AggregatorBuilder<SamplerAggregatorBuilder> {
|
||||
public class SamplerAggregationBuilder extends AggregationBuilder<SamplerAggregationBuilder> {
|
||||
public static final String NAME = InternalSampler.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -42,14 +42,14 @@ public class SamplerAggregatorBuilder extends AggregatorBuilder<SamplerAggregato
|
|||
|
||||
private int shardSize = DEFAULT_SHARD_SAMPLE_SIZE;
|
||||
|
||||
public SamplerAggregatorBuilder(String name) {
|
||||
public SamplerAggregationBuilder(String name) {
|
||||
super(name, InternalSampler.TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public SamplerAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public SamplerAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalSampler.TYPE);
|
||||
shardSize = in.readVInt();
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class SamplerAggregatorBuilder extends AggregatorBuilder<SamplerAggregato
|
|||
/**
|
||||
* Set the max num docs to be returned from each shard.
|
||||
*/
|
||||
public SamplerAggregatorBuilder shardSize(int shardSize) {
|
||||
public SamplerAggregationBuilder shardSize(int shardSize) {
|
||||
this.shardSize = shardSize;
|
||||
return this;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class SamplerAggregatorBuilder extends AggregatorBuilder<SamplerAggregato
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static SamplerAggregatorBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
public static SamplerAggregationBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
XContentParser.Token token;
|
||||
String currentFieldName = null;
|
||||
Integer shardSize = null;
|
||||
|
@ -110,7 +110,7 @@ public class SamplerAggregatorBuilder extends AggregatorBuilder<SamplerAggregato
|
|||
}
|
||||
}
|
||||
|
||||
SamplerAggregatorBuilder factory = new SamplerAggregatorBuilder(aggregationName);
|
||||
SamplerAggregationBuilder factory = new SamplerAggregationBuilder(aggregationName);
|
||||
if (shardSize != null) {
|
||||
factory.shardSize(shardSize);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class SamplerAggregatorBuilder extends AggregatorBuilder<SamplerAggregato
|
|||
|
||||
@Override
|
||||
protected boolean doEquals(Object obj) {
|
||||
SamplerAggregatorBuilder other = (SamplerAggregatorBuilder) obj;
|
||||
SamplerAggregationBuilder other = (SamplerAggregationBuilder) obj;
|
||||
return Objects.equals(shardSize, other.shardSize);
|
||||
}
|
||||
|
||||
|
@ -132,4 +132,4 @@ public class SamplerAggregatorBuilder extends AggregatorBuilder<SamplerAggregato
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,12 +29,12 @@ import org.elasticsearch.search.aggregations.bucket.significant.heuristics.JLHSc
|
|||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.support.IncludeExclude;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
@ -45,7 +45,7 @@ import java.util.Objects;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<ValuesSource, SignificantTermsAggregatorBuilder> {
|
||||
public class SignificantTermsAggregationBuilder extends ValuesSourceAggregationBuilder<ValuesSource, SignificantTermsAggregationBuilder> {
|
||||
public static final String NAME = SignificantStringTerms.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -62,14 +62,14 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
private TermsAggregator.BucketCountThresholds bucketCountThresholds = new BucketCountThresholds(DEFAULT_BUCKET_COUNT_THRESHOLDS);
|
||||
private SignificanceHeuristic significanceHeuristic = DEFAULT_SIGNIFICANCE_HEURISTIC;
|
||||
|
||||
public SignificantTermsAggregatorBuilder(String name, ValueType valueType) {
|
||||
public SignificantTermsAggregationBuilder(String name, ValueType valueType) {
|
||||
super(name, SignificantStringTerms.TYPE, ValuesSourceType.ANY, valueType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a Stream.
|
||||
*/
|
||||
public SignificantTermsAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public SignificantTermsAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, SignificantStringTerms.TYPE, ValuesSourceType.ANY);
|
||||
bucketCountThresholds = new BucketCountThresholds(in);
|
||||
executionHint = in.readOptionalString();
|
||||
|
@ -100,7 +100,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
return bucketCountThresholds;
|
||||
}
|
||||
|
||||
public SignificantTermsAggregatorBuilder bucketCountThresholds(TermsAggregator.BucketCountThresholds bucketCountThresholds) {
|
||||
public SignificantTermsAggregationBuilder bucketCountThresholds(TermsAggregator.BucketCountThresholds bucketCountThresholds) {
|
||||
if (bucketCountThresholds == null) {
|
||||
throw new IllegalArgumentException("[bucketCountThresholds] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
* Sets the size - indicating how many term buckets should be returned
|
||||
* (defaults to 10)
|
||||
*/
|
||||
public SignificantTermsAggregatorBuilder size(int size) {
|
||||
public SignificantTermsAggregationBuilder size(int size) {
|
||||
if (size < 0) {
|
||||
throw new IllegalArgumentException("[size] must be greater than or equal to 0. Found [" + size + "] in [" + name + "]");
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
* search execution). The higher the shard size is, the more accurate the
|
||||
* results are.
|
||||
*/
|
||||
public SignificantTermsAggregatorBuilder shardSize(int shardSize) {
|
||||
public SignificantTermsAggregationBuilder shardSize(int shardSize) {
|
||||
if (shardSize < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[shardSize] must be greater than or equal to 0. Found [" + shardSize + "] in [" + name + "]");
|
||||
|
@ -139,7 +139,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
* Set the minimum document count terms should have in order to appear in
|
||||
* the response.
|
||||
*/
|
||||
public SignificantTermsAggregatorBuilder minDocCount(long minDocCount) {
|
||||
public SignificantTermsAggregationBuilder minDocCount(long minDocCount) {
|
||||
if (minDocCount < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[minDocCount] must be greater than or equal to 0. Found [" + minDocCount + "] in [" + name + "]");
|
||||
|
@ -152,7 +152,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
* Set the minimum document count terms should have on the shard in order to
|
||||
* appear in the response.
|
||||
*/
|
||||
public SignificantTermsAggregatorBuilder shardMinDocCount(long shardMinDocCount) {
|
||||
public SignificantTermsAggregationBuilder shardMinDocCount(long shardMinDocCount) {
|
||||
if (shardMinDocCount < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[shardMinDocCount] must be greater than or equal to 0. Found [" + shardMinDocCount + "] in [" + name + "]");
|
||||
|
@ -164,7 +164,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
/**
|
||||
* Expert: sets an execution hint to the aggregation.
|
||||
*/
|
||||
public SignificantTermsAggregatorBuilder executionHint(String executionHint) {
|
||||
public SignificantTermsAggregationBuilder executionHint(String executionHint) {
|
||||
this.executionHint = executionHint;
|
||||
return this;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
return executionHint;
|
||||
}
|
||||
|
||||
public SignificantTermsAggregatorBuilder backgroundFilter(QueryBuilder backgroundFilter) {
|
||||
public SignificantTermsAggregationBuilder backgroundFilter(QueryBuilder backgroundFilter) {
|
||||
if (backgroundFilter == null) {
|
||||
throw new IllegalArgumentException("[backgroundFilter] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
/**
|
||||
* Set terms to include and exclude from the aggregation results
|
||||
*/
|
||||
public SignificantTermsAggregatorBuilder includeExclude(IncludeExclude includeExclude) {
|
||||
public SignificantTermsAggregationBuilder includeExclude(IncludeExclude includeExclude) {
|
||||
this.includeExclude = includeExclude;
|
||||
return this;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
return includeExclude;
|
||||
}
|
||||
|
||||
public SignificantTermsAggregatorBuilder significanceHeuristic(SignificanceHeuristic significanceHeuristic) {
|
||||
public SignificantTermsAggregationBuilder significanceHeuristic(SignificanceHeuristic significanceHeuristic) {
|
||||
if (significanceHeuristic == null) {
|
||||
throw new IllegalArgumentException("[significanceHeuristic] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
protected XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {
|
||||
bucketCountThresholds.toXContent(builder, params);
|
||||
if (executionHint != null) {
|
||||
builder.field(TermsAggregatorBuilder.EXECUTION_HINT_FIELD_NAME.getPreferredName(), executionHint);
|
||||
builder.field(TermsAggregationBuilder.EXECUTION_HINT_FIELD_NAME.getPreferredName(), executionHint);
|
||||
}
|
||||
if (filterBuilder != null) {
|
||||
builder.field(BACKGROUND_FILTER.getPreferredName(), filterBuilder);
|
||||
|
@ -245,7 +245,7 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
SignificantTermsAggregatorBuilder other = (SignificantTermsAggregatorBuilder) obj;
|
||||
SignificantTermsAggregationBuilder other = (SignificantTermsAggregationBuilder) obj;
|
||||
return Objects.equals(bucketCountThresholds, other.bucketCountThresholds)
|
||||
&& Objects.equals(executionHint, other.executionHint)
|
||||
&& Objects.equals(filterBuilder, other.filterBuilder)
|
|
@ -178,7 +178,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
|
|||
|
||||
numberOfAggregatorsCreated++;
|
||||
BucketCountThresholds bucketCountThresholds = new BucketCountThresholds(this.bucketCountThresholds);
|
||||
if (bucketCountThresholds.getShardSize() == SignificantTermsAggregatorBuilder.DEFAULT_BUCKET_COUNT_THRESHOLDS.getShardSize()) {
|
||||
if (bucketCountThresholds.getShardSize() == SignificantTermsAggregationBuilder.DEFAULT_BUCKET_COUNT_THRESHOLDS.getShardSize()) {
|
||||
// The user has not made a shardSize selection .
|
||||
// Use default heuristic to avoid any wrong-ranking caused by
|
||||
// distributed counting
|
||||
|
|
|
@ -53,10 +53,11 @@ public class SignificantTermsParser extends AbstractTermsParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SignificantTermsAggregatorBuilder doCreateFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, BucketCountThresholds bucketCountThresholds, SubAggCollectionMode collectMode, String executionHint,
|
||||
IncludeExclude incExc, Map<ParseField, Object> otherOptions) {
|
||||
SignificantTermsAggregatorBuilder factory = new SignificantTermsAggregatorBuilder(aggregationName, targetValueType);
|
||||
protected SignificantTermsAggregationBuilder doCreateFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, BucketCountThresholds bucketCountThresholds,
|
||||
SubAggCollectionMode collectMode, String executionHint,
|
||||
IncludeExclude incExc, Map<ParseField, Object> otherOptions) {
|
||||
SignificantTermsAggregationBuilder factory = new SignificantTermsAggregationBuilder(aggregationName, targetValueType);
|
||||
if (bucketCountThresholds != null) {
|
||||
factory.bucketCountThresholds(bucketCountThresholds);
|
||||
}
|
||||
|
@ -66,11 +67,12 @@ public class SignificantTermsParser extends AbstractTermsParser {
|
|||
if (incExc != null) {
|
||||
factory.includeExclude(incExc);
|
||||
}
|
||||
QueryBuilder backgroundFilter = (QueryBuilder) otherOptions.get(SignificantTermsAggregatorBuilder.BACKGROUND_FILTER);
|
||||
QueryBuilder backgroundFilter = (QueryBuilder) otherOptions.get(SignificantTermsAggregationBuilder.BACKGROUND_FILTER);
|
||||
if (backgroundFilter != null) {
|
||||
factory.backgroundFilter(backgroundFilter);
|
||||
}
|
||||
SignificanceHeuristic significanceHeuristic = (SignificanceHeuristic) otherOptions.get(SignificantTermsAggregatorBuilder.HEURISTIC);
|
||||
SignificanceHeuristic significanceHeuristic =
|
||||
(SignificanceHeuristic) otherOptions.get(SignificantTermsAggregationBuilder.HEURISTIC);
|
||||
if (significanceHeuristic != null) {
|
||||
factory.significanceHeuristic(significanceHeuristic);
|
||||
}
|
||||
|
@ -85,12 +87,12 @@ public class SignificantTermsParser extends AbstractTermsParser {
|
|||
.lookupReturningNullIfNotFound(currentFieldName, parseFieldMatcher);
|
||||
if (significanceHeuristicParser != null) {
|
||||
SignificanceHeuristic significanceHeuristic = significanceHeuristicParser.parse(parser, parseFieldMatcher);
|
||||
otherOptions.put(SignificantTermsAggregatorBuilder.HEURISTIC, significanceHeuristic);
|
||||
otherOptions.put(SignificantTermsAggregationBuilder.HEURISTIC, significanceHeuristic);
|
||||
return true;
|
||||
} else if (parseFieldMatcher.match(currentFieldName, SignificantTermsAggregatorBuilder.BACKGROUND_FILTER)) {
|
||||
} else if (parseFieldMatcher.match(currentFieldName, SignificantTermsAggregationBuilder.BACKGROUND_FILTER)) {
|
||||
QueryParseContext queryParseContext = new QueryParseContext(queriesRegistry, parser, parseFieldMatcher);
|
||||
QueryBuilder filter = queryParseContext.parseInnerQueryBuilder();
|
||||
otherOptions.put(SignificantTermsAggregatorBuilder.BACKGROUND_FILTER, filter);
|
||||
otherOptions.put(SignificantTermsAggregationBuilder.BACKGROUND_FILTER, filter);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +101,6 @@ public class SignificantTermsParser extends AbstractTermsParser {
|
|||
|
||||
@Override
|
||||
protected BucketCountThresholds getDefaultBucketCountThresholds() {
|
||||
return new TermsAggregator.BucketCountThresholds(SignificantTermsAggregatorBuilder.DEFAULT_BUCKET_COUNT_THRESHOLDS);
|
||||
return new TermsAggregator.BucketCountThresholds(SignificantTermsAggregationBuilder.DEFAULT_BUCKET_COUNT_THRESHOLDS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms<UnmappedS
|
|||
public UnmappedSignificantTerms(String name, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) {
|
||||
//We pass zero for index/subset sizes because for the purpose of significant term analysis
|
||||
// we assume an unmapped index's size is irrelevant to the proceedings.
|
||||
super(0, 0, name, DocValueFormat.RAW, requiredSize, minDocCount, SignificantTermsAggregatorBuilder.DEFAULT_SIGNIFICANCE_HEURISTIC,
|
||||
super(0, 0, name, DocValueFormat.RAW, requiredSize, minDocCount, SignificantTermsAggregationBuilder.DEFAULT_SIGNIFICANCE_HEURISTIC,
|
||||
BUCKETS, pipelineAggregators, metaData);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.support.IncludeExclude
|
|||
import org.elasticsearch.search.aggregations.support.AbstractValuesSourceParser.AnyValuesSourceParser;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -50,8 +50,10 @@ public abstract class AbstractTermsParser extends AnyValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected final ValuesSourceAggregatorBuilder<ValuesSource, ?> createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
protected final ValuesSourceAggregationBuilder<ValuesSource, ?> createFactory(String aggregationName,
|
||||
ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType,
|
||||
Map<ParseField, Object> otherOptions) {
|
||||
BucketCountThresholds bucketCountThresholds = getDefaultBucketCountThresholds();
|
||||
Integer requiredSize = (Integer) otherOptions.get(REQUIRED_SIZE_FIELD_NAME);
|
||||
if (requiredSize != null && requiredSize != -1) {
|
||||
|
@ -77,10 +79,14 @@ public abstract class AbstractTermsParser extends AnyValuesSourceParser {
|
|||
otherOptions);
|
||||
}
|
||||
|
||||
protected abstract ValuesSourceAggregatorBuilder<ValuesSource, ?> doCreateFactory(String aggregationName,
|
||||
ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, BucketCountThresholds bucketCountThresholds, SubAggCollectionMode collectMode, String executionHint,
|
||||
IncludeExclude incExc, Map<ParseField, Object> otherOptions);
|
||||
protected abstract ValuesSourceAggregationBuilder<ValuesSource, ?> doCreateFactory(String aggregationName,
|
||||
ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType,
|
||||
BucketCountThresholds bucketCountThresholds,
|
||||
SubAggCollectionMode collectMode,
|
||||
String executionHint,
|
||||
IncludeExclude incExc,
|
||||
Map<ParseField, Object> otherOptions);
|
||||
|
||||
@Override
|
||||
protected boolean token(String aggregationName, String currentFieldName, Token token, XContentParser parser,
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.support.IncludeExclude
|
|||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
@ -38,7 +38,7 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<ValuesSource, TermsAggregatorBuilder> {
|
||||
public class TermsAggregationBuilder extends ValuesSourceAggregationBuilder<ValuesSource, TermsAggregationBuilder> {
|
||||
public static final String NAME = StringTerms.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -61,14 +61,14 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
DEFAULT_BUCKET_COUNT_THRESHOLDS);
|
||||
private boolean showTermDocCountError = false;
|
||||
|
||||
public TermsAggregatorBuilder(String name, ValueType valueType) {
|
||||
public TermsAggregationBuilder(String name, ValueType valueType) {
|
||||
super(name, StringTerms.TYPE, ValuesSourceType.ANY, valueType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public TermsAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public TermsAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, StringTerms.TYPE, ValuesSourceType.ANY);
|
||||
bucketCountThresholds = new BucketCountThresholds(in);
|
||||
collectMode = SubAggCollectionMode.readFromStream(in);
|
||||
|
@ -97,7 +97,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
return bucketCountThresholds;
|
||||
}
|
||||
|
||||
public TermsAggregatorBuilder bucketCountThresholds(TermsAggregator.BucketCountThresholds bucketCountThresholds) {
|
||||
public TermsAggregationBuilder bucketCountThresholds(TermsAggregator.BucketCountThresholds bucketCountThresholds) {
|
||||
if (bucketCountThresholds == null) {
|
||||
throw new IllegalArgumentException("[bucketCountThresholds] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
* Sets the size - indicating how many term buckets should be returned
|
||||
* (defaults to 10)
|
||||
*/
|
||||
public TermsAggregatorBuilder size(int size) {
|
||||
public TermsAggregationBuilder size(int size) {
|
||||
if (size < 0) {
|
||||
throw new IllegalArgumentException("[size] must be greater than or equal to 0. Found [" + size + "] in [" + name + "]");
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
* search execution). The higher the shard size is, the more accurate the
|
||||
* results are.
|
||||
*/
|
||||
public TermsAggregatorBuilder shardSize(int shardSize) {
|
||||
public TermsAggregationBuilder shardSize(int shardSize) {
|
||||
if (shardSize < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[shardSize] must be greater than or equal to 0. Found [" + shardSize + "] in [" + name + "]");
|
||||
|
@ -136,7 +136,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
* Set the minimum document count terms should have in order to appear in
|
||||
* the response.
|
||||
*/
|
||||
public TermsAggregatorBuilder minDocCount(long minDocCount) {
|
||||
public TermsAggregationBuilder minDocCount(long minDocCount) {
|
||||
if (minDocCount < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[minDocCount] must be greater than or equal to 0. Found [" + minDocCount + "] in [" + name + "]");
|
||||
|
@ -149,7 +149,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
* Set the minimum document count terms should have on the shard in order to
|
||||
* appear in the response.
|
||||
*/
|
||||
public TermsAggregatorBuilder shardMinDocCount(long shardMinDocCount) {
|
||||
public TermsAggregationBuilder shardMinDocCount(long shardMinDocCount) {
|
||||
if (shardMinDocCount < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[shardMinDocCount] must be greater than or equal to 0. Found [" + shardMinDocCount + "] in [" + name + "]");
|
||||
|
@ -161,7 +161,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
/**
|
||||
* Sets the order in which the buckets will be returned.
|
||||
*/
|
||||
public TermsAggregatorBuilder order(Terms.Order order) {
|
||||
public TermsAggregationBuilder order(Terms.Order order) {
|
||||
if (order == null) {
|
||||
throw new IllegalArgumentException("[order] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
/**
|
||||
* Sets the order in which the buckets will be returned.
|
||||
*/
|
||||
public TermsAggregatorBuilder order(List<Terms.Order> orders) {
|
||||
public TermsAggregationBuilder order(List<Terms.Order> orders) {
|
||||
if (orders == null) {
|
||||
throw new IllegalArgumentException("[orders] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
/**
|
||||
* Expert: sets an execution hint to the aggregation.
|
||||
*/
|
||||
public TermsAggregatorBuilder executionHint(String executionHint) {
|
||||
public TermsAggregationBuilder executionHint(String executionHint) {
|
||||
this.executionHint = executionHint;
|
||||
return this;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
/**
|
||||
* Expert: set the collection mode.
|
||||
*/
|
||||
public TermsAggregatorBuilder collectMode(SubAggCollectionMode collectMode) {
|
||||
public TermsAggregationBuilder collectMode(SubAggCollectionMode collectMode) {
|
||||
if (collectMode == null) {
|
||||
throw new IllegalArgumentException("[collectMode] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
/**
|
||||
* Set terms to include and exclude from the aggregation results
|
||||
*/
|
||||
public TermsAggregatorBuilder includeExclude(IncludeExclude includeExclude) {
|
||||
public TermsAggregationBuilder includeExclude(IncludeExclude includeExclude) {
|
||||
this.includeExclude = includeExclude;
|
||||
return this;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
/**
|
||||
* Set whether doc count error will be return for individual terms
|
||||
*/
|
||||
public TermsAggregatorBuilder showTermDocCountError(boolean showTermDocCountError) {
|
||||
public TermsAggregationBuilder showTermDocCountError(boolean showTermDocCountError) {
|
||||
this.showTermDocCountError = showTermDocCountError;
|
||||
return this;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
bucketCountThresholds.toXContent(builder, params);
|
||||
builder.field(SHOW_TERM_DOC_COUNT_ERROR.getPreferredName(), showTermDocCountError);
|
||||
if (executionHint != null) {
|
||||
builder.field(TermsAggregatorBuilder.EXECUTION_HINT_FIELD_NAME.getPreferredName(), executionHint);
|
||||
builder.field(TermsAggregationBuilder.EXECUTION_HINT_FIELD_NAME.getPreferredName(), executionHint);
|
||||
}
|
||||
builder.field(ORDER_FIELD.getPreferredName());
|
||||
order.toXContent(builder, params);
|
||||
|
@ -280,7 +280,7 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Values
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
TermsAggregatorBuilder other = (TermsAggregatorBuilder) obj;
|
||||
TermsAggregationBuilder other = (TermsAggregationBuilder) obj;
|
||||
return Objects.equals(bucketCountThresholds, other.bucketCountThresholds)
|
||||
&& Objects.equals(collectMode, other.collectMode)
|
||||
&& Objects.equals(executionHint, other.executionHint)
|
|
@ -139,10 +139,10 @@ public abstract class TermsAggregator extends BucketsAggregator {
|
|||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.field(TermsAggregatorBuilder.REQUIRED_SIZE_FIELD_NAME.getPreferredName(), requiredSize);
|
||||
builder.field(TermsAggregatorBuilder.SHARD_SIZE_FIELD_NAME.getPreferredName(), shardSize);
|
||||
builder.field(TermsAggregatorBuilder.MIN_DOC_COUNT_FIELD_NAME.getPreferredName(), minDocCount);
|
||||
builder.field(TermsAggregatorBuilder.SHARD_MIN_DOC_COUNT_FIELD_NAME.getPreferredName(), shardMinDocCount);
|
||||
builder.field(TermsAggregationBuilder.REQUIRED_SIZE_FIELD_NAME.getPreferredName(), requiredSize);
|
||||
builder.field(TermsAggregationBuilder.SHARD_SIZE_FIELD_NAME.getPreferredName(), shardSize);
|
||||
builder.field(TermsAggregationBuilder.MIN_DOC_COUNT_FIELD_NAME.getPreferredName(), minDocCount);
|
||||
builder.field(TermsAggregationBuilder.SHARD_MIN_DOC_COUNT_FIELD_NAME.getPreferredName(), shardMinDocCount);
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
}
|
||||
BucketCountThresholds bucketCountThresholds = new BucketCountThresholds(this.bucketCountThresholds);
|
||||
if (!(order == InternalOrder.TERM_ASC || order == InternalOrder.TERM_DESC)
|
||||
&& bucketCountThresholds.getShardSize() == TermsAggregatorBuilder.DEFAULT_BUCKET_COUNT_THRESHOLDS.getShardSize()) {
|
||||
&& bucketCountThresholds.getShardSize() == TermsAggregationBuilder.DEFAULT_BUCKET_COUNT_THRESHOLDS.getShardSize()) {
|
||||
// The user has not made a shardSize selection. Use default
|
||||
// heuristic to avoid any wrong-ranking caused by distributed
|
||||
// counting
|
||||
|
|
|
@ -41,12 +41,13 @@ import java.util.Map;
|
|||
*/
|
||||
public class TermsParser extends AbstractTermsParser {
|
||||
@Override
|
||||
protected TermsAggregatorBuilder doCreateFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, BucketCountThresholds bucketCountThresholds, SubAggCollectionMode collectMode, String executionHint,
|
||||
IncludeExclude incExc, Map<ParseField, Object> otherOptions) {
|
||||
TermsAggregatorBuilder factory = new TermsAggregatorBuilder(aggregationName, targetValueType);
|
||||
protected TermsAggregationBuilder doCreateFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, BucketCountThresholds bucketCountThresholds,
|
||||
SubAggCollectionMode collectMode, String executionHint,
|
||||
IncludeExclude incExc, Map<ParseField, Object> otherOptions) {
|
||||
TermsAggregationBuilder factory = new TermsAggregationBuilder(aggregationName, targetValueType);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<OrderElement> orderElements = (List<OrderElement>) otherOptions.get(TermsAggregatorBuilder.ORDER_FIELD);
|
||||
List<OrderElement> orderElements = (List<OrderElement>) otherOptions.get(TermsAggregationBuilder.ORDER_FIELD);
|
||||
if (orderElements != null) {
|
||||
List<Terms.Order> orders = new ArrayList<>(orderElements.size());
|
||||
for (OrderElement orderElement : orderElements) {
|
||||
|
@ -66,7 +67,7 @@ public class TermsParser extends AbstractTermsParser {
|
|||
if (incExc != null) {
|
||||
factory.includeExclude(incExc);
|
||||
}
|
||||
Boolean showTermDocCountError = (Boolean) otherOptions.get(TermsAggregatorBuilder.SHOW_TERM_DOC_COUNT_ERROR);
|
||||
Boolean showTermDocCountError = (Boolean) otherOptions.get(TermsAggregationBuilder.SHOW_TERM_DOC_COUNT_ERROR);
|
||||
if (showTermDocCountError != null) {
|
||||
factory.showTermDocCountError(showTermDocCountError);
|
||||
}
|
||||
|
@ -77,12 +78,12 @@ public class TermsParser extends AbstractTermsParser {
|
|||
public boolean parseSpecial(String aggregationName, XContentParser parser, ParseFieldMatcher parseFieldMatcher, Token token,
|
||||
String currentFieldName, Map<ParseField, Object> otherOptions) throws IOException {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (parseFieldMatcher.match(currentFieldName, TermsAggregatorBuilder.ORDER_FIELD)) {
|
||||
otherOptions.put(TermsAggregatorBuilder.ORDER_FIELD, Collections.singletonList(parseOrderParam(aggregationName, parser)));
|
||||
if (parseFieldMatcher.match(currentFieldName, TermsAggregationBuilder.ORDER_FIELD)) {
|
||||
otherOptions.put(TermsAggregationBuilder.ORDER_FIELD, Collections.singletonList(parseOrderParam(aggregationName, parser)));
|
||||
return true;
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
if (parseFieldMatcher.match(currentFieldName, TermsAggregatorBuilder.ORDER_FIELD)) {
|
||||
if (parseFieldMatcher.match(currentFieldName, TermsAggregationBuilder.ORDER_FIELD)) {
|
||||
List<OrderElement> orderElements = new ArrayList<>();
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
|
@ -93,12 +94,12 @@ public class TermsParser extends AbstractTermsParser {
|
|||
"Order elements must be of type object in [" + aggregationName + "] found token of type [" + token + "].");
|
||||
}
|
||||
}
|
||||
otherOptions.put(TermsAggregatorBuilder.ORDER_FIELD, orderElements);
|
||||
otherOptions.put(TermsAggregationBuilder.ORDER_FIELD, orderElements);
|
||||
return true;
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
||||
if (parseFieldMatcher.match(currentFieldName, TermsAggregatorBuilder.SHOW_TERM_DOC_COUNT_ERROR)) {
|
||||
otherOptions.put(TermsAggregatorBuilder.SHOW_TERM_DOC_COUNT_ERROR, parser.booleanValue());
|
||||
if (parseFieldMatcher.match(currentFieldName, TermsAggregationBuilder.SHOW_TERM_DOC_COUNT_ERROR)) {
|
||||
otherOptions.put(TermsAggregationBuilder.SHOW_TERM_DOC_COUNT_ERROR, parser.booleanValue());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +159,7 @@ public class TermsParser extends AbstractTermsParser {
|
|||
|
||||
@Override
|
||||
public TermsAggregator.BucketCountThresholds getDefaultBucketCountThresholds() {
|
||||
return new TermsAggregator.BucketCountThresholds(TermsAggregatorBuilder.DEFAULT_BUCKET_COUNT_THRESHOLDS);
|
||||
return new TermsAggregator.BucketCountThresholds(TermsAggregationBuilder.DEFAULT_BUCKET_COUNT_THRESHOLDS);
|
||||
}
|
||||
|
||||
static Terms.Order resolveOrder(String key, boolean asc) {
|
||||
|
|
|
@ -29,24 +29,24 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class AvgAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource.Numeric, AvgAggregatorBuilder> {
|
||||
public class AvgAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.Numeric, AvgAggregationBuilder> {
|
||||
public static final String NAME = InternalAvg.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public AvgAggregatorBuilder(String name) {
|
||||
public AvgAggregationBuilder(String name) {
|
||||
super(name, InternalAvg.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public AvgAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public AvgAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalAvg.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,4 @@ public class AvgAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,8 +44,8 @@ public class AvgParser extends NumericValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected AvgAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new AvgAggregatorBuilder(aggregationName);
|
||||
protected AvgAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new AvgAggregationBuilder(aggregationName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,14 +28,16 @@ import org.elasticsearch.search.aggregations.AggregatorFactory;
|
|||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public final class CardinalityAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource, CardinalityAggregatorBuilder> {
|
||||
public final class CardinalityAggregationBuilder
|
||||
extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource, CardinalityAggregationBuilder> {
|
||||
|
||||
public static final String NAME = InternalCardinality.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -43,14 +45,14 @@ public final class CardinalityAggregatorBuilder extends ValuesSourceAggregatorBu
|
|||
|
||||
private Long precisionThreshold = null;
|
||||
|
||||
public CardinalityAggregatorBuilder(String name, ValueType targetValueType) {
|
||||
public CardinalityAggregationBuilder(String name, ValueType targetValueType) {
|
||||
super(name, InternalCardinality.TYPE, ValuesSourceType.ANY, targetValueType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public CardinalityAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public CardinalityAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalCardinality.TYPE, ValuesSourceType.ANY);
|
||||
if (in.readBoolean()) {
|
||||
precisionThreshold = in.readLong();
|
||||
|
@ -75,7 +77,7 @@ public final class CardinalityAggregatorBuilder extends ValuesSourceAggregatorBu
|
|||
* Set a precision threshold. Higher values improve accuracy but also
|
||||
* increase memory usage.
|
||||
*/
|
||||
public CardinalityAggregatorBuilder precisionThreshold(long precisionThreshold) {
|
||||
public CardinalityAggregationBuilder precisionThreshold(long precisionThreshold) {
|
||||
if (precisionThreshold < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[precisionThreshold] must be greater than or equal to 0. Found [" + precisionThreshold + "] in [" + name + "]");
|
||||
|
@ -122,7 +124,7 @@ public final class CardinalityAggregatorBuilder extends ValuesSourceAggregatorBu
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
CardinalityAggregatorBuilder other = (CardinalityAggregatorBuilder) obj;
|
||||
CardinalityAggregationBuilder other = (CardinalityAggregationBuilder) obj;
|
||||
return Objects.equals(precisionThreshold, other.precisionThreshold);
|
||||
}
|
||||
|
|
@ -40,10 +40,10 @@ public class CardinalityParser extends AnyValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected CardinalityAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
CardinalityAggregatorBuilder factory = new CardinalityAggregatorBuilder(aggregationName, targetValueType);
|
||||
Long precisionThreshold = (Long) otherOptions.get(CardinalityAggregatorBuilder.PRECISION_THRESHOLD_FIELD);
|
||||
protected CardinalityAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
CardinalityAggregationBuilder factory = new CardinalityAggregationBuilder(aggregationName, targetValueType);
|
||||
Long precisionThreshold = (Long) otherOptions.get(CardinalityAggregationBuilder.PRECISION_THRESHOLD_FIELD);
|
||||
if (precisionThreshold != null) {
|
||||
factory.precisionThreshold(precisionThreshold);
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ public class CardinalityParser extends AnyValuesSourceParser {
|
|||
protected boolean token(String aggregationName, String currentFieldName, Token token, XContentParser parser,
|
||||
ParseFieldMatcher parseFieldMatcher, Map<ParseField, Object> otherOptions) throws IOException {
|
||||
if (token.isValue()) {
|
||||
if (parseFieldMatcher.match(currentFieldName, CardinalityAggregatorBuilder.PRECISION_THRESHOLD_FIELD)) {
|
||||
otherOptions.put(CardinalityAggregatorBuilder.PRECISION_THRESHOLD_FIELD, parser.longValue());
|
||||
if (parseFieldMatcher.match(currentFieldName, CardinalityAggregationBuilder.PRECISION_THRESHOLD_FIELD)) {
|
||||
otherOptions.put(CardinalityAggregationBuilder.PRECISION_THRESHOLD_FIELD, parser.longValue());
|
||||
return true;
|
||||
} else if (parseFieldMatcher.match(currentFieldName, REHASH)) {
|
||||
// ignore
|
||||
|
|
|
@ -28,27 +28,27 @@ import org.elasticsearch.search.aggregations.AggregatorFactory;
|
|||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class GeoBoundsAggregatorBuilder extends ValuesSourceAggregatorBuilder<ValuesSource.GeoPoint, GeoBoundsAggregatorBuilder> {
|
||||
public class GeoBoundsAggregationBuilder extends ValuesSourceAggregationBuilder<ValuesSource.GeoPoint, GeoBoundsAggregationBuilder> {
|
||||
public static final String NAME = InternalGeoBounds.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIED = new ParseField(NAME);
|
||||
|
||||
private boolean wrapLongitude = true;
|
||||
|
||||
public GeoBoundsAggregatorBuilder(String name) {
|
||||
public GeoBoundsAggregationBuilder(String name) {
|
||||
super(name, InternalGeoBounds.TYPE, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public GeoBoundsAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public GeoBoundsAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalGeoBounds.TYPE, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT);
|
||||
wrapLongitude = in.readBoolean();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class GeoBoundsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Va
|
|||
/**
|
||||
* Set whether to wrap longitudes. Defaults to true.
|
||||
*/
|
||||
public GeoBoundsAggregatorBuilder wrapLongitude(boolean wrapLongitude) {
|
||||
public GeoBoundsAggregationBuilder wrapLongitude(boolean wrapLongitude) {
|
||||
this.wrapLongitude = wrapLongitude;
|
||||
return this;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class GeoBoundsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Va
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
GeoBoundsAggregatorBuilder other = (GeoBoundsAggregatorBuilder) obj;
|
||||
GeoBoundsAggregationBuilder other = (GeoBoundsAggregationBuilder) obj;
|
||||
return Objects.equals(wrapLongitude, other.wrapLongitude);
|
||||
}
|
||||
|
||||
|
@ -100,4 +100,4 @@ public class GeoBoundsAggregatorBuilder extends ValuesSourceAggregatorBuilder<Va
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,9 +37,9 @@ public class GeoBoundsParser extends GeoPointValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected GeoBoundsAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
GeoBoundsAggregatorBuilder factory = new GeoBoundsAggregatorBuilder(aggregationName);
|
||||
protected GeoBoundsAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
GeoBoundsAggregationBuilder factory = new GeoBoundsAggregationBuilder(aggregationName);
|
||||
Boolean wrapLongitude = (Boolean) otherOptions.get(GeoBoundsAggregator.WRAP_LONGITUDE_FIELD);
|
||||
if (wrapLongitude != null) {
|
||||
factory.wrapLongitude(wrapLongitude);
|
||||
|
|
|
@ -28,25 +28,25 @@ import org.elasticsearch.search.aggregations.AggregatorFactory;
|
|||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GeoCentroidAggregatorBuilder
|
||||
extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource.GeoPoint, GeoCentroidAggregatorBuilder> {
|
||||
public class GeoCentroidAggregationBuilder
|
||||
extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.GeoPoint, GeoCentroidAggregationBuilder> {
|
||||
public static final String NAME = InternalGeoCentroid.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public GeoCentroidAggregatorBuilder(String name) {
|
||||
public GeoCentroidAggregationBuilder(String name) {
|
||||
super(name, InternalGeoCentroid.TYPE, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public GeoCentroidAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public GeoCentroidAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalGeoCentroid.TYPE, ValuesSourceType.GEOPOINT, ValueType.GEOPOINT);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,4 @@ public class GeoCentroidAggregatorBuilder
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,8 +46,8 @@ public class GeoCentroidParser extends GeoPointValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected GeoCentroidAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new GeoCentroidAggregatorBuilder(aggregationName);
|
||||
protected GeoCentroidAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new GeoCentroidAggregationBuilder(aggregationName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,24 +29,24 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class MaxAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource.Numeric, MaxAggregatorBuilder> {
|
||||
public class MaxAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.Numeric, MaxAggregationBuilder> {
|
||||
public static final String NAME = InternalMax.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public MaxAggregatorBuilder(String name) {
|
||||
public MaxAggregationBuilder(String name) {
|
||||
super(name, InternalMax.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public MaxAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public MaxAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalMax.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,4 @@ public class MaxAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,8 +44,8 @@ public class MaxParser extends NumericValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected MaxAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new MaxAggregatorBuilder(aggregationName);
|
||||
protected MaxAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new MaxAggregationBuilder(aggregationName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,24 +29,24 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class MinAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource.Numeric, MinAggregatorBuilder> {
|
||||
public class MinAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.Numeric, MinAggregationBuilder> {
|
||||
public static final String NAME = InternalMin.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public MinAggregatorBuilder(String name) {
|
||||
public MinAggregationBuilder(String name) {
|
||||
super(name, InternalMin.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public MinAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public MinAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalMin.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,4 @@ public class MinAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,8 +45,8 @@ public class MinParser extends NumericValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected MinAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new MinAggregatorBuilder(aggregationName);
|
||||
protected MinAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new MinAggregationBuilder(aggregationName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.common.xcontent.XContentParser.Token;
|
|||
import org.elasticsearch.search.aggregations.support.AbstractValuesSourceParser.NumericValuesSourceParser;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -115,8 +115,8 @@ public abstract class AbstractPercentilesParser extends NumericValuesSourceParse
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ValuesSourceAggregatorBuilder<Numeric, ?> createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
protected ValuesSourceAggregationBuilder<Numeric, ?> createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
PercentilesMethod method = (PercentilesMethod) otherOptions.getOrDefault(METHOD_FIELD, PercentilesMethod.TDIGEST);
|
||||
|
||||
double[] cdfValues = (double[]) otherOptions.get(keysField());
|
||||
|
@ -126,10 +126,10 @@ public abstract class AbstractPercentilesParser extends NumericValuesSourceParse
|
|||
return buildFactory(aggregationName, cdfValues, method, compression, numberOfSignificantValueDigits, keyed);
|
||||
}
|
||||
|
||||
protected abstract ValuesSourceAggregatorBuilder<Numeric, ?> buildFactory(String aggregationName, double[] cdfValues,
|
||||
PercentilesMethod method,
|
||||
Double compression,
|
||||
Integer numberOfSignificantValueDigits, Boolean keyed);
|
||||
protected abstract ValuesSourceAggregationBuilder<Numeric, ?> buildFactory(String aggregationName, double[] cdfValues,
|
||||
PercentilesMethod method,
|
||||
Double compression,
|
||||
Integer numberOfSignificantValueDigits, Boolean keyed);
|
||||
|
||||
protected abstract ParseField keysField();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder.LeafOnly;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.LeafOnly;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
@ -41,7 +41,7 @@ import java.io.IOException;
|
|||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PercentileRanksAggregatorBuilder extends LeafOnly<ValuesSource.Numeric, PercentileRanksAggregatorBuilder> {
|
||||
public class PercentileRanksAggregationBuilder extends LeafOnly<ValuesSource.Numeric, PercentileRanksAggregationBuilder> {
|
||||
public static final String NAME = InternalTDigestPercentileRanks.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -51,14 +51,14 @@ public class PercentileRanksAggregatorBuilder extends LeafOnly<ValuesSource.Nume
|
|||
private double compression = 100.0;
|
||||
private boolean keyed = true;
|
||||
|
||||
public PercentileRanksAggregatorBuilder(String name) {
|
||||
public PercentileRanksAggregationBuilder(String name) {
|
||||
super(name, InternalTDigestPercentileRanks.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public PercentileRanksAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public PercentileRanksAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalTDigestPercentileRanks.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
values = in.readDoubleArray();
|
||||
keyed = in.readBoolean();
|
||||
|
@ -79,7 +79,7 @@ public class PercentileRanksAggregatorBuilder extends LeafOnly<ValuesSource.Nume
|
|||
/**
|
||||
* Set the values to compute percentiles from.
|
||||
*/
|
||||
public PercentileRanksAggregatorBuilder values(double... values) {
|
||||
public PercentileRanksAggregationBuilder values(double... values) {
|
||||
if (values == null) {
|
||||
throw new IllegalArgumentException("[values] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class PercentileRanksAggregatorBuilder extends LeafOnly<ValuesSource.Nume
|
|||
/**
|
||||
* Set whether the XContent response should be keyed
|
||||
*/
|
||||
public PercentileRanksAggregatorBuilder keyed(boolean keyed) {
|
||||
public PercentileRanksAggregationBuilder keyed(boolean keyed) {
|
||||
this.keyed = keyed;
|
||||
return this;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class PercentileRanksAggregatorBuilder extends LeafOnly<ValuesSource.Nume
|
|||
* Expert: set the number of significant digits in the values. Only relevant
|
||||
* when using {@link PercentilesMethod#HDR}.
|
||||
*/
|
||||
public PercentileRanksAggregatorBuilder numberOfSignificantValueDigits(int numberOfSignificantValueDigits) {
|
||||
public PercentileRanksAggregationBuilder numberOfSignificantValueDigits(int numberOfSignificantValueDigits) {
|
||||
if (numberOfSignificantValueDigits < 0 || numberOfSignificantValueDigits > 5) {
|
||||
throw new IllegalArgumentException("[numberOfSignificantValueDigits] must be between 0 and 5: [" + name + "]");
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class PercentileRanksAggregatorBuilder extends LeafOnly<ValuesSource.Nume
|
|||
* Expert: set the compression. Higher values improve accuracy but also
|
||||
* memory usage. Only relevant when using {@link PercentilesMethod#TDIGEST}.
|
||||
*/
|
||||
public PercentileRanksAggregatorBuilder compression(double compression) {
|
||||
public PercentileRanksAggregationBuilder compression(double compression) {
|
||||
if (compression < 0.0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[compression] must be greater than or equal to 0. Found [" + compression + "] in [" + name + "]");
|
||||
|
@ -152,7 +152,7 @@ public class PercentileRanksAggregatorBuilder extends LeafOnly<ValuesSource.Nume
|
|||
return compression;
|
||||
}
|
||||
|
||||
public PercentileRanksAggregatorBuilder method(PercentilesMethod method) {
|
||||
public PercentileRanksAggregationBuilder method(PercentilesMethod method) {
|
||||
if (method == null) {
|
||||
throw new IllegalArgumentException("[method] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public class PercentileRanksAggregatorBuilder extends LeafOnly<ValuesSource.Nume
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
PercentileRanksAggregatorBuilder other = (PercentileRanksAggregatorBuilder) obj;
|
||||
PercentileRanksAggregationBuilder other = (PercentileRanksAggregationBuilder) obj;
|
||||
if (!Objects.equals(method, other.method)) {
|
||||
return false;
|
||||
}
|
|
@ -20,7 +20,7 @@ package org.elasticsearch.search.aggregations.metrics.percentiles;
|
|||
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -39,9 +39,10 @@ public class PercentileRanksParser extends AbstractPercentilesParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ValuesSourceAggregatorBuilder<Numeric, ?> buildFactory(String aggregationName, double[] keys, PercentilesMethod method,
|
||||
Double compression, Integer numberOfSignificantValueDigits, Boolean keyed) {
|
||||
PercentileRanksAggregatorBuilder factory = new PercentileRanksAggregatorBuilder(aggregationName);
|
||||
protected ValuesSourceAggregationBuilder<Numeric, ?> buildFactory(String aggregationName, double[] keys, PercentilesMethod method,
|
||||
Double compression, Integer numberOfSignificantValueDigits,
|
||||
Boolean keyed) {
|
||||
PercentileRanksAggregationBuilder factory = new PercentileRanksAggregationBuilder(aggregationName);
|
||||
if (keys != null) {
|
||||
factory.values(keys);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder.LeafOnly;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.LeafOnly;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
@ -41,7 +41,7 @@ import java.io.IOException;
|
|||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PercentilesAggregatorBuilder extends LeafOnly<ValuesSource.Numeric, PercentilesAggregatorBuilder> {
|
||||
public class PercentilesAggregationBuilder extends LeafOnly<ValuesSource.Numeric, PercentilesAggregationBuilder> {
|
||||
public static final String NAME = InternalTDigestPercentiles.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -51,14 +51,14 @@ public class PercentilesAggregatorBuilder extends LeafOnly<ValuesSource.Numeric,
|
|||
private double compression = 100.0;
|
||||
private boolean keyed = true;
|
||||
|
||||
public PercentilesAggregatorBuilder(String name) {
|
||||
public PercentilesAggregationBuilder(String name) {
|
||||
super(name, InternalTDigestPercentiles.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public PercentilesAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public PercentilesAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalTDigestPercentiles.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
percents = in.readDoubleArray();
|
||||
keyed = in.readBoolean();
|
||||
|
@ -79,7 +79,7 @@ public class PercentilesAggregatorBuilder extends LeafOnly<ValuesSource.Numeric,
|
|||
/**
|
||||
* Set the values to compute percentiles from.
|
||||
*/
|
||||
public PercentilesAggregatorBuilder percentiles(double... percents) {
|
||||
public PercentilesAggregationBuilder percentiles(double... percents) {
|
||||
if (percents == null) {
|
||||
throw new IllegalArgumentException("[percents] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class PercentilesAggregatorBuilder extends LeafOnly<ValuesSource.Numeric,
|
|||
/**
|
||||
* Set whether the XContent response should be keyed
|
||||
*/
|
||||
public PercentilesAggregatorBuilder keyed(boolean keyed) {
|
||||
public PercentilesAggregationBuilder keyed(boolean keyed) {
|
||||
this.keyed = keyed;
|
||||
return this;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class PercentilesAggregatorBuilder extends LeafOnly<ValuesSource.Numeric,
|
|||
* Expert: set the number of significant digits in the values. Only relevant
|
||||
* when using {@link PercentilesMethod#HDR}.
|
||||
*/
|
||||
public PercentilesAggregatorBuilder numberOfSignificantValueDigits(int numberOfSignificantValueDigits) {
|
||||
public PercentilesAggregationBuilder numberOfSignificantValueDigits(int numberOfSignificantValueDigits) {
|
||||
if (numberOfSignificantValueDigits < 0 || numberOfSignificantValueDigits > 5) {
|
||||
throw new IllegalArgumentException("[numberOfSignificantValueDigits] must be between 0 and 5: [" + name + "]");
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class PercentilesAggregatorBuilder extends LeafOnly<ValuesSource.Numeric,
|
|||
* Expert: set the compression. Higher values improve accuracy but also
|
||||
* memory usage. Only relevant when using {@link PercentilesMethod#TDIGEST}.
|
||||
*/
|
||||
public PercentilesAggregatorBuilder compression(double compression) {
|
||||
public PercentilesAggregationBuilder compression(double compression) {
|
||||
if (compression < 0.0) {
|
||||
throw new IllegalArgumentException(
|
||||
"[compression] must be greater than or equal to 0. Found [" + compression + "] in [" + name + "]");
|
||||
|
@ -152,7 +152,7 @@ public class PercentilesAggregatorBuilder extends LeafOnly<ValuesSource.Numeric,
|
|||
return compression;
|
||||
}
|
||||
|
||||
public PercentilesAggregatorBuilder method(PercentilesMethod method) {
|
||||
public PercentilesAggregationBuilder method(PercentilesMethod method) {
|
||||
if (method == null) {
|
||||
throw new IllegalArgumentException("[method] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public class PercentilesAggregatorBuilder extends LeafOnly<ValuesSource.Numeric,
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
PercentilesAggregatorBuilder other = (PercentilesAggregatorBuilder) obj;
|
||||
PercentilesAggregationBuilder other = (PercentilesAggregationBuilder) obj;
|
||||
if (!Objects.equals(method, other.method)) {
|
||||
return false;
|
||||
}
|
|
@ -20,7 +20,7 @@ package org.elasticsearch.search.aggregations.metrics.percentiles;
|
|||
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -41,9 +41,10 @@ public class PercentilesParser extends AbstractPercentilesParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ValuesSourceAggregatorBuilder<Numeric, ?> buildFactory(String aggregationName, double[] keys, PercentilesMethod method,
|
||||
Double compression, Integer numberOfSignificantValueDigits, Boolean keyed) {
|
||||
PercentilesAggregatorBuilder factory = new PercentilesAggregatorBuilder(aggregationName);
|
||||
protected ValuesSourceAggregationBuilder<Numeric, ?> buildFactory(String aggregationName, double[] keys, PercentilesMethod method,
|
||||
Double compression, Integer numberOfSignificantValueDigits,
|
||||
Boolean keyed) {
|
||||
PercentilesAggregationBuilder factory = new PercentilesAggregationBuilder(aggregationName);
|
||||
if (keys != null) {
|
||||
factory.percentiles(keys);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.index.query.QueryParseContext;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptParameterParser;
|
||||
import org.elasticsearch.script.ScriptParameterParser.ScriptParameterValue;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
|
@ -40,7 +40,7 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedMetricAggregatorBuilder> {
|
||||
public class ScriptedMetricAggregationBuilder extends AggregationBuilder<ScriptedMetricAggregationBuilder> {
|
||||
|
||||
public static final String NAME = InternalScriptedMetric.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
@ -58,14 +58,14 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
private Script reduceScript;
|
||||
private Map<String, Object> params;
|
||||
|
||||
public ScriptedMetricAggregatorBuilder(String name) {
|
||||
public ScriptedMetricAggregationBuilder(String name) {
|
||||
super(name, InternalScriptedMetric.TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public ScriptedMetricAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public ScriptedMetricAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalScriptedMetric.TYPE);
|
||||
initScript = in.readOptionalWriteable(Script::new);
|
||||
mapScript = in.readOptionalWriteable(Script::new);
|
||||
|
@ -92,7 +92,7 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
/**
|
||||
* Set the <tt>init</tt> script.
|
||||
*/
|
||||
public ScriptedMetricAggregatorBuilder initScript(Script initScript) {
|
||||
public ScriptedMetricAggregationBuilder initScript(Script initScript) {
|
||||
if (initScript == null) {
|
||||
throw new IllegalArgumentException("[initScript] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
/**
|
||||
* Set the <tt>map</tt> script.
|
||||
*/
|
||||
public ScriptedMetricAggregatorBuilder mapScript(Script mapScript) {
|
||||
public ScriptedMetricAggregationBuilder mapScript(Script mapScript) {
|
||||
if (mapScript == null) {
|
||||
throw new IllegalArgumentException("[mapScript] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
/**
|
||||
* Set the <tt>combine</tt> script.
|
||||
*/
|
||||
public ScriptedMetricAggregatorBuilder combineScript(Script combineScript) {
|
||||
public ScriptedMetricAggregationBuilder combineScript(Script combineScript) {
|
||||
if (combineScript == null) {
|
||||
throw new IllegalArgumentException("[combineScript] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
/**
|
||||
* Set the <tt>reduce</tt> script.
|
||||
*/
|
||||
public ScriptedMetricAggregatorBuilder reduceScript(Script reduceScript) {
|
||||
public ScriptedMetricAggregationBuilder reduceScript(Script reduceScript) {
|
||||
if (reduceScript == null) {
|
||||
throw new IllegalArgumentException("[reduceScript] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
* Set parameters that will be available in the <tt>init</tt>,
|
||||
* <tt>map</tt> and <tt>combine</tt> phases.
|
||||
*/
|
||||
public ScriptedMetricAggregatorBuilder params(Map<String, Object> params) {
|
||||
public ScriptedMetricAggregationBuilder params(Map<String, Object> params) {
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException("[params] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static ScriptedMetricAggregatorBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
public static ScriptedMetricAggregationBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
Script initScript = null;
|
||||
Script mapScript = null;
|
||||
Script combineScript = null;
|
||||
|
@ -305,7 +305,7 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
throw new ParsingException(parser.getTokenLocation(), "map_script field is required in [" + aggregationName + "].");
|
||||
}
|
||||
|
||||
ScriptedMetricAggregatorBuilder factory = new ScriptedMetricAggregatorBuilder(aggregationName);
|
||||
ScriptedMetricAggregationBuilder factory = new ScriptedMetricAggregationBuilder(aggregationName);
|
||||
if (initScript != null) {
|
||||
factory.initScript(initScript);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
|
||||
@Override
|
||||
protected boolean doEquals(Object obj) {
|
||||
ScriptedMetricAggregatorBuilder other = (ScriptedMetricAggregatorBuilder) obj;
|
||||
ScriptedMetricAggregationBuilder other = (ScriptedMetricAggregationBuilder) obj;
|
||||
return Objects.equals(initScript, other.initScript)
|
||||
&& Objects.equals(mapScript, other.mapScript)
|
||||
&& Objects.equals(combineScript, other.combineScript)
|
||||
|
@ -344,4 +344,4 @@ public class ScriptedMetricAggregatorBuilder extends AggregatorBuilder<ScriptedM
|
|||
&& Objects.equals(params, other.params);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -29,24 +29,24 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class StatsAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource.Numeric, StatsAggregatorBuilder> {
|
||||
public class StatsAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.Numeric, StatsAggregationBuilder> {
|
||||
public static final String NAME = InternalStats.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public StatsAggregatorBuilder(String name) {
|
||||
public StatsAggregationBuilder(String name) {
|
||||
super(name, InternalStats.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public StatsAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public StatsAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalStats.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,4 @@ public class StatsAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOn
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,8 +44,8 @@ public class StatsParser extends NumericValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected StatsAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new StatsAggregatorBuilder(aggregationName);
|
||||
protected StatsAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new StatsAggregationBuilder(aggregationName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,28 +29,28 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ExtendedStatsAggregatorBuilder
|
||||
extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource.Numeric, ExtendedStatsAggregatorBuilder> {
|
||||
public class ExtendedStatsAggregationBuilder
|
||||
extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.Numeric, ExtendedStatsAggregationBuilder> {
|
||||
public static final String NAME = InternalExtendedStats.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
private double sigma = 2.0;
|
||||
|
||||
public ExtendedStatsAggregatorBuilder(String name) {
|
||||
public ExtendedStatsAggregationBuilder(String name) {
|
||||
super(name, InternalExtendedStats.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public ExtendedStatsAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public ExtendedStatsAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalExtendedStats.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
sigma = in.readDouble();
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class ExtendedStatsAggregatorBuilder
|
|||
out.writeDouble(sigma);
|
||||
}
|
||||
|
||||
public ExtendedStatsAggregatorBuilder sigma(double sigma) {
|
||||
public ExtendedStatsAggregationBuilder sigma(double sigma) {
|
||||
if (sigma < 0.0) {
|
||||
throw new IllegalArgumentException("[sigma] must be greater than or equal to 0. Found [" + sigma + "] in [" + name + "]");
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class ExtendedStatsAggregatorBuilder
|
|||
|
||||
@Override
|
||||
protected boolean innerEquals(Object obj) {
|
||||
ExtendedStatsAggregatorBuilder other = (ExtendedStatsAggregatorBuilder) obj;
|
||||
ExtendedStatsAggregationBuilder other = (ExtendedStatsAggregationBuilder) obj;
|
||||
return Objects.equals(sigma, other.sigma);
|
||||
}
|
||||
|
||||
|
@ -99,4 +99,4 @@ public class ExtendedStatsAggregatorBuilder
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,9 +50,9 @@ public class ExtendedStatsParser extends NumericValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ExtendedStatsAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
ExtendedStatsAggregatorBuilder factory = new ExtendedStatsAggregatorBuilder(aggregationName);
|
||||
protected ExtendedStatsAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
ExtendedStatsAggregationBuilder factory = new ExtendedStatsAggregationBuilder(aggregationName);
|
||||
Double sigma = (Double) otherOptions.get(ExtendedStatsAggregator.SIGMA_FIELD);
|
||||
if (sigma != null) {
|
||||
factory.sigma(sigma);
|
||||
|
|
|
@ -29,24 +29,24 @@ import org.elasticsearch.search.aggregations.support.AggregationContext;
|
|||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SumAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource.Numeric, SumAggregatorBuilder> {
|
||||
public class SumAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.Numeric, SumAggregationBuilder> {
|
||||
public static final String NAME = InternalSum.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public SumAggregatorBuilder(String name) {
|
||||
public SumAggregationBuilder(String name) {
|
||||
super(name, InternalSum.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public SumAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public SumAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalSum.TYPE, ValuesSourceType.NUMERIC, ValueType.NUMERIC);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,4 @@ public class SumAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,8 +44,8 @@ public class SumParser extends NumericValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SumAggregatorBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new SumAggregatorBuilder(aggregationName);
|
||||
protected SumAggregationBuilder createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new SumAggregationBuilder(aggregationName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
|||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.search.aggregations.AggregationInitializationException;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
|
@ -51,7 +51,7 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregatorBuilder> {
|
||||
public class TopHitsAggregationBuilder extends AggregationBuilder<TopHitsAggregationBuilder> {
|
||||
public static final String NAME = InternalTopHits.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
|
@ -67,14 +67,14 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
private Set<ScriptField> scriptFields;
|
||||
private FetchSourceContext fetchSourceContext;
|
||||
|
||||
public TopHitsAggregatorBuilder(String name) {
|
||||
public TopHitsAggregationBuilder(String name) {
|
||||
super(name, InternalTopHits.TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public TopHitsAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalTopHits.TYPE);
|
||||
explain = in.readBoolean();
|
||||
fetchSourceContext = in.readOptionalStreamable(FetchSourceContext::new);
|
||||
|
@ -159,7 +159,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
/**
|
||||
* From index to start the search from. Defaults to <tt>0</tt>.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder from(int from) {
|
||||
public TopHitsAggregationBuilder from(int from) {
|
||||
if (from < 0) {
|
||||
throw new IllegalArgumentException("[from] must be greater than or equal to 0. Found [" + from + "] in [" + name + "]");
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
/**
|
||||
* The number of search hits to return. Defaults to <tt>10</tt>.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder size(int size) {
|
||||
public TopHitsAggregationBuilder size(int size) {
|
||||
if (size < 0) {
|
||||
throw new IllegalArgumentException("[size] must be greater than or equal to 0. Found [" + size + "] in [" + name + "]");
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* @param order
|
||||
* The sort ordering
|
||||
*/
|
||||
public TopHitsAggregatorBuilder sort(String name, SortOrder order) {
|
||||
public TopHitsAggregationBuilder sort(String name, SortOrder order) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("sort [name] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* @param name
|
||||
* The name of the field to sort by
|
||||
*/
|
||||
public TopHitsAggregatorBuilder sort(String name) {
|
||||
public TopHitsAggregationBuilder sort(String name) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("sort [name] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
/**
|
||||
* Adds a sort builder.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder sort(SortBuilder<?> sort) {
|
||||
public TopHitsAggregationBuilder sort(SortBuilder<?> sort) {
|
||||
if (sort == null) {
|
||||
throw new IllegalArgumentException("[sort] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
/**
|
||||
* Adds a sort builder.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder sorts(List<SortBuilder<?>> sorts) {
|
||||
public TopHitsAggregationBuilder sorts(List<SortBuilder<?>> sorts) {
|
||||
if (sorts == null) {
|
||||
throw new IllegalArgumentException("[sorts] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
/**
|
||||
* Adds highlight to perform as part of the search.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder highlighter(HighlightBuilder highlightBuilder) {
|
||||
public TopHitsAggregationBuilder highlighter(HighlightBuilder highlightBuilder) {
|
||||
if (highlightBuilder == null) {
|
||||
throw new IllegalArgumentException("[highlightBuilder] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* Indicates whether the response should contain the stored _source for
|
||||
* every hit
|
||||
*/
|
||||
public TopHitsAggregatorBuilder fetchSource(boolean fetch) {
|
||||
public TopHitsAggregationBuilder fetchSource(boolean fetch) {
|
||||
if (this.fetchSourceContext == null) {
|
||||
this.fetchSourceContext = new FetchSourceContext(fetch);
|
||||
} else {
|
||||
|
@ -311,7 +311,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* An optional exclude (optionally wildcarded) pattern to
|
||||
* filter the returned _source
|
||||
*/
|
||||
public TopHitsAggregatorBuilder fetchSource(@Nullable String include, @Nullable String exclude) {
|
||||
public TopHitsAggregationBuilder fetchSource(@Nullable String include, @Nullable String exclude) {
|
||||
fetchSource(include == null ? Strings.EMPTY_ARRAY : new String[] { include },
|
||||
exclude == null ? Strings.EMPTY_ARRAY : new String[] { exclude });
|
||||
return this;
|
||||
|
@ -329,7 +329,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* An optional list of exclude (optionally wildcarded)
|
||||
* pattern to filter the returned _source
|
||||
*/
|
||||
public TopHitsAggregatorBuilder fetchSource(@Nullable String[] includes, @Nullable String[] excludes) {
|
||||
public TopHitsAggregationBuilder fetchSource(@Nullable String[] includes, @Nullable String[] excludes) {
|
||||
fetchSourceContext = new FetchSourceContext(includes, excludes);
|
||||
return this;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
/**
|
||||
* Indicate how the _source should be fetched.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder fetchSource(@Nullable FetchSourceContext fetchSourceContext) {
|
||||
public TopHitsAggregationBuilder fetchSource(@Nullable FetchSourceContext fetchSourceContext) {
|
||||
if (fetchSourceContext == null) {
|
||||
throw new IllegalArgumentException("[fetchSourceContext] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* the search request. If none are specified, the source of the document
|
||||
* will be return.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder field(String field) {
|
||||
public TopHitsAggregationBuilder field(String field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException("[field] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* Sets the fields to load and return as part of the search request. If
|
||||
* none are specified, the source of the document will be returned.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder fields(List<String> fields) {
|
||||
public TopHitsAggregationBuilder fields(List<String> fields) {
|
||||
if (fields == null) {
|
||||
throw new IllegalArgumentException("[fields] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* Sets no fields to be loaded, resulting in only id and type to be
|
||||
* returned per field.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder noFields() {
|
||||
public TopHitsAggregationBuilder noFields() {
|
||||
this.fieldNames = Collections.emptyList();
|
||||
return this;
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* Adds a field to load from the field data cache and return as part of
|
||||
* the search request.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder fieldDataField(String fieldDataField) {
|
||||
public TopHitsAggregationBuilder fieldDataField(String fieldDataField) {
|
||||
if (fieldDataField == null) {
|
||||
throw new IllegalArgumentException("[fieldDataField] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* Adds fields to load from the field data cache and return as part of
|
||||
* the search request.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder fieldDataFields(List<String> fieldDataFields) {
|
||||
public TopHitsAggregationBuilder fieldDataFields(List<String> fieldDataFields) {
|
||||
if (fieldDataFields == null) {
|
||||
throw new IllegalArgumentException("[fieldDataFields] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* @param script
|
||||
* The script
|
||||
*/
|
||||
public TopHitsAggregatorBuilder scriptField(String name, Script script) {
|
||||
public TopHitsAggregationBuilder scriptField(String name, Script script) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("scriptField [name] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* @param script
|
||||
* The script
|
||||
*/
|
||||
public TopHitsAggregatorBuilder scriptField(String name, Script script, boolean ignoreFailure) {
|
||||
public TopHitsAggregationBuilder scriptField(String name, Script script, boolean ignoreFailure) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("scriptField [name] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
return this;
|
||||
}
|
||||
|
||||
public TopHitsAggregatorBuilder scriptFields(List<ScriptField> scriptFields) {
|
||||
public TopHitsAggregationBuilder scriptFields(List<ScriptField> scriptFields) {
|
||||
if (scriptFields == null) {
|
||||
throw new IllegalArgumentException("[scriptFields] must not be null: [" + name + "]");
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* Should each {@link org.elasticsearch.search.SearchHit} be returned
|
||||
* with an explanation of the hit (ranking).
|
||||
*/
|
||||
public TopHitsAggregatorBuilder explain(boolean explain) {
|
||||
public TopHitsAggregationBuilder explain(boolean explain) {
|
||||
this.explain = explain;
|
||||
return this;
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* Should each {@link org.elasticsearch.search.SearchHit} be returned
|
||||
* with a version associated with it.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder version(boolean version) {
|
||||
public TopHitsAggregationBuilder version(boolean version) {
|
||||
this.version = version;
|
||||
return this;
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
* Applies when sorting, and controls if scores will be tracked as well.
|
||||
* Defaults to <tt>false</tt>.
|
||||
*/
|
||||
public TopHitsAggregatorBuilder trackScores(boolean trackScores) {
|
||||
public TopHitsAggregationBuilder trackScores(boolean trackScores) {
|
||||
this.trackScores = trackScores;
|
||||
return this;
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
}
|
||||
|
||||
@Override
|
||||
public TopHitsAggregatorBuilder subAggregations(Builder subFactories) {
|
||||
public TopHitsAggregationBuilder subAggregations(Builder subFactories) {
|
||||
throw new AggregationInitializationException("Aggregator [" + name + "] of type [" + type + "] cannot accept sub-aggregations");
|
||||
}
|
||||
|
||||
|
@ -607,8 +607,8 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static TopHitsAggregatorBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
TopHitsAggregatorBuilder factory = new TopHitsAggregatorBuilder(aggregationName);
|
||||
public static TopHitsAggregationBuilder parse(String aggregationName, QueryParseContext context) throws IOException {
|
||||
TopHitsAggregationBuilder factory = new TopHitsAggregationBuilder(aggregationName);
|
||||
XContentParser.Token token;
|
||||
String currentFieldName = null;
|
||||
XContentParser parser = context.parser();
|
||||
|
@ -741,7 +741,7 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
|
||||
@Override
|
||||
protected boolean doEquals(Object obj) {
|
||||
TopHitsAggregatorBuilder other = (TopHitsAggregatorBuilder) obj;
|
||||
TopHitsAggregationBuilder other = (TopHitsAggregationBuilder) obj;
|
||||
return Objects.equals(explain, other.explain)
|
||||
&& Objects.equals(fetchSourceContext, other.fetchSourceContext)
|
||||
&& Objects.equals(fieldDataFields, other.fieldDataFields)
|
||||
|
@ -759,4 +759,4 @@ public class TopHitsAggregatorBuilder extends AggregatorBuilder<TopHitsAggregato
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,24 +28,24 @@ import org.elasticsearch.search.aggregations.AggregatorFactory;
|
|||
import org.elasticsearch.search.aggregations.support.AggregationContext;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ValueCountAggregatorBuilder extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource, ValueCountAggregatorBuilder> {
|
||||
public class ValueCountAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource, ValueCountAggregationBuilder> {
|
||||
public static final String NAME = InternalValueCount.TYPE.name();
|
||||
public static final ParseField AGGREGATION_NAME_FIELD = new ParseField(NAME);
|
||||
|
||||
public ValueCountAggregatorBuilder(String name, ValueType targetValueType) {
|
||||
public ValueCountAggregationBuilder(String name, ValueType targetValueType) {
|
||||
super(name, InternalValueCount.TYPE, ValuesSourceType.ANY, targetValueType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
public ValueCountAggregatorBuilder(StreamInput in) throws IOException {
|
||||
public ValueCountAggregationBuilder(StreamInput in) throws IOException {
|
||||
super(in, InternalValueCount.TYPE, ValuesSourceType.ANY);
|
||||
}
|
||||
|
||||
|
@ -84,4 +84,4 @@ public class ValueCountAggregatorBuilder extends ValuesSourceAggregatorBuilder.L
|
|||
public String getWriteableName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
|||
import org.elasticsearch.search.aggregations.support.AbstractValuesSourceParser.AnyValuesSourceParser;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -46,8 +46,8 @@ public class ValueCountParser extends AnyValuesSourceParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ValuesSourceAggregatorBuilder<ValuesSource, ValueCountAggregatorBuilder> createFactory(
|
||||
protected ValuesSourceAggregationBuilder<ValuesSource, ValueCountAggregationBuilder> createFactory(
|
||||
String aggregationName, ValuesSourceType valuesSourceType, ValueType targetValueType, Map<ParseField, Object> otherOptions) {
|
||||
return new ValueCountAggregatorBuilder(aggregationName, targetValueType);
|
||||
return new ValueCountAggregationBuilder(aggregationName, targetValueType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public abstract class AbstractValuesSourceParser<VS extends ValuesSource>
|
|||
}
|
||||
|
||||
@Override
|
||||
public final ValuesSourceAggregatorBuilder<VS, ?> parse(String aggregationName, QueryParseContext context)
|
||||
public final ValuesSourceAggregationBuilder<VS, ?> parse(String aggregationName, QueryParseContext context)
|
||||
throws IOException {
|
||||
|
||||
XContentParser parser = context.parser();
|
||||
|
@ -147,7 +147,7 @@ public abstract class AbstractValuesSourceParser<VS extends ValuesSource>
|
|||
}
|
||||
}
|
||||
|
||||
ValuesSourceAggregatorBuilder<VS, ?> factory = createFactory(aggregationName, this.valuesSourceType, this.targetValueType,
|
||||
ValuesSourceAggregationBuilder<VS, ?> factory = createFactory(aggregationName, this.valuesSourceType, this.targetValueType,
|
||||
otherOptions);
|
||||
if (field != null) {
|
||||
factory.field(field);
|
||||
|
@ -171,7 +171,7 @@ public abstract class AbstractValuesSourceParser<VS extends ValuesSource>
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link ValuesSourceAggregatorBuilder} from the information
|
||||
* Creates a {@link ValuesSourceAggregationBuilder} from the information
|
||||
* gathered by the subclass. Options parsed in
|
||||
* {@link AbstractValuesSourceParser} itself will be added to the factory
|
||||
* after it has been returned by this method.
|
||||
|
@ -189,8 +189,8 @@ public abstract class AbstractValuesSourceParser<VS extends ValuesSource>
|
|||
* method
|
||||
* @return the created factory
|
||||
*/
|
||||
protected abstract ValuesSourceAggregatorBuilder<VS, ?> createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions);
|
||||
protected abstract ValuesSourceAggregationBuilder<VS, ?> createFactory(String aggregationName, ValuesSourceType valuesSourceType,
|
||||
ValueType targetValueType, Map<ParseField, Object> otherOptions);
|
||||
|
||||
/**
|
||||
* Allows subclasses of {@link AbstractValuesSourceParser} to parse extra
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.elasticsearch.script.ScriptContext;
|
|||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.AggregationInitializationException;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
|
@ -46,11 +46,11 @@ import java.util.Objects;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public abstract class ValuesSourceAggregatorBuilder<VS extends ValuesSource, AB extends ValuesSourceAggregatorBuilder<VS, AB>>
|
||||
extends AggregatorBuilder<AB> {
|
||||
public abstract class ValuesSourceAggregationBuilder<VS extends ValuesSource, AB extends ValuesSourceAggregationBuilder<VS, AB>>
|
||||
extends AggregationBuilder<AB> {
|
||||
|
||||
public static abstract class LeafOnly<VS extends ValuesSource, AB extends ValuesSourceAggregatorBuilder<VS, AB>>
|
||||
extends ValuesSourceAggregatorBuilder<VS, AB> {
|
||||
public static abstract class LeafOnly<VS extends ValuesSource, AB extends ValuesSourceAggregationBuilder<VS, AB>>
|
||||
extends ValuesSourceAggregationBuilder<VS, AB> {
|
||||
|
||||
protected LeafOnly(String name, Type type, ValuesSourceType valuesSourceType, ValueType targetValueType) {
|
||||
super(name, type, valuesSourceType, targetValueType);
|
||||
|
@ -87,7 +87,7 @@ public abstract class ValuesSourceAggregatorBuilder<VS extends ValuesSource, AB
|
|||
private DateTimeZone timeZone = null;
|
||||
protected ValuesSourceConfig<VS> config;
|
||||
|
||||
protected ValuesSourceAggregatorBuilder(String name, Type type, ValuesSourceType valuesSourceType, ValueType targetValueType) {
|
||||
protected ValuesSourceAggregationBuilder(String name, Type type, ValuesSourceType valuesSourceType, ValueType targetValueType) {
|
||||
super(name, type);
|
||||
if (valuesSourceType == null) {
|
||||
throw new IllegalArgumentException("[valuesSourceType] must not be null: [" + name + "]");
|
||||
|
@ -99,7 +99,7 @@ public abstract class ValuesSourceAggregatorBuilder<VS extends ValuesSource, AB
|
|||
/**
|
||||
* Read an aggregation from a stream that does not serialize its targetValueType. This should be used by most subclasses.
|
||||
*/
|
||||
protected ValuesSourceAggregatorBuilder(StreamInput in, Type type, ValuesSourceType valuesSourceType, ValueType targetValueType)
|
||||
protected ValuesSourceAggregationBuilder(StreamInput in, Type type, ValuesSourceType valuesSourceType, ValueType targetValueType)
|
||||
throws IOException {
|
||||
super(in, type);
|
||||
assert false == serializeTargetValueType() : "Wrong read constructor called for subclass that provides its targetValueType";
|
||||
|
@ -112,7 +112,7 @@ public abstract class ValuesSourceAggregatorBuilder<VS extends ValuesSource, AB
|
|||
* Read an aggregation from a stream that serializes its targetValueType. This should only be used by subclasses that override
|
||||
* {@link #serializeTargetValueType()} to return true.
|
||||
*/
|
||||
protected ValuesSourceAggregatorBuilder(StreamInput in, Type type, ValuesSourceType valuesSourceType) throws IOException {
|
||||
protected ValuesSourceAggregationBuilder(StreamInput in, Type type, ValuesSourceType valuesSourceType) throws IOException {
|
||||
super(in, type);
|
||||
assert serializeTargetValueType() : "Wrong read constructor called for subclass that serializes its targetValueType";
|
||||
this.valuesSourceType = valuesSourceType;
|
||||
|
@ -430,7 +430,7 @@ public abstract class ValuesSourceAggregatorBuilder<VS extends ValuesSource, AB
|
|||
|
||||
@Override
|
||||
protected final boolean doEquals(Object obj) {
|
||||
ValuesSourceAggregatorBuilder<?, ?> other = (ValuesSourceAggregatorBuilder<?, ?>) obj;
|
||||
ValuesSourceAggregationBuilder<?, ?> other = (ValuesSourceAggregationBuilder<?, ?>) obj;
|
||||
if (!Objects.equals(field, other.field))
|
||||
return false;
|
||||
if (!Objects.equals(format, other.format))
|
|
@ -41,7 +41,7 @@ import org.elasticsearch.index.query.QueryBuilder;
|
|||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.index.query.QueryShardContext;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorParsers;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorBuilder;
|
||||
|
@ -600,7 +600,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
/**
|
||||
* Add an aggregation to perform as part of the search.
|
||||
*/
|
||||
public SearchSourceBuilder aggregation(AggregatorBuilder<?> aggregation) {
|
||||
public SearchSourceBuilder aggregation(AggregationBuilder<?> aggregation) {
|
||||
if (aggregations == null) {
|
||||
aggregations = AggregatorFactories.builder();
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ import static org.elasticsearch.cluster.service.ClusterServiceUtils.createCluste
|
|||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public abstract class BaseAggregationTestCase<AB extends AggregatorBuilder<AB>> extends ESTestCase {
|
||||
public abstract class BaseAggregationTestCase<AB extends AggregationBuilder<AB>> extends ESTestCase {
|
||||
|
||||
protected static final String STRING_FIELD_NAME = "mapped_string";
|
||||
protected static final String INT_FIELD_NAME = "mapped_int";
|
||||
|
@ -238,7 +238,7 @@ public abstract class BaseAggregationTestCase<AB extends AggregatorBuilder<AB>>
|
|||
assertSame(XContentParser.Token.FIELD_NAME, parser.nextToken());
|
||||
assertEquals(testAgg.type.name(), parser.currentName());
|
||||
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
|
||||
AggregatorBuilder<?> newAgg = aggParsers.parser(testAgg.getType(), ParseFieldMatcher.STRICT).parse(testAgg.name, parseContext);
|
||||
AggregationBuilder<?> newAgg = aggParsers.parser(testAgg.getType(), ParseFieldMatcher.STRICT).parse(testAgg.name, parseContext);
|
||||
assertSame(XContentParser.Token.END_OBJECT, parser.currentToken());
|
||||
assertSame(XContentParser.Token.END_OBJECT, parser.nextToken());
|
||||
assertSame(XContentParser.Token.END_OBJECT, parser.nextToken());
|
||||
|
@ -258,7 +258,7 @@ public abstract class BaseAggregationTestCase<AB extends AggregatorBuilder<AB>>
|
|||
try (BytesStreamOutput output = new BytesStreamOutput()) {
|
||||
output.writeNamedWriteable(testAgg);
|
||||
try (StreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(output.bytes()), namedWriteableRegistry)) {
|
||||
AggregatorBuilder<?> deserialized = in.readNamedWriteable(AggregatorBuilder.class);
|
||||
AggregationBuilder<?> deserialized = in.readNamedWriteable(AggregationBuilder.class);
|
||||
assertEquals(testAgg, deserialized);
|
||||
assertEquals(testAgg.hashCode(), deserialized.hashCode());
|
||||
assertNotSame(testAgg, deserialized);
|
||||
|
@ -299,7 +299,7 @@ public abstract class BaseAggregationTestCase<AB extends AggregatorBuilder<AB>>
|
|||
agg.writeTo(output);
|
||||
try (StreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(output.bytes()), namedWriteableRegistry)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
AB secondAgg = (AB) namedWriteableRegistry.getReader(AggregatorBuilder.class, agg.getWriteableName()).read(in);
|
||||
AB secondAgg = (AB) namedWriteableRegistry.getReader(AggregationBuilder.class, agg.getWriteableName()).read(in);
|
||||
return secondAgg;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
package org.elasticsearch.search.aggregations.bucket;
|
||||
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.children.ChildrenAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.children.ChildrenAggregationBuilder;
|
||||
|
||||
public class ChildrenTests extends BaseAggregationTestCase<ChildrenAggregatorBuilder> {
|
||||
public class ChildrenTests extends BaseAggregationTestCase<ChildrenAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected ChildrenAggregatorBuilder createTestAggregatorBuilder() {
|
||||
protected ChildrenAggregationBuilder createTestAggregatorBuilder() {
|
||||
String name = randomAsciiOfLengthBetween(3, 20);
|
||||
String childType = randomAsciiOfLengthBetween(5, 40);
|
||||
ChildrenAggregatorBuilder factory = new ChildrenAggregatorBuilder(name, childType);
|
||||
ChildrenAggregationBuilder factory = new ChildrenAggregationBuilder(name, childType);
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,16 +20,16 @@
|
|||
package org.elasticsearch.search.aggregations.bucket;
|
||||
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.ExtendedBounds;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Order;
|
||||
|
||||
public class DateHistogramTests extends BaseAggregationTestCase<DateHistogramAggregatorBuilder> {
|
||||
public class DateHistogramTests extends BaseAggregationTestCase<DateHistogramAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected DateHistogramAggregatorBuilder createTestAggregatorBuilder() {
|
||||
DateHistogramAggregatorBuilder factory = new DateHistogramAggregatorBuilder("foo");
|
||||
protected DateHistogramAggregationBuilder createTestAggregatorBuilder() {
|
||||
DateHistogramAggregationBuilder factory = new DateHistogramAggregationBuilder("foo");
|
||||
factory.field(INT_FIELD_NAME);
|
||||
if (randomBoolean()) {
|
||||
factory.interval(randomIntBetween(1, 100000));
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.search.aggregations.bucket.DateScriptMocks.DateScriptsM
|
|||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range.Bucket;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
|
@ -117,7 +117,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
|||
public void testDateMath() throws Exception {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("fieldname", "date");
|
||||
DateRangeAggregatorBuilder rangeBuilder = dateRange("range");
|
||||
DateRangeAggregationBuilder rangeBuilder = dateRange("range");
|
||||
if (randomBoolean()) {
|
||||
rangeBuilder.field("date");
|
||||
} else {
|
||||
|
|
|
@ -21,17 +21,17 @@ package org.elasticsearch.search.aggregations.bucket;
|
|||
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregationBuilder;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
||||
public class DateRangeTests extends BaseAggregationTestCase<DateRangeAggregatorBuilder> {
|
||||
public class DateRangeTests extends BaseAggregationTestCase<DateRangeAggregationBuilder> {
|
||||
|
||||
private final static String[] timeZoneIds = DateTimeZone.getAvailableIDs().toArray(new String[DateTimeZone.getAvailableIDs().size()]);
|
||||
|
||||
@Override
|
||||
protected DateRangeAggregatorBuilder createTestAggregatorBuilder() {
|
||||
protected DateRangeAggregationBuilder createTestAggregatorBuilder() {
|
||||
int numRanges = randomIntBetween(1, 10);
|
||||
DateRangeAggregatorBuilder factory = new DateRangeAggregatorBuilder("foo");
|
||||
DateRangeAggregationBuilder factory = new DateRangeAggregationBuilder("foo");
|
||||
for (int i = 0; i < numRanges; i++) {
|
||||
String key = null;
|
||||
if (randomBoolean()) {
|
||||
|
|
|
@ -22,12 +22,12 @@ import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
|||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.SearchType;
|
||||
import org.elasticsearch.index.query.TermQueryBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.DiversifiedAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.DiversifiedAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.Sampler;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.Max;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
|
@ -128,7 +128,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
|||
|
||||
public void testSimpleDiversity() throws Exception {
|
||||
int MAX_DOCS_PER_AUTHOR = 1;
|
||||
DiversifiedAggregatorBuilder sampleAgg = new DiversifiedAggregatorBuilder("sample").shardSize(100);
|
||||
DiversifiedAggregationBuilder sampleAgg = new DiversifiedAggregationBuilder("sample").shardSize(100);
|
||||
sampleAgg.field("author").maxDocsPerValue(MAX_DOCS_PER_AUTHOR).executionHint(randomExecutionHint());
|
||||
sampleAgg.subAggregation(terms("authors").field("author"));
|
||||
SearchResponse response = client().prepareSearch("test")
|
||||
|
@ -151,9 +151,9 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
|||
public void testNestedDiversity() throws Exception {
|
||||
// Test multiple samples gathered under buckets made by a parent agg
|
||||
int MAX_DOCS_PER_AUTHOR = 1;
|
||||
TermsAggregatorBuilder rootTerms = terms("genres").field("genre");
|
||||
TermsAggregationBuilder rootTerms = terms("genres").field("genre");
|
||||
|
||||
DiversifiedAggregatorBuilder sampleAgg = new DiversifiedAggregatorBuilder("sample").shardSize(100);
|
||||
DiversifiedAggregationBuilder sampleAgg = new DiversifiedAggregationBuilder("sample").shardSize(100);
|
||||
sampleAgg.field("author").maxDocsPerValue(MAX_DOCS_PER_AUTHOR).executionHint(randomExecutionHint());
|
||||
sampleAgg.subAggregation(terms("authors").field("author"));
|
||||
|
||||
|
@ -178,11 +178,11 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
|||
// Test samples nested under samples
|
||||
int MAX_DOCS_PER_AUTHOR = 1;
|
||||
int MAX_DOCS_PER_GENRE = 2;
|
||||
DiversifiedAggregatorBuilder rootSample = new DiversifiedAggregatorBuilder("genreSample").shardSize(100)
|
||||
DiversifiedAggregationBuilder rootSample = new DiversifiedAggregationBuilder("genreSample").shardSize(100)
|
||||
.field("genre")
|
||||
.maxDocsPerValue(MAX_DOCS_PER_GENRE);
|
||||
|
||||
DiversifiedAggregatorBuilder sampleAgg = new DiversifiedAggregatorBuilder("sample").shardSize(100);
|
||||
DiversifiedAggregationBuilder sampleAgg = new DiversifiedAggregationBuilder("sample").shardSize(100);
|
||||
sampleAgg.field("author").maxDocsPerValue(MAX_DOCS_PER_AUTHOR).executionHint(randomExecutionHint());
|
||||
sampleAgg.subAggregation(terms("authors").field("author"));
|
||||
sampleAgg.subAggregation(terms("genres").field("genre"));
|
||||
|
@ -210,7 +210,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
|||
public void testPartiallyUnmappedDiversifyField() throws Exception {
|
||||
// One of the indexes is missing the "author" field used for
|
||||
// diversifying results
|
||||
DiversifiedAggregatorBuilder sampleAgg = new DiversifiedAggregatorBuilder("sample").shardSize(100).field("author")
|
||||
DiversifiedAggregationBuilder sampleAgg = new DiversifiedAggregationBuilder("sample").shardSize(100).field("author")
|
||||
.maxDocsPerValue(1);
|
||||
sampleAgg.subAggregation(terms("authors").field("author"));
|
||||
SearchResponse response = client().prepareSearch("idx_unmapped_author", "test").setSearchType(SearchType.QUERY_AND_FETCH)
|
||||
|
@ -226,7 +226,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
|||
public void testWhollyUnmappedDiversifyField() throws Exception {
|
||||
//All of the indices are missing the "author" field used for diversifying results
|
||||
int MAX_DOCS_PER_AUTHOR = 1;
|
||||
DiversifiedAggregatorBuilder sampleAgg = new DiversifiedAggregatorBuilder("sample").shardSize(100);
|
||||
DiversifiedAggregationBuilder sampleAgg = new DiversifiedAggregationBuilder("sample").shardSize(100);
|
||||
sampleAgg.field("author").maxDocsPerValue(MAX_DOCS_PER_AUTHOR).executionHint(randomExecutionHint());
|
||||
sampleAgg.subAggregation(terms("authors").field("author"));
|
||||
SearchResponse response = client().prepareSearch("idx_unmapped", "idx_unmapped_author").setSearchType(SearchType.QUERY_AND_FETCH)
|
||||
|
|
|
@ -21,14 +21,14 @@ package org.elasticsearch.search.aggregations.bucket;
|
|||
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.DiversifiedAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.DiversifiedAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregator.ExecutionMode;
|
||||
|
||||
public class DiversifiedSamplerTests extends BaseAggregationTestCase<DiversifiedAggregatorBuilder> {
|
||||
public class DiversifiedSamplerTests extends BaseAggregationTestCase<DiversifiedAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected final DiversifiedAggregatorBuilder createTestAggregatorBuilder() {
|
||||
DiversifiedAggregatorBuilder factory = new DiversifiedAggregatorBuilder("foo");
|
||||
protected final DiversifiedAggregationBuilder createTestAggregatorBuilder() {
|
||||
DiversifiedAggregationBuilder factory = new DiversifiedAggregationBuilder("foo");
|
||||
String field = randomNumericField();
|
||||
int randomFieldBranch = randomInt(3);
|
||||
switch (randomFieldBranch) {
|
||||
|
|
|
@ -23,17 +23,17 @@ import org.elasticsearch.common.geo.GeoDistance;
|
|||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceParser.Range;
|
||||
import org.elasticsearch.test.geo.RandomShapeGenerator;
|
||||
|
||||
public class GeoDistanceRangeTests extends BaseAggregationTestCase<GeoDistanceAggregatorBuilder> {
|
||||
public class GeoDistanceRangeTests extends BaseAggregationTestCase<GeoDistanceAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected GeoDistanceAggregatorBuilder createTestAggregatorBuilder() {
|
||||
protected GeoDistanceAggregationBuilder createTestAggregatorBuilder() {
|
||||
int numRanges = randomIntBetween(1, 10);
|
||||
GeoPoint origin = RandomShapeGenerator.randomPoint(random());
|
||||
GeoDistanceAggregatorBuilder factory = new GeoDistanceAggregatorBuilder("foo", origin);
|
||||
GeoDistanceAggregationBuilder factory = new GeoDistanceAggregationBuilder("foo", origin);
|
||||
for (int i = 0; i < numRanges; i++) {
|
||||
String key = null;
|
||||
if (randomBoolean()) {
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
package org.elasticsearch.search.aggregations.bucket;
|
||||
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregationBuilder;
|
||||
|
||||
public class GeoHashGridTests extends BaseAggregationTestCase<GeoGridAggregatorBuilder> {
|
||||
public class GeoHashGridTests extends BaseAggregationTestCase<GeoGridAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected GeoGridAggregatorBuilder createTestAggregatorBuilder() {
|
||||
protected GeoGridAggregationBuilder createTestAggregatorBuilder() {
|
||||
String name = randomAsciiOfLengthBetween(3, 20);
|
||||
GeoGridAggregatorBuilder factory = new GeoGridAggregatorBuilder(name);
|
||||
GeoGridAggregationBuilder factory = new GeoGridAggregationBuilder(name);
|
||||
if (randomBoolean()) {
|
||||
int precision = randomIntBetween(1, 12);
|
||||
factory.precision(precision);
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
package org.elasticsearch.search.aggregations.bucket;
|
||||
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregationBuilder;
|
||||
|
||||
public class GlobalTests extends BaseAggregationTestCase<GlobalAggregatorBuilder> {
|
||||
public class GlobalTests extends BaseAggregationTestCase<GlobalAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected GlobalAggregatorBuilder createTestAggregatorBuilder() {
|
||||
return new GlobalAggregatorBuilder(randomAsciiOfLengthBetween(3, 20));
|
||||
protected GlobalAggregationBuilder createTestAggregatorBuilder() {
|
||||
return new GlobalAggregationBuilder(randomAsciiOfLengthBetween(3, 20));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,13 +22,13 @@ package org.elasticsearch.search.aggregations.bucket;
|
|||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.ExtendedBounds;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Order;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregationBuilder;
|
||||
|
||||
public class HistogramTests extends BaseAggregationTestCase<HistogramAggregatorBuilder> {
|
||||
public class HistogramTests extends BaseAggregationTestCase<HistogramAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected HistogramAggregatorBuilder createTestAggregatorBuilder() {
|
||||
HistogramAggregatorBuilder factory = new HistogramAggregatorBuilder("foo");
|
||||
protected HistogramAggregationBuilder createTestAggregatorBuilder() {
|
||||
HistogramAggregationBuilder factory = new HistogramAggregationBuilder("foo");
|
||||
factory.field(INT_FIELD_NAME);
|
||||
factory.interval(randomIntBetween(1, 100000));
|
||||
if (randomBoolean()) {
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptModule;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.AggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ import java.net.UnknownHostException;
|
|||
|
||||
import org.elasticsearch.common.network.NetworkAddress;
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeAggregationBuilder;
|
||||
|
||||
public class IpRangeTests extends BaseAggregationTestCase<IpRangeAggregatorBuilder> {
|
||||
public class IpRangeTests extends BaseAggregationTestCase<IpRangeAggregationBuilder> {
|
||||
|
||||
private static String randomIp(boolean v4) {
|
||||
try {
|
||||
|
@ -45,9 +45,9 @@ public class IpRangeTests extends BaseAggregationTestCase<IpRangeAggregatorBuild
|
|||
}
|
||||
|
||||
@Override
|
||||
protected IpRangeAggregatorBuilder createTestAggregatorBuilder() {
|
||||
protected IpRangeAggregationBuilder createTestAggregatorBuilder() {
|
||||
int numRanges = randomIntBetween(1, 10);
|
||||
IpRangeAggregatorBuilder factory = new IpRangeAggregatorBuilder("foo");
|
||||
IpRangeAggregationBuilder factory = new IpRangeAggregationBuilder("foo");
|
||||
for (int i = 0; i < numRanges; i++) {
|
||||
String key = null;
|
||||
if (randomBoolean()) {
|
||||
|
|
|
@ -27,11 +27,11 @@ import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
|||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.AvgAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.AvgAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStats;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStatsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStatsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
|
@ -49,8 +49,8 @@ public class NaNSortingIT extends ESIntegTestCase {
|
|||
private enum SubAggregation {
|
||||
AVG("avg") {
|
||||
@Override
|
||||
public AvgAggregatorBuilder builder() {
|
||||
AvgAggregatorBuilder factory = avg(name);
|
||||
public AvgAggregationBuilder builder() {
|
||||
AvgAggregationBuilder factory = avg(name);
|
||||
factory.field("numeric_field");
|
||||
return factory;
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ public class NaNSortingIT extends ESIntegTestCase {
|
|||
},
|
||||
VARIANCE("variance") {
|
||||
@Override
|
||||
public ExtendedStatsAggregatorBuilder builder() {
|
||||
ExtendedStatsAggregatorBuilder factory = extendedStats(name);
|
||||
public ExtendedStatsAggregationBuilder builder() {
|
||||
ExtendedStatsAggregationBuilder factory = extendedStats(name);
|
||||
factory.field("numeric_field");
|
||||
return factory;
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ public class NaNSortingIT extends ESIntegTestCase {
|
|||
},
|
||||
STD_DEVIATION("std_deviation"){
|
||||
@Override
|
||||
public ExtendedStatsAggregatorBuilder builder() {
|
||||
ExtendedStatsAggregatorBuilder factory = extendedStats(name);
|
||||
public ExtendedStatsAggregationBuilder builder() {
|
||||
ExtendedStatsAggregationBuilder factory = extendedStats(name);
|
||||
factory.field("numeric_field");
|
||||
return factory;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class NaNSortingIT extends ESIntegTestCase {
|
|||
|
||||
public String name;
|
||||
|
||||
public abstract ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource.Numeric, ? extends ValuesSourceAggregatorBuilder.LeafOnly<ValuesSource.Numeric, ?>> builder();
|
||||
public abstract ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.Numeric, ? extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.Numeric, ?>> builder();
|
||||
|
||||
public String sortKey() {
|
||||
return name;
|
||||
|
|
|
@ -21,14 +21,14 @@ package org.elasticsearch.search.aggregations.bucket;
|
|||
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregationBuilder;
|
||||
|
||||
public class RangeTests extends BaseAggregationTestCase<RangeAggregatorBuilder> {
|
||||
public class RangeTests extends BaseAggregationTestCase<RangeAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected RangeAggregatorBuilder createTestAggregatorBuilder() {
|
||||
protected RangeAggregationBuilder createTestAggregatorBuilder() {
|
||||
int numRanges = randomIntBetween(1, 10);
|
||||
RangeAggregatorBuilder factory = new RangeAggregatorBuilder("foo");
|
||||
RangeAggregationBuilder factory = new RangeAggregationBuilder("foo");
|
||||
for (int i = 0; i < numRanges; i++) {
|
||||
String key = null;
|
||||
if (randomBoolean()) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.action.search.SearchType;
|
|||
import org.elasticsearch.index.query.TermQueryBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.Sampler;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.Max;
|
||||
|
@ -123,7 +123,7 @@ public class SamplerIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testSimpleSampler() throws Exception {
|
||||
SamplerAggregatorBuilder sampleAgg = sampler("sample").shardSize(100);
|
||||
SamplerAggregationBuilder sampleAgg = sampler("sample").shardSize(100);
|
||||
sampleAgg.subAggregation(terms("authors").field("author"));
|
||||
SearchResponse response = client().prepareSearch("test").setSearchType(SearchType.QUERY_AND_FETCH)
|
||||
.setQuery(new TermQueryBuilder("genre", "fantasy")).setFrom(0).setSize(60).addAggregation(sampleAgg).execute().actionGet();
|
||||
|
@ -140,7 +140,7 @@ public class SamplerIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testUnmappedChildAggNoDiversity() throws Exception {
|
||||
SamplerAggregatorBuilder sampleAgg = sampler("sample").shardSize(100);
|
||||
SamplerAggregationBuilder sampleAgg = sampler("sample").shardSize(100);
|
||||
sampleAgg.subAggregation(terms("authors").field("author"));
|
||||
SearchResponse response = client().prepareSearch("idx_unmapped")
|
||||
.setSearchType(SearchType.QUERY_AND_FETCH)
|
||||
|
@ -157,7 +157,7 @@ public class SamplerIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testPartiallyUnmappedChildAggNoDiversity() throws Exception {
|
||||
SamplerAggregatorBuilder sampleAgg = sampler("sample").shardSize(100);
|
||||
SamplerAggregationBuilder sampleAgg = sampler("sample").shardSize(100);
|
||||
sampleAgg.subAggregation(terms("authors").field("author"));
|
||||
SearchResponse response = client().prepareSearch("idx_unmapped", "test")
|
||||
.setSearchType(SearchType.QUERY_AND_FETCH)
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
package org.elasticsearch.search.aggregations.bucket;
|
||||
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregationBuilder;
|
||||
|
||||
public class SamplerTests extends BaseAggregationTestCase<SamplerAggregatorBuilder> {
|
||||
public class SamplerTests extends BaseAggregationTestCase<SamplerAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected final SamplerAggregatorBuilder createTestAggregatorBuilder() {
|
||||
SamplerAggregatorBuilder factory = new SamplerAggregatorBuilder("foo");
|
||||
protected final SamplerAggregationBuilder createTestAggregatorBuilder() {
|
||||
SamplerAggregationBuilder factory = new SamplerAggregationBuilder("foo");
|
||||
if (randomBoolean()) {
|
||||
factory.shardSize(randomIntBetween(1, 1000));
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.util.automaton.RegExp;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.GND;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.JLHScore;
|
||||
|
@ -37,7 +37,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.support.IncludeExclude
|
|||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class SignificantTermsTests extends BaseAggregationTestCase<SignificantTermsAggregatorBuilder> {
|
||||
public class SignificantTermsTests extends BaseAggregationTestCase<SignificantTermsAggregationBuilder> {
|
||||
|
||||
private static final String[] executionHints;
|
||||
|
||||
|
@ -50,9 +50,9 @@ public class SignificantTermsTests extends BaseAggregationTestCase<SignificantTe
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SignificantTermsAggregatorBuilder createTestAggregatorBuilder() {
|
||||
protected SignificantTermsAggregationBuilder createTestAggregatorBuilder() {
|
||||
String name = randomAsciiOfLengthBetween(3, 20);
|
||||
SignificantTermsAggregatorBuilder factory = new SignificantTermsAggregatorBuilder(name, null);
|
||||
SignificantTermsAggregationBuilder factory = new SignificantTermsAggregationBuilder(name, null);
|
||||
String field = randomAsciiOfLengthBetween(3, 20);
|
||||
int randomFieldBranch = randomInt(2);
|
||||
switch (randomFieldBranch) {
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.ExecutionMode;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.support.IncludeExclude;
|
||||
import java.util.ArrayList;
|
||||
|
@ -33,7 +33,7 @@ import java.util.List;
|
|||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class TermsTests extends BaseAggregationTestCase<TermsAggregatorBuilder> {
|
||||
public class TermsTests extends BaseAggregationTestCase<TermsAggregationBuilder> {
|
||||
|
||||
private static final String[] executionHints;
|
||||
|
||||
|
@ -46,9 +46,9 @@ public class TermsTests extends BaseAggregationTestCase<TermsAggregatorBuilder>
|
|||
}
|
||||
|
||||
@Override
|
||||
protected TermsAggregatorBuilder createTestAggregatorBuilder() {
|
||||
protected TermsAggregationBuilder createTestAggregatorBuilder() {
|
||||
String name = randomAsciiOfLengthBetween(3, 20);
|
||||
TermsAggregatorBuilder factory = new TermsAggregatorBuilder(name, null);
|
||||
TermsAggregationBuilder factory = new TermsAggregationBuilder(name, null);
|
||||
String field = randomAsciiOfLengthBetween(3, 20);
|
||||
int randomFieldBranch = randomInt(2);
|
||||
switch (randomFieldBranch) {
|
||||
|
|
|
@ -123,7 +123,7 @@ public class NestedAggregatorTests extends ESSingleNodeTestCase {
|
|||
AggregationContext context = new AggregationContext(searchContext);
|
||||
|
||||
AggregatorFactories.Builder builder = AggregatorFactories.builder();
|
||||
NestedAggregatorBuilder factory = new NestedAggregatorBuilder("test", "nested_field");
|
||||
NestedAggregationBuilder factory = new NestedAggregationBuilder("test", "nested_field");
|
||||
builder.addAggregator(factory);
|
||||
AggregatorFactories factories = builder.build(context, null);
|
||||
searchContext.aggregations(new SearchContextAggregations(factories));
|
||||
|
|
|
@ -21,11 +21,11 @@ package org.elasticsearch.search.aggregations.bucket.nested;
|
|||
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
|
||||
public class NestedTests extends BaseAggregationTestCase<NestedAggregatorBuilder> {
|
||||
public class NestedTests extends BaseAggregationTestCase<NestedAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected NestedAggregatorBuilder createTestAggregatorBuilder() {
|
||||
return new NestedAggregatorBuilder(randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(3, 40));
|
||||
protected NestedAggregationBuilder createTestAggregatorBuilder() {
|
||||
return new NestedAggregationBuilder(randomAsciiOfLengthBetween(1, 20), randomAsciiOfLengthBetween(3, 40));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ package org.elasticsearch.search.aggregations.bucket.nested;
|
|||
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
|
||||
public class ReverseNestedTests extends BaseAggregationTestCase<ReverseNestedAggregatorBuilder> {
|
||||
public class ReverseNestedTests extends BaseAggregationTestCase<ReverseNestedAggregationBuilder> {
|
||||
|
||||
@Override
|
||||
protected ReverseNestedAggregatorBuilder createTestAggregatorBuilder() {
|
||||
ReverseNestedAggregatorBuilder factory = new ReverseNestedAggregatorBuilder(randomAsciiOfLengthBetween(1, 20));
|
||||
protected ReverseNestedAggregationBuilder createTestAggregatorBuilder() {
|
||||
ReverseNestedAggregationBuilder factory = new ReverseNestedAggregationBuilder(randomAsciiOfLengthBetween(1, 20));
|
||||
if (randomBoolean()) {
|
||||
factory.path(randomAsciiOfLengthBetween(3, 40));
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ public class SignificanceHeuristicTests extends ESTestCase {
|
|||
|
||||
protected SignificanceHeuristic parseFromBuilder(ParseFieldRegistry<SignificanceHeuristicParser> significanceHeuristicParserRegistry,
|
||||
SearchContext searchContext, SignificanceHeuristic significanceHeuristic) throws IOException {
|
||||
SignificantTermsAggregatorBuilder stBuilder = significantTerms("testagg");
|
||||
SignificantTermsAggregationBuilder stBuilder = significantTerms("testagg");
|
||||
stBuilder.significanceHeuristic(significanceHeuristic).field("text").minDocCount(200);
|
||||
XContentBuilder stXContentBuilder = XContentFactory.jsonBuilder();
|
||||
stBuilder.internalXContent(stXContentBuilder, null);
|
||||
|
@ -271,7 +271,7 @@ public class SignificanceHeuristicTests extends ESTestCase {
|
|||
IndicesQueriesRegistry registry = new IndicesQueriesRegistry();
|
||||
QueryParseContext parseContext = new QueryParseContext(registry, stParser, ParseFieldMatcher.STRICT);
|
||||
stParser.nextToken();
|
||||
SignificantTermsAggregatorBuilder aggregatorFactory = (SignificantTermsAggregatorBuilder) new SignificantTermsParser(
|
||||
SignificantTermsAggregationBuilder aggregatorFactory = (SignificantTermsAggregationBuilder) new SignificantTermsParser(
|
||||
significanceHeuristicParserRegistry, registry).parse("testagg", parseContext);
|
||||
stParser.nextToken();
|
||||
assertThat(aggregatorFactory.getBucketCountThresholds().getMinDocCount(), equalTo(200L));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue