Hibernate Search

8.0 series development

Integration with Hibernate ORM 7.0, metric aggregations, new Lucene-based backend, logging categories and more.

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:

HTML PDF API (Javadoc)

You can find more documentation for all series on the documentation page.

How to get it

Maven, Gradle...

Maven artifacts of Hibernate Search are published to Maven Central. Most build tools fetch artifacts from Maven Central by default, but if that's not the case for you, see this page to configure your build tool.

You can find the Maven coordinates of all artifacts through the link below:

Maven artifacts

Below are the Maven coordinates of the main artifacts.

org.hibernate.search:hibernate-search-bom:8.0.0.Alpha1
Hibernate Search BOM
org.hibernate.search:hibernate-search-mapper-orm:8.0.0.Alpha1
Hibernate ORM mapper
org.hibernate.search:hibernate-search-mapper-orm-outbox-polling:8.0.0.Alpha1
"outbox-polling" coordination strategy for the Hibernate ORM mapper
org.hibernate.search:hibernate-search-mapper-pojo-standalone:8.0.0.Alpha1
Standalone POJO mapper
org.hibernate.search:hibernate-search-backend-lucene:8.0.0.Alpha1
Lucene backend backed by Lucene 9.12
org.hibernate.search:hibernate-search-backend-lucene-next:8.0.0.Alpha1
Lucene backend backed by Lucene 10
org.hibernate.search:hibernate-search-backend-elasticsearch:8.0.0.Alpha1
Elasticsearch/OpenSearch backend
org.hibernate.search:hibernate-search-backend-elasticsearch-aws:8.0.0.Alpha1
Amazon IAM authentication for Elasticsearch/OpenSearch
org.hibernate.search:hibernate-search-mapper-orm-jakarta-batch-core:8.0.0.Alpha1
Jakarta Batch mass indexing job for the Hibernate ORM mapper - Core
org.hibernate.search:hibernate-search-mapper-orm-jakarta-batch-jberet:8.0.0.Alpha1
Jakarta Batch mass indexing job for the Hibernate ORM mapper - JBeret specifics
org.hibernate.search:hibernate-search-v5migrationhelper-orm:8.0.0.Alpha1
Helper for migrating from Hibernate Search 5 to Hibernate Search 6/7 (Hibernate ORM mapper + Lucene backend)

All Maven artifacts of this project released after 2022-01-26 are signed.

To verify signed Maven artifacts, head to this page.

Direct download

A ZIP archive containing all JAR files, documentation and source is available from SourceForge:

Download ZIP archive

Individual Maven artifacts may be downloaded directly from the Maven repository:

Maven Central subdirectory

See here for how to download all dependencies of your Maven project to a local directory on your filesystem.

See here for how to download an explicitly listed set of artifacts to a local directory on your filesystem.

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:

ORM HTML PDF

Standalone HTML PDF

Migrating

If you need to upgrade from a previous series, please refer to the migration guide:

HTML PDF

What's new

Hibernate Search 8.0 is still in development:

  • some features may be incomplete;

  • newly introduced features may change in a backward-incompatible way before the stable release.

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:

Example 1. Using a Set to collect author names in a projection constructor
@ProjectionConstructor
public record MyBookProjection(
    @IdProjection Integer id,
    String title,
    Set<String> authors) {  (1)
}
1 Using Set as a collection for a multivalued projection.
Example 2. Using the set collector within projection DSL
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.

OSSRH snapshots subdirectory

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:

Maven Gradle

Releases in this series

8.0.0.Alpha1

2024-12-17

ASL v2

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

How to get it

Maven artifacts Download Resolved issues Release announcement

Back to top