Skip to content

Commit b073100

Browse files
authored
[SPATIAL] New ShapeFieldMapper for indexing cartesian geometries (#44980)
This commit adds a new ShapeFieldMapper to the xpack spatial module for indexing arbitrary cartesian geometries using a new field type called shape. The indexing approach leverages lucene's new XYShape field type which is backed by BKD in the same manner as LatLonShape but without the WGS84 latitude longitude restrictions. The new field mapper builds on and extends the refactoring effort in AbstractGeometryFieldMapper and accepts shapes in either GeoJSON or WKT format (both of which support non geospatial geometries). Tests are provided in the ShapeFieldMapperTest class in the same manner as GeoShapeFieldMapperTests and LegacyGeoShapeFieldMapperTests. Documentation for how to use the new field type and what parameters are accepted is included. The QueryBuilder for searching indexed shapes is provided in a separate commit.
1 parent 538ce6d commit b073100

File tree

13 files changed

+1246
-15
lines changed

13 files changed

+1246
-15
lines changed

docs/reference/mapping/types.asciidoc

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ string:: <<text,`text`>> and <<keyword,`keyword`>>
5454

5555
<<flattened>>:: Allows an entire JSON object to be indexed as a single field.
5656

57+
<<shape>>:: `shape` for arbitrary cartesian geometries.
58+
5759
[float]
5860
[[types-array-handling]]
5961
=== Arrays
@@ -121,4 +123,6 @@ include::types/sparse-vector.asciidoc[]
121123

122124
include::types/text.asciidoc[]
123125

124-
include::types/token-count.asciidoc[]
126+
include::types/token-count.asciidoc[]
127+
128+
include::types/shape.asciidoc[]

docs/reference/mapping/types/geo-shape.asciidoc

+7-7
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ differs from many Geospatial APIs (e.g., Google Maps) that generally
296296
use the colloquial latitude, longitude (Y, X).
297297
=============================================
298298

299-
[[point]]
299+
[[geo-point-type]]
300300
[float]
301301
===== http://geojson.org/geojson-spec.html#id2[Point]
302302

@@ -328,7 +328,7 @@ POST /example/_doc
328328
// CONSOLE
329329

330330
[float]
331-
[[linestring]]
331+
[[geo-linestring]]
332332
===== http://geojson.org/geojson-spec.html#id3[LineString]
333333

334334
A `linestring` defined by an array of two or more positions. By
@@ -363,7 +363,7 @@ The above `linestring` would draw a straight line starting at the White
363363
House to the US Capitol Building.
364364

365365
[float]
366-
[[polygon]]
366+
[[geo-polygon]]
367367
===== http://www.geojson.org/geojson-spec.html#id4[Polygon]
368368

369369
A polygon is defined by a list of a list of points. The first and last
@@ -480,7 +480,7 @@ POST /example/_doc
480480
// CONSOLE
481481

482482
[float]
483-
[[multipoint]]
483+
[[geo-multipoint]]
484484
===== http://www.geojson.org/geojson-spec.html#id5[MultiPoint]
485485

486486
The following is an example of a list of geojson points:
@@ -511,7 +511,7 @@ POST /example/_doc
511511
// CONSOLE
512512

513513
[float]
514-
[[multilinestring]]
514+
[[geo-multilinestring]]
515515
===== http://www.geojson.org/geojson-spec.html#id6[MultiLineString]
516516

517517
The following is an example of a list of geojson linestrings:
@@ -544,7 +544,7 @@ POST /example/_doc
544544
// CONSOLE
545545

546546
[float]
547-
[[multipolygon]]
547+
[[geo-multipolygon]]
548548
===== http://www.geojson.org/geojson-spec.html#id7[MultiPolygon]
549549

550550
The following is an example of a list of geojson polygons (second polygon contains a hole):
@@ -577,7 +577,7 @@ POST /example/_doc
577577
// CONSOLE
578578

579579
[float]
580-
[[geometry_collection]]
580+
[[geo-geometry_collection]]
581581
===== http://geojson.org/geojson-spec.html#geometrycollection[Geometry Collection]
582582

583583
The following is an example of a collection of geojson geometry objects:

0 commit comments

Comments
 (0)