# Logstash to Elasticsearch - data update

**URL:** <https://discuss.elastic.co/t/logstash-to-elasticsearch-data-update/200987>\
**Category:** Logstash\
**Created:** [September 25, 2019, 7:53am UTC](https://discuss.elastic.co/t/logstash-to-elasticsearch-data-update/200987 "2019-09-25T07:53:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![katara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/katara/32/60143_2.png) [@katara](https://discuss.elastic.co/u/katara)\
**Post date:** [September 25, 2019, 7:53am UTC](https://discuss.elastic.co/t/logstash-to-elasticsearch-data-update/200987/1 "2019-09-25T07:53:17Z")

</div>

I am trying to update an existing data in my Elasticsearch Index. Im using the below Logstash configuration:

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 23, 2019, 7:53am UTC](https://discuss.elastic.co/t/logstash-to-elasticsearch-data-update/200987/2 "2019-10-23T07:53:26Z")

</div>

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