# Failed to parse field \[coordinates\] of type \[geo\_shape\]

**URL:** <https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305>\
**Category:** Elasticsearch\
**Created:** [October 7, 2020, 4:06pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305 "2020-10-07T16:06:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidb1](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@davidb1](https://discuss.elastic.co/u/davidb1)\
**Post date:** [October 7, 2020, 4:06pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305/1 "2020-10-07T16:06:43Z")

</div>

I'm using Kibana to upload a geojson to Elasticsearch. It loads and shows up without problems but when I try to index it I get:

```auto
{
  "success": true,
  "failures": [
    {
      "item": 0,
      "reason": "failed to parse field [coordinates] of type [geo_shape]",
      "doc": {
        "coordinates": {
          "type": "polygon",
          "coordinates": [
....

```

I have fixed all intersections and the error just doesn't convey why the indexing is failing.

Here is the geojson: [https://github.com/davidb1/geojson-elastic-testing/blob/master/testing.geojson](https://github.com/davidb1/geojson-elastic-testing/blob/master/testing.geojson)

How can I find out the issue?

---

<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:** [October 7, 2020, 5:27pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305/2 "2020-10-07T17:27:20Z")

</div>

Hi @davidb1 I think the issue is in Elasticsearch not being able to parse the multigeometries of your file that have several holes.

I tried in different ways to clean/validate your dataset and upload. Finally, using `ogr2ogr` (more [info](https://www.elastic.co/blog/how-to-ingest-geospatial-data-into-elasticsearch-with-gdal)) I managed to get a bit more of info from the error returned by the tool

```auto
...
{
"type":"mapper_parsing_exception",
"reason":"failed to parse field [geometry] of type [geo_shape]",
"caused_by":{
  "type":"invalid_shape_exception",
  "reason":"Invalid shape: Hole is not within polygon"}}}
...

```

Can I ask what's the use case for a dataset like this?

**Note** I moved this topic to the Kibana forum but I'm moving it back, since this is apparently more an issue for the Elasticsearch team, as the issue appeared not only indexing from kibana but also from `ogr2ogr`.

---

<div class="post-metadata">

**Author:** ![davidb1](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@davidb1](https://discuss.elastic.co/u/davidb1)\
**Post date:** [October 7, 2020, 5:36pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305/3 "2020-10-07T17:36:16Z")

</div>

I'm trying to implement a query for checking whether a shape is at sea.

Elastic seems like a good fit for such queries but getting the geojson into an index turning out to be quite a challenge.

Also, it is confusing that the initial stage shows the geojson fine on the map but the indexing fails

---

<div class="post-metadata">

**Author:** ![davidb1](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@davidb1](https://discuss.elastic.co/u/davidb1)\
**Post date:** [October 8, 2020, 8:18am UTC](https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305/4 "2020-10-08T08:18:33Z")

</div>

How would I go about fixing something like this? I can't find enough info about the issue

---

<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:** [October 8, 2020, 12:01pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305/5 "2020-10-08T12:01:58Z")

</div>

> [@davidb1](#):
>
> I'm trying to implement a query for checking whether a shape is at sea.

Thanks for explaining the use case. I'd suggest looking for a land polygon and do the opposite query to find points that don't intersect in documents in your indices. That will reduce enormously the possibility of getting hit by complex geometries.

Still, for good performance, you need your land/water polygons to be **split** so the spatial index picks smaller geometries to try against, otherwise, your queries will be really slow.

You may want to import **more detailed** datasets than the well known Natural Earth. The German OSM community maintains very detailed [land/water datasets](https://osmdata.openstreetmap.de/data/coast.html). These are large files, so uploading with Kibana is not an option. I can suggest using the procedure detailed on [this blog post](https://www.elastic.co/blog/how-to-ingest-geospatial-data-into-elasticsearch-with-gdal).

Beware that even the [simplified dataset](https://osmdata.openstreetmap.de/download/land-polygons-split-3857.zip) for the land polygons is going to result in a **3GB** index in your cluster with **694381** documents.

Example of the precision of the simplified dataset for the west coast of Scotland.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/1/6133dc9d788c1adc2cd208a6beadbb139a4e44ec.jpeg)

Hope this helps

---

<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:** [October 8, 2020, 1:01pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305/6 "2020-10-08T13:01:13Z")

</div>

Forgot to mention, and it's actually relevant, that you can only run this kind of analysis on Elasticsearch using the [enrich processor](https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-processor.html) since Elasticsearch [geoqueries](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-queries.html) only support to point to a single document with the [Preindexed Shape](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html#_pre_indexed_shape) option.

With the enrich processor you could point to your land polygons index as reference data and use the `DISJOINT` spatial relation to mark the documents that don't intersect to any document of your reference polygons. That way, later at query time, you only need to filter by that field.

---

<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:** [October 13, 2020, 7:36am UTC](https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305/7 "2020-10-13T07:36:02Z")

</div>

I had a look into this issue and it is actually a known bug that will be resolved here:

> <https://github.com/elastic/elasticsearch/pull/59501>

---

<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:** [November 10, 2020, 7:36am UTC](https://discuss.elastic.co/t/failed-to-parse-field-coordinates-of-type-geo-shape/251305/8 "2020-11-10T07:36:10Z")

</div>

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