@@ -21,59 +21,48 @@ type.
2121|=======================================================================
2222|Option |Description| Default
2323
24- |`tree |deprecated[6.6, PrefixTrees no longer used] Name of the PrefixTree
25- implementation to be used: `geohash` for GeohashPrefixTree and `quadtree`
26- for QuadPrefixTree. Note: This parameter is only relevant for `term` and
27- `recursive` strategies.
28- | `quadtree`
29-
30- |`precision` |deprecated[6.6, PrefixTrees no longer used] This parameter may
31- be used instead of `tree_levels` to set an appropriate value for the
32- `tree_levels` parameter. The value specifies the desired precision and
33- Elasticsearch will calculate the best tree_levels value to honor this
34- precision. The value should be a number followed by an optional distance
35- unit. Valid distance units include: `in`, `inch`, `yd`, `yard`, `mi`,
36- `miles`, `km`, `kilometers`, `m`,`meters`, `cm`,`centimeters`, `mm`,
37- `millimeters`. Note: This parameter is only relevant for `term` and
38- `recursive` strategies.
24+ |`tree` |Name of the PrefixTree implementation to be used: `geohash` for
25+ GeohashPrefixTree and `quadtree` for QuadPrefixTree.
26+ | `geohash`
27+
28+ |`precision` |This parameter may be used instead of `tree_levels` to set
29+ an appropriate value for the `tree_levels` parameter. The value
30+ specifies the desired precision and Elasticsearch will calculate the
31+ best tree_levels value to honor this precision. The value should be a
32+ number followed by an optional distance unit. Valid distance units
33+ include: `in`, `inch`, `yd`, `yard`, `mi`, `miles`, `km`, `kilometers`,
34+ `m`,`meters`, `cm`,`centimeters`, `mm`, `millimeters`.
3935| `50m`
4036
41- |`tree_levels` |deprecated[6.6, PrefixTrees no longer used] Maximum number
42- of layers to be used by the PrefixTree. This can be used to control the
43- precision of shape representations andtherefore how many terms are
44- indexed. Defaults to the default value of the chosen PrefixTree
45- implementation. Since this parameter requires a certain level of
46- understanding of the underlying implementation, users may use the
47- `precision` parameter instead. However, Elasticsearch only uses the
48- tree_levels parameter internally and this is what is returned via the
49- mapping API even if you use the precision parameter. Note: This parameter
50- is only relevant for `term` and `recursive` strategies.
37+ |`tree_levels` |Maximum number of layers to be used by the PrefixTree.
38+ This can be used to control the precision of shape representations and
39+ therefore how many terms are indexed. Defaults to the default value of
40+ the chosen PrefixTree implementation. Since this parameter requires a
41+ certain level of understanding of the underlying implementation, users
42+ may use the `precision` parameter instead. However, Elasticsearch only
43+ uses the tree_levels parameter internally and this is what is returned
44+ via the mapping API even if you use the precision parameter.
5145| various
5246
53- |`strategy` |deprecated[6.6, PrefixTrees no longer used] The strategy
54- parameter defines the approach for how to represent shapes at indexing
55- and search time. It also influences the capabilities available so it
56- is recommended to let Elasticsearch set this parameter automatically.
57- There are two strategies available: `recursive`, and `term`.
58- Recursive and Term strategies are deprecated and will be removed in a
59- future version. While they are still available, the Term strategy
60- supports point types only (the `points_only` parameter will be
61- automatically set to true) while Recursive strategy supports all
62- shape types. (IMPORTANT: see <<prefix-trees, Prefix trees>> for more
63- detailed information about these strategies)
47+ |`strategy` |The strategy parameter defines the approach for how to
48+ represent shapes at indexing and search time. It also influences the
49+ capabilities available so it is recommended to let Elasticsearch set
50+ this parameter automatically. There are two strategies available:
51+ `recursive` and `term`. Term strategy supports point types only (the
52+ `points_only` parameter will be automatically set to true) while
53+ Recursive strategy supports all shape types. (IMPORTANT: see
54+ <<prefix-trees, Prefix trees>> for more detailed information)
6455| `recursive`
6556
66- |`distance_error_pct` |deprecated[6.6, PrefixTrees no longer used] Used as a
67- hint to the PrefixTree about how precise it should be. Defaults to 0.025 (2.5%)
68- with 0.5 as the maximum supported value. PERFORMANCE NOTE: This value will
69- default to 0 if a `precision` or `tree_level` definition is explicitly defined.
70- This guarantees spatial precision at the level defined in the mapping. This can
71- lead to significant memory usage for high resolution shapes with low error
72- (e.g., large shapes at 1m with < 0.001 error). To improve indexing performance
73- (at the cost of query accuracy) explicitly define `tree_level` or `precision`
74- along with a reasonable `distance_error_pct`, noting that large shapes will have
75- greater false positives. Note: This parameter is only relevant for `term` and
76- `recursive` strategies.
57+ |`distance_error_pct` |Used as a hint to the PrefixTree about how
58+ precise it should be. Defaults to 0.025 (2.5%) with 0.5 as the maximum
59+ supported value. PERFORMANCE NOTE: This value will default to 0 if a `precision` or
60+ `tree_level` definition is explicitly defined. This guarantees spatial precision
61+ at the level defined in the mapping. This can lead to significant memory usage
62+ for high resolution shapes with low error (e.g., large shapes at 1m with < 0.001 error).
63+ To improve indexing performance (at the cost of query accuracy) explicitly define
64+ `tree_level` or `precision` along with a reasonable `distance_error_pct`, noting
65+ that large shapes will have greater false positives.
7766| `0.025`
7867
7968|`orientation` |Optionally define how to interpret vertex order for
@@ -88,13 +77,13 @@ sets vertex order for the coordinate list of a geo_shape field but can be
8877overridden in each individual GeoJSON or WKT document.
8978| `ccw`
9079
91- |`points_only` |deprecated[6.6, PrefixTrees no longer used] Setting this option to
92- `true` (defaults to `false`) configures the `geo_shape` field type for point
93- shapes only (NOTE: Multi-Points are not yet supported). This optimizes index and
94- search performance for the `geohash` and ` quadtree` when it is known that only points
95- will be indexed. At present geo_shape queries can not be executed on `geo_point`
96- field types. This option bridges the gap by improving point performance on a
97- `geo_shape` field so that `geo_shape` queries are optimal on a point only field.
80+ |`points_only` |Setting this option to `true` (defaults to `false`) configures
81+ the `geo_shape` field type for point shapes only (NOTE: Multi-Points are not
82+ yet supported). This optimizes index and search performance for the `geohash` and
83+ ` quadtree` when it is known that only points will be indexed. At present geo_shape
84+ queries can not be executed on `geo_point` field types. This option bridges the gap
85+ by improving point performance on a `geo_shape` field so that `geo_shape` queries are
86+ optimal on a point only field.
9887| `false`
9988
10089|`ignore_malformed` |If true, malformed GeoJSON or WKT shapes are ignored. If
@@ -111,35 +100,16 @@ and reject the whole document.
111100
112101|=======================================================================
113102
114-
115- [[geoshape-indexing-approach]]
116- [float]
117- ==== Indexing approach
118- GeoShape types are indexed by decomposing the shape into a triangular mesh and
119- indexing each triangle as a 7 dimension point in a BKD tree. This provides
120- near perfect spatial resolution (down to 1e-7 decimal degree precision) since all
121- spatial relations are computed using an encoded vector representation of the
122- original shape instead of a raster-grid representation as used by the
123- <<prefix-trees>> indexing approach. Performance of the tessellator primarily
124- depends on the number of vertices that define the polygon/multi-polyogn. While
125- this is the default indexing technique prefix trees can still be used by setting
126- the `tree` or `strategy` parameters according to the appropriate
127- <<geo-shape-mapping-options>>. Note that these parameters are now deprecated
128- and will be removed in a future version.
129-
130103[[prefix-trees]]
131104[float]
132105==== Prefix trees
133106
134- deprecated[6.6, PrefixTrees no longer used] To efficiently represent shapes in
135- an inverted index, Shapes are converted into a series of hashes representing
136- grid squares (commonly referred to as "rasters") using implementations of a
137- PrefixTree. The tree notion comes from the fact that the PrefixTree uses multiple
138- grid layers, each with an increasing level of precision to represent the Earth.
139- This can be thought of as increasing the level of detail of a map or image at higher
140- zoom levels. Since this approach causes precision issues with indexed shape, it has
141- been deprecated in favor of a vector indexing approach that indexes the shapes as a
142- triangular mesh (see <<geoshape-indexing-approach>>).
107+ To efficiently represent shapes in the index, Shapes are converted into
108+ a series of hashes representing grid squares (commonly referred to as "rasters")
109+ using implementations of a PrefixTree. The tree notion comes from the fact that
110+ the PrefixTree uses multiple grid layers, each with an increasing level of
111+ precision to represent the Earth. This can be thought of as increasing the level
112+ of detail of a map or image at higher zoom levels.
143113
144114Multiple PrefixTree implementations are provided:
145115
@@ -161,10 +131,9 @@ number of levels for the quad trees in Elasticsearch is 29; the default is 21.
161131[[spatial-strategy]]
162132[float]
163133===== Spatial strategies
164- deprecated[6.6, PrefixTrees no longer used] The indexing implementation
165- selected relies on a SpatialStrategy for choosing how to decompose the shapes
166- (either as grid squares or a tessellated triangular mesh). Each strategy
167- answers the following:
134+ The PrefixTree implementations rely on a SpatialStrategy for decomposing
135+ the provided Shape(s) into approximated grid squares. Each strategy answers
136+ the following:
168137
169138* What type of Shapes can be indexed?
170139* What types of Query Operations and Shapes can be used?
@@ -177,21 +146,21 @@ are provided:
177146|=======================================================================
178147|Strategy |Supported Shapes |Supported Queries |Multiple Shapes
179148
180- |`recursive` |<<input-structure, All>> |`INTERSECTS`, `DISJOINT`, `WITHIN`, `CONTAINS` |Yes
149+ |`recursive` |<<input-structure, All>> |`INTERSECTS`, `DISJOINT`, `WITHIN`, `CONTAINS` |Yes
181150|`term` |<<point, Points>> |`INTERSECTS` |Yes
182151
183152|=======================================================================
184153
185154[float]
186155===== Accuracy
187156
188- `Recursive` and `Term` strategies do not provide 100% accuracy and depending on
189- how they are configured it may return some false positives for `INTERSECTS`,
190- `WITHIN` and `CONTAINS` queries, and some false negatives for `DISJOINT` queries.
191- To mitigate this, it is important to select an appropriate value for the tree_levels
192- parameter and to adjust expectations accordingly. For example, a point may be near
193- the border of a particular grid cell and may thus not match a query that only matches
194- the cell right next to it -- even though the shape is very close to the point.
157+ Geo_shape does not provide 100% accuracy and depending on how it is configured
158+ it may return some false positives for `INTERSECTS`, `WITHIN` and `CONTAINS`
159+ queries, and some false negatives for `DISJOINT` queries. To mitigate this, it
160+ is important to select an appropriate value for the tree_levels parameter and
161+ to adjust expectations accordingly. For example, a point may be near the border
162+ of a particular grid cell and may thus not match a query that only matches the
163+ cell right next to it -- even though the shape is very close to the point.
195164
196165[float]
197166===== Example
@@ -204,7 +173,9 @@ PUT /example
204173 "doc": {
205174 "properties": {
206175 "location": {
207- "type": "geo_shape"
176+ "type": "geo_shape",
177+ "tree": "quadtree",
178+ "precision": "100m"
208179 }
209180 }
210181 }
@@ -214,23 +185,22 @@ PUT /example
214185// CONSOLE
215186// TESTSETUP
216187
217- This mapping definition maps the location field to the geo_shape
218- type using the default vector implementation. It provides
219- approximately 1e-7 decimal degree precision .
188+ This mapping maps the location field to the geo_shape type using the
189+ quad_tree implementation and a precision of 100m. Elasticsearch translates
190+ this into a tree_levels setting of 20 .
220191
221192[float]
222- ===== Performance considerations with Prefix Trees
193+ ===== Performance considerations
223194
224- deprecated[6.6, PrefixTrees no longer used] With prefix trees,
225- Elasticsearch uses the paths in the tree as terms in the inverted index
226- and in queries. The higher the level (and thus the precision), the more
227- terms are generated. Of course, calculating the terms, keeping them in
195+ Elasticsearch uses the paths in the prefix tree as terms in the index
196+ and in queries. The higher the level is (and thus the precision), the
197+ more terms are generated. Of course, calculating the terms, keeping them in
228198memory, and storing them on disk all have a price. Especially with higher
229- tree levels, indices can become extremely large even with a modest amount
230- of data. Additionally, the size of the features also matters. Big, complex
231- polygons can take up a lot of space at higher tree levels. Which setting
232- is right depends on the use case. Generally one trades off accuracy against
233- index size and query performance.
199+ tree levels, indices can become extremely large even with a modest
200+ amount of data. Additionally, the size of the features also matters.
201+ Big, complex polygons can take up a lot of space at higher tree levels.
202+ Which setting is right depends on the use case. Generally one trades off
203+ accuracy against index size and query performance.
234204
235205The defaults in Elasticsearch for both implementations are a compromise
236206between index size and a reasonable level of precision of 50m at the
@@ -628,10 +598,7 @@ POST /example/doc
628598===== Circle
629599
630600Elasticsearch supports a `circle` type, which consists of a center
631- point with a radius. Note that this circle representation can only
632- be indexed when using the `recursive` Prefix Tree strategy. For
633- the default <<geoshape-indexing-approach>> circles should be approximated using
634- a `POLYGON`.
601+ point with a radius:
635602
636603[source,js]
637604--------------------------------------------------
@@ -645,7 +612,6 @@ POST /example/doc
645612}
646613--------------------------------------------------
647614// CONSOLE
648- // TEST[skip:not supported in default]
649615
650616Note: The inner `radius` field is required. If not specified, then
651617the units of the `radius` will default to `METERS`.
0 commit comments