3

次のようなドメインクラスがあります

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?]

インターネットで多くの投稿を見てきましたが、この問題を解決できません!! これまでのところ、これはマッピングを使用した2つの変数が原因である可能性があると思います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 ...
4

1 に答える 1

1

編集

元のバグが何であったかを発見しました:プリミティブ型(つまりint vote、コメントドメインのプロパティ)はESのプラグインによって「オブジェクト」としてマップされますが、プロパティはオブジェクトとしてシリアル化されないため、ESはわかりませんそれを処理する方法。投票プロパティを asInteger 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.

また、このモードを使用して起動中にプラグインがハングするnode場合は、ES クラスターの自動検出に失敗している可能性があります。その場合は、transport代わりにモードを使用してみてください。参考までに、grails ES プラグインはlocalhost:9300デフォルトでアドレスを使用しますが、これは設定可能です (プラグインのドキュメントを参照してください)。

于 2013-05-30T09:22:09.553 に答える