Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previous versions of the
GeoPointFieldMapper
just stored the actual geohashof a point. This commit changes the behavior of storing geohashes by storing
the geohash and all its prefixes in decreasing order in the same field. To
enable this functionality the option
geohash_prefix
must be set in the mapping.This behavior allows to filter
GeoPoints
by their geohashes. Basically ageohash prefix is defined by the filter and all geohashes that match this
prefix will be returned. The
neighbors
flag allows to filter geohashesthat surround the given geohash cell. In general the neighborhood of a
geohash is defined by its eight adjacent cells.
To enable this, the type of filtered fields must be
geo_point
withgeohashes
and
geohash_prefix
enabled.For example:
This example defines a mapping for a type
location
in an indexlocations
with a field
pin
. The optiongeohash
arranges storing the geohash ofthe
pin
field.To filter the results by the geohash a
geohash_cell
must to be defined.For example
This filter will match all geohashes that start with one of the following
prefixes:
u30
,u1r
,u32
,u33
,u1p
,u31
,u0z
,u2b
andu2c
.Internally the
GeoHashFilter
is either a simpleTermFilter
, in case noneighbors should be filtered or a
BooleanFilter
combining theTermFilters
of the geohash and all its neighbors.
Closes #2778
Closes #3218