I'm trying to use geohash_grid
to plot millions of points on a map in clusters. However the query produces too many buckets, and I'd like to limit the number of buckets returned.
"Use 'size'
" you're probably thinking. Unfortunately size
reduces the number of buckets by eliminating the ones with the lowest count. This effectively skews the data, since the sum of the bucket counts returned doesn't total 100% of the documents matched.
Is there a way to say "Give me all the matching documents, but group them into a specific number N of very approximate buckets"?
Geohashes themselves are perfectly fine here, at any precision level. The problem is simply that there are too many buckets, sometimes hundreds of Kb of data over the pipe, and the number returned varies with each query, zoom, or pan of the map.