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_FIELDEMPTY_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, resolveNestedbuildAsBytes, buildAsBytes, toString, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitisFragmentpublic 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.IOExceptionpublic void writeTo(StreamOutput out) throws java.io.IOException
Writeablejava.io.IOExceptionpublic 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.METERSpublic DistanceUnit unit()
DistanceUnit.METERSpublic 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.IOExceptionpublic java.lang.String getWriteableName()
NamedWriteablepublic boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic 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.IOExceptionpublic SortFieldAndFormat build(QueryShardContext context) throws java.io.IOException
SortBuilderSortFieldAndFormat from this builder.build in class SortBuilder<GeoDistanceSortBuilder>java.io.IOException