Hibernate Search with Elasticsearch

Hi,

I have a project that uses Lucene, Tika and Hibernate search to index and
search text, documents, web pages and Hibernate entities. I wanted to
migrate to Elasticsearch and replace Lucene, but to keep Hibernate search
for now. When I tried to put these two together I faced many difficulties
related to the conflicts between different lucene versions in the backend.
These problems disappeared after I commented all Hibernate Search
dependencies and code referencing it. Is there any chance I can put these
two in the same project working together without any conflicts? If so, what
should I do?

Thanks,
Zoran

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Why not run elastic in a separate jvm?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Maybe i didn't understand your idea very well. I'm trying to use java api
to integrate elasticsearch with my application. At the moment I'm using
local node during development as there are other guys who are working other
things, so I don't want to bother them with configuring elasticsearch, but
later I want to be able to switch to separate Amazon instance. So, I didn't
even run elasticsearch server. The conflict is between elasticsearch client
dependencies and hibernate search dependencies.

On Thursday, 13 June 2013 12:23:27 UTC-7, AlexR wrote:

Why not run elastic in a separate jvm?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

This is a common problem since Lucene is such a wide-spread technology. I
had this problem before and I opted for AlexR's proposal: Don't run two
libraries dependent of Lucene in the same JVM. I even wouldn't recommend
that if the Lucene versions were currently compatible: It might be that
e.g. Elasticsearch rapidly develops forward and it actually is quite quick
with adapting new Lucene versions. I don't know about Hibernate, but if you
update to a newer Elasticsearch version but Hibernate still uses an older
version of Lucene you could run into problems, even if your application is
currently working. Or of course, you don't do updates.

Thus, why don't use an ES search server? You can start it on the same
machine as your search application (or, if you want to, even on a different
machine, your flexible, then) and use it via the Rest API, i.e. through the
Client Java API. This should work very fine you woudn't have to bother with
version conflicts.

On Thursday, 13 June 2013 21:35:29 UTC+2, Zoran Jeremic wrote:

Maybe i didn't understand your idea very well. I'm trying to use java api
to integrate elasticsearch with my application. At the moment I'm using
local node during development as there are other guys who are working other
things, so I don't want to bother them with configuring elasticsearch, but
later I want to be able to switch to separate Amazon instance. So, I didn't
even run elasticsearch server. The conflict is between elasticsearch client
dependencies and hibernate search dependencies.

On Thursday, 13 June 2013 12:23:27 UTC-7, AlexR wrote:

Why not run elastic in a separate jvm?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Erik,

Thank you for your explanation. So you are suggesting that it's not
possible to run those two together in the same application?

How about using Elasticsearch instead of Hibernate Search? I'm using
Hibernate search to support search of the several different Hibernate
entities based the user input in the input box and using a wildcard based
search on the couple of the Hibernate entities. As the user type something
in the textbox, a possible matches are displayed. Do you think it could be
possible to implement search in elasticsearch (without hibernate-search)
and then to query hibernate to pull the entity? I mean, I know it can be
implemented, but would it be wise to apply this approach in terms of
performances?

Zoran

On Thursday, 13 June 2013 23:25:07 UTC-7, Erik Fäßler wrote:

This is a common problem since Lucene is such a wide-spread technology. I
had this problem before and I opted for AlexR's proposal: Don't run two
libraries dependent of Lucene in the same JVM. I even wouldn't recommend
that if the Lucene versions were currently compatible: It might be that
e.g. Elasticsearch rapidly develops forward and it actually is quite quick
with adapting new Lucene versions. I don't know about Hibernate, but if you
update to a newer Elasticsearch version but Hibernate still uses an older
version of Lucene you could run into problems, even if your application is
currently working. Or of course, you don't do updates.

Thus, why don't use an ES search server? You can start it on the same
machine as your search application (or, if you want to, even on a different
machine, your flexible, then) and use it via the Rest API, i.e. through the
Client Java API. This should work very fine you woudn't have to bother with
version conflicts.

On Thursday, 13 June 2013 21:35:29 UTC+2, Zoran Jeremic wrote:

