Renamed AggregatorBuilder to AggregationBuilder, applying the changes to

x-plugins.

Closes elastic/elasticsearch#2263
Relates elastic/elasticsearch#18377

Original commit: elastic/x-pack-elasticsearch@6d1a698669
This commit is contained in:
Ali Beyad 2016-05-19 09:28:53 -04:00
parent 87c085d857
commit d6179855bd
3 changed files with 18 additions and 18 deletions

View File

@ -15,7 +15,7 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
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.SignificantTerms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator;
@ -39,7 +39,7 @@ public class GraphExploreRequest extends ActionRequest<GraphExploreRequest> impl
private String routing; private String routing;
private TimeValue timeout; private TimeValue timeout;
private int sampleSize = SamplerAggregatorBuilder.DEFAULT_SHARD_SAMPLE_SIZE; private int sampleSize = SamplerAggregationBuilder.DEFAULT_SHARD_SAMPLE_SIZE;
private String sampleDiversityField; private String sampleDiversityField;
private int maxDocsPerDiversityValue; private int maxDocsPerDiversityValue;
private boolean useSignificance = true; private boolean useSignificance = true;
@ -199,7 +199,7 @@ public class GraphExploreRequest extends ActionRequest<GraphExploreRequest> impl
/** /**
* The number of top-matching documents that are considered during each hop (default is * The number of top-matching documents that are considered during each hop (default is
* {@link SamplerAggregatorBuilder#DEFAULT_SHARD_SAMPLE_SIZE} * {@link SamplerAggregationBuilder#DEFAULT_SHARD_SAMPLE_SIZE}
* Very small values (less than 50) may not provide sufficient weight-of-evidence to identify * Very small values (less than 50) may not provide sufficient weight-of-evidence to identify
* significant connections between terms. * significant connections between terms.
* <p> Very large values (many thousands) are not recommended with loosely defined queries (fuzzy queries or those * <p> Very large values (many thousands) are not recommended with loosely defined queries (fuzzy queries or those

View File

@ -11,7 +11,7 @@ import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
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.SignificantTerms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator;
@ -138,7 +138,7 @@ public class GraphExploreRequestBuilder extends ActionRequestBuilder<GraphExplor
/** /**
* The number of top-matching documents that are considered during each hop (default is * The number of top-matching documents that are considered during each hop (default is
* {@link SamplerAggregatorBuilder#DEFAULT_SHARD_SAMPLE_SIZE} * {@link SamplerAggregationBuilder#DEFAULT_SHARD_SAMPLE_SIZE}
* Very small values (less than 50) may not provide sufficient weight-of-evidence to identify * Very small values (less than 50) may not provide sufficient weight-of-evidence to identify
* significant connections between terms. * significant connections between terms.
* <p> Very large values (many thousands) are not recommended with loosely defined queries (fuzzy queries or * <p> Very large values (many thousands) are not recommended with loosely defined queries (fuzzy queries or

View File

@ -29,14 +29,14 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.license.plugin.core.LicenseUtils; import org.elasticsearch.license.plugin.core.LicenseUtils;
import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.AggregatorBuilder; import org.elasticsearch.search.aggregations.AggregationBuilder;
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.Sampler;
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms; import org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms;
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms.Bucket; import org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms.Bucket;
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.Terms;
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.bucket.terms.support.IncludeExclude;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
@ -189,9 +189,9 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
// each had non-overlapping sets of terms that needed frequencies looking up for significant terms. // each had non-overlapping sets of terms that needed frequencies looking up for significant terms.
// A common sample pool reduces the specialization that can be given to each root term but // A common sample pool reduces the specialization that can be given to each root term but
// ultimately is much faster to run because of the shared vocabulary in a single sample set. // ultimately is much faster to run because of the shared vocabulary in a single sample set.
AggregatorBuilder sampleAgg = null; AggregationBuilder sampleAgg = null;
if (request.sampleDiversityField() != null) { if (request.sampleDiversityField() != null) {
DiversifiedAggregatorBuilder diversifiedSampleAgg = AggregationBuilders.diversifiedSampler("sample") DiversifiedAggregationBuilder diversifiedSampleAgg = AggregationBuilders.diversifiedSampler("sample")
.shardSize(request.sampleSize()); .shardSize(request.sampleSize());
diversifiedSampleAgg.field(request.sampleDiversityField()); diversifiedSampleAgg.field(request.sampleDiversityField());
diversifiedSampleAgg.maxDocsPerValue(request.maxDocsPerDiversityValue()); diversifiedSampleAgg.maxDocsPerValue(request.maxDocsPerDiversityValue());
@ -227,7 +227,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
for (Vertex v : lastWaveVerticesForField) { for (Vertex v : lastWaveVerticesForField) {
terms[i++] = v.term; terms[i++] = v.term;
} }
TermsAggregatorBuilder lastWaveTermsAgg = AggregationBuilders.terms("field" + fieldNum) TermsAggregationBuilder lastWaveTermsAgg = AggregationBuilders.terms("field" + fieldNum)
.includeExclude(new IncludeExclude(terms, null)) .includeExclude(new IncludeExclude(terms, null))
.shardMinDocCount(1) .shardMinDocCount(1)
.field(lastVr.fieldName()).minDocCount(1) .field(lastVr.fieldName()).minDocCount(1)
@ -246,7 +246,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
size++; size++;
} }
if (request.useSignificance()) { if (request.useSignificance()) {
SignificantTermsAggregatorBuilder nextWaveSigTerms = AggregationBuilders.significantTerms("field" + f) SignificantTermsAggregationBuilder nextWaveSigTerms = AggregationBuilders.significantTerms("field" + f)
.field(vr.fieldName()) .field(vr.fieldName())
.minDocCount(vr.minDocCount()).shardMinDocCount(vr.shardMinDocCount()).executionHint("map").size(size); .minDocCount(vr.minDocCount()).shardMinDocCount(vr.shardMinDocCount()).executionHint("map").size(size);
// nextWaveSigTerms.significanceHeuristic(new PercentageScore.PercentageScoreBuilder()); // nextWaveSigTerms.significanceHeuristic(new PercentageScore.PercentageScoreBuilder());
@ -277,7 +277,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
} }
lastWaveTermsAgg.subAggregation(nextWaveSigTerms); lastWaveTermsAgg.subAggregation(nextWaveSigTerms);
} else { } else {
TermsAggregatorBuilder nextWavePopularTerms = AggregationBuilders.terms("field" + f).field(vr.fieldName()) TermsAggregationBuilder nextWavePopularTerms = AggregationBuilders.terms("field" + f).field(vr.fieldName())
.minDocCount(vr.minDocCount()).shardMinDocCount(vr.shardMinDocCount()) .minDocCount(vr.minDocCount()).shardMinDocCount(vr.shardMinDocCount())
// Map execution mode used because Sampler agg keeps us // Map execution mode used because Sampler agg keeps us
// focused on smaller sets of high quality docs and therefore // focused on smaller sets of high quality docs and therefore
@ -567,9 +567,9 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
BoolQueryBuilder rootBool = QueryBuilders.boolQuery(); BoolQueryBuilder rootBool = QueryBuilders.boolQuery();
AggregatorBuilder rootSampleAgg = null; AggregationBuilder rootSampleAgg = null;
if (request.sampleDiversityField() != null) { if (request.sampleDiversityField() != null) {
DiversifiedAggregatorBuilder diversifiedRootSampleAgg = AggregationBuilders.diversifiedSampler("sample") DiversifiedAggregationBuilder diversifiedRootSampleAgg = AggregationBuilders.diversifiedSampler("sample")
.shardSize(request.sampleSize()); .shardSize(request.sampleSize());
diversifiedRootSampleAgg.field(request.sampleDiversityField()); diversifiedRootSampleAgg.field(request.sampleDiversityField());
diversifiedRootSampleAgg.maxDocsPerValue(request.maxDocsPerDiversityValue()); diversifiedRootSampleAgg.maxDocsPerValue(request.maxDocsPerDiversityValue());
@ -600,7 +600,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
for (int i = 0; i < rootHop.getNumberVertexRequests(); i++) { for (int i = 0; i < rootHop.getNumberVertexRequests(); i++) {
VertexRequest vr = rootHop.getVertexRequest(i); VertexRequest vr = rootHop.getVertexRequest(i);
if (request.useSignificance()) { if (request.useSignificance()) {
SignificantTermsAggregatorBuilder sigBuilder = AggregationBuilders.significantTerms("field" + i); SignificantTermsAggregationBuilder sigBuilder = AggregationBuilders.significantTerms("field" + i);
sigBuilder.field(vr.fieldName()).shardMinDocCount(vr.shardMinDocCount()).minDocCount(vr.minDocCount()) sigBuilder.field(vr.fieldName()).shardMinDocCount(vr.shardMinDocCount()).minDocCount(vr.minDocCount())
// Map execution mode used because Sampler agg // Map execution mode used because Sampler agg
// keeps us focused on smaller sets of high quality // keeps us focused on smaller sets of high quality
@ -621,7 +621,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
} }
rootSampleAgg.subAggregation(sigBuilder); rootSampleAgg.subAggregation(sigBuilder);
} else { } else {
TermsAggregatorBuilder termsBuilder = AggregationBuilders.terms("field" + i); TermsAggregationBuilder termsBuilder = AggregationBuilders.terms("field" + i);
// Min doc count etc really only applies when we are // Min doc count etc really only applies when we are
// thinking about certainty of significance scores - // thinking about certainty of significance scores -
// perhaps less necessary when considering popularity // perhaps less necessary when considering popularity