playframework-elasticsearch icon indicating copy to clipboard operation
playframework-elasticsearch copied to clipboard

Including a list of related entities in the Elasticsearch index

Open preslavrachev opened this issue 12 years ago • 1 comments

Using the elasticsearch module, is it possible to somehow index the results of a related collection, which is lazy-loaded?

I have a model type Book, which has many Authors, which are lazy loaded

If I annotate the list of authors as @ElasticSearchEmbedded, I get the following exception:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: models.Book.authors, no session or session was closed If I mark it as ignored, of course everything goes fine. Is there a way to at least get the names of the authors in the Book index?

preslavrachev avatar Feb 07 '13 09:02 preslavrachev

In general, how do I embed related collections of models? I do not really want to ignore them or mark them as FetchType.EAGER

preslavrachev avatar Feb 07 '13 15:02 preslavrachev