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?
Solr has more advantages when it comes to the static data, because of its caches and the ability to use an uninverted reader for faceting and sorting – for example, e-commerce. On the other hand, Elasticsearch is better suited – and much more frequently used – for timeseries data use cases, like log analysis use cases.
Solr is a search server built on top of Apache Lucene, an open source, Java-based, information retrieval library. It is designed to drive powerful document retrieval applications - wherever you need to serve data to users based on their queries, Solr can work for you.
Both of them are built on top of Apache Lucene, so the features they support are very similar. However, they differ significantly in terms of deployment, scalability, query language, and many other functionalities.
Performance-wise, they are roughly the same. Operationally, Elasticsearch is a bit simpler to work with, it has just a single process. Solr, in its Elasticsearch-like fully distributed deployment mode known as SolrCloud, depends on Apache ZooKeeper.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With