We just published Hibernate Search 6.0.0.Alpha4, the fourth release for the still-in-development 6.0 branch. This release mainly adds an "exists" predicate, improves the DSL by allowing to bypass DSL and projection converters or to override analyzers, restores the Elasticsearch AWS integration, and upgrades the Lucene backend to Lucene 8.
If you want to dive right into the new, shiny Hibernate Search 6, a good starting point is the getting started guide included in the reference documentation.
Hibernate Search 6 is still in development and its APIs differ significantly from Search 5.
For more information about the current status of this branch, see the page dedicated to Search 6 on hibernate.org.
For more information about migration and what we intend to do to help you, see the migration guide.
We added support for the "exists" predicate in the Search DSL,
allowing to filter documents according to the presence or absence of a non-
null value for a given field:
SearchQuery<MyEntity> query = searchSession.search(MyEntity.class).asEntity() .predicate(f -> f.exists().onField("someField")) .toQuery();
DSL and projection converters automatically convert values from the type expected by the user to the underlying type exposed by backends.
java.util.Date properties have a converter between that type and
Just like the
.ignoreFieldBridge option in Search 5,
there is now an option to bypass these converters in Search 6:
// When the value to match is a java.util.Date Date dateToMatch = /* ... */; SearchQuery<MyEntity> query = searchSession.search(MyEntity.class).asEntity() .predicate(f -> f.match().onField("myJavaUtilDate").matching(dateToMatch)) .toQuery(); // When the value to match is a java.time.Instant Instant instantToMatch = /* ... */; SearchQuery<MyEntity> query = searchSession.search(MyEntity.class).asEntity() .predicate(f -> f.match().onField("myJavaUtilDate").matching(instantToMatch, DslConverter.DISABLED)) .toQuery();
// When we need the projection as a java.util.Date SearchQuery<Date> query = searchSession.search(MyEntity.class) .asProjection(f -> f.field("myJavaUtilDate", Date.class) .predicate(f -> f.matchAll()) .toQuery(); // When we need the projection as a java.time.Instant SearchQuery<Instant> query = searchSession.search(MyEntity.class) .asProjection(f -> f.field("myJavaUtilDate", Instant.class, ProjectionConverter.DISABLED) .predicate(f -> f.matchAll()) .toQuery();
Analyzers could already be overridden in Search 5, but only at the
QueryBuilder level and on a per-field basis,
which could be annoying if you had many fields in your predicates or if you needed two predicates with different overrides.
In Search 6, you can now override analyzers on a per-predicate basis:
SearchQuery<MyEntity> query = searchSession.search(MyEntity.class).asEntity() .predicate(f -> f.match().onField("name_autocomplete").matching(userInput).analyzer("edgengram_query")) .toQuery();
the property keys for index-scoped configuration properties are now prefixed with
hibernate.search.backends.myBackend.indexes.myIndex.lifecycle.strategy = create
See the section about configuration in the reference documentation for more information.
HSEARCH-3507: Improve consistency of naming for methods related to native Elasticsearch/Lucene features (fromJsonString, etc.)
HSEARCH-3554: The Elasticsearch backend defaults to a 10 element hit limit
HSEARCH-2534: Allow using query-only analyzer definitions with Elasticsearch
HSEARCH-2185: Phrase query with the DSL does not consider the
HSEARCH-2423: Projecting an unstored field should raise an exception with Elasticsearch
HSEARCH-2518: Allow to assign a name to an analyzer class/instance
HSEARCH-2757: Allow usage of FieldSelectors when using Spatial indexing
HSEARCH-3530: Update the date formats in the reference documentation
HSEARCH-3532: Fix the java module name for hibernate-search-util-common
HSEARCH-3538: Disabling projection converters in projections is ignored when checking compatibility
HSEARCH-3540: The NONE Elasticsearch index lifecycle strategy throws an AssertionFailure
HSEARCH-3543: Allow to set GeoPointBridges as sortable to enable distance sorts
HSEARCH-3548: ZonedDateTime with zone = ZoneOffset.UTC fails when indexing in Elasticsearch 5.6
HSEARCH-3549: Indexing MonthDay.of( 2, 29 ) fails on Elasticsearch
HSEARCH-3557: ZonedDateTime at later offset during DST change gets parsed incorrectly
And more. For a full list of changes since the previous releases, please see the release notes.
All details are available and up to date on the dedicated page on hibernate.org.