Aggregation by results of previous aggregation (not sub aggregation)

(Volodymyr Martynyak) #1

Maybe someone can help me with this:

I can store some geodata like :
"location": { "type": "geo_point", "geohash": true, "geohash_prefix": true }, "profile_id": { "type": "long" }, "updated_at": { "type": "date", "format": "dateOptionalTime" },

I need to get 1 document per each "profile_id" with maximum "updated_at" which in some date range, and then group by "geohash_grid" .

Can I do that with elasticsearch?

(system) #2