# How to create ES index with a mapping and data from Mysql?

**URL:** <https://discuss.elastic.co/t/how-to-create-es-index-with-a-mapping-and-data-from-mysql/17573>\
**Category:** Elasticsearch\
**Created:** [May 17, 2014, 4:33pm UTC](https://discuss.elastic.co/t/how-to-create-es-index-with-a-mapping-and-data-from-mysql/17573 "2014-05-17T16:33:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dark\_shadow](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dark\_shadow](https://discuss.elastic.co/u/dark_shadow)\
**Post date:** [May 17, 2014, 4:33pm UTC](https://discuss.elastic.co/t/how-to-create-es-index-with-a-mapping-and-data-from-mysql/17573/1 "2014-05-17T16:33:25Z")

</div>

Hi,

I'm using ES for creating an index with a mapping and data from Mysql. I'm  
able to create an empty idex along with mappings and settings but I'm not  
able to import data from Mysql into that index. I'm using  
[https://github.com/jprante/elasticsearch-river-jdbc](https://github.com/jprante/elasticsearch-river-jdbc) this plugin with ES  
1.1.0 There is no problem in version. The example shows something like this:

curl -XPUT 'localhost:9200/\_river/my\_jdbc\_river/\_meta' -d '{  
"type" : "jdbc",  
"jdbc" : {  
"url" : "jdbc:mysql://localhost:3306/test",  
"user" : "",  
"password" : "",  
"sql" : "select \* from orders"  
}  
}'

But how can I change it for some index INDEX and type TYPE.

curl -XPUT "localhost:9200/\_river/INDEX/\_meta" -d '  
{  
"type": "jdbc",  
"jdbc": {  
"url": "jdbc:mysql://localhost:3306/my\_db",  
"driver": "com.mysql.jdbc.Driver",  
"user" : "root",  
"password": "root",  
"sql" : "select \* from my\_table"  
},  
"index": {  
"index" : "INDEX",  
"type" : "TYPE"  
}  
}'

But this is not working for me ?

Please help me.

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/209f2dc4-d566-44d8-8413-079578a1d4ce%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/209f2dc4-d566-44d8-8413-079578a1d4ce%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:28am UTC](https://discuss.elastic.co/t/how-to-create-es-index-with-a-mapping-and-data-from-mysql/17573/2 "2017-07-06T01:28:41Z")

</div>


