[英]How to retrieve older version document from elasticsearch?
Is there any way to retrieve older version of same document in elasticsearch?有没有办法在 elasticsearch 中检索旧版本的相同文档? Suppose I've indexed 1 document in ES:
假设我在 ES 中索引了 1 个文档:
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?一旦我索引更新的标记,我就会看到“_version”被更新为 2。有没有办法查询 ES 并获取 _version=1 文档?
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
相反,它可用于在读取/操作/索引操作时防止脏读
您可以使用
localhost:9200/<<index>>/<<type>>/<<doc_id>>?version=<<Version Number>>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.