Get only the last record

Hello ,

Im using logstash and jdbc driver to import my data to ES.

but when i look for data using ,i only find the last record?

my conf:

input {
jdbc {
jdbc_connection_string => "jdbc:sqlserver:myconnexion;databaseName=mydb"
jdbc_user => "myusername"
jdbc_password => "mypass"
jdbc_driver_library => "D:\ES\sqljdbc42.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
statement => "sql statement"

}
}
filter {

}
output {
stdout { codec => rubydebug }
elasticsearch {
#protocol => http
index => "myindex"
document_type => "mytype"
document_id => "%{myid}"
hosts => "localhost"

    }

}

Does the SQL query return a column named myid or are you creating that field elsewhere? It probably doesn't so all documents get the same document id, overwriting each other all the time.

Thank you for your answer!

yes my sql query return the named column

Please show an example document from Elasticsearch or your stdout { codec => rubydebug } output.

assuming that myid is :BusinessEntityID

Field names are case-sensitive (BusinessEntityID vs. businessentityid).

Thank you so much ,for your help !

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.