参考链接:https://stackoverflow.com/questions/39016589/how-to-get-the-docs-version-field
记录一下:
GET doc_detail/_search?version=true
{
"query": {
"terms": {
"_id": [
"1",
"2"
]
}
}
}
需要加一个 version=true 的参数,返回结果中就会返回 version 。文章来源:https://www.toymoban.com/news/detail-564020.html
返回结果:文章来源地址https://www.toymoban.com/news/detail-564020.html
{
"took" : 21,
"timed_out" : false,
"_shards" : {
"total" : 3,
"successful" : 3,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "doc_detail",
"_type" : "_doc",
"_id" : "1",
"_version" : 18,
"_score" : 1.0,
"_source" : {
"author" : "shfq",
"content" : "content1",
"id" : 1
}
}
]
}
}
到了这里,关于怎样查询 elasticsearch es doc 文档中的 version 版本号的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!