0

我现有的数据:

{
    "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"
            }
        }]
    }
}

我想使用以下代码在 id=3 的地方附加地址(地址=9):

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();

但它无法附加。它正在替换原始值。

4

0 回答 0