[hibernate-dev] [Search] Elasticsearch - Thoughts about analyzers and fieldbridges

Emmanuel Bernard emmanuel at hibernate.org
Fri Feb 26 04:50:57 EST 2016

> One catch is the QueryDSL: AFAIR there are a couple of cases in which we invoke
> the analyzer directly to "preprocess" the tokens.. this either needs
> to be killed,
> or we invoke the ES server to do the same operation but that seems
> inefficient.. we'll
> see, I don't remember now for which cases we need such things and hopefully
> there will be an alternative strategy when it comes to run queries on ES.

What comes to mind is 

To search for multiple possible words in the same field, simply add them all in the matching clause.

//search document with storm or lightning in their history
Query luceneQuery =
mythQB.keyword().onField("history").matching("storm lightning").createQuery();
The More Like This implementation also applies Analyzers to create the right corpus. And the algorithm is specific to Hibernate Search and field centric rather that Lucene document centric implementation. Maybe Elasticsearch follows our approach too. 


More information about the hibernate-dev mailing list