我有类似于
的域类class Post {
String title
String body
//common
Date dateCreated
Date lastUpdated
//Mappings
static belongsTo = [user:User]
static hasMany = [comments:Comment,tags:TagBlog]
static mapping = {
body type:"text"
}
static constraints = {
title nullable:false,blank:false
body nullable: false, blank:false
}
static searchable = {
except = 'user'
}
}
和
class Comment {
String comment
int vote
//common
Date dateCreated
Date lastUpdated
static belongsTo = [post:Post,user:User]
static mapping = { comment type:"text" }
static constraints = {
comment nullable:false,blank:false
vote nullable:true,blank:true
}
static searchable = {
except = 'user'
}
}
以下是我得到的错误
| Error 2013-05-30 00:08:15,583 [elasticsearch[index]-pool-6-thread-2] ERROR index.IndexRequestQueue - Failed bulk item: MapperParsingException[object mapping for [comment] tried to parse as object, but got EOF, has a concrete value been provided to it?]
我在互联网上浏览过很多帖子,但我无法解决这个问题!!到目前为止,我的猜测是,这可能是由于我的两个变量与映射type:"Text"
任何帮助都将非常感激。
我现在正在使用以下回购
mavenRepo "https://oss.sonatype.org/content/repositories/snapshots/"
mavenRepo 'https://repo.springsource.org/libs-snapshot/'
mavenRepo "http://maven.springframework.org/milestone/"
以下是我为ES
打开后获得的调试信息2013-05-30 18:26:11,157 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Retrieved index settings
2013-05-30 18:26:11,158 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Installing mappings...
2013-05-30 18:26:11,163 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Index com.ecw.wellness does not exists, initiating creation...
2013-05-30 18:26:11,163 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Waiting at least yellow status on com.ecw.wellness ...
2013-05-30 18:28:07,884 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Index com.ecw.wellness already exists, skip index creation.
2013-05-30 18:28:07,885 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - [com.ecw.wellness.answer] => {com.ecw.wellness.answer={properties={answer={type=string, include_in_all=true, term_vector=with_positions_offsets}, votes={type=object}, dateCreated={type=date, include_in_all=true}, lastUpdated={type=date, include_in_all=true}, question={type=object}}}}
2013-05-30 18:34:13,817 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Index com.ecw.wellness does not exists, initiating creation...
2013-05-30 18:34:13,818 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Waiting at least yellow status on com.ecw.wellness ...
答案 0 :(得分:1)
编辑:
我发现原始错误是什么:原始类型(即:注释域中的int vote
属性)被ES中的插件映射为“对象”,但该属性未被序列化为一个对象,所以ES不知道如何处理它。将投票属性键入Integer vote
将使其正常工作。
我在github存储库上提交了一个问题:https://github.com/mstein/elasticsearch-grails-plugin/issues/61
原始答案(增强型):
您使用的是什么版本的插件?来自grails存储库或直接来自github存储库的那个? 无论如何,您是否可以尝试将魔法出现在grails中央存储库中的插件的0.20.6.1-SNAPSHOT版本拉出来?
runtime ":elasticsearch:0.20.6.1-SNAPSHOT"
注意:如果您没有使用local
模式并且运行自己的ElasticSearch实例,请尝试匹配grails插件的版本号:0.20.6
。< / p>
此外,如果插件在启动期间使用node
模式挂起,则可能意味着它无法自动发现ES群集。在这种情况下,请尝试使用transport
模式。仅供参考,grails ES插件默认使用地址localhost:9300
,但这是可配置的(请参阅插件文档)。