Skip to content

One step of the ordering of returned hits, structured as a tagged union where type selects the sort type. The engine also accepts a sort that omits type, which it reads as a field sort. If order is omitted, score sorts default to descending and field sorts to ascending. Configured index tie-breaker sorts are appended after the requested sorts. See Sorts.

Example

{
"field": "name",
"order": "asc"
}

Types

FieldSorttype: "field"

Sorts by field value. The target field must have sorting enabled. A field inside a nested object is named by its dotted path, and only the nested values that the query's nested clauses matched are considered.
fieldstringrequired
Target field, as named in the index definition.
Example
"name"
Direction to order in.
Default
"asc"
Values
"asc", "desc"

ScoreSorttype: "score"

Sorts by document relevance score.
Direction to order in.
Default
"desc"
Values
"asc", "desc"

DistanceSorttype: "distance"

Sorts by distance from the specified geographic coordinate, nearest first. Accepts no order property. A distance sort on a nested object field returns search:sort:nested_unsupported.
fieldstringrequired
Target geopoint field, as named in the index definition.
Example
"location"
latnumberrequired
Latitude of the origin, in degrees.
Format
double
Range
-90 to 90
Example
59.3
lonnumberrequired
Longitude of the origin, in degrees.
Format
double
Range
-180 to 180
Example
18.1

Endpoints

Endpoints where the request or responses uses this type.

Other types

Types that reference this one.

Exofind is built by Level Four AB and is available under the Apache License 2.0.