Geodistance query NEST API

Hello,
I want to use elastic geodistance query in my C# application. I have referred the example on Elastic NEST API documentation which didn't work for me.
Below is my code. kindly share with me an example I'm using elasticsearch version 6+

   var geoResult = client.Search<Myclass>(s => s
                     .Take(100)
                     .Query(q => q
                     .GeoDistance(g => g
                    .Boost(1.1)
                    .Name("named_query")
                    .Field(p => p.geometry)
                    .DistanceType(GeoDistanceType.Arc)
                    .Location( 39.589114,24.481397)
                    .Distance("200.0m")
                    .ValidationMethod(GeoValidationMethod.IgnoreMalformed)
                )));

I want to calculate the distance from the provided lat long but the query returns no results.

In your example you are searching for objects located within 200m from a point in Aegean Sea, which is probably not what you intention was. If you were trying to find some points in Medina, you should flip the coordinates in such a way that latitude goes first: .Location(24.481397, 39.589114). I

f that didn't help, could you share mapping and some test data that you are using, so I could reproduce the issue locally.

Hello Igor,
Thanks for taking the time to reply, this worked for me.
Thanks Once again.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.