在Elasticsearch中,我有以下数据:
"hits": [
{
"_index": "traffic",
"_type": "entry",
"_id": "922",
"_score": 1,
"_source": {
"Intensity": 0,
"tId": "9"
}
},
{
"_index": "traffic",
"_type": "entry",
"_id": "2812",
"_score": 1,
"_source": {
"Intensity": 0,
"tId": "28"
}
}
如何将等于
Intensity
的tId
设置为等于5的28
?我应该写哪个更新查询?
最佳答案
tId = 28的 _id 是 2812 。所以:
POST traffic/entry/2812/_update
{
"doc" : {
"Intensity" : 5
}
}
资料来源:Elasticsearch Reference Documentation
关于elasticsearch - 如何更新Elasticsearch索引中的特定字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46846304/