opensearch-project / opensearch-net

OpenSearch .NET Client
Apache License 2.0
102 stars 49 forks source link

[FEATURE] Integrate with the Microsoft.Extensions ecosystem #266

Open glen-84 opened 1 year ago

glen-84 commented 1 year ago

Is your feature request related to a problem?

It should be easier to set up the OpenSearch client in an ASP.NET Core application.

What solution would you like?

builder.Services.AddOpenSearchClient(...)

... and configuration in appsettings.json, and logging with the ILogger.

What alternatives have you considered?

https://github.com/MintPlayer/MintPlayer.AspNetCore.OpenSearch This is the only relevant library that I could find on NuGet, but it's not popular/official.

Otherwise, doing it all manually.

Do you have any additional context?

n/a

Xtansia commented 1 year ago

Hi @glen-84!

Thanks for sharing your feature request, I think it'd be helpful if you could expand a bit on what you'd like to see added/supported. Such as what types would you expect to be registered with the service collection, how might the configuration be structured, and what do you think the client should be logging itself.

glen-84 commented 1 year ago

what types would you expect to be registered with the service collection

An IOpenSearchClient.

how might the configuration be structured

Maybe something like:

"OpenSearchClients": {
    "Search": { // Named client.
        "ConnectionPool": {
            "Nodes": [
                {
                    "Uri": "http://127.0.0.1:9201"
                },
                {
                    "Uri": "http://127.0.0.1:9202"
                }
            ]
        }
    }
}

what do you think the client should be logging itself

Maybe something like this (at the information level).