Get results with distance filter


(mostafa) #1

Hello ,
I would like to get the results where coordinates are less than 15 km from this point for example: [35.3,-2.5] but I have this error : no [query] registered for [station_location]

my request is :
image

here the response :
image

the index mapping :


...
image

here on document example :
image


(Christian Dahlqvist) #2

I am not sure I understand what your question or problem is. Could you please clarify?


(Ignacio Vera) #3

I think the query is wrong and Elasticsearch is looking for a query called station_location. Instead you need to place the query geo_distance:

             "filter" : {
                "geo_distance" : {
                    "distance" : "200km",
                    "station_location" : {
                        "lat" : 35.5,
                        "lon" : -2.5
                    }
                }
            }