@StableMinor(version="12.0", sinceVersion="9.0") public class GeoDistanceAggregation extends AbstractSubAggregationAwareAggregation implements IFieldAwareAggregation
center point
and a collection of ranges
.IGeoDistanceAggregationResult
.
Each range will generate a bucket
to store documents that that have a distance that fit into the given range.
The given field
will be used to calculate the geo distance to the given center point
.
Thus, the given field must be of the data type
DocumentTypeField.DataType.GEO_POINT
.
If the given field is a list
, the closest point to the center will be considered.
It is important to notice that at least one range must be added
.
Distance
,
Range
,
IMultiBucketAggregationResult
,
IGeoDistanceAggregationResult
,
GeoPoint
,
SearchQuery.addAggregation(IAggregation)
Constructor and Description |
---|
GeoDistanceAggregation(String id,
DocumentTypeField field,
GeoPoint pin)
Creates a new instance of the aggregation.
|
Modifier and Type | Method and Description |
---|---|
GeoDistanceAggregation |
addRanges(Collection<Range<Double>> ranges)
Add the given ranges to the aggregation.
|
GeoDistanceAggregation |
addRanges(Range<Double>... ranges)
Add the given ranges to the aggregation.
|
DocumentTypeField |
getField()
Returns the field this aggregation is bound to.
|
String |
getId()
Returns the aggregation identifier.
|
GeoPoint |
getPin()
Returns the center point of the aggregation.
|
List<Range<Double>> |
getRanges()
Returns the range list.
|
addSubAggregation, addSubAggregations, addSubAggregations, getSubAggregations
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getId
protected final String id
public GeoDistanceAggregation(String id, DocumentTypeField field, GeoPoint pin)
id
- the aggregation identifier.field
- the field to be used to calculate the distance to the center point.pin
- the center point from which the distance will be calculated.public GeoDistanceAggregation addRanges(Range<Double>... ranges)
ranges
- the ranges.public GeoDistanceAggregation addRanges(Collection<Range<Double>> ranges)
ranges
- the ranges.public List<Range<Double>> getRanges()
public DocumentTypeField getField()
IFieldAwareAggregation
getField
in interface IFieldAwareAggregation
public GeoPoint getPin()
public String getId()
IAggregation
getId
in interface IAggregation
LumisXP 12.0.0.190809 - Copyright © 2006–2019 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.