我现有的数据:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1,
"hits": [{
"_index": "append",
"_type": "userDetails",
"_id": "3",
"_score": 1,
"_source": {
"Address": "7",
"Id": "3",
"Name": "G"
}
}]
}
}
我想通过使用以下代码附加地址(地址= 9),其中id = 3:
IndexRequest indexRequest = new IndexRequest("append", "userDetails", user_id)
.source(temp.toString());
UpdateRequest updateRequest = new UpdateRequest("append", "userDetails", user_id)
.doc(temp.toString())
.upsert(indexRequest);
client.update(updateRequest).get();
但它无法追加。它正在取代原来的价值。