I am facing an issue with geo_distance query in case of multiple locations within a single document. While filtering, it is always considering the first one in the list and ignoring the rest of the locations within the list. So if the first location does not match, the document is not appearing in the search result. Here is my example:
ES version: 2.0
Index:
{
"locations" :
{
"type" : "geo_point"
}
}
Document:
{"locations" : [{"lat": 12.9306989,"lon": 77.6870448}, {"lat": 12.9133638,"lon": 77.6870448}]}
Search DSL:
{
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "1km",
"locations": {"lat" : 12.9165699, "lon" : 77.6393489}
}
}
}
}
}
But the document is not coming in search result even the second location is within 1 km radius of the query location.