Watch Aspire live streamsDocumentaciónPrueba Aspire

Elasticsearch extensions integration

Esta página aún no está disponible en tu idioma.

⭐ Community Toolkit Elasticsearch logo

This add-on extends the official Aspire Elasticsearch hosting resource with Elasticvue, a browser-based Elasticsearch administration interface. It is not a separate Elasticsearch server integration.

Install the Community Toolkit extension in the AppHost:

Aspire CLI — Añadir paquete CommunityToolkit.Aspire.Hosting.Elasticsearch.Extensions
aspire add communitytoolkit-elasticsearch-extensions

La CLI de Aspire es interactiva; asegúrate de seleccionar el resultado adecuado cuando se te pida:

Aspire CLI — Ejemplo de salida
Select an integration to add:
> communitytoolkit-elasticsearch-extensions (CommunityToolkit.Aspire.Hosting.Elasticsearch.Extensions)
> Other results listed as selectable options...

Add Elasticvue to an Elasticsearch resource

Section titled “Add Elasticvue to an Elasticsearch resource”

Call WithElasticvue on the official Elasticsearch resource. Elasticvue waits for Elasticsearch to become ready. The extension also enables Elasticsearch CORS for the Elasticvue endpoint and configures Elasticvue to connect using the resource’s elastic credentials.

AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var elasticsearch = builder.AddElasticsearch("elasticsearch")
.WithElasticvue();
builder.AddProject<Projects.Api>("api")
.WithReference(elasticsearch);
// After adding all resources, run the app...
builder.Build().Run();

The extension reads the Elasticsearch resource’s generated password when it configures Elasticvue. Keep the official resource name, such as elasticsearch, consistent with the name used by dependent projects.

Multiple calls to WithElasticvue reuse one Elasticvue container and add the Elasticsearch clusters to its configuration. The Elasticvue container is excluded from the deployment manifest and has no dedicated health check; its readiness dependency is the Elasticsearch resource.

The optional configureContainer callback lets you configure the Elasticvue container builder. Use its exported WithHostPort method to choose a stable local port instead of Aspire assigning one:

AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var elasticsearch = builder.AddElasticsearch("elasticsearch")
.WithElasticvue(configureContainer: elasticvue =>
elasticvue.WithHostPort(8080));
// After adding all resources, run the app...
builder.Build().Run();

containerName optionally changes the Elasticvue resource name. It defaults to elasticvue. The host port is optional; omit it to let Aspire assign a port. Elasticvue listens on container port 8080; WithHostPort selects the corresponding fixed host port.

The extension package exports these APIs:

  • WithElasticvue(configureContainer, containerName) adds and configures the Elasticvue container for an official ElasticsearchResource.
  • WithHostPort(port) sets the host port on the Elasticvue resource builder. Call it from configureContainer; the extension does not expose a public method to add Elasticvue independently.