Hibernate Search

6.0 series stable

API overhaul. Safer and more concise Search DSL, more powerful bridges, smarter automatic indexing, nested documents. Upgrades to Lucene 8 and Elasticsearch 7.

Compatibility

Java 8, 11 or 16
Hibernate ORM 5.4 (>= 5.4.4.Final)
Elasticsearch 5.6 - 7.10
Apache Lucene 8.7

Not compatible with your requirements? Have a look at the other series.

See also the Compatibility policy.

Documentation

Documentation for this specific series 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 and to the JBoss Maven repository. Refer to the Maven Getting Started guide on the JBoss Wiki for more information on how to configure the JBoss Maven repository.

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-mapper-orm:6.0.3.Final
Hibernate ORM mapper
org.hibernate.search:hibernate-search-backend-lucene:6.0.3.Final
Lucene backend
org.hibernate.search:hibernate-search-backend-elasticsearch:6.0.3.Final
Elasticsearch backend
org.hibernate.search:hibernate-search-backend-elasticsearch-aws:6.0.3.Final
Amazon IAM authentication for Elasticsearch
org.hibernate.search:hibernate-search-mapper-orm-batch-jsr352-core:6.0.3.Final
Batch for Java (JSR-352) mass indexing job for the Hibernate ORM mapper - Core
org.hibernate.search:hibernate-search-mapper-orm-batch-jsr352-jberet:6.0.3.Final
Batch for Java (JSR-352) mass indexing job for the Hibernate ORM mapper - JBeret specifics
org.hibernate.search:hibernate-search-v5migrationhelper-orm:6.0.3.Final
Helper for migrating from Hibernate Search 5 to Hibernate Search 6 (Hibernate ORM mapper + Lucene backend)

Zip archive

Direct download is available from SourceForge:

Download Zip archive

More information about specific releases (announcements, download links) can be found here.

Getting started

If you want to start using the library, please refer to the getting started guide:

HTML PDF

Migrating

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

HTML PDF

What's new

Latest release announcement (2021-04-13): 6.0.3.Final.

A detailed list of new features, improvements and fixes in this series can be found on our issue tracker.

Dependency upgrades

Hibernate ORM

Hibernate Search 6 relies on Hibernate ORM 5.4.

Note that only Hibernate ORM 5.4.4.Final or later will work correctly; 5.4.3.Final and earlier will not.

Lucene 8

The Lucene backend now uses Lucene 8.7.

Elasticsearch 7

The Elasticsearch backend now works with Elasticsearch 5.6, 6.8 or 7.10. Support for older versions of Elasticsearch was dropped.

API overhaul

This is perhaps the most important aspect of Hibernate Search 6: most APIs have changed. We didn’t take this decision lightly, and we don’t intend to do this again anytime soon: at this point, breaking APIs was necessary for Hibernate Search to keep improving.

The primary goal of this overhaul was to abstract away Lucene APIs, so that the Elasticsearch backend can become a first-class citizen, implemented without any hacks or unnecessary dependencies.

It goes without saying, but the Lucene backend will remain as important as ever. In fact, abstracting away Lucene APIs is good for the Lucene backend too: it will give the Hibernate Search project the ability to upgrade Lucene as soon as new versions are released.

Another benefit of the overhaul: since APIs had to change anyway, we took that opportunity to implement long-overdue improvements that also required API changes. See the following sections to know more about these improvements.

Safer, more concise, backend-agnostic Search DSL

The Search DSL is brand new, with several improvements:

Safer
  • Search hits now have a type, even when projecting thanks to the brand-new projection DSL.

  • The implementation for numeric predicates (e.g. int-based, long-based, double-based) is now determined from the type of the targeted field, instead of the type of arguments. This is safer when passing arguments with the wrong type: where Hibernate Search 5 would have generated a predicate that doesn’t match anything, Hibernate Search 6 will detect the type mismatch and will throw an exception.

More concise
More consistent
  • The API types consistently use the Search prefix: no more mixing FullText with Search or simply no prefix.

  • The SearchQuery type (previously FullTextQuery) now defines its own methods instead of extending JPA’s TypeQuery, highlighting the fact that it targets an index and not a database, and making it a friendlier API. When necessary, it is still possible to retrieve an adapter that implements JPA’s TypeQuery.

Backend-agnostic by default, with backend-specific extensions
More features

Easier mapping

Specialized @*Field annotations

Hibernate Search 6 offers separate @*Field annotations for each major field type: @GenericField works in most cases, but you can access more options (analysis, …​) with @FullTextField, @KeywordField, …​

