【发布时间】:2018-11-28 23:03:58
【问题描述】:
我有一个问题,我正在尝试更新 ES 中的一个对象,所以,每次我查询它时,我都会得到所有更新的信息。我有一个这样的对象:
{
"took": 7,
"timed_out": false,
"_shards": {
"total": 768,
"successful": 768,
"failed": 0
},
"hits": {
"total": 456,
"max_score": 1,
"hits": [
{
"_index": "sometype_1",
"_type": "sometype",
"_id": "12312321312312",
"_score": 1,
"_source": {
"readModel": {
"id": "asdfqwerzcxv",
"status": "active",
"hidden": false,
"message": "hello world",
},
"model": {
"id": "asdfqwerzcxv",
"content": {
"objectId": "421421312312",
"content": {
"@type": "text",
"text": "hello world"
}
..... //the rest of the object...
我想更新消息(读取模型的一部分),所以我做了这样的事情:
PUT test/readModel.id/ID123
{
"message" : "hello"
}
但每次我查询以查找 ID123 时,我都会得到相同的信息(更糟糕的是,我制作的 PUT 越多,我返回的对象就越多(具有相同的信息)
知道怎么做吗?
【问题讨论】:
-
您是否需要更新多个带有
readModel.id: asdfqwerzcxv的文档或只更新一个?下面两种情况都有答案。
标签: elasticsearch