Skip to main content
net8.0

Couchbase Index Manager support for Aspire.

Published
Mar 6, 2026
7mo ago
Total Downloads
3.2K
3,205

Install

dotnet add package Couchbase.Aspire.Hosting.Indices --version 1.0.0-beta.2
ProductVersions
.NET
net8.0

README

Couchbase.Aspire.Hosting.Indices library

Provides extension methods and resource definitions to add index management to a Couchbase cluster resource in an Aspire AppHost.

Getting Started

Install the package

dotnet add package Couchbase.Aspire.Hosting.Indices

Usage example

In the AppHost.cs file of your AppHost, add indices to a Couchbase bucket resource using the following methods:

var couchbase = builder.AddCouchbase("couchbase");
var bucket = couchbase.AddBucket("mybucket")
    .WithIndices("../indices");

var myService = builder.AddProject<Projects.MyService>()
    .WithReference(bucket)
    .WaitFor(bucket);

Waiting for indices to be ready

It is also possible to wait for the indices to be applied before starting your application:

var couchbase = builder.AddCouchbase("couchbase");
var bucket = couchbase.AddBucket("mybucket");

var bucketIndices = bucket.AddIndexManager("mybucket-indices")
    .WithIndices("../indices");

var myService = builder.AddProject<Projects.MyService>()
    .WithReference(bucket)
    .WaitFor(bucket)
    .WaitForCompletion(bucketIndices);

Index definition files

Index definition files are JSON or YAML files that define the indexes to be created on a Couchbase bucket. They may be referenced by directory or by individual file. See couchbase-index-manager Documentation for details on the file format.

Using with a secure Couchbase cluster

If your Couchbase cluster uses TLS/SSL, you may need to configure the index manager to trust the cluster's certificate.

var certAuthorityCollection = builder.AddCertificateAuthorityCollection("couchbase-cert-authority")
    .WithCertificate(certificateWithPrivateKey);

var couchbase = builder.AddCouchbase("couchbase");
var bucket = couchbase.AddBucket("mybucket")
    .WithRootCertificateAuthority(certAuthorityCollection); // Use the certificate for the Couchbase cluster

var bucketIndices = bucket.AddIndexManager("mybucket-indices")
    .WithIndices("../indices")
    .WithCertificateAuthorityCollection(certAuthorityCollection); // Trust the certificate for index management

var myService = builder.AddProject<Projects.MyService>()
    .WithReference(bucket)
    .WaitFor(bucket)
    .WaitForCompletion(bucketIndices);

Feedback & contributing

https://github.com/couchbaselabs/couchbase-aspire

Changes from Previous Version

No structural changes between v1.0.0-beta.1 and v1.0.0-beta.2.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.