# How to ingest geo\_shape from MySQL database?

**URL:** https://discuss.elastic.co/t/how-to-ingest-geo-shape-from-mysql-database/238173
**Category:** Logstash
**Created:** [June 23, 2020, 3:05am UTC](https://discuss.elastic.co/t/how-to-ingest-geo-shape-from-mysql-database/238173 "2020-06-23T03:05:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![edbautista](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@edbautista](https://discuss.elastic.co/u/edbautista)
#### Post date: [June 23, 2020, 3:05am UTC](https://discuss.elastic.co/t/how-to-ingest-geo-shape-from-mysql-database/238173/1 "2020-06-23T03:05:21Z")

</div>

We are currently working on ingesting multiple polygons from our MySQL database into Elasticsearch to be visualized in Kibana Maps. We have tried generating a geojson from the polygons we need but we encountered errors when trying to visualize. Is there a way to format or filter before ingestion in Logstash? Or do we need to look for another route to ingest our polygons? Thanks.

---

<div class="post-metadata">

### Author: ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)
#### Post date: [June 23, 2020, 5:48pm UTC](https://discuss.elastic.co/t/how-to-ingest-geo-shape-from-mysql-database/238173/2 "2020-06-23T17:48:54Z")

</div>

Hi @edbautista. Can you share which errors you received when trying to visualize?

If the existing Logstash filters are insufficient for this, you can write a [custom filter using ruby](https://www.elastic.co/guide/en/logstash/current/plugins-filters-ruby.html).

---

<div class="post-metadata">

### Author: ![edbautista](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@edbautista](https://discuss.elastic.co/u/edbautista)
#### Post date: [June 25, 2020, 7:30am UTC](https://discuss.elastic.co/t/how-to-ingest-geo-shape-from-mysql-database/238173/3 "2020-06-25T07:30:51Z")

</div>

{  
"success": true,  
"failures": [  
{  
"item": 3,  
"reason": "failed to parse field [coordinates] of type [geo\_shape]",  
"doc": {  
"coordinates": {  
"type": "polygon",  
"coordinates": [  
[  
[  
125.13984323575562,  
6.133886657363985  
],  
[  
125.13984323575562,  
6.133886657363985  
], ....

Because we don't know how to ingest geo\_shape using logstash from mysql, we opt to generate a geojson file. When we ingested the geojson file via Kibana Maps, it gave us that failure message. We made a workaround for this using our own upload tool and made it worked. However, we would still want to know how to ingest geo\_shape using logstash. Thanks @nickpeihl.

---

<div class="post-metadata">

### Author: ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)
#### Post date: [June 25, 2020, 7:43pm UTC](https://discuss.elastic.co/t/how-to-ingest-geo-shape-from-mysql-database/238173/4 "2020-06-25T19:43:02Z")

</div>

Would you be willing to share the entire geojson file with us so we can debug it in Maps?

There does not appear to be a native way for Logstash to convert a geojson feature from MySQL to a geo\_shape in Elasticsearch. So you'll have to make our own Logstash filter. Perhaps I can offer some ideas. Can you also share one of the documents as it was stored in Elasticsearch?

---

<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: [July 23, 2020, 7:43pm UTC](https://discuss.elastic.co/t/how-to-ingest-geo-shape-from-mysql-database/238173/5 "2020-07-23T19:43:04Z")

</div>

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