Class AbstractInternalTerms<A extends AbstractInternalTerms<A,B>,B extends AbstractInternalTerms.AbstractTermsBucket>
java.lang.Object
org.elasticsearch.search.aggregations.InternalAggregation
org.elasticsearch.search.aggregations.InternalMultiBucketAggregation<A,B>
org.elasticsearch.search.aggregations.bucket.terms.AbstractInternalTerms<A,B>
- All Implemented Interfaces:
NamedWriteable
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
,Aggregation
,MultiBucketsAggregation
- Direct Known Subclasses:
InternalTerms
public abstract class AbstractInternalTerms<A extends AbstractInternalTerms<A,B>,B extends AbstractInternalTerms.AbstractTermsBucket>
extends InternalMultiBucketAggregation<A,B>
Base class for terms and multi_terms aggregation that handles common reduce logic
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.InternalMultiBucketAggregation
InternalMultiBucketAggregation.InternalBucket
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.InternalAggregation
InternalAggregation.ReduceContext, InternalAggregation.ReduceContextBuilder
Nested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.Aggregation
Aggregation.CommonFields
Nested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation
MultiBucketsAggregation.Bucket
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.InternalAggregation
metadata, name
Fields inherited from interface org.elasticsearch.search.aggregations.Aggregation
TYPED_KEYS_DELIMITER
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ModifierConstructorDescriptionAbstractInternalTerms(String name, Map<String,Object> metadata)
protected
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract A
create(String name, List<B> buckets, BucketOrder reduceOrder, long docCountError, long otherDocCount)
Creates InternalTerms at the end of the mergeprotected abstract B
createBucket(long docCount, InternalAggregations aggs, long docCountError, B prototype)
protected static org.elasticsearch.common.xcontent.XContentBuilder
doXContentCommon(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, long docCountError, long otherDocCount, List<? extends AbstractInternalTerms.AbstractTermsBucket> buckets)
protected abstract long
protected abstract long
protected abstract BucketOrder
getOrder()
protected abstract BucketOrder
protected abstract int
protected abstract int
protected abstract long
reduce(List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)
Reduces the given aggregations to a single one and returns it.reduceBucket(List<B> buckets, InternalAggregation.ReduceContext context)
Reduce a list of same-keyed buckets (from multiple shards) to a single bucket.protected abstract void
setDocCountError(long docCountError)
Methods inherited from class org.elasticsearch.search.aggregations.InternalMultiBucketAggregation
copyWithRewritenBuckets, countInnerBucket, countInnerBucket, create, createBucket, forEachBucket, getBuckets, getProperty, mustReduceOnSingleInternalAgg, reducePipelines
Methods inherited from class org.elasticsearch.search.aggregations.InternalAggregation
doWriteTo, doXContentBody, equals, getMetadata, getName, getProperty, getType, hashCode, isMapped, mergePipelineTreeForBWCSerialization, pipelineAggregatorsForBwcSerialization, readSize, sortValue, sortValue, toString, toXContent, writeSize, writeTo
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.search.aggregations.Aggregation
getMetadata, getName, getType
Methods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable
getWriteableName
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContent
toXContent
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
AbstractInternalTerms
-
AbstractInternalTerms
- Throws:
IOException
-
-
Method Details
-
create
protected abstract A create(String name, List<B> buckets, BucketOrder reduceOrder, long docCountError, long otherDocCount)Creates InternalTerms at the end of the merge -
getShardSize
protected abstract int getShardSize() -
getReduceOrder
-
getOrder
-
getSumOfOtherDocCounts
protected abstract long getSumOfOtherDocCounts() -
getDocCountError
protected abstract long getDocCountError() -
setDocCountError
protected abstract void setDocCountError(long docCountError) -
getMinDocCount
protected abstract long getMinDocCount() -
getRequiredSize
protected abstract int getRequiredSize() -
createBucket
protected abstract B createBucket(long docCount, InternalAggregations aggs, long docCountError, B prototype) -
reduceBucket
Description copied from class:InternalMultiBucketAggregation
Reduce a list of same-keyed buckets (from multiple shards) to a single bucket. This requires all buckets to have the same key.- Specified by:
reduceBucket
in classInternalMultiBucketAggregation<A extends AbstractInternalTerms<A,B>,B extends AbstractInternalTerms.AbstractTermsBucket>
-
reduce
public InternalAggregation reduce(List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)Description copied from class:InternalAggregation
Reduces the given aggregations to a single one and returns it. In most cases, the assumption will be the all given aggregations are of the same type (the same type as this aggregation). For best efficiency, when implementing, try reusing an existing instance (typically the first in the given list) to save on redundant object construction.- Specified by:
reduce
in classInternalAggregation
- See Also:
InternalAggregation.mustReduceOnSingleInternalAgg()
-
doXContentCommon
protected static org.elasticsearch.common.xcontent.XContentBuilder doXContentCommon(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, long docCountError, long otherDocCount, List<? extends AbstractInternalTerms.AbstractTermsBucket> buckets) throws IOException- Throws:
IOException
-