在 Grails 和 ElasticSearch 中解组 属性 失败
Unmarshalling property fails in Grails and ElasticSearch
我正在使用 Grails 2.5.0 和 ElasticSearch 0.0.4.6!我有以下域名 类:
Class Library {
--- code omitted ---
static hasMany = [books:Book]
static searchable = true
--- code omitted ---
}
Class Book {
--- code omitted ---
static belongsTo = [library:Library]
static searchable = true
--- code omitted ---
}
我试着搜索这样的书:
--- code omitted ---
def events = elasticSearchService.search(
{
query_string(fields: ["Name"],
query: query)
suggest : { suggest_mode: 'popular' }
})
render events as JSON
我收到以下错误:
ERROR unmarshall.DomainClassUnmarshaller - Error unmarshalling
property 'library' of Class Book with id 2 Message: Property
Book.library is not mapped as [component], but broken search hit
found.
您需要将 Book 域的 'library' 属性 设置为组件。
在您的图书域中替换您的以下代码
static searchable = true
和
static searchable = {
library component: true
}
有关详细信息,请参阅 elastic plugin document
我正在使用 Grails 2.5.0 和 ElasticSearch 0.0.4.6!我有以下域名 类:
Class Library {
--- code omitted ---
static hasMany = [books:Book]
static searchable = true
--- code omitted ---
}
Class Book {
--- code omitted ---
static belongsTo = [library:Library]
static searchable = true
--- code omitted ---
}
我试着搜索这样的书:
--- code omitted ---
def events = elasticSearchService.search(
{
query_string(fields: ["Name"],
query: query)
suggest : { suggest_mode: 'popular' }
})
render events as JSON
我收到以下错误:
ERROR unmarshall.DomainClassUnmarshaller - Error unmarshalling property 'library' of Class Book with id 2 Message: Property Book.library is not mapped as [component], but broken search hit found.
您需要将 Book 域的 'library' 属性 设置为组件。
在您的图书域中替换您的以下代码
static searchable = true
和
static searchable = { library component: true }
有关详细信息,请参阅 elastic plugin document