# Logstash/Elasticsearch process overwriting doc version each time?

**URL:** <https://discuss.elastic.co/t/logstash-elasticsearch-process-overwriting-doc-version-each-time/69317>\
**Category:** Logstash\
**Created:** [December 16, 2016, 8:06pm UTC](https://discuss.elastic.co/t/logstash-elasticsearch-process-overwriting-doc-version-each-time/69317 "2016-12-16T20:06:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![west415](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@west415](https://discuss.elastic.co/u/west415)\
**Post date:** [December 16, 2016, 8:06pm UTC](https://discuss.elastic.co/t/logstash-elasticsearch-process-overwriting-doc-version-each-time/69317/1 "2016-12-16T20:06:36Z")

</div>

HI,

I'm very new to the elastic world, but I was able to get logstash setup and successfully moving data from a SQL Server into my index in elasticsearch using the JDBC driver setup. As of now, my ETL process is currently scheduled to run every minute as my site will be pretty transactional in nature.

When I query (via REST) my elasticsearch index by the document Id ("\_\_id"), I can see the "version" key is incrementing by 1 every time . I'm assuming what's happening is the document is being overwritten despite no changes to the data.

Is there a way I can only have the "\_\_version" key increment by 1 if the record/document has actually changed?

Here is the way my output config file looks, not sure if I need to modify this in any way to achieve my result.

```
output {
    elasticsearch { 
     action => "update"
     hosts => ["localhost:9200"] 
     index => "company"
     document_type => "article"
     document_id => "%{article_id}"
     doc_as_upsert => true
  }
   stdout { codec => json_lines }
}
```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 17, 2016, 12:09am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-process-overwriting-doc-version-each-time/69317/2 "2016-12-17T00:09:37Z")

</div>

No, there's not. It's a simplistic retrieve and index.

---

<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:** [January 14, 2017, 12:10am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-process-overwriting-doc-version-each-time/69317/3 "2017-01-14T00:10:26Z")

</div>

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