2014-12-02 36 views
0

我'獲取數據上Couchbase工作Elasticsearch春天數據。我有一個從Couchbase到Elasticsearch的複製。現在我可以使用spring數據將數據保存在couchbase中,數據被正確保存並被複制到Elasticsearch中。在嘗試從Elasticsearch讀取時,它顯示爲空,只有結果中顯示id值。當我直接保存在Elasticsearch中時,可以正確讀取。我想這是因爲數據的結構變化。我該如何解決這個問題?無法從Elasticsearch

數據在Elasticsearch複製後:

{ 

"_index": "streams", 
"_type": "couchbaseDocument", 
"_id": "e8c7999c-67c8-47a4-b235-726d89102f83", 
"_score": 1, 
"_source": { 
    "meta": { 
     "id": "e8c7999c-67c8-47a4-b235-726d89102f83", 
     "rev": "3-000007c43e1293830000000000000000", 
     "expiration": 0, 
     "flags": 0 
    }, 
    "doc": { 
     "createdOn": "20141201183646786", 
     "activityId": "c3c0dc11-16b5-479b-80c5-93d2ce34d77d", 
     "_class": "com.netspective.streams.model.Activity", 
     "documentType": "Activity", 
     "objectId": "UserAgent_1", 
     "subjectId": "{"actionId":"111"}", 
     "actionId": "2", 
     "updatedOn": "20141201183646786", 
     "deleteStatus": false 
    } 
} 

} 

數據在Elasticsearch是直接插入:

{ 

"_index": "streams", 
"_type": "couchbaseDocument", 
"_id": "45ebb326-a33e-43f2-9fd7-60953cb14772", 
"_score": 1, 
"_source": { 
    "id": "45ebb326-a33e-43f2-9fd7-60953cb14772", 
    "activityId": "56d291bc-eacd-4942-b26d-08025eec0ab1", 
    "subjectId": "{"actionId":"123"}", 
    "objectId": "UserAgent_1", 
    "documentType": "Activity", 
    "createdOn": "20141202113523979", 
    "updatedOn": "20141202113523979", 
    "deleteStstus": false, 
    "action": "2" 
} 

} 

回答

0

你可能需要的,如果你改變你的數據結構來更新Elasticsearch映射。

查看Elasticsearch plugin documentationIndexing Issues部分,其中介紹瞭如何解決此問題。

+0

是否可以刪除文檔和元字段?在模板中,它只允許告訴需要複製的字段,我認爲它不允許更改結構。是嗎? – 2014-12-03 05:04:12