I am working on the GeoTile of Elastic search. After grouping the locations into buckets, I want to get the data in that bucket with pagination (using search after). Have anyone done on that, how can I achieve it? Thank you!
Here is the GeoTile aggregation I have used:
GET /index-name/_doc/_search
{
"aggs": {
"result": {
"geotile_grid": {
"field": "location",
"precision": 12
}
}
}
}
And the result look like:
{
"took" : 3,
"hits" : {
"total" : {
"value" : 39,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ... ]
},
"aggregations" : {
"result" : {
"buckets" : [
{
"key" : "12/3519/1597",
"doc_count" : 36
},
{
"key" : "12/3520/1597",
"doc_count" : 3
}
]
}
}
}
For example, how can I get 36 documents in the "12/3519/1597" bucket? Thank you!
I have already tried to convert between the GeoTile key "12/3519/1597" into a bounding box follow this article or used the GeoTileUtils from the ESearch code.
However, from the example above, the key "12/3519/1597" is converted to a bounding box, and when I query all the documents in that box, there were 2 buckets. The x=3520
bucket contains documents in the lon=129.375
which exactly lie on the right edge
.