Hibernate Search not updating the index for a view, when view is updated on database

0down votefavorite

In my project we are using Lucene and Hibernate Search/ORM 5.9.2. It works perfectly fine if a table is updated on database, same changes are reflected on ES indexes. But the index for a database view is not updated. Values are present under the database but not under the indexes.

Further, Lets assume I’ve 2 classes A & B and C is the view for A+B. And I’m storing C in my elastic indexes. Once A & B are updated under the Database, is it possible C will get updated. As Im using hibernate search+lucene annotations. When a table is updated under database through hibernate entities, hibernate search is updating the same under the indexes. But this behavior is not happening for views as they are updated on the Sql server side. Please suggest if this could be achieved through lucene/hibernate search.

Please help with the corresponding strategy/logic for implementing this through hibernate search.

For any of the code referencing my implementation could be found under implemented code under the java files.

Please help as soon as possible.

Stack overflow link:

Since both Hibernate and StackOverflow use Markdown, it’s just a matter of copy pasting the question to this forum.

Just like posting a link on StackOverflow will lead to your question being removed, the same rules apply when posting a question on the Hibernate forum.

I believe, now its fine. Please post this, so I could get help :slight_smile:

Answered on SO. No need to double post here.

Noted. I’ve replied to you on SO. Please look into my query. Thanks again.

Hi Guillaume,

Could you please elaborate your comments.

BTW, do you need this view at the database level? Because if you only need it at the Elasticsearch level, you can make C a proper entity having a @OneToOne to A and B and index the content of A and B using @IndexedEmbedded and @ContainedIn on the other side. That would solve your issue with native Hibernate Search.

I do not need this new entity at database level, just need this to be on ES index level. How should I go ahead with this.


Hi Guillaume, I’ve posted a new question for our last discussion on SO. Please share your knowledge on the same . SO Question link

Also, shared some queries on our last discussion Thread