[英]elasticsearch _update_by_query doesn't work
Elasticsearch: 2.3.3 Elasticsearch:2.3.3
Below are the sequence of my commands 以下是我的命令顺序
Index a doc 索引文件
POST test-index/doc
{
"name":"sahas"
}
Retrieve the doc 检索文件
GET test-index/_search
{
"query": {
"match": {
"name": "sahas"
}
}
}
Update the doc 更新文件
POST test-index/doc/_update_by_query?name=subramanian
{
"query": {
"match": {
"name": "sahas"
}
}
}
Result of update 更新结果
{
"took": 9,
"timed_out": false,
"total": 1,
"updated": 1,
"batches": 1,
"version_conflicts": 0,
"noops": 0,
"retries": 0,
"failures": []
}
But when I query the document again, its not updated. 但是当我再次查询文档时,它没有更新。 Is there anyway to figure out why update is not working here?
无论如何,有没有找出为什么更新在这里不起作用? am i missing something silly?
我是不是很傻吗?
Appreciate any inputs.. 感谢任何输入。
Your update by query didn't modify the source. 您通过查询进行的更新未修改源。 You need to include a script in order to do so:
您需要包括一个脚本才能这样做:
POST test-index/doc/_update_by_query
{
"query": {
"match": {
"name": "sahas"
}
},
"script": {
"inline": "ctx._source.name = 'subramanian'"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.