elasticsearch-grails-plugin icon indicating copy to clipboard operation
elasticsearch-grails-plugin copied to clipboard

ERROR unmarshall.DomainClassUnmarshaller when searching parent-child

Open sircelsius opened this issue 10 years ago • 4 comments

I'm getting a weird error when searching for domains mapped as parent-child.

Here's how to recreate the error:

Domains

Class Parent{

    String parentName

    static hasMany = [child: Child]

    static searchable = {
        child reference:true
  }

}

Class Child{
    String childName

    static belongsTo = [parent: parent]

    static searchable = {
        parent parent:true, reference:true
   }
}

This mapping is properly created, however, when searching using the following method:

    def searchParentOrderByChildCount(){
        def list = Parent.search([sort: "_score", order: "desc"],{
            bool{
                should{
                    has_child(
                        type:"child",
                        score_mode: "sum",
                        query: QueryBuilders.matchAllQuery()
                    )
                }
            }
    })
}

My console goes wild and logs a strange error for each matching object:

| Error 2014-10-20 15:40:47,706 [http-bio-8080-exec-4] ERROR unmarshall.DomainClassUnmarshaller  - Error unmarshalling Class Parent with id 3

Then the following lines (a few hundred of them):

selection_009

This seems to be coming from the buildResults method of org.grails.plugins.elasticsearch.conversion.unmashall.DomainClassUnmarshaller, lines 82-85, but I don't understand why the error is thrown.

Any ideas?

sircelsius avatar Oct 20 '14 13:10 sircelsius

After fiddling around a bit, it seems that changing the child reference:true to child component:true settles the matter.

Still, for other reasons I need to use the original mapping. Is there any way to make it work without getting rid of the child reference:true part?

Note that this does not affect the results or their actual unmarshalling: the objects are rendered correctly.

sircelsius avatar Oct 20 '14 15:10 sircelsius

Unfortunately I'm facing the same problem with version 0.0.4.4 and 0.0.4.5. Neither child reference:true nor child component:true settles the matter.

BTW Using Grails 2.5.0,

| Error 2015-06-20 17:22:51,105 [http-nio-8080-exec-10] ERROR unmarshall.DomainClassUnmarshaller  - Error unmarshalling property 'customer' of Class License with id 19
Message: null
   Line | Method
->> 285 | unmarshallDomain    in org.grails.plugins.elasticsearch.conversion.unmarshall.DomainClassUnmarshaller
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   271 | unmarshallReference in     ''
|   193 | unmarshallProperty  in     ''
|   216 | unmarshallProperty  in     ''
|   284 | unmarshallDomain .  in     ''
|   271 | unmarshallReference in     ''
|   193 | unmarshallProperty  in     ''
|   284 | unmarshallDomain    in     ''
|   271 | unmarshallReference in     ''

... and a lot more of this messages ...

One elastic search query results in ~5 MB log messages of that type.

kurb70 avatar Jun 20 '15 15:06 kurb70

I have the same issue as @kurb70 in grails 2.5.3

mlist avatar Jun 14 '16 12:06 mlist

@mlist I don't use Grails anymore so I can't help you there mate. Sorry!

sircelsius avatar Jun 14 '16 13:06 sircelsius