2014-12-02 34 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