I'm using elasticsearch 5.1.1 with logstash for using mysql.
logstash.conf
input {
jdbc {
jdbc_driver_library => "lib/mysql-connector-java-5.1.33.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/test"
jdbc_user => "test"
jdbc_password => "test"
statement => "SELECT * FROM test"
schedule => "* * * * *"
type => "test"
}
jdbc {
jdbc_driver_library => "lib/mysql-connector-java-5.1.33.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/test"
jdbc_user => "test"
jdbc_password => "test"
statement => "SELECT * FROM test2"
schedule => "* * * * *"
type => "test2"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "test"
document_type => "%{type}"
document_id => "%{test_id}"
}
}
$ bin/logstash -f logstash.conf
It worked.
But I want to add this options.
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"korean": {
"type": "custom",
"tokenizer": "seunjeon_default_tokenizer"
}
},
"tokenizer": {
"seunjeon_default_tokenizer": {
"type": "seunjeon_tokenizer",
"index_eojeol": false,
"user_words": [
"abc"
]
}
}
}
}
}
}
How to add this option to conf file?
And If I add more tables which have different column, how to set document_id dynamically?