Skip to content

Commit 3aa20e1

Browse files
start on geo polygon
1 parent b0f4d3e commit 3aa20e1

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/django_elasticsearch_dsl_drf/constants.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'LOOKUP_FILTER_GEO_DISTANCE_TO',
2626
'LOOKUP_FILTER_GEO_DISTANCE_INCLUDE_UPPER',
2727
'LOOKUP_FILTER_GEO_DISTANCE_INCLUDE_LOWER',
28+
'LOOKUP_FILTER_GEO_POLYGON',
2829
'LOOKUP_FILTER_PREFIX',
2930
'LOOKUP_FILTER_RANGE',
3031
'LOOKUP_FILTER_TERM',
@@ -292,6 +293,41 @@
292293
# /api/articles/?location__geo_distance_include_lower=2km|43.53|-12.23
293294
LOOKUP_FILTER_GEO_DISTANCE_INCLUDE_LOWER = 'geo_distance_include_lower'
294295

296+
# Geo Polygon Query
297+
#
298+
# A query allowing to include hits that only fall within a polygon of points.
299+
# Here is an example:
300+
#
301+
# GET /_search
302+
# {
303+
# "query": {
304+
# "bool" : {
305+
# "must" : {
306+
# "match_all" : {}
307+
# },
308+
# "filter" : {
309+
# "geo_polygon" : {
310+
# "person.location" : {
311+
# "points" : [
312+
# {"lat" : 40, "lon" : -70},
313+
# {"lat" : 30, "lon" : -80},
314+
# {"lat" : 20, "lon" : -90}
315+
# ]
316+
# }
317+
# }
318+
# }
319+
# }
320+
# }
321+
# }
322+
#
323+
# Query options:
324+
#
325+
# - _name: Optional name field to identify the filter
326+
# - validation_method: Set to IGNORE_MALFORMED to accept geo points with
327+
# invalid latitude or longitude, COERCE to try and infer correct latitude or
328+
# longitude, or STRICT (default is STRICT).
329+
LOOKUP_FILTER_GEO_POLYGON = 'geo_polygon'
330+
295331
# ****************************************************************************
296332
# ************************ Functional filters/queries ************************
297333
# ****************************************************************************

0 commit comments

Comments
 (0)