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

results.total does not correspond to results.searchResults.size() (in some cases)

Open littleiffel opened this issue 11 years ago • 2 comments

I see sometimes in the logs "Unknown SearchHit...."

And in this case the total does not correspond (but is higher then) the size of returned hits.

I see that some hits are not added to resultsList in buildResults(). Why is this happening? Is this behaviour desired or is it a bug?

littleiffel avatar Sep 16 '13 19:09 littleiffel

The plugin does not include results if it doesn't have a mapping for it, it may also mean that he fails to recognize the result as a valid domain. Could you provide an example of the domain & request where this issue occurs ?

mstein avatar Sep 24 '13 10:09 mstein

I have 3 domain classes. One common Parent

class Item{
  static searchable = {
      root = false
   }
  String descritption
  String title
}
class Offer extends Item{
   static searchable = {
      only = ['title', 'description']
   }
}
class Request extends Item{
   static searchable = {
      only = ['title', 'description']
   }
}

When i use elasticSearchSerivce.search('query') it finds one Offer. (That is correct. It should find 1 Offer) But the result is as follows:

['total':2, 'searchResults':[Offer: 1234]]

Offer.search('query') does not return anything and Item.search('query') does not exisit (as expected).

I assume it is the inheritance that might cause some problems?

littleiffel avatar Sep 25 '13 07:09 littleiffel