Maybe i didn't understand your idea very well. I'm trying to use java api
to integrate elasticsearch with my application. At the moment I'm using
local node during development as there are other guys who are working other
things, so I don't want to bother them with configuring elasticsearch, but
later I want to be able to switch to separate Amazon instance. So, I didn't
even run elasticsearch server. The conflict is between elasticsearch client
dependencies and hibernate search dependencies.

On Thursday, 13 June 2013 12:23:27 UTC-7, AlexR wrote:

Why not run elastic in a separate jvm?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hey Zoran,

In my former company I started with an HBSearch project. Then I discovered Elasticsearch and put all that HBSearch stuff away.
In my service layer, basically, each time I was persisting my main entities with merge, save or delete, I:

  • Serialize the javabean to JSon with Jackson
  • Send it to Elasticsearch

That's it.

For searches, I add to adapt my HBSearch code to an ES code (using ES Query DSL instead of Criteria).

So my advice here is to use ES only as your search engine and not try to combine both.

My 2 cents

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 14 juin 2013 à 09:13, Zoran Jeremic zoran.jeremic@gmail.com a écrit :

Hi Erik,

Thank you for your explanation. So you are suggesting that it's not possible to run those two together in the same application?

How about using Elasticsearch instead of Hibernate Search? I'm using Hibernate search to support search of the several different Hibernate entities based the user input in the input box and using a wildcard based search on the couple of the Hibernate entities. As the user type something in the textbox, a possible matches are displayed. Do you think it could be possible to implement search in elasticsearch (without hibernate-search) and then to query hibernate to pull the entity? I mean, I know it can be implemented, but would it be wise to apply this approach in terms of performances?

Zoran

On Thursday, 13 June 2013 23:25:07 UTC-7, Erik Fäßler wrote:
This is a common problem since Lucene is such a wide-spread technology. I had this problem before and I opted for AlexR's proposal: Don't run two libraries dependent of Lucene in the same JVM. I even wouldn't recommend that if the Lucene versions were currently compatible: It might be that e.g. Elasticsearch rapidly develops forward and it actually is quite quick with adapting new Lucene versions. I don't know about Hibernate, but if you update to a newer Elasticsearch version but Hibernate still uses an older version of Lucene you could run into problems, even if your application is currently working. Or of course, you don't do updates.

Thus, why don't use an ES search server? You can start it on the same machine as your search application (or, if you want to, even on a different machine, your flexible, then) and use it via the Rest API, i.e. through the Client Java API. This should work very fine you woudn't have to bother with version conflicts.

On Thursday, 13 June 2013 21:35:29 UTC+2, Zoran Jeremic wrote:
Maybe i didn't understand your idea very well. I'm trying to use java api to integrate elasticsearch with my application. At the moment I'm using local node during development as there are other guys who are working other things, so I don't want to bother them with configuring elasticsearch, but later I want to be able to switch to separate Amazon instance. So, I didn't even run elasticsearch server. The conflict is between elasticsearch client dependencies and hibernate search dependencies.

On Thursday, 13 June 2013 12:23:27 UTC-7, AlexR wrote:
Why not run elastic in a separate jvm?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Zoran,

I would go the way David recommended to you. Don't worry about the
performance, for the usecase you described I absolutely expect real-time
responses. Because Elasticsearch is made for such tasks.
And David's approach is very easy to implement since Elasticsearch
understands documents that actually are JSON objects, how much better can
it be?

On Friday, 14 June 2013 09:13:47 UTC+2, Zoran Jeremic wrote:

Hi Erik,

Thank you for your explanation. So you are suggesting that it's not
possible to run those two together in the same application?

How about using Elasticsearch instead of Hibernate Search? I'm using
Hibernate search to support search of the several different Hibernate
entities based the user input in the input box and using a wildcard based
search on the couple of the Hibernate entities. As the user type something
in the textbox, a possible matches are displayed. Do you think it could be
possible to implement search in elasticsearch (without hibernate-search)
and then to query hibernate to pull the entity? I mean, I know it can be
implemented, but would it be wise to apply this approach in terms of
performances?

Zoran

On Thursday, 13 June 2013 23:25:07 UTC-7, Erik Fäßler wrote:

This is a common problem since Lucene is such a wide-spread technology. I
had this problem before and I opted for AlexR's proposal: Don't run two
libraries dependent of Lucene in the same JVM. I even wouldn't recommend
that if the Lucene versions were currently compatible: It might be that
e.g. Elasticsearch rapidly develops forward and it actually is quite quick
with adapting new Lucene versions. I don't know about Hibernate, but if you
update to a newer Elasticsearch version but Hibernate still uses an older
version of Lucene you could run into problems, even if your application is
currently working. Or of course, you don't do updates.

Thus, why don't use an ES search server? You can start it on the same
machine as your search application (or, if you want to, even on a different
machine, your flexible, then) and use it via the Rest API, i.e. through the
Client Java API. This should work very fine you woudn't have to bother with
version conflicts.

On Thursday, 13 June 2013 21:35:29 UTC+2, Zoran Jeremic wrote:

Maybe i didn't understand your idea very well. I'm trying to use java
api to integrate elasticsearch with my application. At the moment I'm using
local node during development as there are other guys who are working other
things, so I don't want to bother them with configuring elasticsearch, but
later I want to be able to switch to separate Amazon instance. So, I didn't
even run elasticsearch server. The conflict is between elasticsearch client
dependencies and hibernate search dependencies.

On Thursday, 13 June 2013 12:23:27 UTC-7, AlexR wrote:

Why not run elastic in a separate jvm?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi guys,

Thank you for your advices. I'll try the approach David suggested.

Best,
Zoran

On Friday, 14 June 2013 03:47:00 UTC-7, Erik Fäßler wrote:

Hi Zoran,

I would go the way David recommended to you. Don't worry about the
performance, for the usecase you described I absolutely expect real-time
responses. Because Elasticsearch is made for such tasks.
And David's approach is very easy to implement since Elasticsearch
understands documents that actually are JSON objects, how much better can
it be?

On Friday, 14 June 2013 09:13:47 UTC+2, Zoran Jeremic wrote:

Hi Erik,

Thank you for your explanation. So you are suggesting that it's not
possible to run those two together in the same application?

How about using Elasticsearch instead of Hibernate Search? I'm using
Hibernate search to support search of the several different Hibernate
entities based the user input in the input box and using a wildcard based
search on the couple of the Hibernate entities. As the user type something
in the textbox, a possible matches are displayed. Do you think it could be
possible to implement search in elasticsearch (without hibernate-search)
and then to query hibernate to pull the entity? I mean, I know it can be
implemented, but would it be wise to apply this approach in terms of
performances?

Zoran

On Thursday, 13 June 2013 23:25:07 UTC-7, Erik Fäßler wrote:

This is a common problem since Lucene is such a wide-spread technology.
I had this problem before and I opted for AlexR's proposal: Don't run two
libraries dependent of Lucene in the same JVM. I even wouldn't recommend
that if the Lucene versions were currently compatible: It might be that
e.g. Elasticsearch rapidly develops forward and it actually is quite quick
with adapting new Lucene versions. I don't know about Hibernate, but if you
update to a newer Elasticsearch version but Hibernate still uses an older
version of Lucene you could run into problems, even if your application is
currently working. Or of course, you don't do updates.

Thus, why don't use an ES search server? You can start it on the same
machine as your search application (or, if you want to, even on a different
machine, your flexible, then) and use it via the Rest API, i.e. through the
Client Java API. This should work very fine you woudn't have to bother with
version conflicts.

On Thursday, 13 June 2013 21:35:29 UTC+2, Zoran Jeremic wrote:

Maybe i didn't understand your idea very well. I'm trying to use java
api to integrate elasticsearch with my application. At the moment I'm using
local node during development as there are other guys who are working other
things, so I don't want to bother them with configuring elasticsearch, but
later I want to be able to switch to separate Amazon instance. So, I didn't
even run elasticsearch server. The conflict is between elasticsearch client
dependencies and hibernate search dependencies.

On Thursday, 13 June 2013 12:23:27 UTC-7, AlexR wrote:

Why not run elastic in a separate jvm?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.