Satish
Satish

Reputation: 2728

How to retrieve older version document from elasticsearch?

Is there any way to retrieve older version of same document in elasticsearch? Suppose I've indexed 1 document in ES:

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

Later point of time I want to update it to:

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

As soon as I index the updated marks, I see '_version' getting updated as 2. Is there any way to query ES and get _version=1 document?

Upvotes: 9

Views: 10438

Answers (1)

Vineeth Mohan
Vineeth Mohan

Reputation: 19253

This is not possible. Even though there is a version number associated with each create/index/update/delete operation, this version number can't be used to retrieve the older version of the document. Rather it can be used to prevent dirty reads while read/manipulate/index operations

Upvotes: 13

Related Questions