V2EX  ›  yn  ›  全部回复
回复总数  1
回复了 tumayun 创建的主题 › Elasticsearch 如何用 script_fields 计算出来的字段进行排序?2016 年 6 月 28 日
curl -X GET 'http://localhost:9200/users/user/_search?pretty' -d '{
"sort" : [ {
"_geo_distance" : {
"location" : [ {
"lat" : 23.1191,
"lon" : 113.31
} ],
"unit" : "km",
"distance_type" : "arc"
}
}]
}'

使用这个相当于 利用 script_fields 的 distanceInKm 计算 然后排序
1/1
© 2026 V2EX · 10ms · 3.9.8.5