NamedWriteable
, Writeable
, ToXContent
, ToXContentObject
, Rewriteable<SortBuilder<?>>
public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
ALTERNATIVE_NAME |
|
static GeoValidationMethod |
DEFAULT_VALIDATION |
|
static java.lang.String |
NAME |
MAX_REWRITE_ROUNDS
NESTED_FILTER_FIELD, NESTED_PATH_FIELD, order, ORDER_FIELD
EMPTY_PARAMS
Constructor | Description |
---|---|
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,
java.lang.String... geohashes) |
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(StreamInput in) |
Read from a stream.
|
Modifier and Type | Method | 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(XContentParser parser,
java.lang.String elementName) |
|
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() |
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort() |
java.lang.String |
getNestedPath() |
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort() |
NestedSortBuilder |
getNestedSort() |
Returns the
NestedSortBuilder |
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 |
rewrite(QueryRewriteContext ctx) |
Rewrites this instance based on the provided context.
|
GeoDistanceSortBuilder |
setNestedFilter(QueryBuilder nestedFilter) |
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort() |
GeoDistanceSortBuilder |
setNestedPath(java.lang.String nestedPath) |
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort() |
GeoDistanceSortBuilder |
setNestedSort(NestedSortBuilder nestedSort) |
Sets the
NestedSortBuilder to be used for fields that are 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.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
buildSort, fromXContent, order, order, parseNestedFilter, resolveNested, resolveNested, toString
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()
@Deprecated public GeoDistanceSortBuilder setNestedFilter(QueryBuilder nestedFilter)
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
@Deprecated public QueryBuilder getNestedFilter()
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
@Deprecated public GeoDistanceSortBuilder setNestedPath(java.lang.String nestedPath)
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
@Deprecated public java.lang.String getNestedPath()
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
public NestedSortBuilder getNestedSort()
NestedSortBuilder
public GeoDistanceSortBuilder setNestedSort(NestedSortBuilder nestedSort)
NestedSortBuilder
to be used for fields that are inside a nested
object. The NestedSortBuilder
takes a `path` argument and an optional
nested filter that the nested objects should match with in
order to be taken into account for sorting.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(XContentParser parser, java.lang.String elementName) throws java.io.IOException
parser
- the input parser. 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
public GeoDistanceSortBuilder rewrite(QueryRewriteContext ctx) throws java.io.IOException
Rewriteable
java.io.IOException