@Override public int numberOfShards() { return in.numberOfShards(); }
@Override protected ValuesSourceAggregatorFactory<ValuesSource.GeoPoint, ?> innerBuild(SearchContext context, ValuesSourceConfig<ValuesSource.GeoPoint> config, AggregatorFactory<?> parent, Builder subFactoriesBuilder) throws IOException { int shardSize = this.shardSize; int requiredSize = this.requiredSize; if (shardSize < 0) { // Use default heuristic to avoid any wrong-ranking caused by // distributed counting shardSize = BucketUtils.suggestShardSideQueueSize(requiredSize, context.numberOfShards() == 1); } if (requiredSize <= 0 || shardSize <= 0) { throw new ElasticsearchException( "parameters [required_size] and [shard_size] must be >0 in geohash_grid aggregation [" + name + "]."); } if (shardSize < requiredSize) { shardSize = requiredSize; } return new GeoHashGridAggregatorFactory(name, config, precision, requiredSize, shardSize, context, parent, subFactoriesBuilder, metaData); }
.append(context.numberOfShards()).append("], "); if (context.request().source() != null) { sb.append("source[").append(context.request().source().toString(FORMAT_PARAMS)).append("], ");
@Override public int numberOfShards() { return in.numberOfShards(); }
@Override public int numberOfShards() { return in.numberOfShards(); }
@Override public int numberOfShards() { return in.numberOfShards(); }
@Override public int numberOfShards() { return in.numberOfShards(); }
context.numberOfShards() == 1));
searchContext.sort(), numDocs, searchContext.trackScores(), searchContext.numberOfShards(), searchContext.trackTotalHits(), hasFilterCollector); } else if (searchContext.collapse() != null) {
context.numberOfShards() == 1));
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(context.indexShard().shardId()).append(" "); sb.append("took[").append(TimeValue.timeValueNanos(tookInNanos)).append("], took_millis[").append(TimeUnit.NANOSECONDS.toMillis(tookInNanos)).append("], "); if (context.getQueryShardContext().getTypes() == null) { sb.append("types[], "); } else { sb.append("types["); Strings.arrayToDelimitedString(context.getQueryShardContext().getTypes(), ",", sb); sb.append("], "); } if (context.groupStats() == null) { sb.append("stats[], "); } else { sb.append("stats["); Strings.collectionToDelimitedString(context.groupStats(), ",", "", "", sb); sb.append("], "); } sb.append("search_type[").append(context.searchType()).append("], total_shards[").append(context.numberOfShards()).append("], "); if (context.request().source() != null) { sb.append("source[").append(context.request().source().toString(FORMAT_PARAMS)).append("], "); } else { sb.append("source[], "); } return sb.toString(); } }
sb.append("], "); sb.append("search_type[").append(context.searchType()).append("], total_shards[").append(context.numberOfShards()).append("], "); if (context.request().source() != null) { sb.append("source[").append(context.request().source().toString(FORMAT_PARAMS)).append("], ");
@Override protected ValuesSourceAggregatorFactory<ValuesSource.GeoPoint, ?> innerBuild(SearchContext context, ValuesSourceConfig<ValuesSource.GeoPoint> config, AggregatorFactory<?> parent, Builder subFactoriesBuilder) throws IOException { int shardSize = this.shardSize; int requiredSize = this.requiredSize; if (shardSize < 0) { // Use default heuristic to avoid any wrong-ranking caused by // distributed counting shardSize = BucketUtils.suggestShardSideQueueSize(requiredSize, context.numberOfShards() == 1); } if (requiredSize <= 0 || shardSize <= 0) { throw new ElasticsearchException( "parameters [required_size] and [shard_size] must be >0 in geohash_grid aggregation [" + name + "]."); } if (shardSize < requiredSize) { shardSize = requiredSize; } return new GeoHashGridAggregatorFactory(name, config, precision, requiredSize, shardSize, context, parent, subFactoriesBuilder, metaData); }
@Override protected ValuesSourceAggregatorFactory<ValuesSource.GeoPoint, ?> innerBuild(SearchContext context, ValuesSourceConfig<ValuesSource.GeoPoint> config, AggregatorFactory<?> parent, Builder subFactoriesBuilder) throws IOException { int shardSize = this.shardSize; int requiredSize = this.requiredSize; if (shardSize < 0) { // Use default heuristic to avoid any wrong-ranking caused by // distributed counting shardSize = BucketUtils.suggestShardSideQueueSize(requiredSize, context.numberOfShards()); } if (requiredSize <= 0 || shardSize <= 0) { throw new ElasticsearchException( "parameters [required_size] and [shard_size] must be >0 in geohash_grid aggregation [" + name + "]."); } if (shardSize < requiredSize) { shardSize = requiredSize; } return new GeoHashGridAggregatorFactory(name, config, precision, requiredSize, shardSize, context, parent, subFactoriesBuilder, metaData); }
@Override protected ValuesSourceAggregatorFactory<ValuesSource.GeoPoint, ?> innerBuild(SearchContext context, ValuesSourceConfig<ValuesSource.GeoPoint> config, AggregatorFactory<?> parent, Builder subFactoriesBuilder) throws IOException { int shardSize = this.shardSize; int requiredSize = this.requiredSize; if (shardSize < 0) { // Use default heuristic to avoid any wrong-ranking caused by // distributed counting shardSize = BucketUtils.suggestShardSideQueueSize(requiredSize, context.numberOfShards()); } if (requiredSize <= 0 || shardSize <= 0) { throw new ElasticsearchException( "parameters [required_size] and [shard_size] must be >0 in geohash_grid aggregation [" + name + "]."); } if (shardSize < requiredSize) { shardSize = requiredSize; } return new GeoHashGridAggregatorFactory(name, config, precision, requiredSize, shardSize, context, parent, subFactoriesBuilder, metaData); }
context.numberOfShards() == 1));
when(searchContext.numberOfShards()).thenReturn(1); when(searchContext.searcher()).thenReturn(contextIndexSearcher); when(searchContext.fetchPhase())
context.numberOfShards() == 1));
context.numberOfShards()));
@Override public AggregatorFactory parse(String aggregationName, XContentParser parser, SearchContext context) throws IOException { SignificantTermsParametersParser aggParser = new SignificantTermsParametersParser(significanceHeuristicParserMapper); ValuesSourceParser vsParser = ValuesSourceParser.any(aggregationName, SignificantStringTerms.TYPE, context) .scriptable(false) .formattable(true) .build(); IncludeExclude.Parser incExcParser = new IncludeExclude.Parser(); aggParser.parse(aggregationName, parser, context, vsParser, incExcParser); TermsAggregator.BucketCountThresholds bucketCountThresholds = aggParser.getBucketCountThresholds(); if (bucketCountThresholds.getShardSize() == aggParser.getDefaultBucketCountThresholds().getShardSize()) { //The user has not made a shardSize selection . //Use default heuristic to avoid any wrong-ranking caused by distributed counting //but request double the usual amount. //We typically need more than the number of "top" terms requested by other aggregations //as the significance algorithm is in less of a position to down-select at shard-level - //some of the things we want to find have only one occurrence on each shard and as // such are impossible to differentiate from non-significant terms at that early stage. bucketCountThresholds.setShardSize(2 * BucketUtils.suggestShardSideQueueSize(bucketCountThresholds.getRequiredSize(), context.numberOfShards())); } bucketCountThresholds.ensureValidity(); SignificanceHeuristic significanceHeuristic = aggParser.getSignificanceHeuristic(); if (significanceHeuristic == null) { significanceHeuristic = JLHScore.INSTANCE; } return new SignificantTermsAggregatorFactory(aggregationName, vsParser.config(), bucketCountThresholds, aggParser.getIncludeExclude(), aggParser.getExecutionHint(), aggParser.getFilter(), significanceHeuristic); } }