Testcontainers Meilisearch
May 5, 2026 ยท View on GitHub
A Testcontainers implementation for Meilisearch.
How to use
Use the @Container annotation to start a Meilisearch container in your tests.
Default image
@Container
MeilisearchContainer container = new MeilisearchContainer();
Custom image
@Container
MeilisearchContainer container = new MeilisearchContainer(
DockerImageName.parse("getmeili/meilisearch:v1.43.0"));
Configure master key
@Container
MeilisearchContainer container = new MeilisearchContainer()
.withMasterKey("masterKey");
Java SDK client setup
The container exposes helpers for the Meilisearch Java SDK:
Client client = new Client(new Config(container.getEndpoint(), container.getMasterKey()));
Index documents and wait for tasks
@Container
static MeilisearchContainer container = new MeilisearchContainer()
.withMasterKey("masterKey");
Client client = new Client(new Config(container.getEndpoint(), container.getMasterKey()));
String indexUid = "movies";
Index index = client.index(indexUid);
TaskInfo createIndexTask = client.createIndex(indexUid, "id");
index.waitForTask(createIndexTask.getTaskUid(), 15000, 100);
String documents = "["
+ "{\"id\":1,\"title\":\"Dune\"},"
+ "{\"id\":2,\"title\":\"Foundation\"}"
+ "]";
TaskInfo addDocumentsTask = index.addDocuments(documents);
index.waitForTask(addDocumentsTask.getTaskUid(), 15000, 100);
Import a dump fixture
@Container
static MeilisearchContainer container = new MeilisearchContainer()
.withMasterKey("masterKey")
.withDumpImport("meilisearch/fixtures/movies.dump");
Setup
This library is available in Maven Central. You can add it as a dependency to your project using the following snippets.
Gradle
testImplementation 'io.vanslog:testcontainers-meilisearch:2.0.0-SNAPSHOT'
Maven
<dependency>
<groupId>io.vanslog</groupId>
<artifactId>testcontainers-meilisearch</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
If you use the Meilisearch Java SDK in tests, add:
<dependency>
<groupId>com.meilisearch.sdk</groupId>
<artifactId>meilisearch-java</artifactId>
<version>0.15.0</version>
<scope>test</scope>
</dependency>
Release lanes
This project publishes separate release lanes for Testcontainers compatibility:
| Branch | Release tags | Purpose |
|---|---|---|
1.x | v1.* | Maintenance line for Testcontainers 1.x |
main | v2.* | Active line for Testcontainers 2.x |
Snapshot deployments run from pushes to main and 1.x when the Maven project version ends with -SNAPSHOT. Stable releases are deployed only when publishing a GitHub Release whose tag matches the target branch, for example v1.0.7 from 1.x or v2.0.0 from main.