This way, each annotation offers the options that make sense for the selected field types, and only those options. No longer will you end up disabling analysis on a numeric field!

Simpler mapping of container types
More features
  • Ability to define a searchAnalyzer, to analyze search queries differently from indexed text (useful for auto-complete in particular).

  • Ability to map scaled numbers (BigDecimal/BigInteger) with @ScaledNumberField.

More powerful, backend-agnostic bridges

The new Bridge APIs are different and vastly improved.

Full control over field definitions
  • Bridges can declare field types precisely, allowing in particular to pick an analyzer or to enable aggregation (faceting) on a bridge-declared field.

  • Bridges targeting non-String fields are now first-class citizens: when targeting bridge-declared, non-String fields in the Search DSL, you will no longer have to bypass bridges (.ignoreFieldBridge()) like you had to in Search 5.

  • Bridges can declare dynamic fields with a precise type which the Search DSL will be aware of.

Full control over automatic reindexing

Bridges can declare the properties they rely on, allowing Hibernate Search to reindex less frequently.

Custom bridge annotations

Bridges can be applied with custom annotations, allowing clearer mappings, especially when bridges are parameterized.

For more information about bridges, see this section of the documentation.

Backend-agnostic
  • Field declarations do not involve any Lucene API by default.

  • However, bridges can still declare native fields when necessary, be it with Lucene or Elasticsearch.

Easier to configure, smarter automatic indexing

Automatic resolution of reindexing requirements
  • @ContainedIn is no longer needed: when using @IndexedEmbedded on an association, Hibernate Search 6 infers the inverse side of the association from Hibernate ORM metadata, which allows it to automatically reindex the class hosting the @IndexedEmbedded annotation when the target of the association changes.

  • When the inverse side of an association cannot be resolved, Hibernate Search 6 will report a mapping error on bootstrap, allowing you to detect risks of out-of-sync indexes early.

Easy override of reindexing requirements
Easy configuration of indexing synchronization

Some want more performance with asynchronous automatic indexing, others prefer data safety and immediate visibility of indexed documents with synchronous automatic indexing. With Hibernate Search 6, this can all be configured with a single configuration property.

Smarter change processing

Hibernate Search 6 is smarter when processing changes on complex entity graphs.

When a property changes in an entity that is indexed-embedded in multiple other entities, Hibernate Search 6 will only traverse associations to entities that are actually affected by the change, based on @IndexedEmbedded(includePaths = …​) and other metadata.

More flexible schema management

Manage the schema on startup

Just like Hibernate Search 5, Hibernate Search 6 can manage the schema for you on startup. Or not: if this gets in the way, it can be disabled.

Manage the schema on demand

Unlike Hibernate Search 5, Hibernate Search 6 offers dedicated APIs to trigger schema operations on demand.

Manage the schema when mass indexing

The mass indexer can drop and re-create the schema automatically: you only have to call .dropAndCreateSchemaOnStart(true). With the Elasticsearch backend, this can be significantly faster than removing all documents from an existing schema.

Runtime joins with nested documents

Hibernate Search 6.0 introduces "nested" fields and predicates, similar to the feature with the same name in Elasticsearch.

This means in particular that indexed-embedded entities can be searched much more finely, for example searching for that one book whose author has a given first name and last name. With the right mapping and the right query, no longer will Hibernate Search return a book co-authored by "John Smith" and "Jane Doe" when you were looking for "John Doe"!

For details, see Structuring embedded elements as nested documents in the reference documentation.

And more

  • Better support for traditional JPA batch processes involving a periodic flush/clear: Hibernate Search 6 will buffer the documents to index upon flush(), to avoid the dreaded LazyInitializationException that Hibernate Search 5 would trigger.

  • Better reporting of errors on bootstrap: Hibernate Search will provide more context for each error, and will collect as many errors as possible before stopping.

  • …​

Releases in this series

6.0.2.Final

2021-02-23

6.0.1.Final

2021-02-08

6.0.0.Final

2020-12-10

A few internal changes for the benefit of frameworks (Quarkus, ...), and upgrade to Hibernate ORM 5.4.25.Final. Otherwise identical to 6.0.0.CR2.

Maven artifacts Download Resolved issues Release announcement

6.0.0.CR2

2020-11-23

Workaround for applications hanging on startup with Spring Boot 2.3+, type parameters for type bridges and property bridges, URI-based configuration for target Elasticsearch hosts, upgrade to Hibernate ORM 5.4.24.Final, Lucene 8.7, Elasticsearch 7.10.

Maven artifacts Download Resolved issues Release announcement

6.0.0.CR1

2020-11-03

