|
15 | 15 | 'EXTENDED_STRING_LOOKUP_FILTERS', |
16 | 16 | 'FALSE_VALUES', |
17 | 17 | 'LOOKUP_FILTER_EXISTS', |
| 18 | + 'LOOKUP_FILTER_GEO_BOUNDING_BOX', |
18 | 19 | 'LOOKUP_FILTER_GEO_DISTANCE', |
19 | 20 | 'LOOKUP_FILTER_GEO_POLYGON', |
20 | 21 | 'LOOKUP_FILTER_PREFIX', |
|
194 | 195 |
|
195 | 196 | # Draws a circle around the specified location and finds all documents that |
196 | 197 | # have a geo-point within that circle. |
| 198 | +# |
197 | 199 | # The `geo_distance` filter. Accepts three values (distance|lat|lon) |
198 | 200 | # separated by `SEPARATOR_LOOKUP_VALUE`. |
199 | 201 | # https://www.elastic.co/guide/en/elasticsearch/guide/current/geo-distance.html |
| 202 | +# |
200 | 203 | # Example: |
201 | 204 | # |
202 | 205 | # { |
|
249 | 252 | # } |
250 | 253 | # |
251 | 254 | # Query options: |
| 255 | +# |
252 | 256 | # - _name: Optional name field to identify the filter |
253 | 257 | # - validation_method: Set to IGNORE_MALFORMED to accept geo points with |
254 | 258 | # invalid latitude or longitude, COERCE to try and infer correct latitude or |
255 | 259 | # longitude, or STRICT (default is STRICT). |
| 260 | +# |
256 | 261 | # Example: http://localhost:8000 |
257 | 262 | # /api/articles/?location__geo_polygon=40,-70|30,-80|20,-90 |
258 | 263 | LOOKUP_FILTER_GEO_POLYGON = 'geo_polygon' |
259 | 264 |
|
| 265 | +# Geo Bounding Box Query |
| 266 | +# A query allowing to filter hits based on a point location using a bounding |
| 267 | +# box. Assuming the following indexed document: |
| 268 | +# |
| 269 | +# Example: |
| 270 | +# |
| 271 | +# { |
| 272 | +# "query": { |
| 273 | +# "bool" : { |
| 274 | +# "must" : { |
| 275 | +# "match_all" : {} |
| 276 | +# }, |
| 277 | +# "filter" : { |
| 278 | +# "geo_bounding_box" : { |
| 279 | +# "location" : { |
| 280 | +# "top_left" : { |
| 281 | +# "lat" : 40.73, |
| 282 | +# "lon" : -74.1 |
| 283 | +# }, |
| 284 | +# "bottom_right" : { |
| 285 | +# "lat" : 40.01, |
| 286 | +# "lon" : -71.12 |
| 287 | +# } |
| 288 | +# } |
| 289 | +# } |
| 290 | +# } |
| 291 | +# } |
| 292 | +# } |
| 293 | +# } |
| 294 | +# |
| 295 | +# Query options: |
| 296 | +# |
| 297 | +# - _name: Optional name field to identify the filter |
| 298 | +# - validation_method: Set to IGNORE_MALFORMED to accept geo points with |
| 299 | +# invalid latitude or longitude, COERCE to try and infer correct latitude or |
| 300 | +# longitude, or STRICT (default is STRICT). |
| 301 | +# - type: Set to one of indexed or memory to defines whether this filter will |
| 302 | +# be executed in memory or indexed. See Type below for further details. |
| 303 | +# Default is memory. |
| 304 | +# |
| 305 | +# Example: http://localhost:8000 |
| 306 | +# /api/articles/?location__geo_bounding_box=40.73,-74.1|40.01,-71.12 |
| 307 | +LOOKUP_FILTER_GEO_BOUNDING_BOX = 'geo_bounding_box' |
| 308 | + |
260 | 309 | # **************************************************************************** |
261 | 310 | # ************************ Functional filters/queries ************************ |
262 | 311 | # **************************************************************************** |
|
372 | 421 | ) |
373 | 422 |
|
374 | 423 | ALL_GEO_SPATIAL_LOOKUP_FILTERS_AND_QUERIES = ( |
| 424 | + LOOKUP_FILTER_GEO_BOUNDING_BOX, |
375 | 425 | LOOKUP_FILTER_GEO_DISTANCE, |
376 | 426 | LOOKUP_FILTER_GEO_POLYGON, |
377 | 427 | ) |
|
0 commit comments