Skip to content
99 changes: 99 additions & 0 deletions docs/reference/mapping/types/point.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
[[point]]
[role="xpack"]
[testenv="basic"]
=== Point datatype
++++
<titleabbrev>Point</titleabbrev>
++++

The `point` datatype facilitates the indexing of and searching
arbitrary `x, y` pairs that fall in a 2-dimensional planar
coordinate system.

You can query documents using this type using
<<query-dsl-shape-query,shape Query>>.

There are four ways that a point may be specified, as demonstrated below:

[source,console]
--------------------------------------------------
PUT my_index
{
"mappings": {
"properties": {
"location": {
"type": "point"
}
}
}
}

PUT my_index/_doc/1
{
"text": "Point as an object",
"location": { <1>
"x": 41.12,
"y": -71.34
}
}

PUT my_index/_doc/2
{
"text": "Point as a string",
"location": "41.12,-71.34" <2>
}


PUT my_index/_doc/4
{
"text": "Point as an array",
"location": [41.12, -71.34] <3>
}

PUT my_index/_doc/5
{
"text": "Point as a WKT POINT primitive",
"location" : "POINT (41.12 -71.34)" <4>
}

--------------------------------------------------

<1> Point expressed as an object, with `x` and `y` keys.
<2> Point expressed as a string with the format: `"x,y"`.
<4> Point expressed as an array with the format: [ `x`, `y`]
<5> Point expressed as a http://docs.opengeospatial.org/is/12-063r5/12-063r5.html[Well-Known Text]
POINT with the format: `"POINT(x y)"`

The coordinates provided to the indexer are single precision floating point values so
the field guarantees the same accuracy provided by the java virtual machine (typically
`1E-38`).

[[geo-point-params]]
==== Parameters for `geo_point` fields

The following parameters are accepted by `point` fields:

[horizontal]

<<ignore-malformed,`ignore_malformed`>>::

If `true`, malformed points are ignored. If `false` (default),
malformed points throw an exception and reject the whole document.

`ignore_z_value`::

If `true` (default) three dimension points will be accepted (stored in source)
but only x and y values will be indexed; the third dimension is
ignored. If `false`, points containing any more than x and y
(two dimensions) values throw an exception and reject the whole document.

<<null-value,`null_value`>>::

Accepts an point value which is substituted for any explicit `null` values.
Defaults to `null`, which means the field is treated as missing.

==== Sorting and Retrieving index Shapes

It is currently not possible to sort shapes or retrieve their fields
directly. The `point` value is only retrievable through the `_source`
field.
15 changes: 10 additions & 5 deletions docs/reference/query-dsl/shape-queries.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
[testenv="basic"]
== Shape queries


Like <<geo-shape,`geo_shape`>> Elasticsearch supports the ability to index
arbitrary two dimension (non Geospatial) geometries making it possible to
map out virtual worlds, sporting venues, theme parks, and CAD diagrams. The
<<shape,`shape`>> field type supports points, lines, polygons, multi-polygons,
envelope, etc.
map out virtual worlds, sporting venues, theme parks, and CAD diagrams.

Elasticsearch supports two types of cartesian data:
<<point,`point`>> fields which support x/y pairs, and
<<shape,`shape`>> fields, which support points, lines, circles, polygons, multi-polygons, etc.

The queries in this group are:

<<query-dsl-shape-query,`shape`>> query::
Finds documents with shapes that either intersect, are within, or do not
intersect a specified shape.
Finds documents with:
* `shapes` which either intersect, are contained by, are within or do not intersect
with the specified shape
* `points` which intersect the specified shape

include::shape-query.asciidoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.elasticsearch.plugins.SearchPlugin;
import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction;
import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
import org.elasticsearch.xpack.spatial.index.mapper.PointFieldMapper;
import org.elasticsearch.xpack.spatial.index.mapper.ShapeFieldMapper;
import org.elasticsearch.xpack.spatial.index.query.ShapeQueryBuilder;
import org.elasticsearch.xpack.spatial.ingest.CircleProcessor;
Expand Down Expand Up @@ -45,6 +46,7 @@ public SpatialPlugin(Settings settings) {
public Map<String, Mapper.TypeParser> getMappers() {
Map<String, Mapper.TypeParser> mappers = new LinkedHashMap<>();
mappers.put(ShapeFieldMapper.CONTENT_TYPE, new ShapeFieldMapper.TypeParser());
mappers.put(PointFieldMapper.CONTENT_TYPE, new PointFieldMapper.TypeParser());
return Collections.unmodifiableMap(mappers);
}

Expand Down
Loading