Skip to content

Error on GeoDistanceSort [2.0.2] #1836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RTodorov opened this issue Feb 15, 2016 · 4 comments
Closed

Error on GeoDistanceSort [2.0.2] #1836

RTodorov opened this issue Feb 15, 2016 · 4 comments
Assignees

Comments

@RTodorov
Copy link

Hi guys,

I'm adding a GeoDistanceSort to my query but the result json is ignoring GeoUnit and DistanceType:

var searchSorting = new List<ISort>();

...

searchSorting.Add(new GeoDistanceSort
{
    Field = "address.location",
    Points = new List<GeoLocation> { new GeoLocation(location.Coordinates.Lat, location.Coordinates.Lon) },
    GeoUnit = DistanceUnit.Kilometers,
    Order = SortOrder.Ascending,
    DistanceType = GeoDistanceType.Plane
});

...

var request = new SearchRequest
{
    Query = myQuery,
    Sort = searchSorting,
};

The result json:

  "sort": [
    {
      "_geo_distance": {
        "address.location": [
          {
            "lat": -23.549846028909087,
            "lon": -46.70886704698205
          }
        ],
        "order": "asc"
      }
    }
  ],

It's missing unit and distance_type

Any ideas?

Thank you!

@Mpdreamz
Copy link
Member

Not immediately, we are all travelling and attending elasticon the coming days so we might take a tad longer then usual to respond :(

Thanks for reporting, always very much appreciated 👍

@russcam
Copy link
Contributor

russcam commented Feb 16, 2016

Thanks @RTodorov - the type was missing a couple of Json.Net attributes to ensure the properties were serialized when set. This is fixed in PR #1841

@RTodorov
Copy link
Author

Thank you @russcam ! Enjoy elasticon!

@gmarz
Copy link
Contributor

gmarz commented Mar 1, 2016

Closed via #1841

@gmarz gmarz closed this as completed Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants