Skip to content
Snippets Groups Projects
Commit fe9fd812 authored by Aivaras Gotovskis's avatar Aivaras Gotovskis
Browse files

Add geo polygon filter doc.

parent 69a91fce
No related branches found
No related tags found
No related merge requests found
# Geo Polygon Filter
> More info about geo polygon range filter is in the [official elasticsearch docs][1]
A filter allowing to include hits that only fall within a polygon of points.
## Simple example
```JSON
{
"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:
```php
$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();
```
[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-polygon-filter.html
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment