Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregations: Geohash grid should count documents only once #8512

Closed
jpountz opened this issue Nov 17, 2014 · 2 comments
Closed

Aggregations: Geohash grid should count documents only once #8512

jpountz opened this issue Nov 17, 2014 · 2 comments
Labels
:Analytics/Aggregations Aggregations :Analytics/Geo Indexing, search aggregations of geo points and shapes >bug v1.3.6 v1.4.1 v1.5.0 v2.0.0-beta1

Comments

@jpountz
Copy link
Contributor

jpountz commented Nov 17, 2014

If two geo-hashes of the same document fall into the same bucket, then the document count for this bucket will be incremented by 2 instead of 1. Here is a reproduction:

DELETE test

PUT test
{
  "mappings": {
    "test": {
      "properties": {
        "points": {
          "type": "geo_point"
        }
      }
    }
  }
}

PUT test/test/1
{
  "points": [
    "1,2",
    "2,3"
  ]
}

GET /test/_search?search_type=count
{
  "aggs": {
    "grid": {
      "geohash_grid": {
        "field": "points",
        "precision": 2
      }
    }
  }
}

which returns:

{
   "took": 3,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 0,
      "hits": []
   },
   "aggregations": {
      "grid": {
         "buckets": [
            {
               "key": "s0",
               "doc_count": 2
            }
         ]
      }
   }
}
@jpountz jpountz added help wanted adoptme :Analytics/Aggregations Aggregations :Analytics/Geo Indexing, search aggregations of geo points and shapes labels Nov 17, 2014
@ejain
Copy link
Contributor

ejain commented Nov 17, 2014

btw the geohash grid aggregation fails in 1.4.0 if documents with more than one value are present, see #8507

@jpountz
Copy link
Contributor Author

jpountz commented Nov 17, 2014

Indeed, I found this issue while working on a fix for that issue! :) #8513

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations :Analytics/Geo Indexing, search aggregations of geo points and shapes >bug v1.3.6 v1.4.1 v1.5.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants