[hibernate-dev] [Search] ElasticSearch - Progress on faceting

Guillaume Smet guillaume.smet at gmail.com
Thu Feb 4 10:37:58 EST 2016


So the good news: most of the faceting tests now pass with ES.

I rebased the patch onto master.

and for now only one commit:

It's not a PR yet as it's not feature complete and there are still (a few)
tests failing.

General infrastructure

- I introduced a JsonBuilder to make the gson API chainable: I think it's
more readable this way. I haven't updated everything to use it (especially
the Lucene Query -> Json part is not ported yet). Should I continue with
it? Please, please, say yes :).
- All the API is now based on JsonObject so you don't have to play with
String -> Json -> String -> Json manipulation
---> would appreciate feedback on these 2 changes so that I can make
everything consistent
- I introduced a ToElasticSearch class which translates Lucene/HSearch
objects to Json. I moved the existing query translator there.
- I'm not sure building the exact same document we build for Lucene is the
way to go. I'm wondering if we should have a distinct document builder for
ES. I'll see how it works for facets not being fields.
- I made a few fixes here and there: especially the indexing didn't support
multiple values per field. I made something complicated, maybe we could
just index a JsonArray even for single values? see


- The querying/extraction should be OK
- ES doesn't support range bounds inclusion/exclusion for range faceting so
I used the query faceting to build the range faceting
- I have to work on the mapping as having multiple facets on the same field
is not supported yet: currently I use the indexed field to build the
facets, not specific fields
- I have some additional work to do on indexing related to the above matter

Various issues

- A few tests don't pass:
. ElasticSearch returns facets results even if the field doesn't exist: not
sure we can do anything about that
. A test in the WebShopTest is failing as I don't support yet faceting
based on a non existing field
. CollectionUpdateEventTest is failing: this one is weird
- I had to work around an issue with the EsDateBridge and faceting (marked
as XXX in DocumentBuilderIndexedEntity): Dates are considered to be Long
and for ES, we want them to be Strings. Would appreciate a comment on that.

Comments and thoughts appreciated.


More information about the hibernate-dev mailing list