-
Aivaras Gotovskis authoredAivaras Gotovskis authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
GeoPolygon.md 1.05 KiB
Geo Polygon Filter
More info about geo polygon range filter is in the official elasticsearch docs
A filter allowing to include hits that only fall within a polygon of points.
Simple example
{
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"geo_polygon" : {
"person.location" : {
"points" : [
{"lat" : 40, "lon" : -70},
{"lat" : 30, "lon" : -80},
{"lat" : 20, "lon" : -90}
]
}
}
}
}
}
And now the query via DSL:
$geoPolygonFilter = new GeoPolygonFilter(
'person.location',
[
['lat' => 40, 'lon' => -70],
['lat' => 30, 'lon' => -80],
['lat' => 20, 'lon' => -90],
]
);
$search = new Search();
$search->addFilter($geoPolygonFilter);
$queryArray = $search->toArray();