# Import table with compound key

**URL:** <https://discuss.elastic.co/t/import-table-with-compound-key/32979>\
**Category:** Logstash\
**Created:** [October 26, 2015, 11:37am UTC](https://discuss.elastic.co/t/import-table-with-compound-key/32979 "2015-10-26T11:37:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lore6673](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lore6673](https://discuss.elastic.co/u/lore6673)\
**Post date:** [October 26, 2015, 11:37am UTC](https://discuss.elastic.co/t/import-table-with-compound-key/32979/1 "2015-10-26T11:37:49Z")

</div>

Hi there

I need to import a table from Oracle using logstash and jdbc input with a compound primary key, Product\_id and Language\_id.

This is my conf file

```
 input {
    jdbc {
        jdbc_connection_string => "jdbc:oracle:thin:@//myhost:11521/myservice"
        jdbc_user => "user"
        jdbc_password => "password"
        jdbc_driver_library => "ojdbc6.jar"
        jdbc_driver_class => "Java::oracle.jdbc.OracleDriver"
        statement_filepath => "query_ecomm.sql"
    }
}
output {
    elasticsearch { 
    	protocol => http 
    	index => "my_index"
        document_type => "ecomm"
        document_id => "%{product_id}"
        host => "10.0.1.59"
    }
}

```

How can I set the output section in order to add the language\_id?

Thanks  
Lorenzo

---

<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:** [October 27, 2015, 1:34am UTC](https://discuss.elastic.co/t/import-table-with-compound-key/32979/2 "2015-10-27T01:34:08Z")

</div>

Where is the `language_id` defined?

---

<div class="post-metadata">

**Author:** ![lore6673](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lore6673](https://discuss.elastic.co/u/lore6673)\
**Post date:** [October 27, 2015, 6:04am UTC](https://discuss.elastic.co/t/import-table-with-compound-key/32979/3 "2015-10-27T06:04:58Z")

</div>

In my query there are the id and language\_id as columns of my table.

---

<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:** [October 27, 2015, 6:08am UTC](https://discuss.elastic.co/t/import-table-with-compound-key/32979/4 "2015-10-27T06:08:18Z")

</div>

Ok, and where do you want to put the language ID specifically

---

<div class="post-metadata">

**Author:** ![lore6673](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lore6673](https://discuss.elastic.co/u/lore6673)\
**Post date:** [October 27, 2015, 9:42am UTC](https://discuss.elastic.co/t/import-table-with-compound-key/32979/5 "2015-10-27T09:42:32Z")

</div>

Here an example:

Oracle table:  
product\_id, language\_id, desc  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/1/1812fa3f67f273c9fca79cd2a70a4787aaa5274d.png)

I want to import into ES the records as 3 new documents. If I use just the id as document\_id, logstash update the document with the last occurrency and I can find just the description with language\_id uken.

Lorenzo

---

<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:25am UTC](https://discuss.elastic.co/t/import-table-with-compound-key/32979/6 "2017-07-06T05:25:16Z")

</div>

Closed on July 6, 2017, 5:25am UTC


