I need a way to perform a spatial aggregation query against a potentially large document store in order to display summary clusters on a map. The query would slice the current map extents (e.g. -180,-90,180,90) into a number of X and Y bins (e.g. 20 x 16) and, for each, seek a summary count, so that a heat map or series of clusters could be rendered for the grids.
Given Lucene's native usage of prefix trees/geohashes, this seems to be a good fit. As a user pans and zooms the map, new map extents would apply, so this would need to support dynamic grids. However, snapping results/bins to existing geohashes (of the appropriate depth/level) would be fine, assuming that lines up with how the indexes are structured. Naively, I could just issue a series of spatial queries, one for each grid, and get the count. But I wonder if there's a better way... Has anyone encountered this use case? Any suggestions on the best/most efficient way to achieve? Thanks!