Why newly created document has version 2?

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.

can u guys help to answer?

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

Wait for someone to pick your question.

Can you reproduce it with a curl script please?

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

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.

That's why

Can you reproduce it with a curl script please?

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

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

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

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