I would like to import data from my MySQL database to elasticsearch with logstash. I am already able to import a custom query result, but I am missing the point where I can define the mapping/settings of the index being created by logstash. Also, I have no idea how to import data with one to many relations.
This is my logstash.conf so far:
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost:3306/shop"
jdbc_user => "root"
jdbc_password => ""
jdbc_driver_library => "C:\Users\curUser\Desktop\mysql-connector-java-5.1.42\mysql-connector-java-5.1.42-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
statement => "SELECT * FROM variants var"
}
}
output {
elasticsearch {
hosts => "localhost:9200"
index => "search"
document_type => "variants"
document_id => "%{id}"
}
}
Note: I want to use logstash just to import data to elasticsearch. This is for an online shop, so I have to use some analyzers on the fields