Skip to content

Distance sort uses the wrong json structure. #150

@berkes

Description

@berkes

When crafting a distance sort, we get a wrong JSON structure:

   use rs_es::units as rs_u;
   use rs_es::operations::search::{Order, GeoDistance};

   GeoDistance::new("coord")
       .with_location(rs_u::Location::LatLon(coord.y, coord.x))
       .with_order(Order::Desc)
       .with_unit(rs_u::DistanceUnit::Meter)
       .build();

This gives us a:

    {
        "field": "coord",
        "location": {
            "lat": 51.84222,
            "lon": 5.85938
        },
        "order": "desc",
        "unit": "m"
    }

But it should be:

    {
        "_geo_distance": {
            "coord": {
                "lat": 51.84222,
                "lon": 5.85938
            },
            "order": "desc",
            "unit": "m"
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions