# Predefined elasticsearch schema, not mapped with logstash data upload from mysql table column

**URL:** <https://discuss.elastic.co/t/predefined-elasticsearch-schema-not-mapped-with-logstash-data-upload-from-mysql-table-column/37541>\
**Category:** Logstash\
**Created:** [December 18, 2015, 7:18am UTC](https://discuss.elastic.co/t/predefined-elasticsearch-schema-not-mapped-with-logstash-data-upload-from-mysql-table-column/37541 "2015-12-18T07:18:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![krushnat\_khawale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krushnat_khawale/32/6652_2.png) [@krushnat\_khawale](https://discuss.elastic.co/u/krushnat_khawale)\
**Post date:** [December 18, 2015, 7:18am UTC](https://discuss.elastic.co/t/predefined-elasticsearch-schema-not-mapped-with-logstash-data-upload-from-mysql-table-column/37541/1 "2015-12-18T07:18:21Z")

</div>

## I'm using logstash to upload data from mysql to elasticsearch.

**I've created a 'index' named testindex as follows**

POST /insights{  
"settings" : {  
"number\_of\_shards" : 1  
},  
"mappings" : {  
"type1" : {  
"\_source" : { "enabled" : false },  
"properties" : {  
"callref":{"type" : "string", "index" : "not\_analyzed","null\_value" : "NA"},  
"category":{"type" : "string", "index" : "not\_analyzed","null\_value" : "NA"},  
"customer":{"type" : "string", "index" : "not\_analyzed","null\_value" : "NA"},  
"description":{"type" : "string", "index" : "not\_analyzed","null\_value" : "NA"},  
"closedby":{"type" : "string", "index" : "not\_analyzed","null\_value" : "NA"},  
"fixedby":{"type" : "string", "index" : "not\_analyzed","null\_value" : "NA"},  
"category1":{"type" : "string", "index" : "not\_analyzed","null\_value" : "NA"},  
"comments":{"type" : "string", "index" : "not\_analyzed","null\_value" : "NA"},  
"location":{"type" : "geo\_point"}  
}  
}  
}  
}

`using following conf file in logstash`

input {  
jdbc {  
jdbc\_driver\_library =\> "D:\Users\admin\setups\elasticsearch-2.1.0\plugins\mysql-connector-java-5.1.37-bin.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
jdbc\_connection\_string =\> "jdbc:mysql://localhost:3306/testdatabase"  
jdbc\_user =\> "root"  
jdbc\_password =\> "root"  
statement =\> "SELECT \* from fma\_insights\_data"  
}  
}  
output {  
elasticsearch {  
hosts =\> "localhost:9200"  
action =\> "index"  
index =\> "testindex"  
}  
stdout { codec =\> rubydebug }  
}

If **I don't create schema first** and upload from logstash then it creates "testindex" index with corresponding data.

But if I create create schema first and then upload, then **index "textindex" is there but with no data**.

Suggest appropriate solution.

Thanks.

---

<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, 5:17am UTC](https://discuss.elastic.co/t/predefined-elasticsearch-schema-not-mapped-with-logstash-data-upload-from-mysql-table-column/37541/2 "2017-07-06T05:17:55Z")

</div>


