Finding all documents nearby another in one request

I have multiple documents containing a geo-spatial location. I'd like to make a query finding all the documents (let's say B,C,D) whose location is below a given distance of another document (A).
All my document have a location of "type": "geo_point", and I'm able to find all the one nearby a given point using that filter :

            "filter" : {
                "geo_distance" : {
                    "distance" : "{{radius}}",
                    "location" : {
                        "lat" : "{{lat}}",
                        "lon" : "{{lon}}"

However, to get the lat lon in my request, I need to make a request first requesting the coordinates of document A.

Is there a query (in the spirits of the terms query) that would allow me to do something like this?

            "filter" : {
                "geo_distance" : {
                    "distance" : "{{radius}}",
                    "location" : {
                               terms:{ "id" : "A", "path" : "location"}

Thanks in advance

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