Sort an ElasticSearch Geohash Grid Aggregation bucket by Sum of a field

(Dave O) #1

Elasticsearch 5.5 linux.

I am trying to sort the results of a Geohash Grid Aggregation by the "sum" of a field and NOT the default "doc_count" desc.

Is this possible. In my aggs I basically have this

"aggs": {
"geos": {
"geohash_grid": {
"field":"location", "precision":3, "size":1000000, "order": {"total_heat": "desc"}
"aggs": {
"total_heat": {"sum": {"field": "heat" }}

In 5.5 I receive an error that says geohash_grid unknown field [order], parser not found.

If I run a similar query with a "terms" aggregation I get desired results. It just doesn't work with geohash_grid.

The reason I want to do this is because I have already aggregated records where "heat" is the total number of records within that group. So I want to order by the sum of the "heat" desc so I get the most populous records at the top of my query.

Any way I can overcome this?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.