Skip to content
Go to file


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

Hibernate Search

Maven Central Build Status Coverage Status Quality gate Language Grade: Java


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 FSF Lesser GNU Public License (see lgpl.txt).

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.

You can’t perform that action at this time.