# How to re-index a jdbc entity based on timestamp

**URL:** <https://discuss.elastic.co/t/how-to-re-index-a-jdbc-entity-based-on-timestamp/97431>\
**Category:** Logstash\
**Created:** [August 17, 2017, 1:47pm UTC](https://discuss.elastic.co/t/how-to-re-index-a-jdbc-entity-based-on-timestamp/97431 "2017-08-17T13:47:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Parayil](https://avatars.discourse-cdn.com/v4/letter/t/cab0a1/32.png) [@Thomas\_Parayil](https://discuss.elastic.co/u/Thomas_Parayil)\
**Post date:** [August 17, 2017, 1:47pm UTC](https://discuss.elastic.co/t/how-to-re-index-a-jdbc-entity-based-on-timestamp/97431/1 "2017-08-17T13:47:23Z")

</div>

Hi,

I'm trying to do an **incremental update** of the index after every scheduled index.  
How to generate a metadata file which will contain the **lastexecutiondate** (timestamp) and then re-use that value for incremental update.

input {  
jdbc {  
last\_run\_metadata\_path =\> "meta.json"  
jdbc\_connection\_string =\> "jdbc:oracle:thin:/@::"  
jdbc\_user =\> "user"  
jdbc\_password =\> "passwd"  
jdbc\_validate\_connection =\> true  
jdbc\_driver\_library =\> "/scratch/Logstash/ojdbc8.jar"  
jdbc\_driver\_class =\> "Java::oracle.jdbc.driver.OracleDriver"

## This is where i'm confused

statement =\> "SELECT ID from projects where last\_update\_date \> ?"  
parameters =\> {"timestamp" =\> "$metrics.lastexecutionstart"}  
}  
}  
output {  
elasticsearch {  
index =\> "cdrm"  
document\_type =\> "projects"  
document\_id =\> "%{project\_id}"  
hosts =\> ["localhost:9200"]  
}  
stdout { codec =\> json }  
}

Thanks  
Thomas

---

<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:** [September 14, 2017, 1:47pm UTC](https://discuss.elastic.co/t/how-to-re-index-a-jdbc-entity-based-on-timestamp/97431/2 "2017-09-14T13:47:33Z")

</div>

Closed on September 14, 2017, 1:47pm UTC

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