elastic / elasticsearch-net

This strongly-typed, client library enables working with Elasticsearch. It is the official client maintained and supported by Elastic.
https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html
Apache License 2.0
11 stars 1.15k forks source link

Add support for Cluster update settings API #8351

Open Kargo opened 2 months ago

Kargo commented 2 months ago

Is your feature request related to a problem? Please describe. I cannot complete my migration from NEST to Elastic.Clients.Elasticsearch because the Cluster update settings API is missing from the new client.

The following snippet is valid using NEST 7.17.5:

var settingsResponse = await _client.Cluster.PutSettingsAsync(
    descriptor => descriptor.Persistent(
        settings => settings.Add(
            "action.auto_create_index",
            value: false)));

Describe the solution you'd like A cluster put settings method is available on the Elastic.Clients.Elasticsearch client with comparable syntax to the existing method from the NEST client.

Describe alternatives you've considered

flobernd commented 1 month ago

This feature had an unmet requirement for quite some time. The missing functionality got finally implemented on specification side, but currently still misses support on the code generator.

Kargo commented 1 month ago

For anyone else needing this feature, it's possible to send the request manually using the Transport client and anonymous types:

var settings = new
{
    persistent = new { action = new { auto_create_index = false } }
};

await client.Transport.PutAsync<StringResponse>("/_cluster/settings", PostData.Serializable(settings));