This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Data Meilisearch 0.12.0!

Core Concepts

Spring Data Meilisearch supports the core Spring Data repository programming model, but its repository surface is intentionally narrower than stores such as JPA, MongoDB, Elasticsearch, or Redis.

The important distinction is that this module currently provides:

  • repository bootstrap through @EnableMeilisearchRepositories and the XML namespace,

  • a store-specific MeilisearchRepository<T, ID> base interface,

  • CRUD and paging/sorting methods implemented by SimpleMeilisearchRepository,

  • filter-backed derived finder methods for a documented subset,

  • direct access to advanced search features through MeilisearchOperations.

Declared @Query methods, named queries, and unsupported derived operators fail during repository bootstrap. Use MeilisearchOperations for custom searches; see Query Methods.

Repository Interface

MeilisearchRepository<T, ID> extends Spring Data CrudRepository and PagingAndSortingRepository. That means the stable repository contract is the built-in CRUD plus sorting/paging methods defined by those interfaces.

import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.PagingAndSortingRepository;

@NoRepositoryBean
public interface MeilisearchRepository<T, ID>
        extends CrudRepository<T, ID>, PagingAndSortingRepository<T, ID> {
}

Execution Model

The default repository implementation delegates to MeilisearchOperations, but repository methods use different Meilisearch APIs:

  • findById(…​) and existsById(…​) use direct document lookup; findAllById(…​) uses native ID-list retrieval.

  • findAll() lists all documents in one document-list request. Sorted findAll(Sort) counts first, then fetches up to that count in one sorted request; additions between those requests can be absent.

  • Paged findAll(Pageable) uses search APIs. An unpaged Pageable uses document listing and bases its total on the retrieved documents.

  • count() reads the total from a document-list request with a zero-document limit; it does not run a search.

Search-backed repository methods are subject to search settings such as pagination.maxTotalHits. Document-list reads are not capped by that setting and ignore displayedAttributes.

When to Use Repositories vs. Operations

Use repositories when you want Spring Data’s familiar persistence model for:

  • saving and deleting entities,

  • id-based reads,

  • simple collection reads,

  • sorting and pageable access.

Use MeilisearchOperations when you need store-specific behavior such as:

  • BasicQuery, IndexQuery, FacetQuery, or SimilarQuery,

  • federated multi-search,

  • facet metadata,

  • index lifecycle management,

  • runtime settings updates.

For the concrete store-specific rules and current limitations, see Meilisearch Repositories and Query Methods.