Skip to content

Commit 23c4c46

Browse files
committed
Docs: add clarification about geohash use in geohashgrid agg (#36901)
Adds an example on translating geohashes returned by geohashgrid agg as bucket keys into geo bounding box filters in elasticsearch as well as 3rd party applications. Closes #36413
1 parent ca00b7b commit 23c4c46

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/reference/aggregations/bucket/geohashgrid-aggregation.asciidoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,22 @@ POST /museums/_search?size=0
121121
// CONSOLE
122122
// TEST[continued]
123123

124+
The geohashes returned by the `geohash_grid` aggregation as bucket keys can be also
125+
used for "zooming in" by translating them into bounding boxes using one of available
126+
geohash libraries. For example, for javascript the
127+
https://github.com/sunng87/node-geohash[node-geohash] library can be used:
128+
129+
[source,js]
130+
--------------------------------------------------
131+
var geohash = require('ngeohash');
132+
133+
// bbox will contain [ 52.03125, 4.21875, 53.4375, 5.625 ]
134+
// [ minlat, minlon, maxlat, maxlon]
135+
var bbox = geohash.decode_bbox('u17');
136+
--------------------------------------------------
137+
// NOTCONSOLE
138+
139+
124140
==== Cell dimensions at the equator
125141
The table below shows the metric dimensions for cells covered by various string lengths of geohash.
126142
Cell dimensions vary with latitude and so the table is for the worst-case scenario at the equator.

0 commit comments

Comments
 (0)