|
@@ -1,18 +1,15 @@
|
|
|
[[query-dsl-geohash-cell-filter]]
|
|
|
=== Geohash Cell Filter
|
|
|
|
|
|
-A geohash is a hierarchical datastructure which allows a division of a
|
|
|
-spatial geometry. Each geohash defines a cell on the earths surface and
|
|
|
-the longer the geohash the smaller cell. Also the size of a cell can be
|
|
|
-seen as precision. The geohash filter provides an access to this
|
|
|
-datastructure by defining a cell and match only points that lie within
|
|
|
-this cell.
|
|
|
+The `geohash_cell` filter provides access to a hierarchy of geohashes.
|
|
|
+By defining a geohash cell, only <<mapping-geo-point-type,geopoints>>
|
|
|
+within this cell will match this filter.
|
|
|
|
|
|
To get this filter work all prefixes of a geohash need to be indexed. In
|
|
|
example a geohash `u30` needs to be decomposed into three terms: `u30`,
|
|
|
`u3` and `u`. This decomposition must be enabled in the mapping of the
|
|
|
-`geo_point` field that's going to be filtered by setting the
|
|
|
-`geohash_prefix` option:
|
|
|
+<<mapping-geo-point-type,geopoint>> field that's going to be filtered by
|
|
|
+setting the `geohash_prefix` option:
|
|
|
|
|
|
[source,js]
|
|
|
--------------------------------------------------
|
|
@@ -23,7 +20,8 @@ example a geohash `u30` needs to be decomposed into three terms: `u30`,
|
|
|
"pin": {
|
|
|
"type": "geo_point",
|
|
|
"geohash": true,
|
|
|
- "geohash_prefix": true
|
|
|
+ "geohash_prefix": true,
|
|
|
+ "geohash_precision": 10
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -31,14 +29,16 @@ example a geohash `u30` needs to be decomposed into three terms: `u30`,
|
|
|
}
|
|
|
--------------------------------------------------
|
|
|
|
|
|
-The geohash cell can defined by all formats of `geo_points`. If such a
|
|
|
-cell is defined by a latitude and longitude pair the size of the cell
|
|
|
-needs to be setup. This can be done by the `precision` parameter of the
|
|
|
-filter. This parameter can be set to an integer value which sets the
|
|
|
-length of the geohash prefix. Instead of setting a geohash length
|
|
|
-directly it is also possible to define the precision as distance, in
|
|
|
-example `"precision": "50m"`. The `neighbor` option of the filter offers
|
|
|
-the possibility to filter cells next to the given cell.
|
|
|
+The geohash cell can defined by all formats of `geo_points`. If such a cell is
|
|
|
+defined by a latitude and longitude pair the size of the cell needs to be
|
|
|
+setup. This can be done by the `precision` parameter of the filter. This
|
|
|
+parameter can be set to an integer value which sets the length of the geohash
|
|
|
+prefix. Instead of setting a geohash length directly it is also possible to
|
|
|
+define the precision as distance, in example `"precision": "50m"`. (See
|
|
|
+<<distance-units>>.)
|
|
|
+
|
|
|
+The `neighbor` option of the filter offers the possibility to filter cells
|
|
|
+next to the given cell.
|
|
|
|
|
|
[source,js]
|
|
|
--------------------------------------------------
|