我收到以下错误,不确定为什么。错误也显示我也没有返回_id。
{
"timestamp": "2018-10-28T09:45:26.129+0000",
"status": 500,
"error": "Internal Server Error",
"message": "failed to map source [ {\"meta_description\":\"Harry ollectables gifts\",\"body\":\"About us sDesign:\",\"title\":\"Harry Potter-Harry Potter nyl\",\"meta_keywords\":\"Harry Potter,\"}] to class Result",
"path": "/search/harry%20potter" }
因此在kibana(Elasticsearch)中,如果我查询的数据看起来像这样:
{
"_index": "burf",
"_type": "pages",
"_id": "https://www.ebay.ca/sns",
"_score": 15.293041,
"_source": {
"meta_description": "With nearly one million Stores on eBay, you're sure to find your version of perfect.",
"body": "Skip to main ",
"title": "Search eBay Stores | eBay",
"meta_keywords": ""
}
},
我在Spring Boot中的模型如下:
@org.springframework.data.elasticsearch.annotations.Document(indexName = "burf", type = "pages")
data class Result(@Id val id: String,
val title: String,
val body: String,
val meta_description: String?,
val meta_keywords: String?) {
}
答案 0 :(得分:0)
再找一个例子:下面的模型解决了这个问题,但是,我仍然无法获得分数?
@Document(indexName = "burf", type = "pages")
class Result {
@Id
var id: String? = null
var score: Float = 0.0f
var title: String? = null
var body: String? = null
var meta_description: String? = null
var meta_keywords: String? = null
}