# Upsert logstash output - Version not upcounting

**URL:** <https://discuss.elastic.co/t/upsert-logstash-output-version-not-upcounting/78616>\
**Category:** Elasticsearch\
**Created:** [March 14, 2017, 11:01pm UTC](https://discuss.elastic.co/t/upsert-logstash-output-version-not-upcounting/78616 "2017-03-14T23:01:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![whyapenny](https://avatars.discourse-cdn.com/v4/letter/w/90db22/32.png) [@whyapenny](https://discuss.elastic.co/u/whyapenny)\
**Post date:** [March 14, 2017, 11:01pm UTC](https://discuss.elastic.co/t/upsert-logstash-output-version-not-upcounting/78616/1 "2017-03-14T23:01:50Z")

</div>

Posted to logstash and have not had much luck with help. Hoping posting here may get somewhere. Idea is i have a document i want updated or inserted, existence based on a unique doc\_id. I have it working where it updates, however it does not update the @version field.

I was under the impression this was functionality of the upsert api? I dont think it would be too difficult to write logstash code to do this, but if it is built into elasticsearch that would be the proper route:

Finallly, now the if statement is working, however the update feature into elasticsearch is still not working.

output{  
if [EndpointValue] != [previousValue] {  
elasticsearch {  
hosts =\> ["localhost"]  
index =\> "esb-endpoints"  
action =\> "update"  
doc\_as\_upsert =\> "true"  
document\_id =\> "%{Doc\_id}"  
}  
}

my hopes are that the update would modify the field which has changed, as well a uptick the version number. Do i need to add the logic into logstash manually to pull @version and update it with a +1?

---

<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:** [April 11, 2017, 11:01pm UTC](https://discuss.elastic.co/t/upsert-logstash-output-version-not-upcounting/78616/2 "2017-04-11T23:01:51Z")

</div>

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