Filter with multiple geopoints in elasticsearch -
this might simple, not able implement or find out expected query format.
i able create mapping of geo_point
data type right application. able query indices geopoint sending following query part of request body:
{ "query": { "bool" : { "must" : { "match_all" : {} }, "filter" : { "geo_distance" : { "distance" : "5km", "field_location" : "9.0194,-79.4509" } } } } }
here, field_location
name of field of type geo_point
. works fine.
i not able find way in can provide multiple lat/lon
values filter , use or
between them. tried using should
in query, not able find right way. pointers on how achieve helpful.
it seems on right path. bool query elasticsearch supports operators. not using right.
the following query works:
{ "query": { "bool": { "should": [ { "geo_distance": { "distance": "1km", "field_location": "9.0194,-79.4509" } }, { "geo_distance": { "distance": "1km", "field_location": "8.9972,-79.4985" } } ] } } }
Comments
Post a Comment