|
@@ -17,7 +17,7 @@ cover only a small area.
|
|
|
* Low precision keys have a smaller range for x and y, and represent tiles that
|
|
|
each cover a large area.
|
|
|
|
|
|
-See https://wiki.openstreetmap.org/wiki/Zoom_levels[Zoom level documentation]
|
|
|
+See https://wiki.openstreetmap.org/wiki/Zoom_levels[zoom level documentation]
|
|
|
on how precision (zoom) correlates to size on the ground. Precision for this
|
|
|
aggregation can be between 0 and 29, inclusive.
|
|
|
|
|
@@ -102,14 +102,15 @@ Response:
|
|
|
--------------------------------------------------
|
|
|
// TESTRESPONSE[s/\.\.\./"took": $body.took,"_shards": $body._shards,"hits":$body.hits,"timed_out":false,/]
|
|
|
|
|
|
+[[geotilegrid-high-precision]]
|
|
|
==== High-precision requests
|
|
|
|
|
|
-When requesting detailed buckets (typically for displaying a "zoomed in" map)
|
|
|
+When requesting detailed buckets (typically for displaying a "zoomed in" map),
|
|
|
a filter like <<query-dsl-geo-bounding-box-query,geo_bounding_box>> should be
|
|
|
-applied to narrow the subject area otherwise potentially millions of buckets
|
|
|
+applied to narrow the subject area. Otherwise, potentially millions of buckets
|
|
|
will be created and returned.
|
|
|
|
|
|
-[source,console]
|
|
|
+[source,console,id=geotilegrid-high-precision-ex]
|
|
|
--------------------------------------------------
|
|
|
POST /museums/_search?size=0
|
|
|
{
|
|
@@ -137,6 +138,8 @@ POST /museums/_search?size=0
|
|
|
--------------------------------------------------
|
|
|
// TEST[continued]
|
|
|
|
|
|
+Response:
|
|
|
+
|
|
|
[source,console-result]
|
|
|
--------------------------------------------------
|
|
|
{
|
|
@@ -166,13 +169,14 @@ POST /museums/_search?size=0
|
|
|
--------------------------------------------------
|
|
|
// TESTRESPONSE[s/\.\.\./"took": $body.took,"_shards": $body._shards,"hits":$body.hits,"timed_out":false,/]
|
|
|
|
|
|
+[[geotilegrid-addtl-bounding-box-filtering]]
|
|
|
==== Requests with additional bounding box filtering
|
|
|
|
|
|
The `geotile_grid` aggregation supports an optional `bounds` parameter
|
|
|
-that restricts the cells considered to those that intersects the
|
|
|
-bounds provided. The `bounds` parameter accepts the bounding box in
|
|
|
-all the same <<query-dsl-geo-bounding-box-query-accepted-formats,accepted formats>> of the
|
|
|
-bounds specified in the Geo Bounding Box Query. This bounding box can be used with or
|
|
|
+that restricts the cells considered to those that intersect the
|
|
|
+provided bounds. The `bounds` parameter accepts the same
|
|
|
+<<query-dsl-geo-bounding-box-query-accepted-formats,bounding box formats>>
|
|
|
+as the geo-bounding box query. This bounding box can be used with or
|
|
|
without an additional `geo_bounding_box` query for filtering the points prior to aggregating.
|
|
|
It is an independent bounding box that can intersect with, be equal to, or be disjoint
|
|
|
to any additional `geo_bounding_box` queries defined in the context of the aggregation.
|
|
@@ -197,6 +201,8 @@ POST /museums/_search?size=0
|
|
|
--------------------------------------------------
|
|
|
// TEST[continued]
|
|
|
|
|
|
+Response:
|
|
|
+
|
|
|
[source,console-result]
|
|
|
--------------------------------------------------
|
|
|
{
|
|
@@ -225,9 +231,10 @@ POST /museums/_search?size=0
|
|
|
|
|
|
[discrete]
|
|
|
[role="xpack"]
|
|
|
+[[geotilegrid-aggregating-geo-shape]]
|
|
|
==== Aggregating `geo_shape` fields
|
|
|
|
|
|
-Aggregating on <<geo-shape>> fields works just as it does for points, except that a single
|
|
|
+Aggregating on <<geo-shape>> fields works almost as it does for points, except that a single
|
|
|
shape can be counted for in multiple tiles. A shape will contribute to the count of matching values
|
|
|
if any part of its shape intersects with that tile. Below is an image that demonstrates this:
|
|
|
|
|
@@ -237,20 +244,27 @@ image:images/spatial/geoshape_grid.png[]
|
|
|
==== Options
|
|
|
|
|
|
[horizontal]
|
|
|
-field:: Mandatory. The name of the field indexed with GeoPoints.
|
|
|
+field::
|
|
|
+(Required, string) Field containing indexed geo-point or geo-shape values.
|
|
|
+Must be explicitly mapped as a <<geo-point,`geo_point`>> or a <<geo-shape,`geo_shape`>> field.
|
|
|
+If the field contains an array, `geotile_grid` aggregates all array values.
|
|
|
|
|
|
-precision:: Optional. The integer zoom of the key used to define
|
|
|
- cells/buckets in the results. Defaults to 7.
|
|
|
- Values outside of [0,29] will be rejected.
|
|
|
+precision::
|
|
|
+(Optional, integer) Integer zoom of the key used to define cells/buckets in
|
|
|
+the results. Defaults to `7`. Values outside of [`0`,`29`] will be rejected.
|
|
|
|
|
|
-bounds: Optional. The bounding box to filter the points in the bucket.
|
|
|
+bounds::
|
|
|
+(Optional, object) Bounding box used to filter the geo-points or geo-shapes in each bucket.
|
|
|
+Accepts the same bounding box formats as the
|
|
|
+<<query-dsl-geo-bounding-box-query-accepted-formats,geo-bounding box query>>.
|
|
|
|
|
|
-size:: Optional. The maximum number of geohash buckets to return
|
|
|
- (defaults to 10,000). When results are trimmed, buckets are
|
|
|
- prioritised based on the volumes of documents they contain.
|
|
|
+size::
|
|
|
+(Optional, integer) Maximum number of buckets to return. Defaults to 10,000.
|
|
|
+When results are trimmed, buckets are prioritized based on the volume of
|
|
|
+documents they contain.
|
|
|
|
|
|
-shard_size:: Optional. To allow for more accurate counting of the top cells
|
|
|
- returned in the final result the aggregation defaults to
|
|
|
- returning `max(10,(size x number-of-shards))` buckets from each
|
|
|
- shard. If this heuristic is undesirable, the number considered
|
|
|
- from each shard can be over-ridden using this parameter.
|
|
|
+shard_size::
|
|
|
+(Optional, integer) Number of buckets returned from each shard. Defaults to
|
|
|
+`max(10,(size x number-of-shards))` to allow for a more accurate count of the
|
|
|
+top cells in the final result. Since each shard could have a different top result order,
|
|
|
+using a larger number here reduces the risk of inaccurate counts, but incurs a performance cost.
|