The simple case of sorting by a field:
"sort": ["born"]
Equivalent way of sorting, using the object form.
"sort": [
{
"by": "field",
"field": "born",
"missing": "first",
"desc": false
}
]
Mixing the two:
"sort": [
"name",
{
"by": "field",
"field": "born",
"missing": "first",
"desc": false
}
]
Sorting by geo distance:
"sort": [
{
"by": "geo_distance",
"field": "geo",
"unit": "mi",
"location": {
"lon": -122.107799,
"lat": 37.399285
}
}
]
Mixing geo distance with score and another field, _score uses string, other field uses object.
"sort": [
"-_score",
{
"by": "field",
"field": "born",
"missing": "first",
"desc": false
},
{
"by": "geo_distance",
"field": "geo",
"unit": "mi",
"location": {
"lon": -122.107799,
"lat": 37.399285
}
}
]