如何在 NEST for Elasticsearch 中按 _geo_distance 排序?
How can I sort by _geo_distance in NEST for Elasticsearch?
是否可以使用 Elasticsearch 的 BEST 库按 _geo_distance
排序?我找不到任何支持。
做我想做的原始 json 是:
"sort": [
{
"_geo_distance": {
"position": {
"lat": 59.3389428,
"lon": 18.0761637
},
"order": "asc",
"unit": "m",
"distance_type": "plane"
}
}
]
var results = client.Search<object>(sd => sd
.SortGeoDistance(d => d
.OnField("position")
.Unit(GeoUnit.Miles)
.DistanceType(GeoDistance.Plane)
.PinTo(Lat: 59.3389428, Lon: 18.0761637)
.Ascending());
var search2 = _client.Search < Person > (s => s
.Sort(s => s
.GeoDistance(g => g
.Field("location1")
.Order(SortOrder.Ascending)
.DistanceType(GeoDistanceType.Plane)
.Points(search1.Geocoord)
)
)
)
是否可以使用 Elasticsearch 的 BEST 库按 _geo_distance
排序?我找不到任何支持。
做我想做的原始 json 是:
"sort": [
{
"_geo_distance": {
"position": {
"lat": 59.3389428,
"lon": 18.0761637
},
"order": "asc",
"unit": "m",
"distance_type": "plane"
}
}
]
var results = client.Search<object>(sd => sd
.SortGeoDistance(d => d
.OnField("position")
.Unit(GeoUnit.Miles)
.DistanceType(GeoDistance.Plane)
.PinTo(Lat: 59.3389428, Lon: 18.0761637)
.Ascending());
var search2 = _client.Search < Person > (s => s
.Sort(s => s
.GeoDistance(g => g
.Field("location1")
.Order(SortOrder.Ascending)
.DistanceType(GeoDistanceType.Plane)
.Points(search1.Geocoord)
)
)
)