我有如下的域类
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" 任何帮助将不胜感激。
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 ...
编辑 :
我发现了什么是原始错误:int voteES中的插件将原始类型(即,您的Comment域中的属性)映射为“对象”,但是该属性未序列化为对象,因此ES不知道如何处理。键入表决属性Integer vote将使其起作用。我已经在github仓库上提出了一个问题:https : //github.com/mstein/elasticsearch-grails- plugin/issues/61
int vote
Integer vote
原始答案(增强):
您正在使用哪个版本的插件?是从grails仓库还是直接从github仓库?无论如何,您是否可以尝试仅以神奇的方式出现在grails中央存储库中的插件的0.20.6.1-SNAPSHOT版本?
runtime ":elasticsearch:0.20.6.1-SNAPSHOT"
注意: 如果您没有使用该local模式并且正在运行自己的ElasticSearch实例,请尝试匹配grails插件的版本号:0.20.6。
local
0.20.6
另外,如果插件在使用该node模式启动期间挂起,则可能意味着它无法自动发现ES集群。在这种情况下,请尝试使用该transport模式。仅供参考,grails ES插件将localhost:9300默认使用该地址,但这是可配置的(请参阅插件文档)。
node
transport
localhost:9300