I am trying to update an existing data in my Elasticsearch Index. Im using the below Logstash configuration:
input {
jdbc {
jdbc_connection_string => "jdbc:sqlserver://DB01:1433;databasename=mydb;integratedSecurity=true"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_driver_library => "C:\Program Files\sqljdbc_6.2\enu\mssql-jdbc-6.2.2.jre8.jar"
jdbc_user => nil
statement => "SELECT * from data WHERE updated_on > :sql_last_value ORDER BY updated_on"
use_column_value =>true
tracking_column =>updated_on
tracking_column_type => "timestamp"
}
}
output {
elasticsearch { hosts => ["localhost:9200"]
index => "datau"
action=>update
document_id => "%{id}"
doc_as_upsert =>true}
stdout { codec => rubydebug }
}
When i run this, any updation on the existing row is created as a new row. I want to to get updated in the existing row.
How do i do it? Please help me.