Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

…H2 databases

Making things work in ORM 6.1 AND 6.2 is more complex than anticipated,
I'll send another PR when we drop support for ORM 6.1.


Failed to load latest commit information.
Latest commit message
Commit time

Hibernate Search

Maven Central Build Status Sonar Coverage Quality gate


Hibernate Search automatically extracts data from Hibernate ORM entities to push it to local Apache Lucene indexes or remote Elasticsearch indexes.

It features:

For example, map your entities like this:

// This entity is mapped to an index
public class Book {

    // The entity ID is the document ID
    private Integer id;

    // This property is mapped to a document field
    private String title;

    // Authors will be embedded in Book documents
    private Set<Author> authors = new HashSet<>();

    // Getters and setters
    // ...

public class Author {

    private Integer id;

    // This property is mapped to a document field
    private String name;

    @ManyToMany(mappedBy = "authors")
    private Set<Book> books = new HashSet<>();

    // Getters and setters
    // ...

Index existing data like this:

SearchSession searchSession = Search.session( entityManager );
MassIndexer indexer = searchSession.massIndexer( Book.class );

Automatic indexing does not require any change to code based on JPA or Hibernate ORM:

Author author = new Author();
author.setName( "Isaac Asimov" );

Book book = new Book();
book.setTitle( "The Caves Of Steel" );
book.getAuthors().add( author );
author.getBooks().add( book );

entityManager.persist( author );
entityManager.persist( book );

And search like this:

SearchResult<Book> result = Search.session( entityManager )
        .search( Book.class )
        .where( f -> f.match()
                .fields( "title", "" )
                .matching( "Isaac" ) )
        .fetch( 20 );

List<Book> hits = result.hits();
long totalHitCount =;


This software and its documentation are distributed under the terms of the GNU Lesser General Public License (LGPL), version 2.1 or later.

See the lgpl.txt file in the root directory or

Getting started

A getting started guide is available in the reference documentation.

Fore more information, refer to the Hibernate Search website:

For offline use, distribution bundles downloaded from SourceForge also include the reference documentation for the downloaded version in PDF and HTML format.


Latest Documentation


Bug Reports

See the HSEARCH project on the Hibernate JIRA instance:

Community Support



New contributors are always welcome.

See to get started.

The contribution guide also includes build instructions.