假设我想索引文档
SQLitePCL
返回
PUT twitter/_doc/1
{
"user" : "kimchy",
"any" : "thing"
}
GET twitter/_doc/1
然后我想更新文件(没有完全覆盖原文件)[注意字段的差异]
{
"_index": "twitter",
"_type": "_doc",
"_id": "1",
"_version": 3,
"found": true,
"_source": {
"user": "kimchy",
"any": "thing"
}
}
但是ES会覆盖整个文档。有没有办法让丢失的田地不受影响?
理想情况下,我想
PUT twitter/_doc/1
{
"user" : "kimchy",
"some" : "thing"
}
GET twitter/_doc/1
{
"_index": "twitter",
"_type": "_doc",
"_id": "1",
"_version": 6,
"found": true,
"_source": {
"user": "kimchy",
"some": "thing"
}
}
谢谢!
答案 0 :(得分:0)
是的,你需要做partial update,就像这样
POST twitter/_doc/1/_update
{
"doc": {
"user" : "kimchy",
"some" : "thing"
}
}