Module org.elasticsearch.server
Class InternalTDigestPercentileRanks
java.lang.Object
org.elasticsearch.search.aggregations.InternalAggregation
org.elasticsearch.search.aggregations.metrics.InternalNumericMetricsAggregation
org.elasticsearch.search.aggregations.metrics.InternalNumericMetricsAggregation.MultiValue
org.elasticsearch.search.aggregations.metrics.InternalTDigestPercentileRanks
- All Implemented Interfaces:
Iterable<Percentile>
,NamedWriteable
,Writeable
,Aggregation
,NumericMetricsAggregation
,NumericMetricsAggregation.MultiValue
,PercentileRanks
,ToXContent
,ToXContentFragment
public class InternalTDigestPercentileRanks
extends InternalNumericMetricsAggregation.MultiValue
implements PercentileRanks
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.metrics.InternalNumericMetricsAggregation
InternalNumericMetricsAggregation.MultiValue, InternalNumericMetricsAggregation.SingleValue
Nested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.Aggregation
Aggregation.CommonFields
Nested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregation
NumericMetricsAggregation.MultiValue, NumericMetricsAggregation.SingleValue
Nested classes/interfaces inherited from interface org.elasticsearch.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
FieldsModifier and TypeFieldDescriptionprotected static final Iterator<Percentile>
protected final double[]
static final String
protected final TDigestState
Fields inherited from class org.elasticsearch.search.aggregations.metrics.InternalNumericMetricsAggregation
format
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.search.aggregations.metrics.PercentileRanks
TYPE_NAME
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS
-
Constructor Summary
ConstructorsConstructorDescriptionInternalTDigestPercentileRanks
(String name, double[] cdfValues, TDigestState state, boolean keyed, DocValueFormat formatter, Map<String, Object> metadata) Read from a stream. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.elasticsearch.search.aggregations.metrics.AbstractInternalTDigestPercentiles
createReduced
(String name, double[] keys, TDigestState merged, boolean keyed, Map<String, Object> metadata) protected void
doWriteTo
(StreamOutput out) doXContentBody
(XContentBuilder builder, ToXContent.Params params) empty
(String name, double[] keys, double compression, TDigestExecutionHint executionHint, boolean keyed, DocValueFormat format, Map<String, Object> metadata) boolean
finalizeSampling
(SamplingContext samplingContext) Called by the parent sampling context.double[]
getKeys()
Return the keys (percentiles) requested.protected AggregatorReducer
getLeaderReducer
(AggregationReduceContext reduceContext, int size) Return an object that Reduces several aggregations to a single one.getState()
Return the internalTDigestState
sketch for this metric.Returns the name of the writeable objectint
hashCode()
iterator()
boolean
keyed()
Should the output be keyed.double
percent
(double value) Return the percentile for the given value.percentAsString
(double value) Return the percentile for the given value as a String.static double
percentileRank
(TDigestState state, double value) double
value
(double key) double
Return the result of 1 value by nameReturn an iterable over all value names this multi value aggregation provides.Methods inherited from class org.elasticsearch.search.aggregations.metrics.InternalNumericMetricsAggregation.MultiValue
getProperty, sortValue, valueAsString
Methods inherited from class org.elasticsearch.search.aggregations.metrics.InternalNumericMetricsAggregation
mustReduceOnSingleInternalAgg, sortValue
Methods inherited from class org.elasticsearch.search.aggregations.InternalAggregation
canLeadReduction, copyWithRewritenBuckets, forEachBucket, getMetadata, getName, getProperty, getReducer, getType, readSize, reducePipelines, 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 java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregation.MultiValue
value, valueNames
Methods inherited from interface org.elasticsearch.xcontent.ToXContent
toXContent
Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
NAME
- See Also:
-
EMPTY_ITERATOR
-
keys
protected final double[] keys -
state
-
-
Constructor Details
-
InternalTDigestPercentileRanks
public InternalTDigestPercentileRanks(String name, double[] cdfValues, TDigestState state, boolean keyed, DocValueFormat formatter, Map<String, Object> metadata) -
InternalTDigestPercentileRanks
Read from a stream.- Throws:
IOException
-
-
Method Details
-
getWriteableName
Description copied from interface:NamedWriteable
Returns the name of the writeable object- Specified by:
getWriteableName
in interfaceNamedWriteable
-
empty
public static InternalTDigestPercentileRanks empty(String name, double[] keys, double compression, TDigestExecutionHint executionHint, boolean keyed, DocValueFormat format, Map<String, Object> metadata) -
iterator
- Specified by:
iterator
in interfaceIterable<Percentile>
-
percent
public double percent(double value) Description copied from interface:PercentileRanks
Return the percentile for the given value.- Specified by:
percent
in interfacePercentileRanks
-
percentAsString
Description copied from interface:PercentileRanks
Return the percentile for the given value as a String.- Specified by:
percentAsString
in interfacePercentileRanks
-
value
public double value(double key) -
createReduced
protected org.elasticsearch.search.aggregations.metrics.AbstractInternalTDigestPercentiles createReduced(String name, double[] keys, TDigestState merged, boolean keyed, Map<String, Object> metadata) -
percentileRank
-
doWriteTo
- Specified by:
doWriteTo
in classInternalAggregation
- Throws:
IOException
-
value
Description copied from interface:NumericMetricsAggregation.MultiValue
Return the result of 1 value by name- Specified by:
value
in interfaceNumericMetricsAggregation.MultiValue
- Specified by:
value
in classInternalNumericMetricsAggregation.MultiValue
- Parameters:
name
- of the value- Returns:
- the value
-
valueNames
Description copied from interface:NumericMetricsAggregation.MultiValue
Return an iterable over all value names this multi value aggregation provides. The iterable might be created on the fly, if you need to call this multiple times, please cache the result in a variable on caller side..- Returns:
- iterable over all value names
-
formatter
-
getState
Return the internalTDigestState
sketch for this metric. -
getKeys
public double[] getKeys()Return the keys (percentiles) requested. -
keyed
public boolean keyed()Should the output be keyed. -
getLeaderReducer
Description copied from class:InternalAggregation
Return an object that Reduces several aggregations to a single one. This method is called whenInternalAggregation.canLeadReduction()
returns true and expects an reducer that produces the right result.- Specified by:
getLeaderReducer
in classInternalAggregation
-
finalizeSampling
Description copied from class:InternalAggregation
Called by the parent sampling context. Should only ever be called once as some aggregations scale their internal values- Overrides:
finalizeSampling
in classInternalAggregation
- Parameters:
samplingContext
- the current sampling context- Returns:
- new aggregation with the sampling context applied, could be the same aggregation instance if nothing needs to be done
-
doXContentBody
public XContentBuilder doXContentBody(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
doXContentBody
in classInternalAggregation
- Throws:
IOException
-
equals
- Overrides:
equals
in classInternalNumericMetricsAggregation
-
hashCode
public int hashCode()- Overrides:
hashCode
in classInternalNumericMetricsAggregation
-