Refering to the documentation of Sorting, section Geo Distance Sorting, here's the question:
The given example is as follows:
GET /_search
{
"sort" : [
{
"_geo_distance" : {
"pin.location" : [-70, 40],
"order" : "asc",
"unit" : "km",
"mode" : "min",
"distance_type" : "sloppy_arc"
}
}
],
"query" : {
"term" : { "user" : "kimchy" }
}
}
Is pin.location
the field in the mapping containing the geo location? Or is it a keyword understood by the search API as including the base location? If it's a field supposedly containing the location, shouldn't the sort term include the nested_path
set to pin
? And if it's a parameter, where does elasticsearch fetch the location of the item from?
Also, the documentaion mentions sort_mode
as a parameter, but the code uses mode
, I suppose that's a typo?