Hi All,
I am trying to sync data from mysql to Elasticsearch using logstash 7.10.2..Elasticsearch version I am using is : 7.10.2. When I am executing template using logstash , it is not creating in Elasticsearch so eventually it is inserting it's own mapping based on the values. it is not honoring my template. Please find my logstash config file below.
input {
jdbc {
jdbc_driver_library => "<path>\mysql-connector-java-8.0.13.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://xxx.amazonaws.com:3306/test?sslMode=DISABLED"
jdbc_user => "<user>"
jdbc_password => "<pwd>"
jdbc_paging_enabled => true
statement => "SELECT fileDataFlag FROM test_data"
}
}
filter {
mutate {
remove_field => ["id", "@version","@timestamp"]
}
}
output {
elasticsearch {
hosts => "<ES Host>"
index => "test_data_index"
manage_template => true
template => "<path>\test2.json"
template_name => "test_template"
template_overwrite => true
ilm_enabled => false
}
}
my template:
{
"index_patterns": [
"test_data_*"
],
"template": {
"settings": {
"number_of_shards": 5
},
"mappings": {
"_doc":{
"properties": {
"fileDataFlag": {
"type": "keyword"
}
}
}
}
}
}
My issue is what ever I am fetching from database the same values it should push to ES. To achieve this I am taking help of logstash template.. when I push data it is inserting his own mapping and creating the index . please help me.