In Elasticsearch8.5.1, sorted by longitude and latitude, my data format is:
Post_info_address_index:[
{
LatALng:{
Lat: 37.520804,
Lon: 121.219555
}
},
{
LatALng:{
Lat: 37.520496,
Lon: 121.220644
}
}
]
I use DSL statements in Kibana to achieve:
"sort": [
{
"_geo_distance": {
"order": "asc",
"unit": "km",
"nested": {
"path": "post_info_address_index"
},
"mode": "min",
"distance_type": "plane",
"post_info_address_index.latALng": {
"lat": 37.550855034722225,
"lon": 121.24978407118056
}
}
}
]
But in Java, I use the ElasticsearchClient client's sort sorting, and there is no nested