gpt4 book ai didi

elasticsearch - elasticsearch _update_by_query不起作用

转载 作者:行者123 更新时间:2023-12-02 22:58:38 24 4
gpt4 key购买 nike

Elasticsearch:2.3.3

以下是我的命令顺序

索引文件

POST test-index/doc
{
"name":"sahas"
}

检索文件
GET test-index/_search
{
"query": {
"match": {
"name": "sahas"
}
}
}

更新文件
POST test-index/doc/_update_by_query?name=subramanian
{
"query": {
"match": {
"name": "sahas"
}
}
}

更新结果
{
"took": 9,
"timed_out": false,
"total": 1,
"updated": 1,
"batches": 1,
"version_conflicts": 0,
"noops": 0,
"retries": 0,
"failures": []
}

但是当我再次查询文档时,它没有更新。
无论如何,有没有弄清楚为什么更新在这里不起作用?
我是不是很傻吗?

感谢任何输入。

最佳答案

通过查询进行的更新未修改源。您需要包括一个脚本才能这样做:

POST test-index/doc/_update_by_query
{
"query": {
"match": {
"name": "sahas"
}
},
"script": {
"inline": "ctx._source.name = 'subramanian'"
}
}

关于elasticsearch - elasticsearch _update_by_query不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42216292/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com