Class InternalTerms<A extends InternalTerms<A,B>,B extends InternalTerms.Bucket<B>>
java.lang.Object
org.elasticsearch.search.aggregations.InternalAggregation
org.elasticsearch.search.aggregations.InternalMultiBucketAggregation<A,B>
org.elasticsearch.search.aggregations.bucket.terms.InternalTerms<A,B>
- All Implemented Interfaces:
NamedWriteable,Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment,Aggregation,MultiBucketsAggregation,Terms
- Direct Known Subclasses:
InternalMappedTerms,UnmappedTerms
public abstract class InternalTerms<A extends InternalTerms<A,B>,B extends InternalTerms.Bucket<B>> extends InternalMultiBucketAggregation<A,B> implements Terms
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInternalTerms.Bucket<B extends InternalTerms.Bucket<B>>Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.InternalMultiBucketAggregation
InternalMultiBucketAggregation.InternalBucketNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.InternalAggregation
InternalAggregation.ReduceContext, InternalAggregation.ReduceContextBuilderNested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.Aggregation
Aggregation.CommonFieldsNested 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.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields Modifier and Type Field Description protected static org.elasticsearch.common.ParseFieldDOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAMEprotected longminDocCountprotected BucketOrderorderprotected intrequiredSizeprotected static org.elasticsearch.common.ParseFieldSUM_OF_OTHER_DOC_COUNTSFields inherited from class org.elasticsearch.search.aggregations.InternalAggregation
metadata, nameFields inherited from interface org.elasticsearch.search.aggregations.Aggregation
TYPED_KEYS_DELIMITER -
Constructor Summary
Constructors Modifier Constructor Description protectedInternalTerms(java.lang.String name, BucketOrder order, int requiredSize, long minDocCount, java.util.Map<java.lang.String,java.lang.Object> metadata)protectedInternalTerms(StreamInput in)Read from a stream. -
Method Summary
Modifier and Type Method Description protected abstract Acreate(java.lang.String name, java.util.List<B> buckets, long docCountError, long otherDocCount)protected abstract B[]createBucketsArray(int size)Create an array to hold some buckets.protected voiddoWriteTo(StreamOutput out)protected static org.elasticsearch.common.xcontent.XContentBuilderdoXContentCommon(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, long docCountError, long otherDocCount, java.util.List<? extends InternalTerms.Bucket> buckets)booleanequals(java.lang.Object obj)abstract BgetBucketByKey(java.lang.String term)Get the bucket for the given term, or null if there is no such bucket.abstract java.util.List<B>getBuckets()Return the sorted list of the buckets in this terms aggregation.protected abstract intgetShardSize()inthashCode()InternalAggregationreduce(java.util.List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)Reduces the given aggregations to a single one and returns it.protected BreduceBucket(java.util.List<B> buckets, InternalAggregation.ReduceContext context)Reduce a list of same-keyed buckets (from multiple shards) to a single bucket.protected abstract voidsetDocCountError(long docCountError)protected abstract voidwriteTermTypeInfoTo(StreamOutput out)Methods inherited from class org.elasticsearch.search.aggregations.InternalMultiBucketAggregation
copyWithRewritenBuckets, countInnerBucket, countInnerBucket, create, createBucket, forEachBucket, getProperty, reducePipelinesMethods inherited from class org.elasticsearch.search.aggregations.InternalAggregation
doXContentBody, getMetadata, getName, getProperty, getType, isMapped, mergePipelineTreeForBWCSerialization, pipelineAggregatorsForBwcSerialization, readSize, sortValue, sortValue, toString, toXContent, writeSize, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.search.aggregations.Aggregation
getMetadata, getName, getTypeMethods inherited from interface org.elasticsearch.search.aggregations.bucket.terms.Terms
getDocCountError, getSumOfOtherDocCounts
-
Field Details
-
DOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAME
protected static final org.elasticsearch.common.ParseField DOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAME -
SUM_OF_OTHER_DOC_COUNTS
protected static final org.elasticsearch.common.ParseField SUM_OF_OTHER_DOC_COUNTS -
order
-
requiredSize
protected final int requiredSize -
minDocCount
protected final long minDocCount
-
-
Constructor Details
-
InternalTerms
protected InternalTerms(java.lang.String name, BucketOrder order, int requiredSize, long minDocCount, java.util.Map<java.lang.String,java.lang.Object> metadata) -
InternalTerms
Read from a stream.- Throws:
java.io.IOException
-
-
Method Details
-
doWriteTo
- Specified by:
doWriteToin classInternalAggregation- Throws:
java.io.IOException
-
writeTermTypeInfoTo
- Throws:
java.io.IOException
-
getBuckets
Description copied from interface:TermsReturn the sorted list of the buckets in this terms aggregation.- Specified by:
getBucketsin interfaceMultiBucketsAggregation- Specified by:
getBucketsin interfaceTerms- Specified by:
getBucketsin classInternalMultiBucketAggregation<A extends InternalTerms<A,B>,B extends InternalTerms.Bucket<B>>- Returns:
- The buckets of this aggregation.
-
getBucketByKey
Description copied from interface:TermsGet the bucket for the given term, or null if there is no such bucket.- Specified by:
getBucketByKeyin interfaceTerms
-
reduce
public InternalAggregation reduce(java.util.List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)Description copied from class:InternalAggregationReduces 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:
reducein classInternalAggregation
-
reduceBucket
Description copied from class:InternalMultiBucketAggregationReduce a list of same-keyed buckets (from multiple shards) to a single bucket. This requires all buckets to have the same key.- Specified by:
reduceBucketin classInternalMultiBucketAggregation<A extends InternalTerms<A,B>,B extends InternalTerms.Bucket<B>>
-
setDocCountError
protected abstract void setDocCountError(long docCountError) -
getShardSize
protected abstract int getShardSize() -
create
-
createBucketsArray
Create an array to hold some buckets. Used in collecting the results. -
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classInternalAggregation
-
hashCode
public int hashCode()- Overrides:
hashCodein classInternalAggregation
-
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, java.util.List<? extends InternalTerms.Bucket> buckets) throws java.io.IOException- Throws:
java.io.IOException
-