# Keep DB extracts up to date

**URL:** https://discuss.elastic.co/t/keep-db-extracts-up-to-date/137433
**Category:** Logstash
**Created:** [June 26, 2018, 1:06pm UTC](https://discuss.elastic.co/t/keep-db-extracts-up-to-date/137433 "2018-06-26T13:06:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hgpit](https://avatars.discourse-cdn.com/v4/letter/h/f1d935/32.png) [@hgpit](https://discuss.elastic.co/u/hgpit)
#### Post date: [June 26, 2018, 1:06pm UTC](https://discuss.elastic.co/t/keep-db-extracts-up-to-date/137433/1 "2018-06-26T13:06:38Z")

</div>

Hi,

Totally new to Logstash (and ELK in general). We've set everything up following the many online guides to extract product information from our DB and be able to query it in ES. But if the info changes in our DB, we need Logstash/ES to reflect the changes as soon as possible.

We created a logstash config as follows:

"  
input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:mysql://svr-h003671.hayley-group.local:3306/masdata"  
jdbc\_user =\> "elastic"  
jdbc\_password =\> "xxxxxx"  
jdbc\_driver\_library =\> "/usr/share/java/mysql-connector-java.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
jdbc\_paging\_enabled =\> "true"  
# jdbc\_page\_size =\> "50000"  
jdbc\_fetch\_size =\> "50000"  
schedule =\> "5 \* \* \* \*"  
statement =\> "SELECT item\_code,item\_description,brand\_name FROM tbl\_products p LEFT JOIN tbl\_brands b ON b.brand\_id = p.brand\_id"  
tags =\> "idx-md\_descriptions"  
}  
}  
output {  
if "idx-md\_descriptions" in [tags] {  
elasticsearch {  
hosts =\> ["10.11.2.11:9200"]  
index =\> "idx-md\_descriptions"  
document\_id =\> "%{item\_code}"  
}  
}  
}  
"

What configuration change do I need to tell it to refresh the existing data (or check for changes on a 'per row' level)?

Thank you.

---

<div class="post-metadata">

### Author: ![hgpit](https://avatars.discourse-cdn.com/v4/letter/h/f1d935/32.png) [@hgpit](https://discuss.elastic.co/u/hgpit)
#### Post date: [June 26, 2018, 3:02pm UTC](https://discuss.elastic.co/t/keep-db-extracts-up-to-date/137433/2 "2018-06-26T15:02:12Z")

</div>

Nevermind, it looks like it does actually update existing records automatically. Despite there being posts online discussing ways around this behaviour!

---

<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: [July 24, 2018, 3:02pm UTC](https://discuss.elastic.co/t/keep-db-extracts-up-to-date/137433/3 "2018-07-24T15:02:14Z")

</div>

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