public class GeoDistanceBuilder extends AggregationBuilder<GeoDistanceBuilder>
GeoDistance
aggregation.Modifier and Type | Class and Description |
---|---|
static class |
GeoDistanceBuilder.Range
A range of values.
|
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
type
EMPTY_PARAMS
Constructor and Description |
---|
GeoDistanceBuilder(String name)
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
GeoDistanceBuilder |
addRange(double from,
double to)
Same as
addRange(String, double, double) but the key will be
automatically generated based on from and to . |
GeoDistanceBuilder |
addRange(String key,
double from,
double to)
Add a new range to this aggregation.
|
GeoDistanceBuilder |
addUnboundedFrom(double from)
Same as
addUnboundedFrom(String, double) but the key will be
computed automatically. |
GeoDistanceBuilder |
addUnboundedFrom(String key,
double from)
Add a new range with no upper bound.
|
GeoDistanceBuilder |
addUnboundedTo(double to)
Same as
addUnboundedTo(String, double) but the key will be
computed automatically. |
GeoDistanceBuilder |
addUnboundedTo(String key,
double to)
Add a new range with no lower bound.
|
GeoDistanceBuilder |
distanceType(GeoDistance distanceType)
Set the
distance type to use, defaults to
GeoDistance.SLOPPY_ARC . |
GeoDistanceBuilder |
field(String field)
Set the field to use to compute distances.
|
GeoDistanceBuilder |
geohash(String geohash)
Set the point to calculate distances from using its geohash.
|
protected XContentBuilder |
internalXContent(XContentBuilder builder,
ToXContent.Params params) |
GeoDistanceBuilder |
lat(double lat)
Set the latitude of the point to calculate distances from.
|
GeoDistanceBuilder |
lon(double lon)
Set the longitude of the point to calculate distances from.
|
GeoDistanceBuilder |
point(GeoPoint point)
Set the point to calculate distances from.
|
GeoDistanceBuilder |
point(String latLon)
Set the point to calculate distances from using a
lat,lon notation or geohash. |
GeoDistanceBuilder |
unit(DistanceUnit unit)
Set the unit to use for distances, default is kilometers.
|
setMetaData, subAggregation, subAggregation, subAggregation, subAggregation, subAggregation, subAggregation, toXContent
getName
public GeoDistanceBuilder(String name)
public GeoDistanceBuilder field(String field)
public GeoDistanceBuilder unit(DistanceUnit unit)
public GeoDistanceBuilder distanceType(GeoDistance distanceType)
distance type
to use, defaults to
GeoDistance.SLOPPY_ARC
.public GeoDistanceBuilder point(String latLon)
lat,lon
notation or geohash.public GeoDistanceBuilder point(GeoPoint point)
public GeoDistanceBuilder geohash(String geohash)
public GeoDistanceBuilder lat(double lat)
public GeoDistanceBuilder lon(double lon)
public GeoDistanceBuilder addRange(String key, double from, double to)
key
- the key to use for this range in the responsefrom
- the lower bound on the distances, inclusiveto
- the upper bound on the distances, exclusivepublic GeoDistanceBuilder addRange(double from, double to)
addRange(String, double, double)
but the key will be
automatically generated based on from
and to
.public GeoDistanceBuilder addUnboundedTo(String key, double to)
key
- the key to use for this range in the responseto
- the upper bound on the distances, exclusivepublic GeoDistanceBuilder addUnboundedTo(double to)
addUnboundedTo(String, double)
but the key will be
computed automatically.public GeoDistanceBuilder addUnboundedFrom(String key, double from)
key
- the key to use for this range in the responsefrom
- the lower bound on the distances, inclusivepublic GeoDistanceBuilder addUnboundedFrom(double from)
addUnboundedFrom(String, double)
but the key will be
computed automatically.protected XContentBuilder internalXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
internalXContent
in class AggregationBuilder<GeoDistanceBuilder>
IOException
Copyright © 2009–2017. All rights reserved.