public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
Writeable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALTERNATIVE_NAME |
static GeoValidationMethod |
DEFAULT_VALIDATION |
static java.lang.String |
NAME |
NESTED_FILTER_FIELD, NESTED_PATH_FIELD, order, ORDER_FIELD
EMPTY_PARAMS
Constructor and Description |
---|
GeoDistanceSortBuilder(StreamInput in)
Read from a stream.
|
GeoDistanceSortBuilder(java.lang.String fieldName,
double lat,
double lon)
Constructs a new distance based sort on a geo point like field.
|
GeoDistanceSortBuilder(java.lang.String fieldName,
GeoPoint... points)
Constructs a new distance based sort on a geo point like field.
|
GeoDistanceSortBuilder(java.lang.String fieldName,
java.lang.String... geohashes)
Constructs a new distance based sort on a geo point like field.
|
Modifier and Type | Method and Description |
---|---|
SortFieldAndFormat |
build(QueryShardContext context)
Create a @link
SortFieldAndFormat from this builder. |
boolean |
equals(java.lang.Object object) |
java.lang.String |
fieldName()
Returns the geo point like field the distance based sort operates on.
|
static GeoDistanceSortBuilder |
fromXContent(QueryParseContext context,
java.lang.String elementName)
Creates a new
GeoDistanceSortBuilder from the query held by the QueryParseContext in
XContent format. |
GeoDistance |
geoDistance()
Returns the geo distance type used to compute the distance.
|
GeoDistanceSortBuilder |
geoDistance(GeoDistance geoDistance)
The geo distance type used to compute the distance.
|
GeoDistanceSortBuilder |
geohashes(java.lang.String... geohashes)
Deprecated.
|
QueryBuilder |
getNestedFilter()
Returns the nested filter that the nested objects should match with in order to be taken into account
for sorting.
|
java.lang.String |
getNestedPath()
Returns the nested path if sorting occurs on a field that is inside a nested object.
|
java.lang.String |
getWriteableName()
Returns the name of the writeable object
|
int |
hashCode() |
GeoDistanceSortBuilder |
point(double lat,
double lon)
The point to create the range distance facets from.
|
GeoPoint[] |
points()
Returns the points to create the range distance facets from.
|
GeoDistanceSortBuilder |
points(GeoPoint... points)
The point to create the range distance facets from.
|
GeoDistanceSortBuilder |
setNestedFilter(QueryBuilder nestedFilter)
Sets the nested filter that the nested objects should match with in order to be taken into account
for sorting.
|
GeoDistanceSortBuilder |
setNestedPath(java.lang.String nestedPath)
Sets the nested path if sorting occurs on a field that is inside a nested object.
|
SortMode |
sortMode()
Returns which distance to use for sorting in the case a document contains multiple geo points.
|
GeoDistanceSortBuilder |
sortMode(SortMode sortMode)
Defines which distance to use for sorting in the case a document contains multiple geo points.
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
DistanceUnit |
unit()
Returns the distance unit to use.
|
GeoDistanceSortBuilder |
unit(DistanceUnit unit)
The distance unit to use.
|
GeoValidationMethod |
validation()
Returns the validation method to use for this sort builder.
|
GeoDistanceSortBuilder |
validation(GeoValidationMethod method)
Sets validation method for this sort builder.
|
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
buildSort, fromXContent, order, order, parseNestedFilter, resolveNested
buildAsBytes, buildAsBytes, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
public static final java.lang.String NAME
public static final java.lang.String ALTERNATIVE_NAME
public static final GeoValidationMethod DEFAULT_VALIDATION
public GeoDistanceSortBuilder(java.lang.String fieldName, GeoPoint... points)
fieldName
- The geo point like field name.points
- The points to create the range distance facets from.public GeoDistanceSortBuilder(java.lang.String fieldName, double lat, double lon)
fieldName
- The geo point like field name.lat
- Latitude of the point to create the range distance facets from.lon
- Longitude of the point to create the range distance facets from.public GeoDistanceSortBuilder(java.lang.String fieldName, java.lang.String... geohashes)
fieldName
- The geo point like field name.geohashes
- The points to create the range distance facets from.public GeoDistanceSortBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
java.io.IOException
public java.lang.String fieldName()
public GeoDistanceSortBuilder point(double lat, double lon)
lat
- latitude.lon
- longitude.public GeoDistanceSortBuilder points(GeoPoint... points)
points
- reference points.public GeoPoint[] points()
@Deprecated public GeoDistanceSortBuilder geohashes(java.lang.String... geohashes)
public GeoDistanceSortBuilder geoDistance(GeoDistance geoDistance)
public GeoDistance geoDistance()
public GeoDistanceSortBuilder unit(DistanceUnit unit)
DistanceUnit.METERS
public DistanceUnit unit()
DistanceUnit.METERS
public GeoDistanceSortBuilder validation(GeoValidationMethod method)
public GeoValidationMethod validation()
public GeoDistanceSortBuilder sortMode(SortMode sortMode)
public SortMode sortMode()
public GeoDistanceSortBuilder setNestedFilter(QueryBuilder nestedFilter)
public QueryBuilder getNestedFilter()
public GeoDistanceSortBuilder setNestedPath(java.lang.String nestedPath)
public java.lang.String getNestedPath()
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException
public java.lang.String getWriteableName()
NamedWriteable
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static GeoDistanceSortBuilder fromXContent(QueryParseContext context, java.lang.String elementName) throws java.io.IOException
GeoDistanceSortBuilder
from the query held by the QueryParseContext
in
XContent
format.context
- the input parse context. The state on the parser contained in this context will be changed as a
side effect of this method callelementName
- in some sort syntax variations the field name precedes the xContent object that specifies
further parameters, e.g. in '{ "foo": { "order" : "asc"} }'. When parsing the inner object,
the field name can be passed in via this argumentjava.io.IOException
public SortFieldAndFormat build(QueryShardContext context) throws java.io.IOException
SortBuilder
SortFieldAndFormat
from this builder.build
in class SortBuilder<GeoDistanceSortBuilder>
java.io.IOException