# Logstash does not update document

**URL:** <https://discuss.elastic.co/t/logstash-does-not-update-document/337777>\
**Category:** Logstash\
**Created:** [July 6, 2023, 10:24am UTC](https://discuss.elastic.co/t/logstash-does-not-update-document/337777 "2023-07-06T10:24:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehmetalix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mehmetalix/32/100571_2.png) [@mehmetalix](https://discuss.elastic.co/u/mehmetalix)\
**Post date:** [July 6, 2023, 10:24am UTC](https://discuss.elastic.co/t/logstash-does-not-update-document/337777/1 "2023-07-06T10:24:23Z")

</div>

Hi,

I have a problem with data update in logstash.  
I need to update specific field in some document according to sql data.  
My data is looking like this:

testid-field1-field2-field3-testtype-time  
1-1-1-1-1-2023/05  
1-null-null-2-2-2023/06  
1-null-null-3-2-2023/07  
Time field is an example (It is normal in my sql data)  
I need to have it as  
1-1-1-3-2  
in the end.

I have a logstash configuration like this:

```auto
input {
    jdbc {
        jdbc_driver_library => "${LOGSTASH_JDBC_DRIVER_JAR_LOCATION}"
        jdbc_driver_class => "${LOGSTASH_JDBC_DRIVER}"
        jdbc_connection_string => "${LOGSTASH_JDBC_URL}"
        jdbc_user => "${LOGSTASH_JDBC_USERNAME}"
        jdbc_password => "${LOGSTASH_JDBC_PASSWORD}"
        schedule => "/10 * * * * *"
        statement => "select * from testdata where time
        > :sql_last_value ORDER BY time NULLS LAST"
        use_column_value => true
        tracking_column => "time"
        tracking_column_type => "timestamp"
        jdbc_paging_enabled => true
        jdbc_paging_mode => "explicit"
        jdbc_page_size => 100000
        clean_run => true
    }
}

filter {
    if [testtype] == 2 {mutate {remove_field => ["field1", "field2"]}}
}

output {
    elasticsearch {
        hosts => ["${LOGSTASH_ELASTICSEARCH_HOST}"]
        user => "${ELASTIC_USER}"
        password => "${ELASTIC_PASSWORD}"
        index => "testdata"
        document_id => "%{testid}"
        doc_as_upsert => true
        action => "update"
        retry_initial_interval => 10
        retry_max_interval => 300
        retry_on_conflict => 25
    }
    stdout { codec => json_lines }
}

```

But with this configuration elasticsearch store it as first row of data which is  
1-1-1-1-1

What do I do wrong?

---

<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:** [August 3, 2023, 10:24am UTC](https://discuss.elastic.co/t/logstash-does-not-update-document/337777/2 "2023-08-03T10:24:39Z")

</div>

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