Why use Elasticsearch or Apache Solr along with Hibernate Search? Why use Elasticsearch or Apache Solr along with Hibernate Search? elasticsearch elasticsearch

Why use Elasticsearch or Apache Solr along with Hibernate Search?


I haven't implemented elasticsearch but I am looking it as a back-end for Hibernate search.

One issue that I have had with Hibernate search is if I'm running a cluster of 8 JBoss servers in standalone mode, by default they all have a separate index on their local filesystem. When a change is made via hibernate it only updates the index on that single node. It becomes difficult to keep all of the indexes up to date.

To fix this we have been looking into the recommended approach of running Hibernate search in a clustered configuration but that is proving to be difficult to get running properly. With elasticsearch it looks like we can move the search server outside of the web app and manage it separately without having to change any of our older Hibernate Search code.


From my former experience, I moved from hibernate search to elasticsearch without keeping anything around from Hibernate search (I mean annotations).

I think it's so easy to serialize a bean to JSon with Jackson that you don't need complex things. Once, you have the Json document, just send it to elasticsearch and you are done.

That said, I kept an old fashion SQL search in case I needed to do some maintenance operations on elasticsearch cluster. But if you embed elasticsearch in your webapp (let's say you don't have so much data to manage), then you don't need to think about it.

My 2 cents


Please note: the previous answers where good but are outdated by years.

Hibernate Search now has great integration with Elasticsearch, so you can have the benefits of integration with Hibernate like others suggested while still having the benefits of Elasticsearch as well.

See search.hibernate.org

Integration with Apache Solr should be possible as well, but this wasn't implemented yet and the team will need help with that.

Hopefully having done the hard work of de-coupling and making the Elasticsearch integration an option should make it easier.