Why use Elasticsearch or Apache Solr along with Hibernate Search?

Steven picture Steven · Jan 17, 2014 · Viewed 9.5k times · Source

I learned and understood that Elasticsearch, Apache Solr and Hibernate Search are based on the Apache Lucene library. They provide fast full-text search and all of them either use JPA annotations, implement the JPA and/or define custom annotations. They are mostly used in addition to RDBMS/NoSQL data storage. The indexed and searchable data is present in the form of documents.

I am totally okay that someone poses the question Solr vs Hibernate Search - Which to choose and When? or even 'Elasticsearch vs Solr' or 'Elasticsearch vs Hibernate Search' But then there is this Hibernate Search/Elasticsearch connector as an approach to use Hibernate Search and Elasticsearch alongside or this post asking "How to integrate Hibernate and Solr together?" with the answer how to integrate Hibernate Search and Solr together, which for me is something different, right?

Assuming the above summary is correct and given the linked posts confused me: Why do people consider to or do use Elasticsearch or Solr in addition to Hibernate Search? Isn't this redundant? Or does Hibernate Search provide any interface for Solr/Elasticsearch which Hibernate ORM does not and thus is only used as some sort of adapter?

Answer

teacurran picture teacurran · Mar 12, 2015

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.