# Trying to fetch document ids with a geohash\_grid aggregation

**URL:** <https://discuss.elastic.co/t/trying-to-fetch-document-ids-with-a-geohash-grid-aggregation/17801>\
**Category:** Elasticsearch\
**Created:** [May 29, 2014, 8:55am UTC](https://discuss.elastic.co/t/trying-to-fetch-document-ids-with-a-geohash-grid-aggregation/17801 "2014-05-29T08:55:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![svartalf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/svartalf/32/1379_2.png) [@svartalf](https://discuss.elastic.co/u/svartalf)\
**Post date:** [May 29, 2014, 8:55am UTC](https://discuss.elastic.co/t/trying-to-fetch-document-ids-with-a-geohash-grid-aggregation/17801/1 "2014-05-29T08:55:28Z")

</div>

Hi!

I'm trying to make a clustering of geo-points and got stuck with a two  
problems.

1. If bucket contains only one document, is there any way to get it's id?
2. Is there any way to get only aggregated data from ES with out of a  
'hits' information? It is really a lot of unnecessary data there.

ES version: 1.1.1

Query example:

> ```
> {
> "size": 1000,
> "aggregations": {
> 'cells': {
> 'geohash_grid': {
> 'field': 'point',
> 'precision': precision,
> },
> 'aggregations': {
> 'lat': {
> 'avg': {
> 'script': '''doc['point'].lat''',
> }
> },
> 'lon': {
> 'avg': {
> 'script': '''doc['point'].lon''',
> }
> }
> }
> }
> },
> 'query': {
> 'constant_score': {
> 'filter': {
> 'exists': {
> 'field': 'point',
> }
> }
> }
> }
> }
> 
> ```

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/408a5cb8-9eaa-4f49-a448-ae790722d4e5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/408a5cb8-9eaa-4f49-a448-ae790722d4e5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![ElasticSearch\_Users\_](https://avatars.discourse-cdn.com/v4/letter/e/b4bc9f/32.png) [@ElasticSearch\_Users\_](https://discuss.elastic.co/u/ElasticSearch_Users_)\
**Post date:** [May 30, 2014, 9:57pm UTC](https://discuss.elastic.co/t/trying-to-fetch-document-ids-with-a-geohash-grid-aggregation/17801/2 "2014-05-30T21:57:01Z")

</div>

1. The upcoming top\_hits aggregation "may" help here:

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-top-hits-aggregation.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-top-hits-aggregation.html)

1. If you do localhost:9200/\_search?search\_type=count, the hits will not be  
returned in the most efficient manner possible.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/bab505af-9d3c-4959-a8ef-e563356e9d2c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bab505af-9d3c-4959-a8ef-e563356e9d2c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:25am UTC](https://discuss.elastic.co/t/trying-to-fetch-document-ids-with-a-geohash-grid-aggregation/17801/3 "2017-07-06T01:25:35Z")

</div>


