简体   繁体   English

如何从elasticsearch检索旧版本文档?

[英]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.

相关问题 Elasticsearch 过去版本文件 - Elasticsearch past version document 集群中的节点如何在ElasticSearch中进行通信,以及我们如何决定应在哪个节点中存储文档以及以后从哪里检索文档? - How nodes in cluster communicate in ElasticSearch and also how we decide in which node we should store document and later from where to retrieve? ElasticSearch:如何更新现有索引中的文档类型 - ElasticSearch: How to update a document type in an existing index 如何在Golang的Elasticsearch文档(已索引)中搜索字符串? - How to search a string in the elasticsearch document(indexed) in golang? Elasticsearch-如何从日期时间字段中提取日期并将其作为新字段添加到每个文档中 - Elasticsearch - how to extract date from date time field and add it to each document as a new field 如何在PostgreSQL中存储和查询同一文档的版本? - How to store and query version of same document in PostgreSQL? 如何在[Javascript + ElasticSearch]中带有条件的文档建立索引 - How to index a document with a condition inside [Javascript+ElasticSearch] 创建一个JSON文档elasticsearch - Create a JSON document, elasticsearch 如何使用NEST更新ElasticSearch索引内的现有文档? - How to update an existing document inside an ElasticSearch index using NEST? 我如何知道创建索引的 Elasticsearch 版本? - How can I know the Elasticsearch version an index was created in?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM