gpt4 book ai didi

具有 "text"映射的 Grails elasticsearch 插件

转载 作者:行者123 更新时间:2023-11-29 02:57:20 24 4
gpt4 key购买 nike

我有如下所示的域类

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"非常感谢任何帮助。

我现在正在使用以下 repo 协议(protocol)

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 vote 属性)被 ES 中的插件映射为“对象”,但是属性没有序列化为对象,所以 ES 不知道如何处理它。将 vote 属性键入 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"

注意:如果您没有使用本地模式并且有您自己的ElasticSearch实例在运行,请尝试匹配grails插件的版本号:0.20 .6

另外,如果插件在使用node模式启动的过程中挂掉了,这可能意味着它没有自动发现ES集群。在这种情况下,请尝试改用 transport 模式。仅供引用,grails ES 插件默认使用地址 localhost:9300,但这是可配置的(请参阅插件文档)。

关于具有 "text"映射的 Grails elasticsearch 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16821635/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com