Skip to content

Error on GeoDistanceSort [2.0.2] #1836

Closed
@RTodorov

Description

@RTodorov

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!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions