Sdílet prostřednictvím


AspireElasticClientsElasticsearchExtensions.AddKeyedElasticsearchClient Method

Definition

Registers Elastic.Clients.Elasticsearch.ElasticsearchClient instance for connecting to Elasticsearch with Elastic.Clients.Elasticsearch client.

public static void AddKeyedElasticsearchClient (this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.Elastic.Clients.Elasticsearch.ElasticClientsElasticsearchSettings>? configureSettings = default, Action<Elastic.Clients.Elasticsearch.ElasticsearchClientSettings>? configureClientSettings = default);
static member AddKeyedElasticsearchClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.Elastic.Clients.Elasticsearch.ElasticClientsElasticsearchSettings> * Action<Elastic.Clients.Elasticsearch.ElasticsearchClientSettings> -> unit
<Extension()>
Public Sub AddKeyedElasticsearchClient (builder As IHostApplicationBuilder, name As String, Optional configureSettings As Action(Of ElasticClientsElasticsearchSettings) = Nothing, Optional configureClientSettings As Action(Of ElasticsearchClientSettings) = Nothing)

Parameters

builder
IHostApplicationBuilder

The IHostApplicationBuilder to read config from and add services to.

name
String

The name of the component, which is used as the ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.

configureSettings
Action<ElasticClientsElasticsearchSettings>

An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.

configureClientSettings
Action<Elastic.Clients.Elasticsearch.ElasticsearchClientSettings>

An optional delegate that can be used for customizing ElasticsearchClientSettings.

Exceptions

If required ConnectionString is not provided in configuration section

Applies to