# Can not create a document has mutlipolygon having hole

**URL:** https://discuss.elastic.co/t/can-not-create-a-document-has-mutlipolygon-having-hole/348177
**Category:** Elasticsearch
**Created:** [November 28, 2023, 6:55pm UTC](https://discuss.elastic.co/t/can-not-create-a-document-has-mutlipolygon-having-hole/348177 "2023-11-28T18:55:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Sai\_Suvam\_Patnaik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sai_suvam_patnaik/32/128175_2.png) [@Sai\_Suvam\_Patnaik](https://discuss.elastic.co/u/Sai_Suvam_Patnaik)
#### Post date: [November 28, 2023, 6:55pm UTC](https://discuss.elastic.co/t/can-not-create-a-document-has-mutlipolygon-having-hole/348177/1 "2023-11-28T18:55:11Z")

</div>

Hi, can anyone help me  
I am facing a following.

**Summary**  
Can not create a document has mutlipolygon having hole.  
I do not know why responses reason is correct or this is bug?  
I have visualize the multipolygon, using geojson.  
But , It seems correct polygon.

 ![Screenshot 2023-11-29 at 12.23.28 AM](https://us1.discourse-cdn.com/elastic/original/3X/2/f/2fa57c61c2ef5ea695b56479bf8382c7b2f51bcd.jpeg)

This is the geometry:

MULTIPOLYGON (((477500.00002257974 1327499.999981646, 475000.00002257974 1327499.999981646, 475000.00002257974 1329999.999981646, 475000.00002257974 1332499.999981646, 475000.00002257974 1334999.999981646, 475000.00002257974 1337499.999981646, 475000.00002257974 1339999.999981646, 475000.00002257974 1342499.999981646, 475000.00002257974 1344999.999981646, 475000.00002257974 1347499.999981646, 475000.00002257974 1349999.999981646, 477500.00002257974 1349999.999981646, 477500.00002257974 1352499.999981646, 480000.00002257974 1352499.999981646, 480000.00002257974 1354999.999981646, 482500.00002257974 1354999.999981646, 485000.00002257974 1354999.999981646, 487500.00002257974 1354999.999981646, 487500.00002257974 1352499.999981646, 490000.00002257974 1352499.999981646, 492500.00002257974 1352499.999981646, 495000.00002257974 1352499.999981646, 495000.00002257974 1354999.999981646, 497500.00002257974 1354999.999981646, 500000.00002257974 1354999.999981646, 500000.00002257974 1357499.999981646, 500000.00002257974 1359999.999981646, 502500.00002257974 1359999.999981646, 502500.00002257974 1362499.999981646, 505000.00002257974 1362499.999981646, 507500.00002257974 1362499.999981646, 510000.0000225798 1362499.999981646, 510000.0000225798 1364999.999981646, 512500.0000225798 1364999.999981646, 515000.0000225798 1364999.999981646, 515000.0000225798 1367499.999981646, 515000.0000225798 1369999.999981646, 517500.0000225798 1369999.999981646, 520000.0000225798 1369999.999981646, 522500.0000225798 1369999.999981646, 525000.0000225798 1369999.999981646, 527500.0000225798 1369999.999981646, 530000.0000225798 1369999.999981646, 530000.0000225798 1372499.999981646, 532500.0000225798 1372499.999981646, 532500.0000225798 1374999.999981646, 535000.0000225798 1374999.999981646, 537500.0000225798 1374999.999981646, 537500.0000225798 1377499.999981646, 540000.0000225798 1377499.999981646, 542500.0000225798 1377499.999981646, 545000.0000225798 1377499.999981646, 545000.0000225798 1379999.999981646, 547500.0000225798 1379999.999981646, 547500.0000225798 1382499.999981646, 550000.0000225798 1382499.999981646, 552500.0000225798 1382499.999981646, 555000.0000225798 1382499.999981646, 555000.0000225798 1379999.999981646, 557500.0000225798 1379999.999981646, 557500.0000225798 1377499.999981646, 557500.0000225798 1374999.999981646, 560000.000022579 1374999.999981646, 560000.000022579 1374999.9999816492, 562500.0000225827 1374999.9999816492, 562500.0000225827 1372499.9999816492, 560000.0000225798 1372499.9999816492, 560000.0000225798 1372499.999981646, 562500.0000225798 1372499.999981646, 562500.0000225798 1369999.999981646, 565000.0000225798 1369999.999981646, 565000.0000225798 1367499.999981646, 565000.0000225798 1367499.9999816418, 567500.0000225827 1367499.9999816418, 567500.0000225827 1364999.9999816492, 565000.0000225798 1364999.9999816492, 565000.0000225798 1364999.999981646, 567500.0000225798 1364999.999981646, 567500.0000225798 1362499.999981646, 567500.0000225798 1359999.999981646, 567500.0000225798 1357499.999981646, 567500.0000225798 1354999.999981646, 567500.0000225798 1352499.999981646, 567500.0000225798 1349999.9999816492, 567500.0000225827 1349999.9999816492, 567500.0000225827 1347499.9999816567, 565000.0000225864 1347499.9999816567, 565000.0000225864 1344999.9999816567, 562500.0000225827 1344999.9999816567, 562500.0000225827 1342499.9999816641, 560000.0000225798 1342499.9999816641, 560000.0000225798 1342499.9999816492, 560000.0000225864 1342499.9999816492, 560000.0000225864 1339999.9999816641, 557500.0000225827 1339999.9999816641, 557500.0000225827 1342499.999981646, 557500.0000225798 1342499.999981646, 557500.0000225798 1339999.999981646, 557500.0000225798 1337499.9999816567, 557500.0000225827 1337499.9999816567, 557500.0000225827 1334999.9999816567, 555000.0000225798 1334999.9999816567, 555000.0000225798 1334999.999981646, 557500.0000225798 1334999.999981646, 557500.0000225798 1332499.999981646, 557500.0000225798 1329999.999981646, 557500.0000225798 1327499.999981646, 555000.0000225798 1327499.999981646, 552500.0000225798 1327499.999981646, 550000.0000225798 1327499.999981646, 547500.0000225798 1327499.999981646, 545000.0000225798 1327499.999981646, 542500.0000225798 1327499.999981646, 540000.0000225798 1327499.999981646, 537500.0000225798 1327499.999981646, 535000.0000225798 1327499.999981646, 532500.0000225798 1327499.999981646, 530000.0000225798 1327499.999981646, 527500.0000225798 1327499.999981646, 525000.0000225798 1327499.999981646, 522500.0000225798 1327499.999981646, 520000.0000225798 1327499.999981646, 517500.0000225798 1327499.999981646, 515000.0000225798 1327499.999981646, 512500.0000225798 1327499.999981646, 510000.0000225798 1327499.999981646, 507500.00002257974 1327499.999981646, 505000.00002257974 1327499.999981646, 502500.00002257974 1327499.999981646, 500000.00002257974 1327499.999981646, 497500.00002257974 1327499.999981646, 495000.00002257974 1327499.999981646, 492500.00002257974 1327499.999981646, 490000.00002257974 1327499.999981646, 487500.00002257974 1327499.999981646, 485000.00002257974 1327499.999981646, 482500.00002257974 1327499.999981646, 480000.00002257974 1327499.999981646, 477500.00002257974 1327499.999981646), (562500.0000225827 1344999.9999816567, 562500.0000225827 1347499.999981646, 562500.0000225798 1347499.999981646, 562500.0000225798 1344999.9999816567, 562500.0000225827 1344999.9999816567)), ((567500.0000225827 1359999.9999816567, 567500.0000225827 1362499.9999816492, 570000.0000225864 1362499.9999816492, 570000.0000225864 1359999.9999816567, 570000.0000225864 1357499.9999816567, 570000.0000225864 1354999.9999816567, 567500.0000225827 1354999.9999816567, 567500.0000225827 1357499.9999816567, 567500.0000225827 1359999.9999816567)), ((570000.0000225864 1352499.9999816641, 567500.0000225827 1352499.9999816641, 567500.0000225827 1354999.9999816492, 570000.0000225864 1354999.9999816492, 570000.0000225864 1352499.9999816641)))

**Expected behavior**  
The document is successfuly created.

**Actual behavior**  
Can not create a document.  
The reponse is status 400.

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "failed to parse field [location] of type [geo_shape]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "failed to parse field [location] of type [geo_shape]",
    "caused_by": {
      "type": "invalid_shape_exception",
      "reason": "Invalid shape: Hole is not within polygon"
    }
  },
  "status": 400
}

