Skip to content

_geo_distance sort: Support for many-to-many geo distance sort #3926

@bobrik

Description

@bobrik

What we'd like to see:

Ability to specify many geo points in geo distance sort, like this:

{
    "sort": [
        {
            "_geo_distance": {
                "geo_points.point": [
                    {
                        "lat": 59.959946,
                        "lon": 30.313819
                    },
                    {
                        "lat": 59.979788,
                        "lon": 30.304513
                    }
                ]
            }
        }
    ]
}

Use-case: each user has several points of interest and wants to find other users who are close to these points. For example, I have work, home, and favourite breakfast cafe. I'd like to find people who hang out near any of those places. Right now I should fire as many queries, as many points of interest I have, and then I need to merge results outside of elasticsearch. Having ability to use single query for this.

Looks like it could be quite trivial change, an extra loop to iterate requested points. I might be wrong about this.

I understand, that it could be very cpu intensive for querying with many points, but the point here is to use small amount of points.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions