Why use Elasticsearch or Apache Solr along with Hibernate Search?
Asked Answered
L

4

13

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?

Liquefy answered 16/1, 2014 at 23:24 Comment(0)
E
9

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.

Exemplification answered 12/3, 2015 at 21:28 Comment(0)
L
5

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.

Liturgist answered 9/6, 2017 at 10:57 Comment(0)
G
4

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

Geber answered 20/1, 2014 at 10:13 Comment(2)
That sounds reasonable to me. I just wonder why these adapters are around and if there isn't any legitimate reason to combine them (apart from some exotic cases). I am just finishing my thesis which is partly about combining RDBMS, NoSQL, Search servers - that's why I am curious about this.Liquefy
I think it's more because people are afraid of removing existing code and want to simply change implementation without modifying code. Also, thinking "NoSQL" is to me different than thinking "Relational". So may be they are not ready to change their mindset? My 2 cents.Geber
M
3

To take advantage of Hibernate Search's rdbms/index synching capabilities. This means your search indexes are always in sync with the relational database/source. While at the same time you may still want some of the advanced features you get from Solr or Elastic Search (high-lighting. auto shard rebalancing...

Milburt answered 23/6, 2015 at 17:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.