-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
The way geo distance and bounding box filters work by default is by doing in memory checks to see if the document matches the provided parameters. Those in memory checks are fast, and with the new optimize bounding box option in geo distance (on by default), distance checks are also fast.
But, sometimes its faster to do the checks using indexed lat/lon values, especially when either only doing the geo checks, or when the bounding box is "small".
The geo_bounding_box
filter now allows to provide a type
, which can be set to indexed
(defaults to memory
). When set to indexed
, it will do checks based on indexed lat and lon.
The geo_distance
and geo_distance_range
filters allow to pass to the optimize_bbox
parameter either none
, indexed
, or "memory" (defaults to memory
).
Note, in order to use the indexed
option, the geo_point
mapping type must set lat_lon
to true
in its mapping in order to index them as well. Also, this option will not work properly for a document with multiple locations under the same field unless nested documents are used.