# Trying to pull only changed records in elastic

**URL:** <https://discuss.elastic.co/t/trying-to-pull-only-changed-records-in-elastic/150372>\
**Category:** Logstash\
**Created:** [September 28, 2018, 4:54pm UTC](https://discuss.elastic.co/t/trying-to-pull-only-changed-records-in-elastic/150372 "2018-09-28T16:54:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitu\_gupta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nitu_gupta/32/106639_2.png) [@nitu\_gupta](https://discuss.elastic.co/u/nitu_gupta)\
**Post date:** [September 28, 2018, 4:54pm UTC](https://discuss.elastic.co/t/trying-to-pull-only-changed-records-in-elastic/150372/1 "2018-09-28T16:54:25Z")

</div>

logstash version:6.4.1  
i am trying to pull records from mysql to elastic.  
the onetime operation is successful.However, i want that afterwards, only changed or new records should be inserted instead of inserting all again.  
// i am using following conf file. with this file all records are inserted again. Also sql\_last\_value in .logstash.jdbc.last.run is --- 0

input {  
jdbc {  
jdbc\_driver\_library =\> "/home/nitu/learnmysql/mysql-connector-java-5.1.47.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
jdbc\_connection\_string =\> "jdbc:mysql://127.0.0.1:3307/trgdb"  
jdbc\_user =\> "root"  
jdbc\_password =\> "password"

# or jdbc\_password\_filepath =\> "/path/to/my/password\_file"

# schedule =\> "\* \* \* \* \*"

```
statement => "SELECT * from studentlist where datamodified >:sql_last_value"
# statement => "SELECT * from studentlist "
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
use_column_value => true
tracking_column => datamodified
# tracking_column_type => "timestamp"
schedule => "* * * * *"

```

}  
}

output {  
stdout {  
codec =\> rubydebug  
}  
elasticsearch {  
hosts =\> "localhost:9200"  
index =\> "trgelasticindex"  
document\_id =\> "%{studentid}"  
}  
}

---

<div class="post-metadata">

**Author:** ![nitu\_gupta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nitu_gupta/32/106639_2.png) [@nitu\_gupta](https://discuss.elastic.co/u/nitu_gupta)\
**Post date:** [September 29, 2018, 6:27am UTC](https://discuss.elastic.co/t/trying-to-pull-only-changed-records-in-elastic/150372/2 "2018-09-29T06:27:43Z")

</div>

any update ?

---

<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 27, 2018, 6:27am UTC](https://discuss.elastic.co/t/trying-to-pull-only-changed-records-in-elastic/150372/3 "2018-10-27T06:27:55Z")

</div>

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