```

Can someone help with this

---

<div class="post-metadata">

### Author: ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)
#### Post date: [November 29, 2023, 9:44am UTC](https://discuss.elastic.co/t/can-not-create-a-document-has-mutlipolygon-having-hole/348177/2 "2023-11-29T09:44:14Z")

</div>

Hi,

Pretty sure the issue is in your coordinates. GeoJSON expects coordinates in Longitude, Latitude. From [the spec](https://datatracker.ietf.org/doc/html/rfc7946#section-4)

> 1. Coordinate Reference System
> 
> The coordinate reference system for all GeoJSON coordinates is a geographic coordinate reference system, using the World Geodetic System 1984 (WGS 84) [[WGS84](https://datatracker.ietf.org/doc/html/rfc7946#ref-WGS84)] datum, with longitude and latitude units of decimal degrees. This is equivalent to the coordinate reference system identified by the Open Geospatial Consortium (OGC) URN urn:ogc:def:crs:OGC::CRS84. An OPTIONAL third-position element SHALL be the height in meters above or below the WGS 84 reference ellipsoid. In the absence of elevation values, applications sensitive to height or depth SHOULD interpret positions as being at local ground or sea level.

---

<div class="post-metadata">

### Author: ![Ignacio\_Vera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ignacio_vera/32/36674_2.png) [@Ignacio\_Vera](https://discuss.elastic.co/u/Ignacio_Vera)
#### Post date: [November 30, 2023, 6:31pm UTC](https://discuss.elastic.co/t/can-not-create-a-document-has-mutlipolygon-having-hole/348177/3 "2023-11-30T18:31:07Z")

</div>

And indeed the geo\_shape field expects coordinates in WGS84. It is actually a bit hidden in the documentation:([Geoshape field type | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/geo-shape.html#input-structure))

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 28, 2023, 6:31pm UTC](https://discuss.elastic.co/t/can-not-create-a-document-has-mutlipolygon-having-hole/348177/4 "2023-12-28T18:31:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
