我在grails 3.3.6中实现了弹性搜索。我运行的应用程序出现错误-ID为7的类别的错误索引。
我的类别网域是
class Category {
static hasMany = [events : Event]
Category parent
String name
String description
User createdBy
User modifiedBy
Timestamp createdDate
Timestamp modifiedDate
def beforeInsert(){
createdDate = new Timestamp(new Date().getTime())
modifiedDate = new Timestamp(new Date().getTime())
}
def beforeUpdate() {
modifiedDate = new Timestamp(new Date().getTime())
}
static constraints = {
name nullable: false , unique: true
description nullable: true
parent nullable: true
createdBy nullable: false
modifiedBy nullable: false
createdDate nullable: true
modifiedDate nullable: true
events nullable: true
}
static searchable = true
}
我的事件域是
package com.grailsbrains
导入com.grailsbrains.auth.User
导入java.sql.Timestamp
课程事件{
static belongsTo = [category : Category, organization: Organization]
static hasMany = [languages : Language,formats:Format]
String title
String duration
String type
String summary
String prequel
byte[] mainVideo
byte[] mainImage
String tagline
String specialInstruction
String mapUrl
Timestamp startDateTime
Timestamp endDateTime
boolean isEnabled
boolean isExpired
String accessType
String entrance
User createdBy
User modifiedBy
Timestamp createdDate
Timestamp modifiedDate
def beforeInsert(){
createdDate = new Timestamp(new Date().getTime())
modifiedDate = new Timestamp(new Date().getTime())
}
def beforeUpdate() {
modifiedDate = new Timestamp(new Date().getTime())
}
static searchable = {
title boost: 2.0
summary boost: 1.0
title analyzer: 'simple'
summary analyzer: 'simple'
tagline analyzer: 'simple'
category reference : true
formats reference: true
languages reference: true
except = ['mainImage','mainVideo','createdBy','modifiedBy','createdDate','modifiedDate']
}
static constraints = {
title nullable: true , unique: true
startDateTime nullable: true
endDateTime nullable: true
mainImage nullable: true
mainVideo nullable: true
duration nullable: true
type nullable: true, blank:false
summary nullable: true , blank:false
prequel nullable: true
tagline nullable: true
specialInstruction nullable: true
mapUrl nullable: true
isExpired nullable: false
isEnabled nullable: false
accessType nullable: true
entrance nullable: true
createdBy nullable: true
modifiedBy nullable: true
createdDate nullable: true
modifiedDate nullable: true
}
}
我正在尝试通过邮递员使用API将值插入类别表中。数据已插入表中。但是我遇到了这个错误
2018-07-31 14:20:15.337错误-[[主要] g.p.e.index.IndexRequestQueue:错误索引类 com.grailsbrains.Category(索引:com.grailsbrains_write,键入: 类别)的ID 7 grails.plugins.elasticsearch.exception.IndexException:失败 marshall域实例[com.grailsbrains.Category:7]位于 sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 在java.lang.reflect.Constructor.newInstance(Constructor.java:408)
在我的控制台中。任何想法-有人可以帮我吗?
谢谢。