gpt4 book ai didi

elasticsearch - elasticsearch不会更新文件

转载 作者:行者123 更新时间:2023-12-03 01:49:59 25 4
gpt4 key购买 nike

我正面临与文档更新有关的麻烦。

我能够索引(创建)文档,并且它们已正确添加到索引中。

但是,当我尝试更新其中之一时,未进行操作,文档也未更新。

当我第一次添加文档时,它就像:

{
"user" : "user4",
"timestamp" : "2016-12-16T15:00:22.645Z",
"startTimestamp" : "2016-12-16T15:00:22.645Z",
"dueTimestamp" : null,
"closingTimestamp" : null,
"matter" : "F1",
"comment" : null,
"status" : 0,
"backlogStatus" : 20,
"metainfos" : {
"ceeaceaaaceeaceaaaceeaceaaaceeaaceaaaceeabceaaa" : [ "FZ11" ]
},
"resources" : [ ],
"notes" : null
}

这是我用来构建UpdateRequest的代码:
this.elasticsearchResources.getElasticsearchClient()
.prepareUpdate()
.setIndex(this.user.getMe().getUser())
.setType(type)
.setId(id.toString())
.setDoc(source)
.setUpsert(source)
.setDetectNoop(true);

我还能够调试该请求的内容,然后将其发送给elasticsearch。该文件是:
{
"user":"user4",
"timestamp":"2016-12-16T15:00:22.645Z",
"startTimestamp":"2016-12-16T15:00:22.645Z",
"dueTimestamp":null,
"closingTimestamp":null,
"matter":"F1",
"comment":null,
"status":0,
"backlogStatus":20,
"metainfos":{

},
"resources":[

],
"notes":null
}

如您所见,当我尝试更新文档时,唯一的区别是 metainfos为空。

执行完 update request后,文档不会更新。我的意思是 metainfos的内容保持不变:
#curl -XGET 'http://localhost:9200/user4/fuas/_search?pretty'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "living_v1",
"_type" : "fuas",
"_id" : "327c9435-c394-11e6-aa90-02420a011808",
"_score" : 1.0,
"_routing" : "user4",
"_source" : {
"user" : "user4",
"timestamp" : "2016-12-16T15:00:22.645Z",
"startTimestamp" : "2016-12-16T15:00:22.645Z",
"dueTimestamp" : null,
"closingTimestamp" : null,
"matter" : "F1",
"comment" : null,
"status" : 0,
"backlogStatus" : 20,
"metainfos" : {
>>>>>>>> "ceeaceaaaceeaceaaaceeaceaaaceeaaceaaaceeabceaaa" : [ "FZ11" ]
},
"resources" : [ ],
"notes" : null
}
} ]
}
}

我不太清楚怎么了。有任何想法吗?

最佳答案

ElasticSearch不会更新空对象。您可以尝试:
"metainfos":null
"metainfos":"ceeaceaaaceeaceaaaceeaceaaaceeaaceaaaceeabceaaa":[]

清理 field 。

关于elasticsearch - elasticsearch不会更新文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41185882/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com