Hi,
I want to reset the version value of a document I read about in this blog on how to:
and at this end it's written:
For most practical use cases, 60 second is enough for the system to catch up and for delayed requests to arrive. If this doesn't work for you, you can change it by setting
index.gc_deletes
on your index to some other time span.
So if I wait ~ 60 sec after I delete my document the version is set to zero and if I need to reduce this time I need to set gc_deletes to lower value.
I don't know the side effect of reducing the the gc value. So I wonder if there's a dynamic way to call it, like refresh or flush.
Otherwise need to wait one minute, which can be ok for my case as I need to reset the version only in some really rare case.
Here a test case for those who want to reproduce (elastic 6.x):
#Clean all and create a new document
DELETE my_index
PUT my_index/doc/1
{}
#get the version, must return 1
GET my_index/doc/_search
{
"version": true
}
#run again several time to increment the version
PUT my_index/doc/1
{}
Then get (see previous command) the version increase
#delete the document
DELETE my_index/doc/1
#don't wait run one put command then get command and see the version increase, the previous version is kept.
#delete the document and wait 1 minute
#then run put 1 time and get command, the version will be 1
Thanks for any help!