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!

Index and Instance Operations

MeilisearchOperations exposes two Meilisearch-specific entry points:

  • instanceOps() for instance-level information.

  • indexOps(…​) for APIs bound to an index uid.

These synchronous APIs cover instance inspection and index lifecycle/settings operations without requiring direct use of the Meilisearch Java SDK. See Settings for settings annotation and update details.

Instance Operations

MeilisearchInstanceOperations provides these read operations:

  • MeilisearchHealth health()

  • boolean isHealthy()

  • MeilisearchVersion version()

  • MeilisearchStats stats()

MeilisearchInstanceOperations instance = meilisearchOperations.instanceOps();

MeilisearchHealth health = instance.health();
boolean healthy = instance.isHealthy();
MeilisearchVersion version = instance.version();
MeilisearchStats stats = instance.stats();

instanceOps().stats() reports instance-level statistics. For statistics for one index, use indexOps(…​).stats().

Index-bound Operations

Resolve index operations either from entity mapping metadata or from an explicit uid:

MeilisearchIndexOperations byEntity = meilisearchOperations.indexOps(Movie.class);
MeilisearchIndexOperations byIndexUid = meilisearchOperations.indexOps("movies");

indexOps(Class<?>) requires an entity annotated with @Document and uses its indexUid. indexOps(String) is useful for index administration when no mapped entity type is involved. Document and search operations still require a mapped entity class.

Index Lifecycle

MeilisearchIndexOperations exposes:

  • MeilisearchIndex create() and MeilisearchIndex create(MeilisearchIndexCreateRequest)

  • MeilisearchIndex get()

  • MeilisearchIndexList list() and MeilisearchIndexList list(MeilisearchIndexQuery)

  • MeilisearchIndex update(MeilisearchIndexUpdateRequest)

  • boolean delete()

  • MeilisearchIndexStats stats()

  • MeilisearchIndexSettings getSettings()

  • MeilisearchIndexSettings updateSettings(MeilisearchIndexSettings)

  • MeilisearchIndexSettings resetSettings()

create() creates the bound index without an explicit primary key. Pass a create request to specify one:

MeilisearchIndexOperations index = meilisearchOperations.indexOps("catalog");

MeilisearchIndex created = index.create(new MeilisearchIndexCreateRequest("productId"));
MeilisearchIndex current = index.get();

MeilisearchIndexList firstHundred = index.list(new MeilisearchIndexQuery(0, 100));
MeilisearchIndex updated = index.update(new MeilisearchIndexUpdateRequest("productId"));
boolean deleted = index.delete();

The index list methods return a page of indexes for the Meilisearch instance; they are not restricted to the uid bound to the MeilisearchIndexOperations object. MeilisearchIndexQuery supplies a non-negative offset and positive limit. update(request) sets the bound index’s primary key from the request. delete() returns whether its delete task succeeded.

Runtime Settings

Inspect, update, or reset settings on the bound index:

MeilisearchIndexSettings current = index.getSettings();

MeilisearchIndexSettings updatedSettings = index.updateSettings(
        MeilisearchIndexSettings.builder()
                .withSearchableAttributes(List.of("title", "description"))
                .withFilterableAttributes(List.of("genres"))
                .withPagination(new MeilisearchIndexSettings.PaginationSettings(1500))
                .build());

MeilisearchIndexSettings defaults = index.resetSettings();

updateSettings applies only the non-null fields supplied in the settings value; an empty collection clears a supported list or map setting. resetSettings() restores all Meilisearch index settings to defaults. Both methods return settings read after their task succeeds. See Runtime Settings Updates.

The public API uses Spring Data Meilisearch value types such as MeilisearchIndexSettings, MeilisearchIndexCreateRequest, MeilisearchIndexUpdateRequest, and MeilisearchIndexList rather than exposing Meilisearch Java SDK request/response models directly.

Asynchronous Task Behavior

Meilisearch enqueues document writes/deletes, settings changes, and index lifecycle mutations as tasks. The public operations wait for those tasks using the configured request timeout and polling interval before returning; they do not expose task ids or return immediately after enqueueing. This applies to document methods such as save(…​), delete(…​), and applySettings(…​) as well as index methods such as create(), update(…​), delete(), and settings mutations.

ClientConfigurationBuilder.withRequestTimeout(…​) and withRequestInterval(…​) configure these values in milliseconds. A non-succeeded task raises TaskStatusException from save(…​), applySettings(…​), index create(…​) and update(…​), and settings mutations. Boolean deletion operations return false when their task does not succeed.