Module org.elasticsearch.server
Class InternalVariableWidthHistogram.Bucket
java.lang.Object
org.elasticsearch.search.aggregations.InternalMultiBucketAggregation.InternalBucket
org.elasticsearch.search.aggregations.InternalMultiBucketAggregation.InternalBucketWritable
org.elasticsearch.search.aggregations.bucket.histogram.AbstractHistogramBucket
org.elasticsearch.search.aggregations.bucket.histogram.InternalVariableWidthHistogram.Bucket
- All Implemented Interfaces:
Writeable,MultiBucketsAggregation.Bucket,KeyComparable<InternalVariableWidthHistogram.Bucket>
- Enclosing class:
InternalVariableWidthHistogram
public static class InternalVariableWidthHistogram.Bucket
extends AbstractHistogramBucket
implements KeyComparable<InternalVariableWidthHistogram.Bucket>
-
Nested Class Summary
Nested ClassesNested 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.bucket.histogram.AbstractHistogramBucket
aggregations, docCount, format -
Constructor Summary
ConstructorsConstructorDescriptionBucket(double centroid, InternalVariableWidthHistogram.Bucket.BucketBounds bounds, long docCount, DocValueFormat format, InternalAggregations aggregations) -
Method Summary
Modifier and TypeMethodDescriptiondoublecentroid()intCompare thisMultiBucketsAggregation.Bucketskeywith another bucket.booleangetKey()Buckets are compared using their centroids.inthashCode()doublemax()doublemin()readFrom(StreamInput in, DocValueFormat format) Read from a stream.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.search.aggregations.bucket.histogram.AbstractHistogramBucket
getAggregations, getDocCount, getFormatterMethods inherited from class org.elasticsearch.search.aggregations.InternalMultiBucketAggregation.InternalBucket
getProperty
-
Constructor Details
-
Bucket
public Bucket(double centroid, InternalVariableWidthHistogram.Bucket.BucketBounds bounds, long docCount, DocValueFormat format, InternalAggregations aggregations)
-
-
Method Details
-
readFrom
public static InternalVariableWidthHistogram.Bucket readFrom(StreamInput in, DocValueFormat format) throws IOException Read from a stream.- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
getKeyAsString
- Specified by:
getKeyAsStringin interfaceMultiBucketsAggregation.Bucket- Returns:
- The key associated with the bucket as a string
-
getKey
Buckets are compared using their centroids. But, in the final XContent returned by the aggregation, we want the bucket's key to be its min. Otherwise, it would look like the distances between centroids are buckets, which is incorrect.- Specified by:
getKeyin interfaceMultiBucketsAggregation.Bucket- Returns:
- The key associated with the bucket
-
min
public double min() -
max
public double max() -
centroid
public double centroid() -
compareKey
Description copied from interface:KeyComparableCompare thisMultiBucketsAggregation.Bucketskeywith another bucket.- Specified by:
compareKeyin interfaceKeyComparable<InternalVariableWidthHistogram.Bucket>- Parameters:
other- the bucket that contains the key to compare to.- Returns:
- a negative integer, zero, or a positive integer as this buckets key is less than, equal to, or greater than the other buckets key.
- See Also:
-