Module org.elasticsearch.server
Class InternalCentroid
java.lang.Object
org.elasticsearch.search.aggregations.InternalAggregation
org.elasticsearch.search.aggregations.metrics.InternalCentroid
- All Implemented Interfaces:
NamedWriteable,Writeable,Aggregation,CentroidAggregation,ToXContent,ToXContentFragment
- Direct Known Subclasses:
InternalGeoCentroid
Serialization and merge logic for
GeoCentroidAggregator.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.Aggregation
Aggregation.CommonFieldsNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from class org.elasticsearch.search.aggregations.InternalAggregation
metadata, nameFields inherited from interface org.elasticsearch.search.aggregations.Aggregation
TYPED_KEYS_DELIMITERFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsModifierConstructorDescriptionInternalCentroid(String name, SpatialPoint centroid, long count, Map<String, Object> metadata) protectedRead from a stream. -
Method Summary
Modifier and TypeMethodDescriptioncentroid()protected abstract SpatialPointprotected abstract voidprotected abstract InternalCentroidcopyWith(double firstSum, double secondSum, long totalCount) Create a new centroid with by reducing from the sums and total countprotected abstract InternalCentroidcopyWith(SpatialPoint result, long count) longcount()protected voiddoWriteTo(StreamOutput out) doXContentBody(XContentBuilder builder, ToXContent.Params params) booleanprotected abstract doubleextractDouble(String name) protected abstract doubleextractFirst(SpatialPoint point) protected abstract doubleextractSecond(SpatialPoint point) finalizeSampling(SamplingContext samplingContext) Called by the parent sampling context.protected AggregatorReducergetLeaderReducer(AggregationReduceContext reduceContext, int size) Return an object that Reduces several aggregations to a single one.getProperty(List<String> path) inthashCode()protected booleanSignal the framework if the AggregatorReducer phase needs to be called when there is only one InternalAggregation.protected abstract Stringprotected abstract StringtoString()Methods inherited from class org.elasticsearch.search.aggregations.InternalAggregation
canLeadReduction, copyWithRewritenBuckets, forEachBucket, getMetadata, getName, getProperty, getReducer, getType, readSize, reducePipelines, sortValue, sortValue, 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.common.io.stream.NamedWriteable
getWriteableNameMethods inherited from interface org.elasticsearch.xcontent.ToXContent
toXContentMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
centroid
-
count
protected final long count
-
-
Constructor Details
-
InternalCentroid
public InternalCentroid(String name, SpatialPoint centroid, long count, Map<String, Object> metadata) -
InternalCentroid
Read from a stream.- Throws:
IOException
-
-
Method Details
-
centroidFromStream
- Throws:
IOException
-
centroidToStream
- Throws:
IOException
-
doWriteTo
- Specified by:
doWriteToin classInternalAggregation- Throws:
IOException
-
centroid
- Specified by:
centroidin interfaceCentroidAggregation
-
count
public long count()- Specified by:
countin interfaceCentroidAggregation
-
copyWith
-
copyWith
Create a new centroid with by reducing from the sums and total count -
getLeaderReducer
Description copied from class:InternalAggregationReturn 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:
getLeaderReducerin classInternalAggregation
-
nameFirst
-
extractFirst
-
nameSecond
-
extractSecond
-
finalizeSampling
Description copied from class:InternalAggregationCalled by the parent sampling context. Should only ever be called once as some aggregations scale their internal values- Overrides:
finalizeSamplingin 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
-
mustReduceOnSingleInternalAgg
protected boolean mustReduceOnSingleInternalAgg()Description copied from class:InternalAggregationSignal the framework if the AggregatorReducer phase needs to be called when there is only one InternalAggregation.- Specified by:
mustReduceOnSingleInternalAggin classInternalAggregation
-
extractDouble
-
getProperty
- Specified by:
getPropertyin classInternalAggregation
-
doXContentBody
public XContentBuilder doXContentBody(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
doXContentBodyin classInternalAggregation- Throws:
IOException
-
equals
- Overrides:
equalsin classInternalAggregation
-
hashCode
public int hashCode()- Overrides:
hashCodein classInternalAggregation
-
toString
- Overrides:
toStringin classInternalAggregation
-