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,ToXContent,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.InternalBucket
-
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.InternalAggregation
InternalAggregation.ReduceContext
-
Nested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.Aggregation
Aggregation.CommonFields
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested 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 ParseFieldDOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAMEprotected longminDocCountprotected BucketOrderorderprotected intrequiredSizeprotected static ParseFieldSUM_OF_OTHER_DOC_COUNTS-
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
Constructors Modifier Constructor Description protectedInternalTerms(String name, BucketOrder order, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, Map<String,Object> metaData)protectedInternalTerms(StreamInput in)Read from a stream.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Acreate(String name, List<B> buckets, long docCountError, long otherDocCount)protected abstract B[]createBucketsArray(int size)Create an array to hold some buckets.InternalAggregationdoReduce(List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)protected voiddoWriteTo(StreamOutput out)protected static XContentBuilderdoXContentCommon(XContentBuilder builder, ToXContent.Params params, long docCountError, long otherDocCount, List<? extends InternalTerms.Bucket> buckets)booleanequals(Object obj)abstract BgetBucketByKey(String term)Get the bucket for the given term, or null if there is no such bucket.abstract List<B>getBuckets()Return the sorted list of the buckets in this terms aggregation.protected abstract intgetShardSize()inthashCode()protected BreduceBucket(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
countInnerBucket, countInnerBucket, create, createBucket, getProperty
-
Methods inherited from class org.elasticsearch.search.aggregations.InternalAggregation
doXContentBody, getMetaData, getName, getProperty, getType, isMapped, pipelineAggregators, readSize, reduce, 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.search.aggregations.bucket.terms.Terms
getDocCountError, getSumOfOtherDocCounts
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContent
toXContent
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
DOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAME
protected static final ParseField DOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAME
-
SUM_OF_OTHER_DOC_COUNTS
protected static final ParseField SUM_OF_OTHER_DOC_COUNTS
-
order
protected final BucketOrder order
-
requiredSize
protected final int requiredSize
-
minDocCount
protected final long minDocCount
-
-
Constructor Detail
-
InternalTerms
protected InternalTerms(String name, BucketOrder order, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, Map<String,Object> metaData)
-
InternalTerms
protected InternalTerms(StreamInput in) throws IOException
Read from a stream.- Throws:
IOException
-
-
Method Detail
-
doWriteTo
protected final void doWriteTo(StreamOutput out) throws IOException
- Specified by:
doWriteToin classInternalAggregation- Throws:
IOException
-
writeTermTypeInfoTo
protected abstract void writeTermTypeInfoTo(StreamOutput out) throws IOException
- Throws:
IOException
-
getBuckets
public abstract List<B> 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
public abstract B getBucketByKey(String term)
Description copied from interface:TermsGet the bucket for the given term, or null if there is no such bucket.- Specified by:
getBucketByKeyin interfaceTerms
-
doReduce
public InternalAggregation doReduce(List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)
- Specified by:
doReducein classInternalAggregation
-
reduceBucket
protected B reduceBucket(List<B> buckets, InternalAggregation.ReduceContext context)
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
protected abstract A create(String name, List<B> buckets, long docCountError, long otherDocCount)
-
createBucketsArray
protected abstract B[] createBucketsArray(int size)
Create an array to hold some buckets. Used in collecting the results.
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classInternalAggregation
-
hashCode
public int hashCode()
- Overrides:
hashCodein classInternalAggregation
-
doXContentCommon
protected static XContentBuilder doXContentCommon(XContentBuilder builder, ToXContent.Params params, long docCountError, long otherDocCount, List<? extends InternalTerms.Bucket> buckets) throws IOException
- Throws:
IOException
-
-