Get started with the Meilisearch integrations
Meilisearch is a fast, open-source search engine that makes search and discovery easy. The Aspire Meilisearch integration enables you to connect to existing Meilisearch instances or create new instances from Aspire using the docker.io/getmeili/meilisearch container image.
In this introduction, you'll see how to install and use the Aspire Meilisearch integrations in a simple configuration. If you already have this knowledge, see Meilisearch hosting integration for full reference details.
Note
To follow this guide, you must have created an Aspire solution to work with. To learn how to do that, see Build your first Aspire app.
Set up hosting integration
To begin, install the Aspire Meilisearch Hosting integration in your Aspire AppHost project:
dotnet add package CommunityToolkit.Aspire.Hosting.MeilisearchNext, in the AppHost project, register and consume the Meilisearch integration using the AddMeilisearch extension method to add the Meilisearch container to the application builder:
var builder = DistributedApplication.CreateBuilder(args);
var meilisearch = builder.AddMeilisearch("meilisearch");
builder.AddProject<Projects.ExampleProject>()
.WithReference(meilisearch);
// After adding all resources, run the app...
Set up client integration
To get started with the Aspire Meilisearch client integration, install the NuGet package in the client-consuming project:
dotnet add package CommunityToolkit.Aspire.MeilisearchIn the Program.cs file of your client-consuming project, call the AddMeilisearchClient extension method to register a MeilisearchClient for use via the dependency injection container:
builder.AddMeilisearchClient(connectionName: "meilisearch");
You can then retrieve the MeilisearchClient instance using dependency injection. For example, to retrieve the client from a service:
public class ExampleService(MeilisearchClient client)
{
// Use client...
}
For full reference details, see Meilisearch hosting integration and Meilisearch client integration.