# Importing data into ElasticSearch from RDBMS

**URL:** <https://discuss.elastic.co/t/importing-data-into-elasticsearch-from-rdbms/55722>\
**Category:** Elasticsearch\
**Created:** [July 18, 2016, 6:21am UTC](https://discuss.elastic.co/t/importing-data-into-elasticsearch-from-rdbms/55722 "2016-07-18T06:21:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mukunda.ms](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@mukunda.ms](https://discuss.elastic.co/u/mukunda.ms)\
**Post date:** [July 18, 2016, 6:21am UTC](https://discuss.elastic.co/t/importing-data-into-elasticsearch-from-rdbms/55722/1 "2016-07-18T06:21:14Z")

</div>

We are currently using Apache Solr and want to migrate to ElasticSearch. We have one requirement where we want to index data from RDBMS to ElasticSearch. The data is not in flat structure but as follows:

TableName: Employee

EmployeeID, EmpName  
1234, ABCD  
4231, XYZ  
5534, QWERT

TableName: Emp-Department

EmployeeID DepartmentID  
1234 333  
1234 4123  
4231 333  
4231 555  
5534 333

TableName: Department

DepartmentID DepartmentName  
333 Finance  
4123 HR  
555 Logistics

The data that I want to index should be as below:

{  
"EmployeeID":1234,  
"EmpName":"ABCD",  
"Department":["Finance","HR"]  
},  
{  
"EmployeeID":4231,  
"EmpName":"XYZ",  
"Department":["Finance","Logistics"]  
},  
{  
"EmployeeID":5534,  
"EmpName":"QWERT",  
"Department":["Finance"]  
}

In Apache Solr I am able to achive this by having nested entities in the DataImportHandler. I am not able to figure how this can be achieved in ElasticSearch.

Kindly help.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [July 18, 2016, 7:02am UTC](https://discuss.elastic.co/t/importing-data-into-elasticsearch-from-rdbms/55722/2 "2016-07-18T07:02:22Z")

</div>

You can try my JDBC importer [https://github.com/jprante/elasticsearch-jdbc/](https://github.com/jprante/elasticsearch-jdbc/)

---

<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 5, 2017, 10:34pm UTC](https://discuss.elastic.co/t/importing-data-into-elasticsearch-from-rdbms/55722/3 "2017-07-05T22:34:49Z")

</div>


