How can I apply a geo distance range filter using NEST? It seems to be something like
var results = client.Search<MyDataType>(s => s
.Filter(m => m.GeoDistance(c => c.Location, f => f.Distance(100, GeoUnit.mi)));
but how do I pass in long/lat of the target location?
(similar question has been asked for Java client)
Answering my own question. This works:
var results = client.Search<MyDataType>(s => s
.Filter(m => m.GeoDistance(
c => c.Location,
f => f.Distance("100 mi").Location(40.7, -74.0)));
After some debugging, I suspect that f.Distance(100, GeoUnit.mi)
didn't work due to a bug in NEST.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With