First release candidate for Hibernate Search 6. Compared to Beta11: Batch for Java (JSR-352) integration for the ORM mapper, built-in analyzer definitions for Lucene, total hit count on scrolls, optional path prefix for Elasticsearch, upgrade to Hibernate ORM 5.4.23.Final.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta11

2020-10-08

Default analyzer, ReindexOnUpdate.SHALLOW to limit automatic reindexing to same-entity updates only, new implementation for AWS IAM authentication, migration helper for applications moving from Search 5 to Search 6, upgrades to Lucene 8.6.2 and Hibernate ORM 5.4.22.Final

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta10

2020-09-04

Total hit count threshold, conditional indexing, per-index analyzer definitions for Elasticsearch, better timeouts, upgrades to Lucene 8.6.1, Elasticsearch 7.9.0 and Hibernate ORM 5.4.21.Final

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta9

2020-08-03

Simpler configuration, scrolling, projections on multi-valued fields, complete documentation, upgrades to Lucene 8.6.0, Elasticsearch 7.8.0 and Hibernate ORM 5.4.19.Final

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta8

2020-06-03

Entity graphs in search queries, @Indexed becomes inherited, upgrades to Lucene 8.5.2, Elasticsearch 7.7.0 and Hibernate ORM 5.4.17.Final

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta7

2020-05-11

Better sorts/aggregations on multi-valued/nested fields, dynamic index fields, index metamodel, low-level configuration of the Lucene backend, upgrade to Hibernate ORM 5.4.15.Final

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta6

2020-03-31

Bugfixes, schema management configuration and API at the mapper level, sorts on multi-valued fields, simpler and configurable indexing queues, implicit nested predicates, offline startup for Elasticsearch, upgrades to Lucene 8.5, Elasticsearch 7.6.1 and Hibernate ORM 5.4.13.Final

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta5

2020-02-24

Aliases for Elasticsearch indexes, delayed commits and NRT for Lucene, renaming of a few Search DSL methods, upgrades to Lucene 8.4, Elasticsearch 7.6 and Hibernate ORM 5.4.12.Final.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta4

2020-01-23

Fixed a performance regression in the Lucene backend, new MassIndexingFailureHandler for custom behavior on failure during mass indexing.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta3

2019-12-16

Schema improvements, deep customization of Elasticsearch search requests, more powerful bridge definitions, search query timeouts, upgrades to Lucene 8.3.0, Elasticsearch 7.5 and Hibernate ORM 5.4.10.Final.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta2

2019-10-28

Search analyzers, improved background failure handling, upgrades to Elasticsearch 7.4 and Hibernate ORM 5.4.7.Final.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Beta1

2019-09-24

Consistent API expected to remain stable, complete documentation for major features, aggregations.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Alpha9

2019-08-26

Correct handling of session flushing and clearing, static sharding, upgrades to Elasticsearch 7.3, Lucene 8.2 and Hibernate ORM 5.4.4.Final

Maven artifacts Download Resolved issues Release announcement

6.0.0.Alpha8

2019-07-22

Restored configuration options for entity loading and Lucene index storage, simpler and more powerful bridge APIs, upgrades to Elasticsearch 7.2 and Lucene 8.1

Maven artifacts Download Resolved issues Release announcement

6.0.0.Alpha7

2019-06-24

Missing index field type parameters restored, explicit indexing APIs restored, upgrade to Elasticsearch 6.8 and 7.1.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Alpha6

2019-05-27

Decent performance for Lucene index access, indexing BigDecimal and BigInteger, less verbose search DSL, configuration of on-commit synchronization for automatic indexing, other bugfixes and improvements.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Alpha5

2019-05-02

"indexNullAs" feature restored, API to declare dependencies in bridges, Elasticsearch 6.7 and 7.0, other bugfixes and improvements.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Alpha4

2019-04-05

"exists" predicate, DSL converter bypass and analyzer override in predicates, upgrade to Lucene 8, Elasticsearch AWS integration restored, other bugfixes and improvements.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Alpha3

2019-03-22

More field types, more predicates, more consistent and less verbose API, other bugfixes and improvements.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Alpha2

2019-01-31

Mass indexer, Elasticsearch index lifecycle, efficient work orchestration in Elasticsearch, more projections, shorter annotation names, settings improvements.

Maven artifacts Download Resolved issues Release announcement

6.0.0.Alpha1

2018-11-29

Initial implementation: a few field types only, a few predicates/sorts/projections only, sub-optimal work orchestration, minimal documentation.

Maven artifacts Download Resolved issues Release announcement

Back to top