Compatibility
Java | 17, 21, or 23 |
Hibernate ORM | 7.0 |
Elasticsearch server | 7.10 - 8.17 |
OpenSearch server | 1.3 - 2.18 |
Apache Lucene | 9.12 / 10.0 |
Not compatible with your requirements? Have a look at the other series.
See also the Compatibility policy and Maintenance policy.
Documentation
Documentation for Hibernate Search 8.0 can be accessed through the links below:
You can find more documentation for all series on the documentation page.
How to get it
More information about specific releases (announcements, download links) can be found here.
Getting started
If you want to start using Hibernate Search 8.0, please refer to the getting started guide:
Migrating
If you need to upgrade from a previous series, please refer to the migration guide:
What's new
Hibernate Search 8.0 is still in development:
We encourage you to give it a try and to let us know of any bugs or problems you encounter. |
Latest release announcement (2024-12-17): 8.0.0.Alpha1.
A detailed list of new features, improvements and fixes in this series can be found on our issue tracker.
Dependency upgrades
- JDK
-
Hibernate Search upgrades to JDK 17 as the baseline and drops JDK 11 compatibility.
- Hibernate ORM
-
Hibernate Search now targets the Hibernate ORM 7.0 series, which implements Jakarta Persistence 3.2.0. In particular, it is currently based on Hibernate ORM 7.0.0.Beta3.
- Lucene
-
The Lucene backend now uses Lucene 9.12.1.
- Elasticsearch
-
The Elasticsearch backend is compatible with Elasticsearch 8.16 and 8.17, as well as other already compatible versions.
- OpenSearch
-
The Elasticsearch backend works with OpenSearch 2.17 and 2.18, as well as other already compatible versions.
Metric aggregations
The Hibernate Search DSL now allows requesting metric aggregations:
AggregationKey<Double> avgPriceKey = AggregationKey.of( "avgPrice" ); (1)
AggregationKey<LocalDate> oldestReleaseKey = AggregationKey.of( "oldestRelease" ); (2)
SearchResult<Book> result = searchSession.search( Book.class )
.where( f -> f.matchAll() )
.aggregation( avgPriceKey, f -> f.avg().field( "price", Double.class ) ) (3)
.aggregation( oldestReleaseKey, f -> f.min().field( "releaseDate", LocalDate.class ) ) (4)
.fetch( 20 );
Double avgPrice = result.aggregation( avgPriceKey ); (5)
LocalDate oldestRelease = result.aggregation( oldestReleaseKey );
1 | Create an aggregation key for an average price aggregation. |
2 | Create an aggregation key for a minimum date aggregation. |
3 | Request an .avg() aggregation on the price field.
Specifying Double here defines the expected return type of the computed aggregation. |
4 | Request a .min() aggregation on the release date field.
Specifying LocalDate here defines the expected return type of the computed aggregation. |
5 | Extract the aggregated value from the results. |
See the corresponding section on metric aggregations to learn which aggregations are available.
New Lucene backend
While Hibernate Search 8.0 still targets JDK 17, Lucene, starting with version 10,
is leveraging new Java APIs, particularly to work with memory, that are available starting with JDK 21.
To give users an option to work with the newer Lucene version, Hibernate Search introduces the
hibernate-search-backend-lucene-next
backend.
Currently, this backend is backed by Lucene 10 and requires JDK 21. In terms of functionality, both Lucene-based backends have the same search capabilities.
See this section of the reference documentation to learn more.
Projecting multivalued fields
It is now possible to use other collection types than List
for multivalued projections:
@ProjectionConstructor
public record MyBookProjection(
@IdProjection Integer id,
String title,
Set<String> authors) { (1)
}
1 | Using Set as a collection for a multivalued projection. |
List<Set<String>> hits = searchSession.search( Book.class )
.select( f -> f.field( "authors.lastName", String.class ).set() ) (1)
.where( f -> f.matchAll() )
.fetchHits( 20 );
1 | Using the set collector. |
Hibernate Search comes with implementation for most popular collections, but it is also possible to extend it and use a custom collector for an unsupported collection:
List<MyCustomCollection<String>> hits = searchSession.search( Book.class )
.select( f -> f.field( "authors.lastName", String.class ).collector( new MyCustomCollector() ) ) (1)
.where( f -> f.matchAll() )
.fetchHits( 20 );
1 | Pass an instance of ProjectionCollector.Provider to the .collector() method. |
Logging categories
Hibernate Search now utilizes logging categories instead of FQCNs. It is now easier to enable logging when debugging a particular area of Hibernate Search:
# Set logging level for massindexing events to `TRACE`:
org.hibernate.search.mapper.massindexing=TRACE
See the corresponding section on logging categories to find out which categories are available.
Development versions (SNAPSHOTS)
The latest development versions of Maven artifacts for Hibernate Search are published to the OSSRH snapshots repository.
You should only need those (unstable) versions for testing recently merged patches, and should never use them in production.
To consume these artifacts, you may need to configure your build tool to fetch artifacts
from
https://oss.sonatype.org/content/repositories/snapshots
and to enable snapshots:
Releases in this series
Integration with Hibernate ORM 7.0, metric aggregations, logging categories, new Lucene-based backend, compatibility with new versions of Elasticsearch/OpenSearch, other bugfixes, improvements and upgrades
Maven artifacts Download Resolved issues Release announcement