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

**URL:** <https://discuss.elastic.co/t/sort-an-elasticsearch-geohash-grid-aggregation-bucket-by-sum-of-a-field/114940>\
**Category:** Elasticsearch\
**Created:** [January 10, 2018, 7:28pm UTC](https://discuss.elastic.co/t/sort-an-elasticsearch-geohash-grid-aggregation-bucket-by-sum-of-a-field/114940 "2018-01-10T19:28:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_O](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dave_o/32/69398_2.png) [@Dave\_O](https://discuss.elastic.co/u/Dave_O)\
**Post date:** [January 10, 2018, 7:28pm UTC](https://discuss.elastic.co/t/sort-an-elasticsearch-geohash-grid-aggregation-bucket-by-sum-of-a-field/114940/1 "2018-01-10T19:28:41Z")

</div>

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?

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 7, 2018, 7:29pm UTC](https://discuss.elastic.co/t/sort-an-elasticsearch-geohash-grid-aggregation-bucket-by-sum-of-a-field/114940/2 "2018-02-07T19:29:06Z")

</div>

Closed on February 7, 2018, 7:29pm UTC

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