How to get old version document from elasticsearch?

Is there a way to get the old version of the same document in elasticsearch? Suppose I have indexed 1 document in ES:

put class/student/1
{
    "marks":95
}

      

Later I want to update it to:

put class/student/1
    {
        "marks":96
    }

      

As soon as I index the updated checkmarks, I see that '_version' is updated as 2. Is there a way to query ES and get _version = 1 document?

+3


source to share


2 answers


It's impossible. Although there is a version number associated with each create / index / update / delete operation, this version number cannot be used to retrieve an old version of a document. Rather, it can be used to prevent dirty reads during read / manipulation / indexing operations.



+7


source


you can use



localhost:9200/<<index>>/<<type>>/<<doc_id>>?version=<<Version Number>>

-five


source







All Articles