# ElasticvueBuilderExtensions Methods

- Package: [CommunityToolkit.Aspire.Hosting.Elasticsearch.Extensions](/reference/api/csharp/communitytoolkit.aspire.hosting.elasticsearch.extensions.md)
- Type: [ElasticvueBuilderExtensions](/reference/api/csharp/communitytoolkit.aspire.hosting.elasticsearch.extensions/elasticvuebuilderextensions.md)
- Kind: `Methods`
- Members: `2`

Provides extension methods for Elasticvue resources to an `Hosting.IDistributedApplicationBuilder`.

## WithElasticvue(IResourceBuilder<ElasticsearchResource>, Action<IResourceBuilder<ElasticvueContainerResource>>, string?)

- Name: `WithElasticvue(IResourceBuilder<ElasticsearchResource>, Action<IResourceBuilder<ElasticvueContainerResource>>, string?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<ElasticsearchResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Elasticsearch.Extensions/ElasticvueBuilderExtensions.cs#L89-L106)

Adds an administration and development platform for Elasticsearch to the application model using Elasticvue.

```csharp
public static class ElasticvueBuilderExtensions
{
    public static IResourceBuilder<ElasticsearchResource> WithElasticvue(
        this IResourceBuilder<ElasticsearchResource> builder,
        Action<IResourceBuilder<ElasticvueContainerResource>>? configureContainer = null,
        string? containerName = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<ElasticsearchResource>`)
  The Elasticsearch server resource builder.
- `configureContainer` (`Action<IResourceBuilder<ElasticvueContainerResource>>`) `optional`
  Configuration callback for Elasticvue container resource.
- `containerName` (`string?`) `optional`
  The name of the container (Optional).

## Returns

`IResourceBuilder<ElasticsearchResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1`.

## Remarks

This version of the package defaults to the `Tag` tag of the `Image` container image.

## Examples

Use in application host with a Elasticsearch resource

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var elasticsearch = builder.AddElasticsearch("elasticsearch")
   .WithElasticvue();

var api = builder.AddProject<Projects.Api>("api")
  .WithReference(elasticsearch);

builder.Build().Run();
```

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithHostPort(IResourceBuilder<ElasticvueContainerResource>, int?)

- Name: `WithHostPort(IResourceBuilder<ElasticvueContainerResource>, int?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<ElasticvueContainerResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Elasticsearch.Extensions/ElasticvueBuilderExtensions.cs#L22-L27)

Configures the host port that the Elasticvue resource is exposed on instead of using randomly assigned port.

```csharp
public static class ElasticvueBuilderExtensions
{
    public static IResourceBuilder<ElasticvueContainerResource> WithHostPort(
        this IResourceBuilder<ElasticvueContainerResource> builder,
        int? port)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<ElasticvueContainerResource>`)
  The resource builder for Elasticvue.
- `port` (`int?`)
  The port to bind on the host. If `null` is used random port will be assigned.

## Returns

`IResourceBuilder<ElasticvueContainerResource>` -- The resource builder for Elasticvue.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.
