Import table with compound key

(Lorenzo) #1

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 => ""

How can I set the output section in order to add the language_id?


(Mark Walkom) #2

Where is the language_id defined?

(Lorenzo) #3

In my query there are the id and language_id as columns of my table.

(Mark Walkom) #4

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

(Lorenzo) #5

Here an example:

Oracle table:
product_id, language_id, desc

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.


(system) #6