# Building ETL form ES to csv, last run date needed

**URL:** <https://discuss.elastic.co/t/building-etl-form-es-to-csv-last-run-date-needed/153841>\
**Category:** Logstash\
**Created:** [October 24, 2018, 3:32pm UTC](https://discuss.elastic.co/t/building-etl-form-es-to-csv-last-run-date-needed/153841 "2018-10-24T15:32:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_1982](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Martin\_1982](https://discuss.elastic.co/u/Martin_1982)\
**Post date:** [October 24, 2018, 3:32pm UTC](https://discuss.elastic.co/t/building-etl-form-es-to-csv-last-run-date-needed/153841/1 "2018-10-24T15:32:12Z")

</div>

Hello,

im using logstash to extract data from ES to store it in csv (finally it should end up in a s3 bucket, but the output part is not so important here). I set up the following configuration:

input {  
elasticsearch {  
hosts =\> "localhost:9200"  
index =\> "trip-logs"  
docinfo =\> true  
query =\> ' {  
"\_source" : ["asset","recorded\_at\_ms", "fields.BATT"],  
"sort" : [  
{ "recorded\_at" : {"order" : "desc"}}  
],  
"size":10000,  
"query" : {  
"constant\_score" : {  
"filter" : {  
"terms" : {  
"fields.BATT" : [0, 1]  
}  
}  
}  
}  
}'  
}  
}  
output {  
csv {  
fields =\> ["asset","recorded\_at\_ms","[fields][BATT]"]  
path =\> "C:/Elasticsearch/output.csv"  
}  
}

My problem is, im really missing a last run date. I want to include it in the query to get just the new results. What i try to achieve is a more or less classic etl.

So far i could figure out that, e.g., the jdbc input and the file input plugin have a kind of last run date, but not the es input plugin.

Could anyone give me a solution or hint how to solve this problem?

Best

Martin

---

<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:** [November 21, 2018, 3:32pm UTC](https://discuss.elastic.co/t/building-etl-form-es-to-csv-last-run-date-needed/153841/2 "2018-11-21T15:32:13Z")

</div>

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