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
Modifier and TypeClassDescriptionprotected static class
static class
Nested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.Aggregation
Aggregation.CommonFields
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
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.xcontent.ToXContent
EMPTY, EMPTY_PARAMS
-
Constructor Summary
ModifierConstructorDescriptionInternalCentroid
(String name, SpatialPoint centroid, long count, Map<String, Object> metadata, InternalCentroid.FieldExtractor firstField, InternalCentroid.FieldExtractor secondField) protected
InternalCentroid
(StreamInput in, InternalCentroid.FieldExtractor firstField, InternalCentroid.FieldExtractor secondField) Read from a stream. -
Method Summary
Modifier and TypeMethodDescriptioncentroid()
protected abstract SpatialPoint
protected abstract void
protected abstract InternalCentroid
copyWith
(double firstSum, double secondSum, long totalCount) Create a new centroid with by reducing from the sums and total countprotected abstract InternalCentroid
copyWith
(SpatialPoint result, long count) long
count()
protected void
doWriteTo
(StreamOutput out) doXContentBody
(XContentBuilder builder, ToXContent.Params params) boolean
protected abstract double
extractDouble
(String name) finalizeSampling
(SamplingContext samplingContext) Called by the parent sampling context.protected AggregatorReducer
getLeaderReducer
(AggregationReduceContext reduceContext, int size) Return an object that Reduces several aggregations to a single one.getProperty
(List<String> path) int
hashCode()
protected boolean
Signal the framework if the AggregatorReducer phase needs to be called when there is only one InternalAggregation.toString()
Methods inherited from class org.elasticsearch.search.aggregations.InternalAggregation
canLeadReduction, copyWithRewritenBuckets, forEachBucket, getMetadata, getName, getProperty, getReducer, getType, readSize, reducePipelines, sortValue, sortValue, 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.xcontent.ToXContent
toXContent
Methods 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.FieldExtractor firstField, InternalCentroid.FieldExtractor secondField) -
InternalCentroid
protected InternalCentroid(StreamInput in, InternalCentroid.FieldExtractor firstField, InternalCentroid.FieldExtractor secondField) throws IOException Read from a stream.- Throws:
IOException
-
-
Method Details
-
centroidFromStream
- Throws:
IOException
-
centroidToStream
- Throws:
IOException
-
doWriteTo
- Specified by:
doWriteTo
in classInternalAggregation
- Throws:
IOException
-
centroid
- Specified by:
centroid
in interfaceCentroidAggregation
-
count
public long count()- Specified by:
count
in interfaceCentroidAggregation
-
copyWith
-
copyWith
Create a new centroid with by reducing from the sums and total count -
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
-
mustReduceOnSingleInternalAgg
protected boolean mustReduceOnSingleInternalAgg()Description copied from class:InternalAggregation
Signal the framework if the AggregatorReducer phase needs to be called when there is only one InternalAggregation.- Specified by:
mustReduceOnSingleInternalAgg
in classInternalAggregation
-
extractDouble
-
getProperty
- Specified by:
getProperty
in classInternalAggregation
-
doXContentBody
public XContentBuilder doXContentBody(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
doXContentBody
in classInternalAggregation
- Throws:
IOException
-
equals
- Overrides:
equals
in classInternalAggregation
-
hashCode
public int hashCode()- Overrides:
hashCode
in classInternalAggregation
-
toString
- Overrides:
toString
in classInternalAggregation
-