Well, I have a index for the detailed docs, the fields are like this: the house's geo_point, the house's name.
With a geohash_grid aggregation, I can retrieve those geohash_grids and how many houses within it.
However, I want to see the exact house's information(the detailed ones) for the geohash_grid buckets which contain less than 3 houses.
in SQL-like format, that query will be like this:
SELECT *
FROM detailed_table t
WHERE geohash_grid in
(
SELECT geohash_grid, COUNT()
FROM detailed_table t
GROUP BY geohash_grid
HAVING COUNT() < 3
);
thanks:)