Reputation: 41
{ "query": "", "page": { "size": 18 }, "filters": { "all": [ { "published": "1" }, { "psid": "58" } ] }, "sort": [ { "geopoint": { "pin.location": [ 4.342083917809, -2.9475302108444 ], "order": "asc", "unit": "km", "mode": "min", "distance_type": "arc", "ignore_unmapped": true } } ] }
i'm receiving error like this :
{
"errors": [
"Sort direction '{\"pin.location\"=>[4.342083917809, -2.9475302108444], \"order\"=>\"asc\", \"unit\"=>\"km\", \"mode\"=>\"min\", \"distance_type\"=>\"arc\", \"ignore_unmapped\"=>true}' is not 'asc' or 'desc'"
]
}
I do not understand. Please need help.
Upvotes: 1
Views: 113
Reputation: 212
you should be using _geo_distance instead of geopoint, this is how it should be according to the official docs:
"sort" : [
{
"_geo_distance" : {
"pin.location" : [-70, 40],
"order" : "asc",
"unit" : "km",
"mode" : "min",
"distance_type" : "arc",
"ignore_unmapped": true
}
}
],
Upvotes: 0
Reputation: 5841
It should be called _geo_distance
not geopoint
, see example in the docs
Upvotes: 1