我正在使用Couchbase和Elasticsearch开发spring data。我有一个从Couchbase到Elasticsearch启动的复制。现在我可以使用spring数据将数据保存在couchbase中,数据被正确保存并复制到Elasticsearch中。在尝试从Elasticsearch读取时,它显示为null,结果中只显示id值。当我直接保存在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
}
}
}
直接插入的弹性搜索中的数据:
{
"_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"
}
}
发布于 2014-12-02 09:41:37
如果您已经更改了数据的结构,您可能需要更新Elasticsearch映射。
看看索引问题部分的Elasticsearch插件文档,其中描述了如何解决这个问题。
https://stackoverflow.com/questions/27243252
复制相似问题