xy point field type

Introduced 2.4

An xy point field type contains a point in a two-dimensional Cartesian coordinate system, specified by x and y coordinates. It is based on the Lucene XYPoint field type. The xy point field type is similar to the geopoint field type, but does not have the range limitations of geopoint. The coordinates of an xy point are single-precision floating-point values. For information about the range and precision of floating-point values, see Numeric field types.

Example

Create a mapping with an xy point field type:

  1. PUT testindex1
  2. {
  3. "mappings": {
  4. "properties": {
  5. "point": {
  6. "type": "xy_point"
  7. }
  8. }
  9. }
  10. }

copy

Formats

xy points can be indexed in the following formats:

  • An object with x and y coordinates
  1. PUT testindex1/_doc/1
  2. {
  3. "point": {
  4. "x": 0.5,
  5. "y": 4.5
  6. }
  7. }

copy

  • A string in the “x, y” format
  1. PUT testindex1/_doc/2
  2. {
  3. "point": "0.5, 4.5"
  4. }

copy

  • An array in the [x, y] format
  1. PUT testindex1/_doc/3
  2. {
  3. "point": [0.5, 4.5]
  4. }

copy

  1. PUT testindex1/_doc/4
  2. {
  3. "point": "POINT (0.5 4.5)"
  4. }

copy

  • GeoJSON format
  1. PUT testindex1/_doc/5
  2. {
  3. "point" : {
  4. "type" : "Point",
  5. "coordinates" : [0.5, 4.5]
  6. }
  7. }

copy

In all xy point formats, the coordinates must be specified in the x, y order.

Parameters

The following table lists the parameters accepted by xy point field types. All parameters are optional.

ParameterDescription
ignore_malformedA Boolean value that specifies to ignore malformed values and not to throw an exception. Default is false.
ignore_z_valueSpecific to points with three coordinates. If ignore_z_value is true, the third coordinate is not indexed but is still stored in the _source field. If ignore_z_value is false, an exception is thrown.
null_valueA value to be used in place of null. The value must be of the same type as the field. If this parameter is not specified, the field is treated as missing when its value is null. Default is null.