# Geohash grid aggregation broken in 1.4.0!

**URL:** <https://discuss.elastic.co/t/geohash-grid-aggregation-broken-in-1-4-0/20792>\
**Category:** Elasticsearch\
**Created:** [November 17, 2014, 6:48pm UTC](https://discuss.elastic.co/t/geohash-grid-aggregation-broken-in-1-4-0/20792 "2014-11-17T18:48:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [November 17, 2014, 6:48pm UTC](https://discuss.elastic.co/t/geohash-grid-aggregation-broken-in-1-4-0/20792/1 "2014-11-17T18:48:41Z")

</div>

If you are using the "geohash grid" aggregation, and your index can contain  
documents with more than one value, you may want to hold off migrating to  
1.4.0 (see comment at see  
[https://github.com/elasticsearch/elasticsearch/issues/8512](https://github.com/elasticsearch/elasticsearch/issues/8512))...

--  
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/5ce977ae-8e92-44a3-8f5e-ae78ba160ab9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5ce977ae-8e92-44a3-8f5e-ae78ba160ab9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [November 17, 2014, 7:07pm UTC](https://discuss.elastic.co/t/geohash-grid-aggregation-broken-in-1-4-0/20792/2 "2014-11-17T19:07:37Z")

</div>

On Mon, Nov 17, 2014 at 10:48 AM, Eric Jain [eric.jain@gmail.com](mailto:eric.jain@gmail.com) wrote:

> If you are using the "geohash grid" aggregation, and your index can contain  
> documents with more than one value, you may want to hold off migrating to  
> 1.4.0 [...]

The correct issue link is

> <https://github.com/elastic/elasticsearch/issues/8507>
>
> Using a geohash\_grid aggregation used to work on arrays of points, but with ES 1….4.0 an exception occurs instead. The following curl commands reproduce the issue on a clean installation of ES:
> 
> \`\`\`
> \# create index with geo\_point mapping
> curl -XPUT localhost:9200/test -d '{
> "mappings": {
> "test": {
> "properties": {
> "points": {
> "type": "geo\_point",
> "geohash\_prefix": true
> }
> }
> }
> }
> }'
> 
> \# insert documents
> curl -XPUT localhost:9200/test/test/1?refresh=true -d '{ "points": \[\[1,2\], \[2,3\]\] }'
> curl -XPUT localhost:9200/test/test/2?refresh=true -d '{ "points": \[\[2,3\], \[3,4\]\] }'
> 
> \# perform aggregation
> curl -XGET localhost:9200/test/test/\_search?pretty -d '{
> "size": 0,
> "aggs": {
> "a1": {
> "geohash\_grid": {
> "field": "points",
> "precision": 3
> }
> }
> }
> }'
> \`\`\`
> 
> On Elasticsearch 1.3.5 this produces the expected result:
> 
> \`\`\`
> ...
> "aggregations" : {
> "a1" : {
> "buckets" : \[ {
> "key" : "s09",
> "doc\_count" : 2
> }, {
> "key" : "s0d",
> "doc\_count" : 1
> }, {
> "key" : "s02",
> "doc\_count" : 1
> } \]
> }
> }
> ...
> \`\`\`
> 
> However on Elasticsearch 1.4.0 this triggers a failure:
> 
> \`\`\`
> {
> "took" : 76,
> "timed\_out" : false,
> "\_shards" : {
> "total" : 5,
> "successful" : 3,
> "failed" : 2,
> "failures" : \[ {
> "index" : "test",
> "shard" : 2,
> "status" : 500,
> "reason" : "QueryPhaseExecutionException\[\[test\]\[2\]: query\[ConstantScore(cache(\_type:test))\],from\[0\],size\[0\]: Query Failed \[Failed to execute main query\]\]; nested: ArrayIndexOutOfBoundsException\[1\]; "
> }, {
> "index" : "test",
> "shard" : 3,
> "status" : 500,
> "reason" : "QueryPhaseExecutionException\[\[test\]\[3\]: query\[ConstantScore(cache(\_type:test))\],from\[0\],size\[0\]: Query Failed \[Failed to execute main query\]\]; nested: ArrayIndexOutOfBoundsException\[1\]; "
> } \]
> },
> "hits" : {
> "total" : 0,
> "max\_score" : 0.0,
> "hits" : \[\]
> },
> "aggregations" : {
> "a1" : {
> "buckets" : \[\]
> }
> }
> }
> \`\`\`
> 
> The log contains this exception:
> 
> \`\`\`
> \[2014-11-17 17:28:25,121\]\[DEBUG\]\[action.search.type \] \[Franklin Storm\] \[test\]\[3\], node\[-S9ijRKKQH-IEAr3sUW14Q\], \[P\], s\[STARTED\]: Failed to execute \[org.elasticsearch.action.search.SearchRequest@1fa40d49\]
> org.elasticsearch.search.query.QueryPhaseExecutionException: \[test\]\[3\]: query\[ConstantScore(cache(\_type:test))\],from\[0\],size\[0\]: Query Failed \[Failed to execute main query\]
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:163)
> at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:275)
> at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:231)
> at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:228)
> at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:559)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:744)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
> at org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGridParser$GeoGridFactory$CellValues.setDocument(GeoHashGridParser.java:154)
> at org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGridAggregator.collect(GeoHashGridAggregator.java:73)
> at org.elasticsearch.search.aggregations.AggregationPhase$AggregationsCollector.collect(AggregationPhase.java:161)
> at org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:60)
> at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:193)
> at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:163)
> at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:35)
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:621)
> at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:191)
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:309)
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:117)
> ... 7 more
> \`\`\`

--  
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/CAHte5%2B%2BpCD18VVYRaeY1mMwzbz95MXPyndAdJXfDgo8CzXg9og%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHte5%2B%2BpCD18VVYRaeY1mMwzbz95MXPyndAdJXfDgo8CzXg9og%40mail.gmail.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, 12:49am UTC](https://discuss.elastic.co/t/geohash-grid-aggregation-broken-in-1-4-0/20792/3 "2017-07-06T00:49:27Z")

</div>


