# Using logstash to migrate data from postgres to ES

**URL:** <https://discuss.elastic.co/t/using-logstash-to-migrate-data-from-postgres-to-es/26829>\
**Category:** Logstash\
**Created:** [August 4, 2015, 7:27pm UTC](https://discuss.elastic.co/t/using-logstash-to-migrate-data-from-postgres-to-es/26829 "2015-08-04T19:27:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freddie](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@Freddie](https://discuss.elastic.co/u/Freddie)\
**Post date:** [August 4, 2015, 7:27pm UTC](https://discuss.elastic.co/t/using-logstash-to-migrate-data-from-postgres-to-es/26829/1 "2015-08-04T19:27:58Z")

</div>

I'm using the logstash logstash-input-jdbc plugin. logstash conf file as follows.

input {  
jdbc {  
jdbc\_driver\_library =\> "/mars/services/ows/webapps/ows/WEB-INF/lib/postgresql-8.4-701.jdbc3.jar"  
jdbc\_driver\_class =\> "org.postgresql.Driver"  
jdbc\_connection\_string =\> "jdbc:postgresql://localhost:5432/testdb"  
jdbc\_user =\> "tests"  
jdbc\_password =\> "password"  
statement =\> "select \* from vw\_gmti\_job\_definition"  
}  
}

filter {  
mutate { add\_field =\> { "[@metadata][\_index]" =\> "gmti\_y%{+YYYY-MM}\_v1" } }  
mutate { add\_field =\> { "[@metadata][\_type]" =\> "job" } }  
}

output {

# We build the "new" elasticsearch index in the default cluster

elasticsearch {  
cluster =\> "testdb"  
document\_type =\> "%{[@metadata][\_type]}"  
host =\> "localhost"  
index =\> "%{[@metadata][\_index]}"  
manage\_template =\> "true"  
port =\> "9200"  
protocol =\> "http"  
template =\> "/usr/share/logstash-1.5.2/lib/logstash/outputs/elasticsearch/elasticsearch-mars-template.json"  
template\_name =\> "mars"  
template\_overwrite =\> "false"  
workers =\> "1"  
}

stdout { codec =\> json\_lines }  
file {  
codec =\> "json"  
path =\> "/tmp/debug-filters.json"  
}  
}

The migration process is failing on the mapping.

org.elasticsearch.index.mapper.MapperParsingException: object mapping for [job] tried to parse field [platformType] as object, but got EOF, has a concrete value been provided to it?

this is the mapping clause.

```
            "platformType": {
                "type": "object",
                "properties": {
                    "name" : {"type": "string", "index": "not_analyzed"},
                    "enum" : {"type": "integer"}
                }
            }, 

```

How can this error be resolved?

thanks

---

<div class="post-metadata">

**Author:** ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)\
**Post date:** [June 21, 2016, 5:38pm UTC](https://discuss.elastic.co/t/using-logstash-to-migrate-data-from-postgres-to-es/26829/2 "2016-06-21T17:38:24Z")

</div>

I'm having the same issue. Any solutions?

---

<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 6, 2017, 4:51am UTC](https://discuss.elastic.co/t/using-logstash-to-migrate-data-from-postgres-to-es/26829/3 "2017-07-06T04:51:25Z")

</div>


