# Joining two sql tables in elasticsearch

**URL:** <https://discuss.elastic.co/t/joining-two-sql-tables-in-elasticsearch/175685>\
**Category:** Elasticsearch\
**Created:** [April 6, 2019, 7:41pm UTC](https://discuss.elastic.co/t/joining-two-sql-tables-in-elasticsearch/175685 "2019-04-06T19:41:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkuiate1](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@dkuiate1](https://discuss.elastic.co/u/dkuiate1)\
**Post date:** [April 6, 2019, 7:41pm UTC](https://discuss.elastic.co/t/joining-two-sql-tables-in-elasticsearch/175685/1 "2019-04-06T19:41:12Z")

</div>

Hello i'm new to elasticsearch. I'm trying to join data that i imported from two sql tables and i do not really understand how to do that.  
These are my config files to import data:

input {  
jdbc {  
jdbc\_driver\_library =\> "C:\Users\dkuiate\Downloads\ojdbc6.jar"  
jdbc\_driver\_class =\> "Java::oracle.jdbc.driver.OracleDriver"  
jdbc\_connection\_string =\> ""  
jdbc\_user =\> "gemini"  
jdbc\_password =\> "gemini"  
jdbc\_validate\_connection =\> true  
statement =\>"select ......  
where p.pid = t.priority and s.service\_id = t.type\_id  
and e.env\_id = t.od\_env\_id and b.ctr\_id = t.bin\_id and lc.lgl\_ctr\_id = b.lgl\_ctr\_id  
and trunc(t.d\_otime,'MONTH') \>= to\_date('1/6/2018','DD/MM/YYYY')"  
}  
}

output {  
elasticsearch{  
hosts =\> "localhost:9200"  
index =\> "home"  
document\_type =\> "home\_ticket"  
# document\_id =\> "%{id}"

```
}

```

}

and the second one is similar. I have around 10 000 rows of data so i can't do it manually, i used to do it manually but now it is just impossible. Can anybody help?  
i want to be capable to make visualization joinning data from both two data set!  
Do i have a way to do that while importing with the jdbc driver.  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 6, 2019, 8:13pm UTC](https://discuss.elastic.co/t/joining-two-sql-tables-in-elasticsearch/175685/2 "2019-04-06T20:13:52Z")

</div>

You'd probably be best off joining in your SQL if you can.

---

<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:** [May 4, 2019, 8:13pm UTC](https://discuss.elastic.co/t/joining-two-sql-tables-in-elasticsearch/175685/3 "2019-05-04T20:13:57Z")

</div>

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