Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 436
Satish Madiwal Avatar asked Dec 25 '14 13:12

Satish Madiwal


1 Answers

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

like image 191
Vineeth Mohan Avatar answered Sep 20 '22 03:09

Vineeth Mohan