Why newly created document has version 2?

(Makeyang) #1

I used upsert API and print UpdateResponse

StringBuilder sb = new StringBuilder();

and I found below resposne:


so my question is: why created doc has _version 2?
is it by design or is it a bug?
if it is by design, can give more description or share some useful info please.

(Makeyang) #2

can u guys help to answer?

(David Pilato) #3

Please don't ping people like this. This is so annoying.

Wait for someone to pick your question.

(David Pilato) #4

Can you reproduce it with a curl script please?

(Colin Goodheart-Smithe) #5

See this page in the definitive guide for details on versioning: https://www.elastic.co/guide/en/elasticsearch/guide/master/optimistic-concurrency-control.html#optimistic-concurrency-control

(Makeyang) #6

are u saying that I upsert data with giving certain version number? if so, I am telling u that I am not. I am not giving any version number when I upsert document. most of the docs' version is 1 when create=true, only a few with 2.

(David Pilato) #7

That's why

Can you reproduce it with a curl script please?

would help a lot to see if it's actually an issue...

(Makeyang) #8

I create a script and all response turns out to be "_version":1

(David Pilato) #9

It means you are may be doing something wrong in the other code or you did change a document which was already existing...

(Makeyang) #10

you are damn right.but what exactly something wrong is? isn't server should response for this some way?

(system) #11