# Ingest shapefile into Elasticsearch with GDAL

**URL:** <https://discuss.elastic.co/t/ingest-shapefile-into-elasticsearch-with-gdal/235104>\
**Category:** Elasticsearch\
**Created:** [June 1, 2020, 3:01am UTC](https://discuss.elastic.co/t/ingest-shapefile-into-elasticsearch-with-gdal/235104 "2020-06-01T03:01:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scorpion21](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/scorpion21/32/48483_2.png) [@Scorpion21](https://discuss.elastic.co/u/Scorpion21)\
**Post date:** [June 1, 2020, 3:01am UTC](https://discuss.elastic.co/t/ingest-shapefile-into-elasticsearch-with-gdal/235104/1 "2020-06-01T03:01:59Z")

</div>

I am trying to index shapefile into Elasticsearch. The geometry type is Multipolygon.

By following this blog post

> **[How to ingest geospatial data into Elasticsearch with GDAL](https://www.elastic.co/blog/how-to-ingest-geospatial-data-into-elasticsearch-with-gdal)**
>
> With the GDAL (Geospatial Data Abstraction Library) command line tools, you can easily get your geo and map data into Elasticsearch without setting up Beats or Logstash. And once ingested, you can start using it to build multilayer map visualizations...

I try this cmd:

`ogr2ogr -lco INDEX_NAME=test -lco NOT_ANALYZED_FIELDS={ALL} ES:http://localhost:9200 test.shp`

However, I have got below errors.

ERROR 1: HTTP error code : 406

ERROR 1: {"error":"Content-Type header [application/x-javascript; charset=UTF-8] is not supported","status":406}

ERROR 1: Unable to write feature 0 from layer test.

ERROR 1: Terminating translation prematurely after failed

translation of layer test (use -skipfailures to skip errors)

Can anyone help on this?

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 1, 2020, 5:16pm UTC](https://discuss.elastic.co/t/ingest-shapefile-into-elasticsearch-with-gdal/235104/2 "2020-06-01T17:16:09Z")

</div>

Hi @Scorpion21. Which version of elasticsearch and which version of GDAL are you using?

The GDAL version can be found by running `ogrinfo --version`.

---

<div class="post-metadata">

**Author:** ![Scorpion21](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/scorpion21/32/48483_2.png) [@Scorpion21](https://discuss.elastic.co/u/Scorpion21)\
**Post date:** [June 1, 2020, 11:51pm UTC](https://discuss.elastic.co/t/ingest-shapefile-into-elasticsearch-with-gdal/235104/3 "2020-06-01T23:51:11Z")

</div>

> [@nickpeihl](#):
>
> ogrinfo --version

GDAL 2.3.3  
Elasticsearch 7.6.2

---

<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 2, 2020, 7:07pm UTC](https://discuss.elastic.co/t/ingest-shapefile-into-elasticsearch-with-gdal/235104/4 "2020-06-02T19:07:13Z")

</div>

Hi @Scorpion21. GDAL 2.3.3 is not compatible with Elasticsearch 7+. You'll want to install [GDAL 3.1.0](https://gdal.org/download.html#current-releases).

---

<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:** [June 30, 2020, 7:07pm UTC](https://discuss.elastic.co/t/ingest-shapefile-into-elasticsearch-with-gdal/235104/5 "2020-06-30T19:07:18Z")

</div>

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