我正在尝试使用UpdateRequest
通过java api更新索引中的值,该{
"took": 2,
"timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 },
"hits": {
"total": 1,
"max_score": 0.94064164,
"hits": [
{
"_index": "ticketdump",
"_type": "event",
"_id": "AVefK2vFmf0chKzzBkzy",
"_score": 0.94064164,
"_source": {
"clientversion": "123465",
"queue": "test,test",
"vertical": "test",
"troubleshooting": "test",
"reason": "test",
"status": "test",
"ticketversion": "1132465",
"apuid": 1,
"golive": "2014-07-14",
"clientname": "test",
"message": "test",
"product": "test",
"clientid": 1,
"createddatetime": "2016-05-03 09:43:48",
"area": "test",
"developmentfix": "test",
"actiontaken": "test",
"categoryname": "test",
"parentcategory": "test",
"problemdef": "test",
"ticketid": 1
}
}
]
}
}
接受三个参数。
问题 - 我知道我的索引名称是什么,但我不确定应该在文档和 id 字段中传递什么值。
示例数据
_source
我试图传递UpdateRequest updateRequest = new UpdateRequest("ticketdump",js.getJSONObject("hits").getJSONArray("hits").getJSONObject(0).getJSONObject("_source").toString(),"1").script(new Script("ctx._source.message = \"bhavik\""));
client.update(updateRequest).get();
对象,但是文档遗漏了错误。也许我错过了这个概念?
JAVA CODE
function ff(b, o) {
if (b) {
return o.x // IC here
} else {
return o.x // IC here
}
}
答案 0 :(得分:3)
实际上,您的UpdateRequest接受3个参数
通过以下数据,您可以看到: