Geopoint field type

Introduced 1.0

A geopoint field type contains a geographic point specified by latitude and longitude.

Example

Create a mapping with a geopoint field type:

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

copy

Formats

Geopoints can be indexed in the following formats:

  • An object with a latitude and longitude
  1. PUT testindex1/_doc/1
  2. {
  3. "point": {
  4. "lat": 40.71,
  5. "lon": 74.00
  6. }
  7. }

copy

  • A string in the “latitude,longitude” format
  1. PUT testindex1/_doc/2
  2. {
  3. "point": "40.71,74.00"
  4. }

copy

  • A geohash
  1. PUT testindex1/_doc/3
  2. {
  3. "point": "txhxegj0uyp3"
  4. }

copy

  • An array in the [longitude, latitude] format
  1. PUT testindex1/_doc/4
  2. {
  3. "point": [74.00, 40.71]
  4. }

copy

  1. PUT testindex1/_doc/5
  2. {
  3. "point": "POINT (74.00 40.71)"
  4. }

copy

  • GeoJSON format, where the coordinates are in the [longitude, latitude] format
  1. PUT testindex1/_doc/6
  2. {
  3. "point": {
  4. "type": "Point",
  5. "coordinates": [74.00, 40.71]
  6. }
  7. }

copy

Parameters

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

ParameterDescription
ignore_malformedA Boolean value that specifies to ignore malformed values and not to throw an exception. Valid values for latitude are [-90, 90]. Valid values for longitude are [-180, 180]. 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. 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.