# Versioning with version\_type external

**URL:** <https://discuss.elastic.co/t/versioning-with-version-type-external/98446>\
**Category:** Logstash\
**Created:** [August 26, 2017, 8:39am UTC](https://discuss.elastic.co/t/versioning-with-version-type-external/98446 "2017-08-26T08:39:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lukas\_Tilch](https://avatars.discourse-cdn.com/v4/letter/l/e495f1/32.png) [@Lukas\_Tilch](https://discuss.elastic.co/u/Lukas_Tilch)\
**Post date:** [August 26, 2017, 8:39am UTC](https://discuss.elastic.co/t/versioning-with-version-type-external/98446/1 "2017-08-26T08:39:55Z")

</div>

Hello,

I want to use an external versioning system with logstash so a document only gets updated when the version is GTE  
The config looks like this

> output {  
> stdout {  
> codec =\> rubydebug  
> }  
> elasticsearch {  
> hosts =\> ["hcd1515g:9200"]  
> action =\> "update"  
> doc\_as\_upsert =\> "true"  
> document\_id =\> "%{name}"  
> document\_type =\> "mks-files"  
> index =\> "logstash-mks-file"  
> version =\> "%{Rev}"  
> version\_type =\> "external\_gte"  
> }  
> }

But i get this error as soon as version\_type is set

> [2017-08-26T10:33:59,958][ERROR][logstash.pipeline] Error registering plugin {:plugin=\>"#\<LogStash::OutputDelega  
> tor:0x7dc93e01 @namespaced\_metric=#\<LogStash::Instrument::NamespacedMetric:0x730edfc8 @metric=#\<LogStash::Instrument::Me  
> tric:0x77315571 @collector=#\<LogStash::Instrument::Collector:0x3233d5f3 @agent=nil, @metric\_store=#\<LogStash::Instrument  
> ::MetricStore:0x6bedc82 @store=#\<Concurrent:🗺0x000000000627a8 entries=2 default\_proc=nil\>, @structured\_lookup\_mutex=  
> #Mutex:0x34ba302, @fast\_lookup=#\<Concurrent:🗺0x000000000627ac entries=57 default\_proc=nil\>\>\>\>, @namespace\_name=[:s  
> tats, :pipelines, :main, :plugins, :outputs, :"73aba349a5abf8e2465258fc520b2bb30369f619-10"]\>, @metric=#\<LogStash::Ins  
> trument::NamespacedMetric:0x521c2abc @metric=#\<LogStash::Instrument::Metric:0x77315571 @collector=#\<LogStash::Instrument  
> ::Collector:0x3233d5f3 @agent=nil, @metric\_store=#\<LogStash::Instrument::MetricStore:0x6bedc82 @store=#\<Concurrent:🗺  
> 0x000000000627a8 entries=2 default\_proc=nil\>, @structured\_lookup\_mutex=#Mutex:0x34ba302, @fast\_lookup=#\<Concurrent::Ma  
> p:0x000000000627ac entries=57 default\_proc=nil\>\>\>\>, @namespace\_name=[:stats, :pipelines, :main, :plugins, :outputs]\>, @l  
> ogger=#\<LogStash::Logging::Logger:0x7cbb5246 @logger=#Java::OrgApacheLoggingLog4jCore::Logger:0x68e14285\>, @strategy=#  
> \<LogStash::OutputDelegatorStrategies::Shared:0x56529409 @output=\<LogStash::Outputs::Elasticsearch hosts=\>[//hcd1515g:920  
> 0], action=\>"update", doc\_as\_upsert=\>true, document\_id=\>"%{name}", document\_type=\>"mks-files", index=\>"logstash-m  
> ks-file", version=\>"%{Rev}", version\_type=\>"external", id=\>"73aba349a5abf8e2465258fc520b2bb30369f619-10", enable\_  
> metric=\>true, codec=\>\<LogStash::Codecs::Plain id=\>"plain\_497afcb1-b4ab-4206-8f2c-12366e3b3e66", enable\_metric=\>true, c  
> harset=\>"UTF-8"\>, workers=\>1, manage\_template=\>true, template\_name=\>"logstash", template\_overwrite=\>false, idle\_flus  
> h\_time=\>1, script\_type=\>"inline", script\_lang=\>"painless", script\_var\_name=\>"event", scripted\_upsert=\>false, retry  
> \_initial\_interval=\>2, retry\_max\_interval=\>64, retry\_on\_conflict=\>1, ssl\_certificate\_verification=\>true, sniffing=\>false,  
> sniffing\_delay=\>5, timeout=\>60, pool\_max=\>1000, pool\_max\_per\_route=\>100, resurrect\_delay=\>5, validate\_after\_inactivity=
> 
> > 10000, http\_compression=\>false\>\>, @id="73aba349a5abf8e2465258fc520b2bb30369f619-10", @metric\_events=#\<LogStash::Instr  
> > ument::NamespacedMetric:0x4146b35c @metric=#\<LogStash::Instrument::Metric:0x77315571 @collector=#\<LogStash::Instrument::  
> > Collector:0x3233d5f3 @agent=nil, @metric\_store=#\<LogStash::Instrument::MetricStore:0x6bedc82 @store=#\<Concurrent:🗺0x  
> > 000000000627a8 entries=2 default\_proc=nil\>, @structured\_lookup\_mutex=#Mutex:0x34ba302, @fast\_lookup=#\<Concurrent:🗺  
> > 0x000000000627ac entries=57 default\_proc=nil\>\>\>\>, @namespace\_name=[:stats, :pipelines, :main, :plugins, :outputs, :"73a  
> > ba349a5abf8e2465258fc520b2bb30369f619-10", :events]\>, @output\_class=LogStash::Outputs::Elasticsearch\>", :error=\>"Extern  
> > al versioning is not supported by the update action. See [Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current)  
> > /docs-update.html."}  
> > [2017-08-26T10:33:59,973][ERROR][logstash.agent] Pipeline aborted due to error {:exception=\>#\<LogStash::Confi  
> > gurationError: External versioning is not supported by the update action. See [https://www.elastic.co/guide/en/elasticsea](https://www.elastic.co/guide/en/elasticsea)  
> > rch/reference/current/docs-update.html.\>, :backtrace=\>["C:/contiio\_stack/logstash/vendor/bundle/jruby/1.9/gems/logstash-  
> > output-elasticsearch-7.3.2-java/lib/logstash/outputs/elasticsearch/http\_client\_builder.rb:82:in `build'", "C:/contiio_st ack/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-7.3.2-java/lib/logstash/outputs/elasticsearch.rb :230:in `build\_client'", "C:/contiio\_stack/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-7.3.2-jav  
> > a/lib/logstash/outputs/elasticsearch/common.rb:28:in `register'", "C:/contiio_stack/logstash/logstash-core/lib/logstash/ output_delegator_strategies/shared.rb:9:in `register'", "C:/contiio\_stack/logstash/logstash-core/lib/logstash/output\_del  
> > egator.rb:41:in `register'", "C:/contiio_stack/logstash/logstash-core/lib/logstash/pipeline.rb:268:in `register\_plugin'"  
> > , "C:/contiio\_stack/logstash/logstash-core/lib/logstash/pipeline.rb:279:in `register_plugins'", "org/jruby/RubyArray.jav a:1613:in `each'", "C:/contiio\_stack/logstash/logstash-core/lib/logstash/pipeline.rb:279:in `register_plugins'", "C:/con tiio_stack/logstash/logstash-core/lib/logstash/pipeline.rb:288:in `start\_workers'", "C:/contiio\_stack/logstash/logstash-  
> > core/lib/logstash/pipeline.rb:214:in `run'", "C:/contiio_stack/logstash/logstash-core/lib/logstash/agent.rb:398:in `star  
> > t\_pipeline'"]}  
> > [2017-08-26T10:34:00,036][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}  
> > [2017-08-26T10:34:03,000][WARN][logstash.agent] stopping pipeline {:id=\>"main"}

---

<div class="post-metadata">

**Author:** ![paz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paz/32/28003_2.png) [@paz](https://discuss.elastic.co/u/paz)\
**Post date:** [August 28, 2017, 9:39am UTC](https://discuss.elastic.co/t/versioning-with-version-type-external/98446/2 "2017-08-28T09:39:27Z")

</div>

This is your problem right here

> Pipeline aborted due to error {:exception=\>#\<LogStash::Confi  
> gurationError: External versioning is not supported by the update action.

Try changing your output plugin action to _index_, it should start up normally afterwards.

Edit: Changed suggested action to proper one, was a typo

---

<div class="post-metadata">

**Author:** ![Lukas\_Tilch](https://avatars.discourse-cdn.com/v4/letter/l/e495f1/32.png) [@Lukas\_Tilch](https://discuss.elastic.co/u/Lukas_Tilch)\
**Post date:** [August 28, 2017, 1:11pm UTC](https://discuss.elastic.co/t/versioning-with-version-type-external/98446/3 "2017-08-28T13:11:05Z")

</div>

Thanks for yout time, with insert i got this error

> Action 'insert' is invalid! Pick one of ["index", "delete", "create", "update"]`

it seems to be working with `"index"`  
it indexes the documents, but the `@version` is not set with  
`version => "%{Rev}"`

i just want a conditional update, that the document only gets indext, if its Version or Rev is GTE to the document in elasticsearch.

Edit:  
It works now thanks.

`@version` isn't the right field it's `_version` it works now as intended

---

<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 25, 2017, 1:11pm UTC](https://discuss.elastic.co/t/versioning-with-version-type-external/98446/4 "2017-09-25T13:11:15Z")

</div>

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