既然你貼不會出現在文件是合法的,我假設你的意思是這樣的:
{
"key": {
"anotherKey": {
"firstEntryKey": "firstValue",
"secondEntry": "secondValue"
}
}
}
所以,如果我創建一個索引,並張貼文件,
DELETE /test_index
PUT /test_index
PUT /test_index/doc/1
{
"key": {
"anotherKey": {
"firstEntryKey": "firstValue",
"secondEntry": "secondValue"
}
}
}
GET /test_index/doc/1
...
{
"_index": "test_index",
"_type": "doc",
"_id": "1",
"_version": 1,
"found": true,
"_source": {
"key": {
"anotherKey": {
"firstEntryKey": "firstValue",
"secondEntry": "secondValue"
}
}
}
}
然後用新版本更新文檔,我找回新版本:
PUT /test_index/doc/1
{
"key": {
"anotherKey": {
"firstEntryKey": "firstValue"
}
}
}
GET /test_index/doc/1
...
{
"_index": "test_index",
"_type": "doc",
"_id": "1",
"_version": 2,
"found": true,
"_source": {
"key": {
"anotherKey": {
"firstEntryKey": "firstValue"
}
}
}
}
這是我使用的代碼:
http://sense.qbox.io/gist/fb38750594550d4bf7f8a168883a168c7adc3d49
這是否解決問題了嗎?如果沒有,留下評論,我會盡力幫助。
這是嵌套文檔嗎? –
我相信正確的teminology是多層次的對象,所以我知道它的關鍵和路徑,但我該如何刪除它? –