AspireElasticClientsElasticsearchExtensions Methods
Class Methods 2 members
Extension methods for connecting Elasticsearch with Elastic.Clients.Elasticsearch client.
AddElasticsearchClient(IHostApplicationBuilder, string, Action<ElasticClientsElasticsearchSettings>, Action<ElasticsearchClientSettings>) Section titled AddElasticsearchClient(IHostApplicationBuilder, string, Action<ElasticClientsElasticsearchSettings>, Action<ElasticsearchClientSettings>) extension Registers
Elasticsearch.ElasticsearchClient instance for connecting to Elasticsearch with Elastic.Clients.Elasticsearch client. public static class AspireElasticClientsElasticsearchExtensions{ public static void AddElasticsearchClient( this IHostApplicationBuilder builder, string connectionName, Action<ElasticClientsElasticsearchSettings>? configureSettings = null, Action<ElasticsearchClientSettings>? configureClientSettings = null) { // ... }}Parameters
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to. connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section. configureSettings Action<ElasticClientsElasticsearchSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration. configureClientSettings Action<ElasticsearchClientSettings> optional An optional delegate that can be used for customizing ElasticsearchClientSettings. Exceptions
InvalidOperationException If required ConnectionString is not provided in configuration section AddKeyedElasticsearchClient(IHostApplicationBuilder, string, Action<ElasticClientsElasticsearchSettings>, Action<ElasticsearchClientSettings>) Section titled AddKeyedElasticsearchClient(IHostApplicationBuilder, string, Action<ElasticClientsElasticsearchSettings>, Action<ElasticsearchClientSettings>) extension Registers
Elasticsearch.ElasticsearchClient instance for connecting to Elasticsearch with Elastic.Clients.Elasticsearch client. public static class AspireElasticClientsElasticsearchExtensions{ public static void AddKeyedElasticsearchClient( this IHostApplicationBuilder builder, string name, Action<ElasticClientsElasticsearchSettings>? configureSettings = null, Action<ElasticsearchClientSettings>? configureClientSettings = null) { // ... }}Parameters
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to. name string The name of the component, which is used as the ServiceDescriptor.ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section. configureSettings Action<ElasticClientsElasticsearchSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration. configureClientSettings Action<ElasticsearchClientSettings> optional An optional delegate that can be used for customizing ElasticsearchClientSettings. Exceptions
InvalidOperationException If required ConnectionString is not provided in configuration section