Module org.elasticsearch.server
Class TDigestState
java.lang.Object
org.elasticsearch.search.aggregations.metrics.TDigestState
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,Releasable
- Direct Known Subclasses:
EmptyTDigestState
Decorates
TDigest with custom serialization. The underlying implementation for TDigest is selected
through factory method params, providing one optimized for performance (e.g. MergingDigest or HybridDigest) by default, or optionally one
that produces highly accurate results regardless of input size but its construction over the sample population takes 2x-10x longer.-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTDigestState(CircuitBreaker breaker, TDigestState.Type type, double compression) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double x) voidadd(double x, long w) voidadd(TDigestState other) final doublecdf(double x) final intfinal Collection<Centroid> voidclose()final voidcompress()final doublestatic TDigestStatecreate(CircuitBreaker breaker, double compression) Default factory for TDigestState.static TDigestStatecreate(CircuitBreaker breaker, double compression, TDigestExecutionHint executionHint) Factory for TDigestState.static TDigestStateFactory for TDigestState.static TDigestStatecreateWithoutCircuitBreaking(double compression) Deprecated.No-op circuit-breaked factory for TDigestState.static TDigestStatecreateWithoutCircuitBreaking(double compression, TDigestExecutionHint executionHint) Deprecated.No-op circuit-breaked factory for TDigestState.booleanfinal doublegetMax()final doublegetMin()inthashCode()final doublequantile(double q) longstatic TDigestStateread(CircuitBreaker breaker, StreamInput in) static TDigestStateread(StreamInput in) Deprecated.No-op circuit-breaked factory for TDigestState.final longsize()static voidwrite(TDigestState state, StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Constructor Details
-
TDigestState
-
-
Method Details
-
createWithoutCircuitBreaking
Deprecated.No-op circuit-breaked factory for TDigestState. Used in _search aggregations. Please use thecreate(CircuitBreaker, double)method instead on new usages. -
create
Default factory for TDigestState. The underlyingTDigestimplementation is optimized for performance, potentially providing slightly inaccurate results compared to other, substantially slower implementations.- Parameters:
compression- the compression factor for the underlyingTDigestobject- Returns:
- a TDigestState object that's optimized for performance
-
createWithoutCircuitBreaking
@Deprecated public static TDigestState createWithoutCircuitBreaking(double compression, TDigestExecutionHint executionHint) Deprecated.No-op circuit-breaked factory for TDigestState. Used in _search aggregations. Please use thecreate(CircuitBreaker, double, TDigestExecutionHint)method instead on new usages. -
create
public static TDigestState create(CircuitBreaker breaker, double compression, TDigestExecutionHint executionHint) Factory for TDigestState. The underlyingTDigestimplementation is either optimized for performance (default), potentially providing slightly inaccurate results for large populations, or optimized for accuracy but taking 2x-10x more to build.- Parameters:
compression- the compression factor for the underlyingTDigestobjectexecutionHint- controls which implementation is used; accepted values are 'high_accuracy' and '' (default)- Returns:
- a TDigestState object
-
createUsingParamsFrom
Factory for TDigestState. Uses the same initialization params as the passed TDigestState object. No data loading happens, and the input TDigestState object doesn't get altered in any way.- Parameters:
state- the TDigestState object providing the initialization params- Returns:
- a TDigestState object
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-
compression
public final double compression() -
write
- Throws:
IOException
-
read
Deprecated.No-op circuit-breaked factory for TDigestState. Used in _search aggregations. Please use theread(CircuitBreaker, StreamInput)method instead on new usages.- Throws:
IOException
-
read
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
add
-
add
public void add(double x, long w) -
add
public void add(double x) -
compress
public final void compress() -
size
public final long size() -
cdf
public final double cdf(double x) -
quantile
public final double quantile(double q) -
centroids
-
centroidCount
public final int centroidCount() -
getMin
public final double getMin() -
getMax
public final double getMax() -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReleasable
-